This repository has been archived by the owner on Oct 6, 2023. It is now read-only.
generated from pulumi/pulumi-tf-provider-boilerplate
/
function.go
430 lines (384 loc) · 17.5 KB
/
function.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package yandex
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Allows management of [Yandex Cloud Function](https://cloud.yandex.com/docs/functions/)
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-yandex/sdk/go/yandex"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := yandex.NewFunction(ctx, "test-function", &yandex.FunctionArgs{
// Content: &FunctionContentArgs{
// ZipFilename: pulumi.String("function.zip"),
// },
// Description: pulumi.String("any description"),
// Entrypoint: pulumi.String("main"),
// ExecutionTimeout: pulumi.String("10"),
// Memory: pulumi.Int(128),
// Runtime: pulumi.String("python37"),
// ServiceAccountId: pulumi.String("are1service2account3id"),
// Tags: pulumi.StringArray{
// pulumi.String("my_tag"),
// },
// UserHash: pulumi.String("any_user_defined_string"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
type Function struct {
pulumi.CustomResourceState
// Version deployment content for Yandex Cloud Function code. Can be only one `package` or `content` section.
// * `content.0.zip_filename` - Filename to zip archive for the version.
Content FunctionContentPtrOutput `pulumi:"content"`
// Creation timestamp of the Yandex Cloud Function.
CreatedAt pulumi.StringOutput `pulumi:"createdAt"`
// Description of the Yandex Cloud Function
Description pulumi.StringPtrOutput `pulumi:"description"`
// Entrypoint for Yandex Cloud Function
Entrypoint pulumi.StringOutput `pulumi:"entrypoint"`
// A set of key/value environment variables for Yandex Cloud Function
Environment pulumi.StringMapOutput `pulumi:"environment"`
// Execution timeout in seconds for Yandex Cloud Function
ExecutionTimeout pulumi.StringPtrOutput `pulumi:"executionTimeout"`
// Folder ID for the Yandex Cloud Function
FolderId pulumi.StringOutput `pulumi:"folderId"`
// Image size for Yandex Cloud Function.
ImageSize pulumi.IntOutput `pulumi:"imageSize"`
// A set of key/value label pairs to assign to the Yandex Cloud Function
Labels pulumi.StringMapOutput `pulumi:"labels"`
// Loggroup ID size for Yandex Cloud Function.
LoggroupId pulumi.StringOutput `pulumi:"loggroupId"`
// Memory in megabytes (**aligned to 128MB**) for Yandex Cloud Function
Memory pulumi.IntOutput `pulumi:"memory"`
// Yandex Cloud Function name used to define trigger
Name pulumi.StringOutput `pulumi:"name"`
// Version deployment package for Yandex Cloud Function code. Can be only one `package` or `content` section.
// * `package.0.sha_256` - SHA256 hash of the version deployment package.
// * `package.0.bucket_name` - Name of the bucket that stores the code for the version.
// * `package.0.object_name` - Name of the object in the bucket that stores the code for the version.
Package FunctionPackagePtrOutput `pulumi:"package"`
// Runtime for Yandex Cloud Function
Runtime pulumi.StringOutput `pulumi:"runtime"`
// Service account ID for Yandex Cloud Function
ServiceAccountId pulumi.StringPtrOutput `pulumi:"serviceAccountId"`
// Tags for Yandex Cloud Function. Tag "$latest" isn't returned.
Tags pulumi.StringArrayOutput `pulumi:"tags"`
// User-defined string for current function version. User must change this string any times when function changed. Function will be updated when hash is changed.
UserHash pulumi.StringOutput `pulumi:"userHash"`
// Version for Yandex Cloud Function.
Version pulumi.StringOutput `pulumi:"version"`
}
// NewFunction registers a new resource with the given unique name, arguments, and options.
func NewFunction(ctx *pulumi.Context,
name string, args *FunctionArgs, opts ...pulumi.ResourceOption) (*Function, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Entrypoint == nil {
return nil, errors.New("invalid value for required argument 'Entrypoint'")
}
if args.Memory == nil {
return nil, errors.New("invalid value for required argument 'Memory'")
}
if args.Runtime == nil {
return nil, errors.New("invalid value for required argument 'Runtime'")
}
if args.UserHash == nil {
return nil, errors.New("invalid value for required argument 'UserHash'")
}
var resource Function
err := ctx.RegisterResource("yandex:index/function:Function", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetFunction gets an existing Function resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetFunction(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *FunctionState, opts ...pulumi.ResourceOption) (*Function, error) {
var resource Function
err := ctx.ReadResource("yandex:index/function:Function", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Function resources.
type functionState struct {
// Version deployment content for Yandex Cloud Function code. Can be only one `package` or `content` section.
// * `content.0.zip_filename` - Filename to zip archive for the version.
Content *FunctionContent `pulumi:"content"`
// Creation timestamp of the Yandex Cloud Function.
CreatedAt *string `pulumi:"createdAt"`
// Description of the Yandex Cloud Function
Description *string `pulumi:"description"`
// Entrypoint for Yandex Cloud Function
Entrypoint *string `pulumi:"entrypoint"`
// A set of key/value environment variables for Yandex Cloud Function
Environment map[string]string `pulumi:"environment"`
// Execution timeout in seconds for Yandex Cloud Function
ExecutionTimeout *string `pulumi:"executionTimeout"`
// Folder ID for the Yandex Cloud Function
FolderId *string `pulumi:"folderId"`
// Image size for Yandex Cloud Function.
ImageSize *int `pulumi:"imageSize"`
// A set of key/value label pairs to assign to the Yandex Cloud Function
Labels map[string]string `pulumi:"labels"`
// Loggroup ID size for Yandex Cloud Function.
LoggroupId *string `pulumi:"loggroupId"`
// Memory in megabytes (**aligned to 128MB**) for Yandex Cloud Function
Memory *int `pulumi:"memory"`
// Yandex Cloud Function name used to define trigger
Name *string `pulumi:"name"`
// Version deployment package for Yandex Cloud Function code. Can be only one `package` or `content` section.
// * `package.0.sha_256` - SHA256 hash of the version deployment package.
// * `package.0.bucket_name` - Name of the bucket that stores the code for the version.
// * `package.0.object_name` - Name of the object in the bucket that stores the code for the version.
Package *FunctionPackage `pulumi:"package"`
// Runtime for Yandex Cloud Function
Runtime *string `pulumi:"runtime"`
// Service account ID for Yandex Cloud Function
ServiceAccountId *string `pulumi:"serviceAccountId"`
// Tags for Yandex Cloud Function. Tag "$latest" isn't returned.
Tags []string `pulumi:"tags"`
// User-defined string for current function version. User must change this string any times when function changed. Function will be updated when hash is changed.
UserHash *string `pulumi:"userHash"`
// Version for Yandex Cloud Function.
Version *string `pulumi:"version"`
}
type FunctionState struct {
// Version deployment content for Yandex Cloud Function code. Can be only one `package` or `content` section.
// * `content.0.zip_filename` - Filename to zip archive for the version.
Content FunctionContentPtrInput
// Creation timestamp of the Yandex Cloud Function.
CreatedAt pulumi.StringPtrInput
// Description of the Yandex Cloud Function
Description pulumi.StringPtrInput
// Entrypoint for Yandex Cloud Function
Entrypoint pulumi.StringPtrInput
// A set of key/value environment variables for Yandex Cloud Function
Environment pulumi.StringMapInput
// Execution timeout in seconds for Yandex Cloud Function
ExecutionTimeout pulumi.StringPtrInput
// Folder ID for the Yandex Cloud Function
FolderId pulumi.StringPtrInput
// Image size for Yandex Cloud Function.
ImageSize pulumi.IntPtrInput
// A set of key/value label pairs to assign to the Yandex Cloud Function
Labels pulumi.StringMapInput
// Loggroup ID size for Yandex Cloud Function.
LoggroupId pulumi.StringPtrInput
// Memory in megabytes (**aligned to 128MB**) for Yandex Cloud Function
Memory pulumi.IntPtrInput
// Yandex Cloud Function name used to define trigger
Name pulumi.StringPtrInput
// Version deployment package for Yandex Cloud Function code. Can be only one `package` or `content` section.
// * `package.0.sha_256` - SHA256 hash of the version deployment package.
// * `package.0.bucket_name` - Name of the bucket that stores the code for the version.
// * `package.0.object_name` - Name of the object in the bucket that stores the code for the version.
Package FunctionPackagePtrInput
// Runtime for Yandex Cloud Function
Runtime pulumi.StringPtrInput
// Service account ID for Yandex Cloud Function
ServiceAccountId pulumi.StringPtrInput
// Tags for Yandex Cloud Function. Tag "$latest" isn't returned.
Tags pulumi.StringArrayInput
// User-defined string for current function version. User must change this string any times when function changed. Function will be updated when hash is changed.
UserHash pulumi.StringPtrInput
// Version for Yandex Cloud Function.
Version pulumi.StringPtrInput
}
func (FunctionState) ElementType() reflect.Type {
return reflect.TypeOf((*functionState)(nil)).Elem()
}
type functionArgs struct {
// Version deployment content for Yandex Cloud Function code. Can be only one `package` or `content` section.
// * `content.0.zip_filename` - Filename to zip archive for the version.
Content *FunctionContent `pulumi:"content"`
// Description of the Yandex Cloud Function
Description *string `pulumi:"description"`
// Entrypoint for Yandex Cloud Function
Entrypoint string `pulumi:"entrypoint"`
// A set of key/value environment variables for Yandex Cloud Function
Environment map[string]string `pulumi:"environment"`
// Execution timeout in seconds for Yandex Cloud Function
ExecutionTimeout *string `pulumi:"executionTimeout"`
// Folder ID for the Yandex Cloud Function
FolderId *string `pulumi:"folderId"`
// A set of key/value label pairs to assign to the Yandex Cloud Function
Labels map[string]string `pulumi:"labels"`
// Memory in megabytes (**aligned to 128MB**) for Yandex Cloud Function
Memory int `pulumi:"memory"`
// Yandex Cloud Function name used to define trigger
Name *string `pulumi:"name"`
// Version deployment package for Yandex Cloud Function code. Can be only one `package` or `content` section.
// * `package.0.sha_256` - SHA256 hash of the version deployment package.
// * `package.0.bucket_name` - Name of the bucket that stores the code for the version.
// * `package.0.object_name` - Name of the object in the bucket that stores the code for the version.
Package *FunctionPackage `pulumi:"package"`
// Runtime for Yandex Cloud Function
Runtime string `pulumi:"runtime"`
// Service account ID for Yandex Cloud Function
ServiceAccountId *string `pulumi:"serviceAccountId"`
// Tags for Yandex Cloud Function. Tag "$latest" isn't returned.
Tags []string `pulumi:"tags"`
// User-defined string for current function version. User must change this string any times when function changed. Function will be updated when hash is changed.
UserHash string `pulumi:"userHash"`
}
// The set of arguments for constructing a Function resource.
type FunctionArgs struct {
// Version deployment content for Yandex Cloud Function code. Can be only one `package` or `content` section.
// * `content.0.zip_filename` - Filename to zip archive for the version.
Content FunctionContentPtrInput
// Description of the Yandex Cloud Function
Description pulumi.StringPtrInput
// Entrypoint for Yandex Cloud Function
Entrypoint pulumi.StringInput
// A set of key/value environment variables for Yandex Cloud Function
Environment pulumi.StringMapInput
// Execution timeout in seconds for Yandex Cloud Function
ExecutionTimeout pulumi.StringPtrInput
// Folder ID for the Yandex Cloud Function
FolderId pulumi.StringPtrInput
// A set of key/value label pairs to assign to the Yandex Cloud Function
Labels pulumi.StringMapInput
// Memory in megabytes (**aligned to 128MB**) for Yandex Cloud Function
Memory pulumi.IntInput
// Yandex Cloud Function name used to define trigger
Name pulumi.StringPtrInput
// Version deployment package for Yandex Cloud Function code. Can be only one `package` or `content` section.
// * `package.0.sha_256` - SHA256 hash of the version deployment package.
// * `package.0.bucket_name` - Name of the bucket that stores the code for the version.
// * `package.0.object_name` - Name of the object in the bucket that stores the code for the version.
Package FunctionPackagePtrInput
// Runtime for Yandex Cloud Function
Runtime pulumi.StringInput
// Service account ID for Yandex Cloud Function
ServiceAccountId pulumi.StringPtrInput
// Tags for Yandex Cloud Function. Tag "$latest" isn't returned.
Tags pulumi.StringArrayInput
// User-defined string for current function version. User must change this string any times when function changed. Function will be updated when hash is changed.
UserHash pulumi.StringInput
}
func (FunctionArgs) ElementType() reflect.Type {
return reflect.TypeOf((*functionArgs)(nil)).Elem()
}
type FunctionInput interface {
pulumi.Input
ToFunctionOutput() FunctionOutput
ToFunctionOutputWithContext(ctx context.Context) FunctionOutput
}
func (*Function) ElementType() reflect.Type {
return reflect.TypeOf((**Function)(nil)).Elem()
}
func (i *Function) ToFunctionOutput() FunctionOutput {
return i.ToFunctionOutputWithContext(context.Background())
}
func (i *Function) ToFunctionOutputWithContext(ctx context.Context) FunctionOutput {
return pulumi.ToOutputWithContext(ctx, i).(FunctionOutput)
}
// FunctionArrayInput is an input type that accepts FunctionArray and FunctionArrayOutput values.
// You can construct a concrete instance of `FunctionArrayInput` via:
//
// FunctionArray{ FunctionArgs{...} }
type FunctionArrayInput interface {
pulumi.Input
ToFunctionArrayOutput() FunctionArrayOutput
ToFunctionArrayOutputWithContext(context.Context) FunctionArrayOutput
}
type FunctionArray []FunctionInput
func (FunctionArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Function)(nil)).Elem()
}
func (i FunctionArray) ToFunctionArrayOutput() FunctionArrayOutput {
return i.ToFunctionArrayOutputWithContext(context.Background())
}
func (i FunctionArray) ToFunctionArrayOutputWithContext(ctx context.Context) FunctionArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(FunctionArrayOutput)
}
// FunctionMapInput is an input type that accepts FunctionMap and FunctionMapOutput values.
// You can construct a concrete instance of `FunctionMapInput` via:
//
// FunctionMap{ "key": FunctionArgs{...} }
type FunctionMapInput interface {
pulumi.Input
ToFunctionMapOutput() FunctionMapOutput
ToFunctionMapOutputWithContext(context.Context) FunctionMapOutput
}
type FunctionMap map[string]FunctionInput
func (FunctionMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Function)(nil)).Elem()
}
func (i FunctionMap) ToFunctionMapOutput() FunctionMapOutput {
return i.ToFunctionMapOutputWithContext(context.Background())
}
func (i FunctionMap) ToFunctionMapOutputWithContext(ctx context.Context) FunctionMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(FunctionMapOutput)
}
type FunctionOutput struct{ *pulumi.OutputState }
func (FunctionOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Function)(nil)).Elem()
}
func (o FunctionOutput) ToFunctionOutput() FunctionOutput {
return o
}
func (o FunctionOutput) ToFunctionOutputWithContext(ctx context.Context) FunctionOutput {
return o
}
type FunctionArrayOutput struct{ *pulumi.OutputState }
func (FunctionArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Function)(nil)).Elem()
}
func (o FunctionArrayOutput) ToFunctionArrayOutput() FunctionArrayOutput {
return o
}
func (o FunctionArrayOutput) ToFunctionArrayOutputWithContext(ctx context.Context) FunctionArrayOutput {
return o
}
func (o FunctionArrayOutput) Index(i pulumi.IntInput) FunctionOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Function {
return vs[0].([]*Function)[vs[1].(int)]
}).(FunctionOutput)
}
type FunctionMapOutput struct{ *pulumi.OutputState }
func (FunctionMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Function)(nil)).Elem()
}
func (o FunctionMapOutput) ToFunctionMapOutput() FunctionMapOutput {
return o
}
func (o FunctionMapOutput) ToFunctionMapOutputWithContext(ctx context.Context) FunctionMapOutput {
return o
}
func (o FunctionMapOutput) MapIndex(k pulumi.StringInput) FunctionOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Function {
return vs[0].(map[string]*Function)[vs[1].(string)]
}).(FunctionOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*FunctionInput)(nil)).Elem(), &Function{})
pulumi.RegisterInputType(reflect.TypeOf((*FunctionArrayInput)(nil)).Elem(), FunctionArray{})
pulumi.RegisterInputType(reflect.TypeOf((*FunctionMapInput)(nil)).Elem(), FunctionMap{})
pulumi.RegisterOutputType(FunctionOutput{})
pulumi.RegisterOutputType(FunctionArrayOutput{})
pulumi.RegisterOutputType(FunctionMapOutput{})
}