generated from pulumi/pulumi-tf-provider-boilerplate
/
ruleEngine.go
469 lines (417 loc) · 15.3 KB
/
ruleEngine.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
// 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 teo
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a resource to create a teo ruleEngine
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-tencentcloud/sdk/go/tencentcloud/Teo"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/tencentcloudstack/pulumi-tencentcloud/sdk/go/tencentcloud/Teo"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := Teo.NewRuleEngine(ctx, "rule1", &Teo.RuleEngineArgs{
// ZoneId: pulumi.Any(tencentcloud_teo_zone.Example.Id),
// RuleName: pulumi.String("test-rule"),
// Status: pulumi.String("disable"),
// Rules: teo.RuleEngineRuleArray{
// &teo.RuleEngineRuleArgs{
// Actions: teo.RuleEngineRuleActionArray{
// &teo.RuleEngineRuleActionArgs{
// NormalAction: &teo.RuleEngineRuleActionNormalActionArgs{
// Action: pulumi.String("UpstreamUrlRedirect"),
// Parameters: teo.RuleEngineRuleActionNormalActionParameterArray{
// &teo.RuleEngineRuleActionNormalActionParameterArgs{
// Name: pulumi.String("Type"),
// Values: pulumi.StringArray{
// pulumi.String("Path"),
// },
// },
// &teo.RuleEngineRuleActionNormalActionParameterArgs{
// Name: pulumi.String("Action"),
// Values: pulumi.StringArray{
// pulumi.String("addPrefix"),
// },
// },
// &teo.RuleEngineRuleActionNormalActionParameterArgs{
// Name: pulumi.String("Value"),
// Values: pulumi.StringArray{
// pulumi.String("/sss"),
// },
// },
// },
// },
// },
// },
// Ors: teo.RuleEngineRuleOrArray{
// &teo.RuleEngineRuleOrArgs{
// Ands: teo.RuleEngineRuleOrAndArray{
// &teo.RuleEngineRuleOrAndArgs{
// Operator: pulumi.String("equal"),
// Target: pulumi.String("host"),
// IgnoreCase: pulumi.Bool(false),
// Values: pulumi.StringArray{
// pulumi.String("a.tf-teo-t.xyz"),
// },
// },
// &teo.RuleEngineRuleOrAndArgs{
// Operator: pulumi.String("equal"),
// Target: pulumi.String("extension"),
// IgnoreCase: pulumi.Bool(false),
// Values: pulumi.StringArray{
// pulumi.String("jpg"),
// },
// },
// },
// },
// &teo.RuleEngineRuleOrArgs{
// Ands: teo.RuleEngineRuleOrAndArray{
// &teo.RuleEngineRuleOrAndArgs{
// Operator: pulumi.String("equal"),
// Target: pulumi.String("filename"),
// IgnoreCase: pulumi.Bool(false),
// Values: pulumi.StringArray{
// pulumi.String("test.txt"),
// },
// },
// },
// },
// },
// SubRules: teo.RuleEngineRuleSubRuleArray{
// &teo.RuleEngineRuleSubRuleArgs{
// Tags: pulumi.StringArray{
// pulumi.String("png"),
// },
// Rules: teo.RuleEngineRuleSubRuleRuleArray{
// &teo.RuleEngineRuleSubRuleRuleArgs{
// Ors: teo.RuleEngineRuleSubRuleRuleOrArray{
// &teo.RuleEngineRuleSubRuleRuleOrArgs{
// Ands: teo.RuleEngineRuleSubRuleRuleOrAndArray{
// &teo.RuleEngineRuleSubRuleRuleOrAndArgs{
// Operator: pulumi.String("notequal"),
// Target: pulumi.String("host"),
// IgnoreCase: pulumi.Bool(false),
// Values: pulumi.StringArray{
// pulumi.String("a.tf-teo-t.xyz"),
// },
// },
// &teo.RuleEngineRuleSubRuleRuleOrAndArgs{
// Operator: pulumi.String("equal"),
// Target: pulumi.String("extension"),
// IgnoreCase: pulumi.Bool(false),
// Values: pulumi.StringArray{
// pulumi.String("png"),
// },
// },
// },
// },
// &teo.RuleEngineRuleSubRuleRuleOrArgs{
// Ands: teo.RuleEngineRuleSubRuleRuleOrAndArray{
// &teo.RuleEngineRuleSubRuleRuleOrAndArgs{
// Operator: pulumi.String("notequal"),
// Target: pulumi.String("filename"),
// IgnoreCase: pulumi.Bool(false),
// Values: pulumi.StringArray{
// pulumi.String("test.txt"),
// },
// },
// },
// },
// },
// Actions: teo.RuleEngineRuleSubRuleRuleActionArray{
// &teo.RuleEngineRuleSubRuleRuleActionArgs{
// NormalAction: &teo.RuleEngineRuleSubRuleRuleActionNormalActionArgs{
// Action: pulumi.String("UpstreamUrlRedirect"),
// Parameters: teo.RuleEngineRuleSubRuleRuleActionNormalActionParameterArray{
// &teo.RuleEngineRuleSubRuleRuleActionNormalActionParameterArgs{
// Name: pulumi.String("Type"),
// Values: pulumi.StringArray{
// pulumi.String("Path"),
// },
// },
// &teo.RuleEngineRuleSubRuleRuleActionNormalActionParameterArgs{
// Name: pulumi.String("Action"),
// Values: pulumi.StringArray{
// pulumi.String("addPrefix"),
// },
// },
// &teo.RuleEngineRuleSubRuleRuleActionNormalActionParameterArgs{
// Name: pulumi.String("Value"),
// Values: pulumi.StringArray{
// pulumi.String("/www"),
// },
// },
// },
// },
// },
// },
// },
// },
// },
// },
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// teo rule_engine can be imported using the id#rule_id, e.g.
//
// ```sh
// $ pulumi import tencentcloud:Teo/ruleEngine:RuleEngine rule_engine zone-297z8rf93cfw#rule-ajol584a
// ```
type RuleEngine struct {
pulumi.CustomResourceState
// Rule ID.
RuleId pulumi.StringOutput `pulumi:"ruleId"`
// The rule name (1 to 255 characters).
RuleName pulumi.StringOutput `pulumi:"ruleName"`
// Rule items list.
Rules RuleEngineRuleArrayOutput `pulumi:"rules"`
// Rule status. Values: `enable`: Enabled; `disable`: Disabled.
Status pulumi.StringOutput `pulumi:"status"`
// rule tag list.
Tags pulumi.StringArrayOutput `pulumi:"tags"`
// ID of the site.
ZoneId pulumi.StringOutput `pulumi:"zoneId"`
}
// NewRuleEngine registers a new resource with the given unique name, arguments, and options.
func NewRuleEngine(ctx *pulumi.Context,
name string, args *RuleEngineArgs, opts ...pulumi.ResourceOption) (*RuleEngine, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.RuleName == nil {
return nil, errors.New("invalid value for required argument 'RuleName'")
}
if args.Rules == nil {
return nil, errors.New("invalid value for required argument 'Rules'")
}
if args.Status == nil {
return nil, errors.New("invalid value for required argument 'Status'")
}
if args.ZoneId == nil {
return nil, errors.New("invalid value for required argument 'ZoneId'")
}
opts = pkgResourceDefaultOpts(opts)
var resource RuleEngine
err := ctx.RegisterResource("tencentcloud:Teo/ruleEngine:RuleEngine", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetRuleEngine gets an existing RuleEngine 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 GetRuleEngine(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *RuleEngineState, opts ...pulumi.ResourceOption) (*RuleEngine, error) {
var resource RuleEngine
err := ctx.ReadResource("tencentcloud:Teo/ruleEngine:RuleEngine", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering RuleEngine resources.
type ruleEngineState struct {
// Rule ID.
RuleId *string `pulumi:"ruleId"`
// The rule name (1 to 255 characters).
RuleName *string `pulumi:"ruleName"`
// Rule items list.
Rules []RuleEngineRule `pulumi:"rules"`
// Rule status. Values: `enable`: Enabled; `disable`: Disabled.
Status *string `pulumi:"status"`
// rule tag list.
Tags []string `pulumi:"tags"`
// ID of the site.
ZoneId *string `pulumi:"zoneId"`
}
type RuleEngineState struct {
// Rule ID.
RuleId pulumi.StringPtrInput
// The rule name (1 to 255 characters).
RuleName pulumi.StringPtrInput
// Rule items list.
Rules RuleEngineRuleArrayInput
// Rule status. Values: `enable`: Enabled; `disable`: Disabled.
Status pulumi.StringPtrInput
// rule tag list.
Tags pulumi.StringArrayInput
// ID of the site.
ZoneId pulumi.StringPtrInput
}
func (RuleEngineState) ElementType() reflect.Type {
return reflect.TypeOf((*ruleEngineState)(nil)).Elem()
}
type ruleEngineArgs struct {
// The rule name (1 to 255 characters).
RuleName string `pulumi:"ruleName"`
// Rule items list.
Rules []RuleEngineRule `pulumi:"rules"`
// Rule status. Values: `enable`: Enabled; `disable`: Disabled.
Status string `pulumi:"status"`
// rule tag list.
Tags []string `pulumi:"tags"`
// ID of the site.
ZoneId string `pulumi:"zoneId"`
}
// The set of arguments for constructing a RuleEngine resource.
type RuleEngineArgs struct {
// The rule name (1 to 255 characters).
RuleName pulumi.StringInput
// Rule items list.
Rules RuleEngineRuleArrayInput
// Rule status. Values: `enable`: Enabled; `disable`: Disabled.
Status pulumi.StringInput
// rule tag list.
Tags pulumi.StringArrayInput
// ID of the site.
ZoneId pulumi.StringInput
}
func (RuleEngineArgs) ElementType() reflect.Type {
return reflect.TypeOf((*ruleEngineArgs)(nil)).Elem()
}
type RuleEngineInput interface {
pulumi.Input
ToRuleEngineOutput() RuleEngineOutput
ToRuleEngineOutputWithContext(ctx context.Context) RuleEngineOutput
}
func (*RuleEngine) ElementType() reflect.Type {
return reflect.TypeOf((**RuleEngine)(nil)).Elem()
}
func (i *RuleEngine) ToRuleEngineOutput() RuleEngineOutput {
return i.ToRuleEngineOutputWithContext(context.Background())
}
func (i *RuleEngine) ToRuleEngineOutputWithContext(ctx context.Context) RuleEngineOutput {
return pulumi.ToOutputWithContext(ctx, i).(RuleEngineOutput)
}
// RuleEngineArrayInput is an input type that accepts RuleEngineArray and RuleEngineArrayOutput values.
// You can construct a concrete instance of `RuleEngineArrayInput` via:
//
// RuleEngineArray{ RuleEngineArgs{...} }
type RuleEngineArrayInput interface {
pulumi.Input
ToRuleEngineArrayOutput() RuleEngineArrayOutput
ToRuleEngineArrayOutputWithContext(context.Context) RuleEngineArrayOutput
}
type RuleEngineArray []RuleEngineInput
func (RuleEngineArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*RuleEngine)(nil)).Elem()
}
func (i RuleEngineArray) ToRuleEngineArrayOutput() RuleEngineArrayOutput {
return i.ToRuleEngineArrayOutputWithContext(context.Background())
}
func (i RuleEngineArray) ToRuleEngineArrayOutputWithContext(ctx context.Context) RuleEngineArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(RuleEngineArrayOutput)
}
// RuleEngineMapInput is an input type that accepts RuleEngineMap and RuleEngineMapOutput values.
// You can construct a concrete instance of `RuleEngineMapInput` via:
//
// RuleEngineMap{ "key": RuleEngineArgs{...} }
type RuleEngineMapInput interface {
pulumi.Input
ToRuleEngineMapOutput() RuleEngineMapOutput
ToRuleEngineMapOutputWithContext(context.Context) RuleEngineMapOutput
}
type RuleEngineMap map[string]RuleEngineInput
func (RuleEngineMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*RuleEngine)(nil)).Elem()
}
func (i RuleEngineMap) ToRuleEngineMapOutput() RuleEngineMapOutput {
return i.ToRuleEngineMapOutputWithContext(context.Background())
}
func (i RuleEngineMap) ToRuleEngineMapOutputWithContext(ctx context.Context) RuleEngineMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(RuleEngineMapOutput)
}
type RuleEngineOutput struct{ *pulumi.OutputState }
func (RuleEngineOutput) ElementType() reflect.Type {
return reflect.TypeOf((**RuleEngine)(nil)).Elem()
}
func (o RuleEngineOutput) ToRuleEngineOutput() RuleEngineOutput {
return o
}
func (o RuleEngineOutput) ToRuleEngineOutputWithContext(ctx context.Context) RuleEngineOutput {
return o
}
// Rule ID.
func (o RuleEngineOutput) RuleId() pulumi.StringOutput {
return o.ApplyT(func(v *RuleEngine) pulumi.StringOutput { return v.RuleId }).(pulumi.StringOutput)
}
// The rule name (1 to 255 characters).
func (o RuleEngineOutput) RuleName() pulumi.StringOutput {
return o.ApplyT(func(v *RuleEngine) pulumi.StringOutput { return v.RuleName }).(pulumi.StringOutput)
}
// Rule items list.
func (o RuleEngineOutput) Rules() RuleEngineRuleArrayOutput {
return o.ApplyT(func(v *RuleEngine) RuleEngineRuleArrayOutput { return v.Rules }).(RuleEngineRuleArrayOutput)
}
// Rule status. Values: `enable`: Enabled; `disable`: Disabled.
func (o RuleEngineOutput) Status() pulumi.StringOutput {
return o.ApplyT(func(v *RuleEngine) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
}
// rule tag list.
func (o RuleEngineOutput) Tags() pulumi.StringArrayOutput {
return o.ApplyT(func(v *RuleEngine) pulumi.StringArrayOutput { return v.Tags }).(pulumi.StringArrayOutput)
}
// ID of the site.
func (o RuleEngineOutput) ZoneId() pulumi.StringOutput {
return o.ApplyT(func(v *RuleEngine) pulumi.StringOutput { return v.ZoneId }).(pulumi.StringOutput)
}
type RuleEngineArrayOutput struct{ *pulumi.OutputState }
func (RuleEngineArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*RuleEngine)(nil)).Elem()
}
func (o RuleEngineArrayOutput) ToRuleEngineArrayOutput() RuleEngineArrayOutput {
return o
}
func (o RuleEngineArrayOutput) ToRuleEngineArrayOutputWithContext(ctx context.Context) RuleEngineArrayOutput {
return o
}
func (o RuleEngineArrayOutput) Index(i pulumi.IntInput) RuleEngineOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *RuleEngine {
return vs[0].([]*RuleEngine)[vs[1].(int)]
}).(RuleEngineOutput)
}
type RuleEngineMapOutput struct{ *pulumi.OutputState }
func (RuleEngineMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*RuleEngine)(nil)).Elem()
}
func (o RuleEngineMapOutput) ToRuleEngineMapOutput() RuleEngineMapOutput {
return o
}
func (o RuleEngineMapOutput) ToRuleEngineMapOutputWithContext(ctx context.Context) RuleEngineMapOutput {
return o
}
func (o RuleEngineMapOutput) MapIndex(k pulumi.StringInput) RuleEngineOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *RuleEngine {
return vs[0].(map[string]*RuleEngine)[vs[1].(string)]
}).(RuleEngineOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*RuleEngineInput)(nil)).Elem(), &RuleEngine{})
pulumi.RegisterInputType(reflect.TypeOf((*RuleEngineArrayInput)(nil)).Elem(), RuleEngineArray{})
pulumi.RegisterInputType(reflect.TypeOf((*RuleEngineMapInput)(nil)).Elem(), RuleEngineMap{})
pulumi.RegisterOutputType(RuleEngineOutput{})
pulumi.RegisterOutputType(RuleEngineArrayOutput{})
pulumi.RegisterOutputType(RuleEngineMapOutput{})
}