/
flow.go
374 lines (314 loc) · 11.6 KB
/
flow.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
// *** 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 fnf
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Provides a Serverless Workflow Flow resource.
//
// For information about Serverless Workflow Flow and how to use it, see [What is Flow](https://www.alibabacloud.com/help/en/doc-detail/123079.htm).
//
// > **NOTE:** Available in v1.105.0+.
//
// ## Example Usage
//
// Basic Usage
//
// ```go
// package main
//
// import (
// "fmt"
//
// "github.com/pulumi/pulumi-alicloud/sdk/v2/go/alicloud/fnf"
// "github.com/pulumi/pulumi-alicloud/sdk/v2/go/alicloud/ram"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ram.NewRole(ctx, "_default", &ram.RoleArgs{
// Document: pulumi.String(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v%v", " {\n", " \"Statement\": [\n", " {\n", " \"Action\": \"sts:AssumeRole\",\n", " \"Effect\": \"Allow\",\n", " \"Principal\": {\n", " \"Service\": [\n", " \"fnf.aliyuncs.com\"\n", " ]\n", " }\n", " }\n", " ],\n", " \"Version\": \"1\"\n", " }\n")),
// })
// if err != nil {
// return err
// }
// _, err = fnf.NewFlow(ctx, "example", &fnf.FlowArgs{
// Definition: pulumi.String(fmt.Sprintf("%v%v%v%v%v", " version: v1beta1\n", " type: flow\n", " steps:\n", " - type: pass\n", " name: helloworld\n")),
// RoleArn: _default.Arn,
// Description: pulumi.String("Test for terraform fnf_flow."),
// Type: pulumi.String("FDL"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Serverless Workflow Flow can be imported using the id, e.g.
//
// ```sh
// $ pulumi import alicloud:fnf/flow:Flow example <name>
// ```
type Flow struct {
pulumi.CustomResourceState
// The definition of the flow. It must comply with the Flow Definition Language (FDL) syntax.
Definition pulumi.StringOutput `pulumi:"definition"`
// The description of the flow.
Description pulumi.StringOutput `pulumi:"description"`
// The unique ID of the flow.
FlowId pulumi.StringOutput `pulumi:"flowId"`
// The time when the flow was last modified.
LastModifiedTime pulumi.StringOutput `pulumi:"lastModifiedTime"`
// The name of the flow. The name must be unique in an Alibaba Cloud account.
Name pulumi.StringOutput `pulumi:"name"`
// The ARN of the specified RAM role that Serverless Workflow uses to assume the role when Serverless Workflow executes a flow.
RoleArn pulumi.StringPtrOutput `pulumi:"roleArn"`
// The type of the flow. Valid values are `FDL` or `DEFAULT`.
Type pulumi.StringOutput `pulumi:"type"`
}
// NewFlow registers a new resource with the given unique name, arguments, and options.
func NewFlow(ctx *pulumi.Context,
name string, args *FlowArgs, opts ...pulumi.ResourceOption) (*Flow, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Definition == nil {
return nil, errors.New("invalid value for required argument 'Definition'")
}
if args.Description == nil {
return nil, errors.New("invalid value for required argument 'Description'")
}
if args.Type == nil {
return nil, errors.New("invalid value for required argument 'Type'")
}
var resource Flow
err := ctx.RegisterResource("alicloud:fnf/flow:Flow", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetFlow gets an existing Flow 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 GetFlow(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *FlowState, opts ...pulumi.ResourceOption) (*Flow, error) {
var resource Flow
err := ctx.ReadResource("alicloud:fnf/flow:Flow", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Flow resources.
type flowState struct {
// The definition of the flow. It must comply with the Flow Definition Language (FDL) syntax.
Definition *string `pulumi:"definition"`
// The description of the flow.
Description *string `pulumi:"description"`
// The unique ID of the flow.
FlowId *string `pulumi:"flowId"`
// The time when the flow was last modified.
LastModifiedTime *string `pulumi:"lastModifiedTime"`
// The name of the flow. The name must be unique in an Alibaba Cloud account.
Name *string `pulumi:"name"`
// The ARN of the specified RAM role that Serverless Workflow uses to assume the role when Serverless Workflow executes a flow.
RoleArn *string `pulumi:"roleArn"`
// The type of the flow. Valid values are `FDL` or `DEFAULT`.
Type *string `pulumi:"type"`
}
type FlowState struct {
// The definition of the flow. It must comply with the Flow Definition Language (FDL) syntax.
Definition pulumi.StringPtrInput
// The description of the flow.
Description pulumi.StringPtrInput
// The unique ID of the flow.
FlowId pulumi.StringPtrInput
// The time when the flow was last modified.
LastModifiedTime pulumi.StringPtrInput
// The name of the flow. The name must be unique in an Alibaba Cloud account.
Name pulumi.StringPtrInput
// The ARN of the specified RAM role that Serverless Workflow uses to assume the role when Serverless Workflow executes a flow.
RoleArn pulumi.StringPtrInput
// The type of the flow. Valid values are `FDL` or `DEFAULT`.
Type pulumi.StringPtrInput
}
func (FlowState) ElementType() reflect.Type {
return reflect.TypeOf((*flowState)(nil)).Elem()
}
type flowArgs struct {
// The definition of the flow. It must comply with the Flow Definition Language (FDL) syntax.
Definition string `pulumi:"definition"`
// The description of the flow.
Description string `pulumi:"description"`
// The name of the flow. The name must be unique in an Alibaba Cloud account.
Name *string `pulumi:"name"`
// The ARN of the specified RAM role that Serverless Workflow uses to assume the role when Serverless Workflow executes a flow.
RoleArn *string `pulumi:"roleArn"`
// The type of the flow. Valid values are `FDL` or `DEFAULT`.
Type string `pulumi:"type"`
}
// The set of arguments for constructing a Flow resource.
type FlowArgs struct {
// The definition of the flow. It must comply with the Flow Definition Language (FDL) syntax.
Definition pulumi.StringInput
// The description of the flow.
Description pulumi.StringInput
// The name of the flow. The name must be unique in an Alibaba Cloud account.
Name pulumi.StringPtrInput
// The ARN of the specified RAM role that Serverless Workflow uses to assume the role when Serverless Workflow executes a flow.
RoleArn pulumi.StringPtrInput
// The type of the flow. Valid values are `FDL` or `DEFAULT`.
Type pulumi.StringInput
}
func (FlowArgs) ElementType() reflect.Type {
return reflect.TypeOf((*flowArgs)(nil)).Elem()
}
type FlowInput interface {
pulumi.Input
ToFlowOutput() FlowOutput
ToFlowOutputWithContext(ctx context.Context) FlowOutput
}
func (*Flow) ElementType() reflect.Type {
return reflect.TypeOf((*Flow)(nil))
}
func (i *Flow) ToFlowOutput() FlowOutput {
return i.ToFlowOutputWithContext(context.Background())
}
func (i *Flow) ToFlowOutputWithContext(ctx context.Context) FlowOutput {
return pulumi.ToOutputWithContext(ctx, i).(FlowOutput)
}
func (i *Flow) ToFlowPtrOutput() FlowPtrOutput {
return i.ToFlowPtrOutputWithContext(context.Background())
}
func (i *Flow) ToFlowPtrOutputWithContext(ctx context.Context) FlowPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(FlowPtrOutput)
}
type FlowPtrInput interface {
pulumi.Input
ToFlowPtrOutput() FlowPtrOutput
ToFlowPtrOutputWithContext(ctx context.Context) FlowPtrOutput
}
type flowPtrType FlowArgs
func (*flowPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**Flow)(nil))
}
func (i *flowPtrType) ToFlowPtrOutput() FlowPtrOutput {
return i.ToFlowPtrOutputWithContext(context.Background())
}
func (i *flowPtrType) ToFlowPtrOutputWithContext(ctx context.Context) FlowPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(FlowPtrOutput)
}
// FlowArrayInput is an input type that accepts FlowArray and FlowArrayOutput values.
// You can construct a concrete instance of `FlowArrayInput` via:
//
// FlowArray{ FlowArgs{...} }
type FlowArrayInput interface {
pulumi.Input
ToFlowArrayOutput() FlowArrayOutput
ToFlowArrayOutputWithContext(context.Context) FlowArrayOutput
}
type FlowArray []FlowInput
func (FlowArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*Flow)(nil))
}
func (i FlowArray) ToFlowArrayOutput() FlowArrayOutput {
return i.ToFlowArrayOutputWithContext(context.Background())
}
func (i FlowArray) ToFlowArrayOutputWithContext(ctx context.Context) FlowArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(FlowArrayOutput)
}
// FlowMapInput is an input type that accepts FlowMap and FlowMapOutput values.
// You can construct a concrete instance of `FlowMapInput` via:
//
// FlowMap{ "key": FlowArgs{...} }
type FlowMapInput interface {
pulumi.Input
ToFlowMapOutput() FlowMapOutput
ToFlowMapOutputWithContext(context.Context) FlowMapOutput
}
type FlowMap map[string]FlowInput
func (FlowMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*Flow)(nil))
}
func (i FlowMap) ToFlowMapOutput() FlowMapOutput {
return i.ToFlowMapOutputWithContext(context.Background())
}
func (i FlowMap) ToFlowMapOutputWithContext(ctx context.Context) FlowMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(FlowMapOutput)
}
type FlowOutput struct {
*pulumi.OutputState
}
func (FlowOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Flow)(nil))
}
func (o FlowOutput) ToFlowOutput() FlowOutput {
return o
}
func (o FlowOutput) ToFlowOutputWithContext(ctx context.Context) FlowOutput {
return o
}
func (o FlowOutput) ToFlowPtrOutput() FlowPtrOutput {
return o.ToFlowPtrOutputWithContext(context.Background())
}
func (o FlowOutput) ToFlowPtrOutputWithContext(ctx context.Context) FlowPtrOutput {
return o.ApplyT(func(v Flow) *Flow {
return &v
}).(FlowPtrOutput)
}
type FlowPtrOutput struct {
*pulumi.OutputState
}
func (FlowPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Flow)(nil))
}
func (o FlowPtrOutput) ToFlowPtrOutput() FlowPtrOutput {
return o
}
func (o FlowPtrOutput) ToFlowPtrOutputWithContext(ctx context.Context) FlowPtrOutput {
return o
}
type FlowArrayOutput struct{ *pulumi.OutputState }
func (FlowArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]Flow)(nil))
}
func (o FlowArrayOutput) ToFlowArrayOutput() FlowArrayOutput {
return o
}
func (o FlowArrayOutput) ToFlowArrayOutputWithContext(ctx context.Context) FlowArrayOutput {
return o
}
func (o FlowArrayOutput) Index(i pulumi.IntInput) FlowOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) Flow {
return vs[0].([]Flow)[vs[1].(int)]
}).(FlowOutput)
}
type FlowMapOutput struct{ *pulumi.OutputState }
func (FlowMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]Flow)(nil))
}
func (o FlowMapOutput) ToFlowMapOutput() FlowMapOutput {
return o
}
func (o FlowMapOutput) ToFlowMapOutputWithContext(ctx context.Context) FlowMapOutput {
return o
}
func (o FlowMapOutput) MapIndex(k pulumi.StringInput) FlowOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) Flow {
return vs[0].(map[string]Flow)[vs[1].(string)]
}).(FlowOutput)
}
func init() {
pulumi.RegisterOutputType(FlowOutput{})
pulumi.RegisterOutputType(FlowPtrOutput{})
pulumi.RegisterOutputType(FlowArrayOutput{})
pulumi.RegisterOutputType(FlowMapOutput{})
}