@@ -60,6 +60,14 @@ func FromFloatPtrValue(v *float64) string {
6060 return strconv .FormatFloat (* v , 'f' , 0 , 64 )
6161}
6262
63+ // FromIntPtrValue adapts an int pointer field for use as a CurrentValue.
64+ func FromIntPtrValue (v * int64 ) string {
65+ if v == nil {
66+ return ""
67+ }
68+ return strconv .FormatInt (* v , 10 )
69+ }
70+
6371// ToPtrValue adapts a ResolvedValue for use as a string pointer field.
6472func ToPtrValue (v string ) * string {
6573 if v == "" {
@@ -80,6 +88,18 @@ func ToFloatPtrValue(v string) *float64 {
8088 return & vParsed
8189}
8290
91+ // ToIntPtrValue adapts a ResolvedValue for use as an int pointer field.
92+ func ToIntPtrValue (v string ) * int64 {
93+ if v == "" {
94+ return nil
95+ }
96+ vParsed , err := strconv .ParseInt (v , 10 , 64 )
97+ if err != nil {
98+ return nil
99+ }
100+ return & vParsed
101+ }
102+
83103// FromPtrValues adapts a slice of string pointer fields for use as CurrentValues.
84104// NOTE: Do not use this utility function unless you have to.
85105// Using pointer slices does not adhere to our current API practices.
@@ -102,6 +122,15 @@ func FromFloatPtrValues(v []*float64) []string {
102122 return res
103123}
104124
125+ // FromIntPtrValues adapts a slice of int64 pointer fields for use as CurrentValues.
126+ func FromIntPtrValues (v []* int64 ) []string {
127+ var res = make ([]string , len (v ))
128+ for i := 0 ; i < len (v ); i ++ {
129+ res [i ] = FromIntPtrValue (v [i ])
130+ }
131+ return res
132+ }
133+
105134// ToPtrValues adapts ResolvedValues for use as a slice of string pointer fields.
106135// NOTE: Do not use this utility function unless you have to.
107136// Using pointer slices does not adhere to our current API practices.
@@ -124,6 +153,15 @@ func ToFloatPtrValues(v []string) []*float64 {
124153 return res
125154}
126155
156+ // ToIntPtrValues adapts ResolvedValues for use as a slice of int64 pointer fields.
157+ func ToIntPtrValues (v []string ) []* int64 {
158+ var res = make ([]* int64 , len (v ))
159+ for i := 0 ; i < len (v ); i ++ {
160+ res [i ] = ToIntPtrValue (v [i ])
161+ }
162+ return res
163+ }
164+
127165// To indicates the kind of managed resource a reference is to.
128166type To struct {
129167 Managed resource.Managed
0 commit comments