/
function.go
683 lines (615 loc) · 31.4 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
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package fc
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a Alicloud Function Compute Function resource. Function allows you to trigger execution of code in response to events in Alibaba Cloud. The Function itself includes source code and runtime configuration.
//
// For information about Service and how to use it, see [What is Function Compute](https://www.alibabacloud.com/help/en/fc/developer-reference/api-createfunction).
//
// > **NOTE:** The resource requires a provider field 'account_id'. See account_id.
//
// > **NOTE:** Available since v1.10.0.
//
// ## Example Usage
//
// # Basic Usage
//
// ```go
// package main
//
// import (
//
// "fmt"
//
// "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/fc"
// "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/log"
// "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/oss"
// "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ram"
// "github.com/pulumi/pulumi-random/sdk/v4/go/random"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
// Max: 99999,
// Min: 10000,
// })
// if err != nil {
// return err
// }
// defaultProject, err := log.NewProject(ctx, "default", &log.ProjectArgs{
// ProjectName: pulumi.String(fmt.Sprintf("example-value-%v", _default.Result)),
// })
// if err != nil {
// return err
// }
// defaultStore, err := log.NewStore(ctx, "default", &log.StoreArgs{
// ProjectName: defaultProject.Name,
// LogstoreName: pulumi.String("example-value"),
// })
// if err != nil {
// return err
// }
// defaultRole, err := ram.NewRole(ctx, "default", &ram.RoleArgs{
// Name: pulumi.String(fmt.Sprintf("fcservicerole-%v", _default.Result)),
// Document: pulumi.String(` {
// "Statement": [
// {
// "Action": "sts:AssumeRole",
// "Effect": "Allow",
// "Principal": {
// "Service": [
// "fc.aliyuncs.com"
// ]
// }
// }
// ],
// "Version": "1"
// }
//
// `),
//
// Description: pulumi.String("this is a example"),
// Force: pulumi.Bool(true),
// })
// if err != nil {
// return err
// }
// _, err = ram.NewRolePolicyAttachment(ctx, "default", &ram.RolePolicyAttachmentArgs{
// RoleName: defaultRole.Name,
// PolicyName: pulumi.String("AliyunLogFullAccess"),
// PolicyType: pulumi.String("System"),
// })
// if err != nil {
// return err
// }
// defaultService, err := fc.NewService(ctx, "default", &fc.ServiceArgs{
// Name: pulumi.String(fmt.Sprintf("example-value-%v", _default.Result)),
// Description: pulumi.String("example-value"),
// Role: defaultRole.Arn,
// LogConfig: &fc.ServiceLogConfigArgs{
// Project: defaultProject.Name,
// Logstore: defaultStore.Name,
// EnableInstanceMetrics: pulumi.Bool(true),
// EnableRequestMetrics: pulumi.Bool(true),
// },
// })
// if err != nil {
// return err
// }
// defaultBucket, err := oss.NewBucket(ctx, "default", &oss.BucketArgs{
// Bucket: pulumi.String(fmt.Sprintf("terraform-example-%v", _default.Result)),
// })
// if err != nil {
// return err
// }
// // If you upload the function by OSS Bucket, you need to specify path can't upload by content.
// defaultBucketObject, err := oss.NewBucketObject(ctx, "default", &oss.BucketObjectArgs{
// Bucket: defaultBucket.ID(),
// Key: pulumi.String("index.py"),
// Content: pulumi.String("import logging \ndef handler(event, context): \nlogger = logging.getLogger() \nlogger.info('hello world') \nreturn 'hello world'"),
// })
// if err != nil {
// return err
// }
// _, err = fc.NewFunction(ctx, "foo", &fc.FunctionArgs{
// Service: defaultService.Name,
// Name: pulumi.String("terraform-example"),
// Description: pulumi.String("example"),
// OssBucket: defaultBucket.ID(),
// OssKey: defaultBucketObject.Key,
// MemorySize: pulumi.Int(512),
// Runtime: pulumi.String("python3.10"),
// Handler: pulumi.String("hello.handler"),
// EnvironmentVariables: pulumi.Map{
// "prefix": pulumi.Any("terraform"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Module Support
//
// You can use to the existing fc module
// to create a function quickly and set several triggers for it.
//
// ## Import
//
// Function Compute function can be imported using the id, e.g.
//
// ```sh
// $ pulumi import alicloud:fc/function:Function foo my-fc-service:hello-world
// ```
type Function struct {
pulumi.CustomResourceState
// The port that the function listen to, only valid for [custom runtime](https://www.alibabacloud.com/help/doc-detail/132044.htm) and [custom container runtime](https://www.alibabacloud.com/help/doc-detail/179368.htm).
CaPort pulumi.IntPtrOutput `pulumi:"caPort"`
// The checksum (crc64) of the function code.Used to trigger updates.The value can be generated by data source alicloud_file_crc64_checksum.
// > **NOTE:** For more information, see [Limits](https://www.alibabacloud.com/help/doc-detail/51907.htm).
CodeChecksum pulumi.StringOutput `pulumi:"codeChecksum"`
// The configuration for custom container runtime.See `customContainerConfig` below.
CustomContainerConfig FunctionCustomContainerConfigPtrOutput `pulumi:"customContainerConfig"`
// The Function Compute function description.
Description pulumi.StringPtrOutput `pulumi:"description"`
// A map that defines environment variables for the function.
EnvironmentVariables pulumi.MapOutput `pulumi:"environmentVariables"`
// The path to the function's deployment package within the local filesystem. It is conflict with the `oss_`-prefixed options.
Filename pulumi.StringPtrOutput `pulumi:"filename"`
// The Function Compute service ID.
FunctionId pulumi.StringOutput `pulumi:"functionId"`
// The function [entry point](https://www.alibabacloud.com/help/doc-detail/157704.htm) in your code.
Handler pulumi.StringOutput `pulumi:"handler"`
// The maximum length of time, in seconds, that the function's initialization should be run for.
InitializationTimeout pulumi.IntPtrOutput `pulumi:"initializationTimeout"`
// The entry point of the function's [initialization](https://www.alibabacloud.com/help/doc-detail/157704.htm).
Initializer pulumi.StringPtrOutput `pulumi:"initializer"`
// The maximum number of requests can be executed concurrently within the single function instance.
InstanceConcurrency pulumi.IntPtrOutput `pulumi:"instanceConcurrency"`
// The instance type of the function.
InstanceType pulumi.StringPtrOutput `pulumi:"instanceType"`
// The date this resource was last modified.
LastModified pulumi.StringOutput `pulumi:"lastModified"`
// The configuration for layers.
Layers pulumi.StringArrayOutput `pulumi:"layers"`
// Amount of memory in MB your function can use at runtime. Defaults to `128`. Limits to [128, 32768].
MemorySize pulumi.IntPtrOutput `pulumi:"memorySize"`
// The Function Compute function name. It is the only in one service and is conflict with "namePrefix".
Name pulumi.StringOutput `pulumi:"name"`
// Setting a prefix to get a only function name. It is conflict with "name".
NamePrefix pulumi.StringPtrOutput `pulumi:"namePrefix"`
// The OSS bucket location containing the function's deployment package. Conflicts with `filename`. This bucket must reside in the same Alibaba Cloud region where you are creating the function.
OssBucket pulumi.StringPtrOutput `pulumi:"ossBucket"`
// The OSS key of an object containing the function's deployment package. Conflicts with `filename`.
OssKey pulumi.StringPtrOutput `pulumi:"ossKey"`
// See [Runtimes][https://www.alibabacloud.com/help/zh/function-compute/latest/manage-functions#multiTask3514] for valid values.
Runtime pulumi.StringOutput `pulumi:"runtime"`
// The Function Compute service name.
Service pulumi.StringOutput `pulumi:"service"`
// The amount of time your function has to run in seconds.
Timeout pulumi.IntPtrOutput `pulumi:"timeout"`
}
// 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.Handler == nil {
return nil, errors.New("invalid value for required argument 'Handler'")
}
if args.Runtime == nil {
return nil, errors.New("invalid value for required argument 'Runtime'")
}
if args.Service == nil {
return nil, errors.New("invalid value for required argument 'Service'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Function
err := ctx.RegisterResource("alicloud:fc/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("alicloud:fc/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 {
// The port that the function listen to, only valid for [custom runtime](https://www.alibabacloud.com/help/doc-detail/132044.htm) and [custom container runtime](https://www.alibabacloud.com/help/doc-detail/179368.htm).
CaPort *int `pulumi:"caPort"`
// The checksum (crc64) of the function code.Used to trigger updates.The value can be generated by data source alicloud_file_crc64_checksum.
// > **NOTE:** For more information, see [Limits](https://www.alibabacloud.com/help/doc-detail/51907.htm).
CodeChecksum *string `pulumi:"codeChecksum"`
// The configuration for custom container runtime.See `customContainerConfig` below.
CustomContainerConfig *FunctionCustomContainerConfig `pulumi:"customContainerConfig"`
// The Function Compute function description.
Description *string `pulumi:"description"`
// A map that defines environment variables for the function.
EnvironmentVariables map[string]interface{} `pulumi:"environmentVariables"`
// The path to the function's deployment package within the local filesystem. It is conflict with the `oss_`-prefixed options.
Filename *string `pulumi:"filename"`
// The Function Compute service ID.
FunctionId *string `pulumi:"functionId"`
// The function [entry point](https://www.alibabacloud.com/help/doc-detail/157704.htm) in your code.
Handler *string `pulumi:"handler"`
// The maximum length of time, in seconds, that the function's initialization should be run for.
InitializationTimeout *int `pulumi:"initializationTimeout"`
// The entry point of the function's [initialization](https://www.alibabacloud.com/help/doc-detail/157704.htm).
Initializer *string `pulumi:"initializer"`
// The maximum number of requests can be executed concurrently within the single function instance.
InstanceConcurrency *int `pulumi:"instanceConcurrency"`
// The instance type of the function.
InstanceType *string `pulumi:"instanceType"`
// The date this resource was last modified.
LastModified *string `pulumi:"lastModified"`
// The configuration for layers.
Layers []string `pulumi:"layers"`
// Amount of memory in MB your function can use at runtime. Defaults to `128`. Limits to [128, 32768].
MemorySize *int `pulumi:"memorySize"`
// The Function Compute function name. It is the only in one service and is conflict with "namePrefix".
Name *string `pulumi:"name"`
// Setting a prefix to get a only function name. It is conflict with "name".
NamePrefix *string `pulumi:"namePrefix"`
// The OSS bucket location containing the function's deployment package. Conflicts with `filename`. This bucket must reside in the same Alibaba Cloud region where you are creating the function.
OssBucket *string `pulumi:"ossBucket"`
// The OSS key of an object containing the function's deployment package. Conflicts with `filename`.
OssKey *string `pulumi:"ossKey"`
// See [Runtimes][https://www.alibabacloud.com/help/zh/function-compute/latest/manage-functions#multiTask3514] for valid values.
Runtime *string `pulumi:"runtime"`
// The Function Compute service name.
Service *string `pulumi:"service"`
// The amount of time your function has to run in seconds.
Timeout *int `pulumi:"timeout"`
}
type FunctionState struct {
// The port that the function listen to, only valid for [custom runtime](https://www.alibabacloud.com/help/doc-detail/132044.htm) and [custom container runtime](https://www.alibabacloud.com/help/doc-detail/179368.htm).
CaPort pulumi.IntPtrInput
// The checksum (crc64) of the function code.Used to trigger updates.The value can be generated by data source alicloud_file_crc64_checksum.
// > **NOTE:** For more information, see [Limits](https://www.alibabacloud.com/help/doc-detail/51907.htm).
CodeChecksum pulumi.StringPtrInput
// The configuration for custom container runtime.See `customContainerConfig` below.
CustomContainerConfig FunctionCustomContainerConfigPtrInput
// The Function Compute function description.
Description pulumi.StringPtrInput
// A map that defines environment variables for the function.
EnvironmentVariables pulumi.MapInput
// The path to the function's deployment package within the local filesystem. It is conflict with the `oss_`-prefixed options.
Filename pulumi.StringPtrInput
// The Function Compute service ID.
FunctionId pulumi.StringPtrInput
// The function [entry point](https://www.alibabacloud.com/help/doc-detail/157704.htm) in your code.
Handler pulumi.StringPtrInput
// The maximum length of time, in seconds, that the function's initialization should be run for.
InitializationTimeout pulumi.IntPtrInput
// The entry point of the function's [initialization](https://www.alibabacloud.com/help/doc-detail/157704.htm).
Initializer pulumi.StringPtrInput
// The maximum number of requests can be executed concurrently within the single function instance.
InstanceConcurrency pulumi.IntPtrInput
// The instance type of the function.
InstanceType pulumi.StringPtrInput
// The date this resource was last modified.
LastModified pulumi.StringPtrInput
// The configuration for layers.
Layers pulumi.StringArrayInput
// Amount of memory in MB your function can use at runtime. Defaults to `128`. Limits to [128, 32768].
MemorySize pulumi.IntPtrInput
// The Function Compute function name. It is the only in one service and is conflict with "namePrefix".
Name pulumi.StringPtrInput
// Setting a prefix to get a only function name. It is conflict with "name".
NamePrefix pulumi.StringPtrInput
// The OSS bucket location containing the function's deployment package. Conflicts with `filename`. This bucket must reside in the same Alibaba Cloud region where you are creating the function.
OssBucket pulumi.StringPtrInput
// The OSS key of an object containing the function's deployment package. Conflicts with `filename`.
OssKey pulumi.StringPtrInput
// See [Runtimes][https://www.alibabacloud.com/help/zh/function-compute/latest/manage-functions#multiTask3514] for valid values.
Runtime pulumi.StringPtrInput
// The Function Compute service name.
Service pulumi.StringPtrInput
// The amount of time your function has to run in seconds.
Timeout pulumi.IntPtrInput
}
func (FunctionState) ElementType() reflect.Type {
return reflect.TypeOf((*functionState)(nil)).Elem()
}
type functionArgs struct {
// The port that the function listen to, only valid for [custom runtime](https://www.alibabacloud.com/help/doc-detail/132044.htm) and [custom container runtime](https://www.alibabacloud.com/help/doc-detail/179368.htm).
CaPort *int `pulumi:"caPort"`
// The checksum (crc64) of the function code.Used to trigger updates.The value can be generated by data source alicloud_file_crc64_checksum.
// > **NOTE:** For more information, see [Limits](https://www.alibabacloud.com/help/doc-detail/51907.htm).
CodeChecksum *string `pulumi:"codeChecksum"`
// The configuration for custom container runtime.See `customContainerConfig` below.
CustomContainerConfig *FunctionCustomContainerConfig `pulumi:"customContainerConfig"`
// The Function Compute function description.
Description *string `pulumi:"description"`
// A map that defines environment variables for the function.
EnvironmentVariables map[string]interface{} `pulumi:"environmentVariables"`
// The path to the function's deployment package within the local filesystem. It is conflict with the `oss_`-prefixed options.
Filename *string `pulumi:"filename"`
// The function [entry point](https://www.alibabacloud.com/help/doc-detail/157704.htm) in your code.
Handler string `pulumi:"handler"`
// The maximum length of time, in seconds, that the function's initialization should be run for.
InitializationTimeout *int `pulumi:"initializationTimeout"`
// The entry point of the function's [initialization](https://www.alibabacloud.com/help/doc-detail/157704.htm).
Initializer *string `pulumi:"initializer"`
// The maximum number of requests can be executed concurrently within the single function instance.
InstanceConcurrency *int `pulumi:"instanceConcurrency"`
// The instance type of the function.
InstanceType *string `pulumi:"instanceType"`
// The configuration for layers.
Layers []string `pulumi:"layers"`
// Amount of memory in MB your function can use at runtime. Defaults to `128`. Limits to [128, 32768].
MemorySize *int `pulumi:"memorySize"`
// The Function Compute function name. It is the only in one service and is conflict with "namePrefix".
Name *string `pulumi:"name"`
// Setting a prefix to get a only function name. It is conflict with "name".
NamePrefix *string `pulumi:"namePrefix"`
// The OSS bucket location containing the function's deployment package. Conflicts with `filename`. This bucket must reside in the same Alibaba Cloud region where you are creating the function.
OssBucket *string `pulumi:"ossBucket"`
// The OSS key of an object containing the function's deployment package. Conflicts with `filename`.
OssKey *string `pulumi:"ossKey"`
// See [Runtimes][https://www.alibabacloud.com/help/zh/function-compute/latest/manage-functions#multiTask3514] for valid values.
Runtime string `pulumi:"runtime"`
// The Function Compute service name.
Service string `pulumi:"service"`
// The amount of time your function has to run in seconds.
Timeout *int `pulumi:"timeout"`
}
// The set of arguments for constructing a Function resource.
type FunctionArgs struct {
// The port that the function listen to, only valid for [custom runtime](https://www.alibabacloud.com/help/doc-detail/132044.htm) and [custom container runtime](https://www.alibabacloud.com/help/doc-detail/179368.htm).
CaPort pulumi.IntPtrInput
// The checksum (crc64) of the function code.Used to trigger updates.The value can be generated by data source alicloud_file_crc64_checksum.
// > **NOTE:** For more information, see [Limits](https://www.alibabacloud.com/help/doc-detail/51907.htm).
CodeChecksum pulumi.StringPtrInput
// The configuration for custom container runtime.See `customContainerConfig` below.
CustomContainerConfig FunctionCustomContainerConfigPtrInput
// The Function Compute function description.
Description pulumi.StringPtrInput
// A map that defines environment variables for the function.
EnvironmentVariables pulumi.MapInput
// The path to the function's deployment package within the local filesystem. It is conflict with the `oss_`-prefixed options.
Filename pulumi.StringPtrInput
// The function [entry point](https://www.alibabacloud.com/help/doc-detail/157704.htm) in your code.
Handler pulumi.StringInput
// The maximum length of time, in seconds, that the function's initialization should be run for.
InitializationTimeout pulumi.IntPtrInput
// The entry point of the function's [initialization](https://www.alibabacloud.com/help/doc-detail/157704.htm).
Initializer pulumi.StringPtrInput
// The maximum number of requests can be executed concurrently within the single function instance.
InstanceConcurrency pulumi.IntPtrInput
// The instance type of the function.
InstanceType pulumi.StringPtrInput
// The configuration for layers.
Layers pulumi.StringArrayInput
// Amount of memory in MB your function can use at runtime. Defaults to `128`. Limits to [128, 32768].
MemorySize pulumi.IntPtrInput
// The Function Compute function name. It is the only in one service and is conflict with "namePrefix".
Name pulumi.StringPtrInput
// Setting a prefix to get a only function name. It is conflict with "name".
NamePrefix pulumi.StringPtrInput
// The OSS bucket location containing the function's deployment package. Conflicts with `filename`. This bucket must reside in the same Alibaba Cloud region where you are creating the function.
OssBucket pulumi.StringPtrInput
// The OSS key of an object containing the function's deployment package. Conflicts with `filename`.
OssKey pulumi.StringPtrInput
// See [Runtimes][https://www.alibabacloud.com/help/zh/function-compute/latest/manage-functions#multiTask3514] for valid values.
Runtime pulumi.StringInput
// The Function Compute service name.
Service pulumi.StringInput
// The amount of time your function has to run in seconds.
Timeout pulumi.IntPtrInput
}
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
}
// The port that the function listen to, only valid for [custom runtime](https://www.alibabacloud.com/help/doc-detail/132044.htm) and [custom container runtime](https://www.alibabacloud.com/help/doc-detail/179368.htm).
func (o FunctionOutput) CaPort() pulumi.IntPtrOutput {
return o.ApplyT(func(v *Function) pulumi.IntPtrOutput { return v.CaPort }).(pulumi.IntPtrOutput)
}
// The checksum (crc64) of the function code.Used to trigger updates.The value can be generated by data source alicloud_file_crc64_checksum.
// > **NOTE:** For more information, see [Limits](https://www.alibabacloud.com/help/doc-detail/51907.htm).
func (o FunctionOutput) CodeChecksum() pulumi.StringOutput {
return o.ApplyT(func(v *Function) pulumi.StringOutput { return v.CodeChecksum }).(pulumi.StringOutput)
}
// The configuration for custom container runtime.See `customContainerConfig` below.
func (o FunctionOutput) CustomContainerConfig() FunctionCustomContainerConfigPtrOutput {
return o.ApplyT(func(v *Function) FunctionCustomContainerConfigPtrOutput { return v.CustomContainerConfig }).(FunctionCustomContainerConfigPtrOutput)
}
// The Function Compute function description.
func (o FunctionOutput) Description() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Function) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
}
// A map that defines environment variables for the function.
func (o FunctionOutput) EnvironmentVariables() pulumi.MapOutput {
return o.ApplyT(func(v *Function) pulumi.MapOutput { return v.EnvironmentVariables }).(pulumi.MapOutput)
}
// The path to the function's deployment package within the local filesystem. It is conflict with the `oss_`-prefixed options.
func (o FunctionOutput) Filename() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Function) pulumi.StringPtrOutput { return v.Filename }).(pulumi.StringPtrOutput)
}
// The Function Compute service ID.
func (o FunctionOutput) FunctionId() pulumi.StringOutput {
return o.ApplyT(func(v *Function) pulumi.StringOutput { return v.FunctionId }).(pulumi.StringOutput)
}
// The function [entry point](https://www.alibabacloud.com/help/doc-detail/157704.htm) in your code.
func (o FunctionOutput) Handler() pulumi.StringOutput {
return o.ApplyT(func(v *Function) pulumi.StringOutput { return v.Handler }).(pulumi.StringOutput)
}
// The maximum length of time, in seconds, that the function's initialization should be run for.
func (o FunctionOutput) InitializationTimeout() pulumi.IntPtrOutput {
return o.ApplyT(func(v *Function) pulumi.IntPtrOutput { return v.InitializationTimeout }).(pulumi.IntPtrOutput)
}
// The entry point of the function's [initialization](https://www.alibabacloud.com/help/doc-detail/157704.htm).
func (o FunctionOutput) Initializer() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Function) pulumi.StringPtrOutput { return v.Initializer }).(pulumi.StringPtrOutput)
}
// The maximum number of requests can be executed concurrently within the single function instance.
func (o FunctionOutput) InstanceConcurrency() pulumi.IntPtrOutput {
return o.ApplyT(func(v *Function) pulumi.IntPtrOutput { return v.InstanceConcurrency }).(pulumi.IntPtrOutput)
}
// The instance type of the function.
func (o FunctionOutput) InstanceType() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Function) pulumi.StringPtrOutput { return v.InstanceType }).(pulumi.StringPtrOutput)
}
// The date this resource was last modified.
func (o FunctionOutput) LastModified() pulumi.StringOutput {
return o.ApplyT(func(v *Function) pulumi.StringOutput { return v.LastModified }).(pulumi.StringOutput)
}
// The configuration for layers.
func (o FunctionOutput) Layers() pulumi.StringArrayOutput {
return o.ApplyT(func(v *Function) pulumi.StringArrayOutput { return v.Layers }).(pulumi.StringArrayOutput)
}
// Amount of memory in MB your function can use at runtime. Defaults to `128`. Limits to [128, 32768].
func (o FunctionOutput) MemorySize() pulumi.IntPtrOutput {
return o.ApplyT(func(v *Function) pulumi.IntPtrOutput { return v.MemorySize }).(pulumi.IntPtrOutput)
}
// The Function Compute function name. It is the only in one service and is conflict with "namePrefix".
func (o FunctionOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Function) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// Setting a prefix to get a only function name. It is conflict with "name".
func (o FunctionOutput) NamePrefix() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Function) pulumi.StringPtrOutput { return v.NamePrefix }).(pulumi.StringPtrOutput)
}
// The OSS bucket location containing the function's deployment package. Conflicts with `filename`. This bucket must reside in the same Alibaba Cloud region where you are creating the function.
func (o FunctionOutput) OssBucket() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Function) pulumi.StringPtrOutput { return v.OssBucket }).(pulumi.StringPtrOutput)
}
// The OSS key of an object containing the function's deployment package. Conflicts with `filename`.
func (o FunctionOutput) OssKey() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Function) pulumi.StringPtrOutput { return v.OssKey }).(pulumi.StringPtrOutput)
}
// See [Runtimes][https://www.alibabacloud.com/help/zh/function-compute/latest/manage-functions#multiTask3514] for valid values.
func (o FunctionOutput) Runtime() pulumi.StringOutput {
return o.ApplyT(func(v *Function) pulumi.StringOutput { return v.Runtime }).(pulumi.StringOutput)
}
// The Function Compute service name.
func (o FunctionOutput) Service() pulumi.StringOutput {
return o.ApplyT(func(v *Function) pulumi.StringOutput { return v.Service }).(pulumi.StringOutput)
}
// The amount of time your function has to run in seconds.
func (o FunctionOutput) Timeout() pulumi.IntPtrOutput {
return o.ApplyT(func(v *Function) pulumi.IntPtrOutput { return v.Timeout }).(pulumi.IntPtrOutput)
}
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{})
}