@@ -36,6 +36,34 @@ func ApplyResourceChangeResponse(in *tfprotov5.ApplyResourceChangeResponse) *tfp
36
36
}
37
37
}
38
38
39
+ func CallFunctionRequest (in * tfprotov5.CallFunctionRequest ) * tfprotov6.CallFunctionRequest {
40
+ if in == nil {
41
+ return nil
42
+ }
43
+
44
+ out := & tfprotov6.CallFunctionRequest {
45
+ Arguments : make ([]* tfprotov6.DynamicValue , 0 , len (in .Arguments )),
46
+ Name : in .Name ,
47
+ }
48
+
49
+ for _ , argument := range in .Arguments {
50
+ out .Arguments = append (out .Arguments , DynamicValue (argument ))
51
+ }
52
+
53
+ return out
54
+ }
55
+
56
+ func CallFunctionResponse (in * tfprotov5.CallFunctionResponse ) * tfprotov6.CallFunctionResponse {
57
+ if in == nil {
58
+ return nil
59
+ }
60
+
61
+ return & tfprotov6.CallFunctionResponse {
62
+ Diagnostics : Diagnostics (in .Diagnostics ),
63
+ Result : DynamicValue (in .Result ),
64
+ }
65
+ }
66
+
39
67
func ConfigureProviderRequest (in * tfprotov5.ConfigureProviderRequest ) * tfprotov6.ConfigureProviderRequest {
40
68
if in == nil {
41
69
return nil
@@ -98,6 +126,84 @@ func DynamicValue(in *tfprotov5.DynamicValue) *tfprotov6.DynamicValue {
98
126
}
99
127
}
100
128
129
+ func Function (in * tfprotov5.Function ) * tfprotov6.Function {
130
+ if in == nil {
131
+ return nil
132
+ }
133
+
134
+ out := & tfprotov6.Function {
135
+ DeprecationMessage : in .DeprecationMessage ,
136
+ Description : in .Description ,
137
+ DescriptionKind : StringKind (in .DescriptionKind ),
138
+ Parameters : make ([]* tfprotov6.FunctionParameter , 0 , len (in .Parameters )),
139
+ Return : FunctionReturn (in .Return ),
140
+ Summary : in .Summary ,
141
+ VariadicParameter : FunctionParameter (in .VariadicParameter ),
142
+ }
143
+
144
+ for _ , parameter := range in .Parameters {
145
+ out .Parameters = append (out .Parameters , FunctionParameter (parameter ))
146
+ }
147
+
148
+ return out
149
+ }
150
+
151
+ func FunctionMetadata (in tfprotov5.FunctionMetadata ) tfprotov6.FunctionMetadata {
152
+ return tfprotov6.FunctionMetadata {
153
+ Name : in .Name ,
154
+ }
155
+ }
156
+
157
+ func FunctionParameter (in * tfprotov5.FunctionParameter ) * tfprotov6.FunctionParameter {
158
+ if in == nil {
159
+ return nil
160
+ }
161
+
162
+ return & tfprotov6.FunctionParameter {
163
+ AllowNullValue : in .AllowNullValue ,
164
+ AllowUnknownValues : in .AllowUnknownValues ,
165
+ Description : in .Description ,
166
+ DescriptionKind : StringKind (in .DescriptionKind ),
167
+ Name : in .Name ,
168
+ Type : in .Type ,
169
+ }
170
+ }
171
+
172
+ func FunctionReturn (in * tfprotov5.FunctionReturn ) * tfprotov6.FunctionReturn {
173
+ if in == nil {
174
+ return nil
175
+ }
176
+
177
+ return & tfprotov6.FunctionReturn {
178
+ Type : in .Type ,
179
+ }
180
+ }
181
+
182
+ func GetFunctionsRequest (in * tfprotov5.GetFunctionsRequest ) * tfprotov6.GetFunctionsRequest {
183
+ if in == nil {
184
+ return nil
185
+ }
186
+
187
+ return & tfprotov6.GetFunctionsRequest {}
188
+ }
189
+
190
+ func GetFunctionsResponse (in * tfprotov5.GetFunctionsResponse ) * tfprotov6.GetFunctionsResponse {
191
+ if in == nil {
192
+ return nil
193
+ }
194
+
195
+ functions := make (map [string ]* tfprotov6.Function , len (in .Functions ))
196
+
197
+ for name , function := range in .Functions {
198
+ functions [name ] = Function (function )
199
+ }
200
+
201
+ return & tfprotov6.GetFunctionsResponse {
202
+ Diagnostics : Diagnostics (in .Diagnostics ),
203
+ Functions : functions ,
204
+ }
205
+ }
206
+
101
207
func GetMetadataRequest (in * tfprotov5.GetMetadataRequest ) * tfprotov6.GetMetadataRequest {
102
208
if in == nil {
103
209
return nil
@@ -114,6 +220,7 @@ func GetMetadataResponse(in *tfprotov5.GetMetadataResponse) *tfprotov6.GetMetada
114
220
resp := & tfprotov6.GetMetadataResponse {
115
221
DataSources : make ([]tfprotov6.DataSourceMetadata , 0 , len (in .DataSources )),
116
222
Diagnostics : Diagnostics (in .Diagnostics ),
223
+ Functions : make ([]tfprotov6.FunctionMetadata , 0 , len (in .Functions )),
117
224
Resources : make ([]tfprotov6.ResourceMetadata , 0 , len (in .Resources )),
118
225
ServerCapabilities : ServerCapabilities (in .ServerCapabilities ),
119
226
}
@@ -122,6 +229,10 @@ func GetMetadataResponse(in *tfprotov5.GetMetadataResponse) *tfprotov6.GetMetada
122
229
resp .DataSources = append (resp .DataSources , DataSourceMetadata (datasource ))
123
230
}
124
231
232
+ for _ , function := range in .Functions {
233
+ resp .Functions = append (resp .Functions , FunctionMetadata (function ))
234
+ }
235
+
125
236
for _ , resource := range in .Resources {
126
237
resp .Resources = append (resp .Resources , ResourceMetadata (resource ))
127
238
}
@@ -148,6 +259,12 @@ func GetProviderSchemaResponse(in *tfprotov5.GetProviderSchemaResponse) *tfproto
148
259
dataSourceSchemas [k ] = Schema (v )
149
260
}
150
261
262
+ functions := make (map [string ]* tfprotov6.Function , len (in .Functions ))
263
+
264
+ for name , function := range in .Functions {
265
+ functions [name ] = Function (function )
266
+ }
267
+
151
268
resourceSchemas := make (map [string ]* tfprotov6.Schema , len (in .ResourceSchemas ))
152
269
153
270
for k , v := range in .ResourceSchemas {
@@ -157,6 +274,7 @@ func GetProviderSchemaResponse(in *tfprotov5.GetProviderSchemaResponse) *tfproto
157
274
return & tfprotov6.GetProviderSchemaResponse {
158
275
DataSourceSchemas : dataSourceSchemas ,
159
276
Diagnostics : Diagnostics (in .Diagnostics ),
277
+ Functions : functions ,
160
278
Provider : Schema (in .Provider ),
161
279
ProviderMeta : Schema (in .ProviderMeta ),
162
280
ResourceSchemas : resourceSchemas ,
0 commit comments