-
Notifications
You must be signed in to change notification settings - Fork 5
/
function.go
215 lines (202 loc) · 10.7 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
// *** 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 fc
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
type Function struct {
pulumi.CustomResourceState
// The checksum (crc64) of the function code.
CodeChecksum pulumi.StringOutput `pulumi:"codeChecksum"`
// 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/62213.htm) in your code.
Handler pulumi.StringOutput `pulumi:"handler"`
// The date this resource was last modified.
LastModified pulumi.StringOutput `pulumi:"lastModified"`
// Amount of memory in MB your Function can use at runtime. Defaults to `128`. Limits to [128, 3072].
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/doc-detail/52077.htm] 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 || args.Handler == nil {
return nil, errors.New("missing required argument 'Handler'")
}
if args == nil || args.Runtime == nil {
return nil, errors.New("missing required argument 'Runtime'")
}
if args == nil || args.Service == nil {
return nil, errors.New("missing required argument 'Service'")
}
if args == nil {
args = &FunctionArgs{}
}
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 checksum (crc64) of the function code.
CodeChecksum *string `pulumi:"codeChecksum"`
// 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/62213.htm) in your code.
Handler *string `pulumi:"handler"`
// The date this resource was last modified.
LastModified *string `pulumi:"lastModified"`
// Amount of memory in MB your Function can use at runtime. Defaults to `128`. Limits to [128, 3072].
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/doc-detail/52077.htm] 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 checksum (crc64) of the function code.
CodeChecksum pulumi.StringPtrInput
// 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/62213.htm) in your code.
Handler pulumi.StringPtrInput
// The date this resource was last modified.
LastModified pulumi.StringPtrInput
// Amount of memory in MB your Function can use at runtime. Defaults to `128`. Limits to [128, 3072].
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/doc-detail/52077.htm] 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 checksum (crc64) of the function code.
CodeChecksum *string `pulumi:"codeChecksum"`
// 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/62213.htm) in your code.
Handler string `pulumi:"handler"`
// Amount of memory in MB your Function can use at runtime. Defaults to `128`. Limits to [128, 3072].
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/doc-detail/52077.htm] 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 checksum (crc64) of the function code.
CodeChecksum pulumi.StringPtrInput
// 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/62213.htm) in your code.
Handler pulumi.StringInput
// Amount of memory in MB your Function can use at runtime. Defaults to `128`. Limits to [128, 3072].
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/doc-detail/52077.htm] 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()
}