generated from pulumi/pulumi-tf-provider-boilerplate
/
forwardingRule.go
338 lines (284 loc) · 13.3 KB
/
forwardingRule.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
// 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 ga
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a Global Accelerator (GA) Forwarding Rule resource.
//
// For information about Global Accelerator (GA) Forwarding Rule and how to use it, see [What is Forwarding Rule](https://www.alibabacloud.com/help/zh/doc-detail/205815.htm).
//
// > **NOTE:** Available in v1.120.0+.
//
// ## Import
//
// Ga Forwarding Rule can be imported using the id, e.g.
//
// ```sh
//
// $ pulumi import alicloud:ga/forwardingRule:ForwardingRule example <id>
//
// ```
type ForwardingRule struct {
pulumi.CustomResourceState
// The ID of the Global Accelerator instance.
AcceleratorId pulumi.StringOutput `pulumi:"acceleratorId"`
// Forwarding Policy ID.
ForwardingRuleId pulumi.StringOutput `pulumi:"forwardingRuleId"`
// Forwarding policy name. The length of the name is 2-128 English or Chinese characters. It must start with uppercase and lowercase letters or Chinese characters. It can contain numbers, half width period (.), underscores (_) And dash (-).
ForwardingRuleName pulumi.StringPtrOutput `pulumi:"forwardingRuleName"`
// Forwarding Policy Status.
ForwardingRuleStatus pulumi.StringOutput `pulumi:"forwardingRuleStatus"`
// The ID of the listener.
ListenerId pulumi.StringOutput `pulumi:"listenerId"`
// Forwarding policy priority.
Priority pulumi.IntOutput `pulumi:"priority"`
// Forward action.
RuleActions ForwardingRuleRuleActionArrayOutput `pulumi:"ruleActions"`
// Forwarding condition list.
RuleConditions ForwardingRuleRuleConditionArrayOutput `pulumi:"ruleConditions"`
}
// NewForwardingRule registers a new resource with the given unique name, arguments, and options.
func NewForwardingRule(ctx *pulumi.Context,
name string, args *ForwardingRuleArgs, opts ...pulumi.ResourceOption) (*ForwardingRule, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.AcceleratorId == nil {
return nil, errors.New("invalid value for required argument 'AcceleratorId'")
}
if args.ListenerId == nil {
return nil, errors.New("invalid value for required argument 'ListenerId'")
}
if args.RuleActions == nil {
return nil, errors.New("invalid value for required argument 'RuleActions'")
}
if args.RuleConditions == nil {
return nil, errors.New("invalid value for required argument 'RuleConditions'")
}
opts = pkgResourceDefaultOpts(opts)
var resource ForwardingRule
err := ctx.RegisterResource("alicloud:ga/forwardingRule:ForwardingRule", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetForwardingRule gets an existing ForwardingRule 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 GetForwardingRule(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ForwardingRuleState, opts ...pulumi.ResourceOption) (*ForwardingRule, error) {
var resource ForwardingRule
err := ctx.ReadResource("alicloud:ga/forwardingRule:ForwardingRule", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ForwardingRule resources.
type forwardingRuleState struct {
// The ID of the Global Accelerator instance.
AcceleratorId *string `pulumi:"acceleratorId"`
// Forwarding Policy ID.
ForwardingRuleId *string `pulumi:"forwardingRuleId"`
// Forwarding policy name. The length of the name is 2-128 English or Chinese characters. It must start with uppercase and lowercase letters or Chinese characters. It can contain numbers, half width period (.), underscores (_) And dash (-).
ForwardingRuleName *string `pulumi:"forwardingRuleName"`
// Forwarding Policy Status.
ForwardingRuleStatus *string `pulumi:"forwardingRuleStatus"`
// The ID of the listener.
ListenerId *string `pulumi:"listenerId"`
// Forwarding policy priority.
Priority *int `pulumi:"priority"`
// Forward action.
RuleActions []ForwardingRuleRuleAction `pulumi:"ruleActions"`
// Forwarding condition list.
RuleConditions []ForwardingRuleRuleCondition `pulumi:"ruleConditions"`
}
type ForwardingRuleState struct {
// The ID of the Global Accelerator instance.
AcceleratorId pulumi.StringPtrInput
// Forwarding Policy ID.
ForwardingRuleId pulumi.StringPtrInput
// Forwarding policy name. The length of the name is 2-128 English or Chinese characters. It must start with uppercase and lowercase letters or Chinese characters. It can contain numbers, half width period (.), underscores (_) And dash (-).
ForwardingRuleName pulumi.StringPtrInput
// Forwarding Policy Status.
ForwardingRuleStatus pulumi.StringPtrInput
// The ID of the listener.
ListenerId pulumi.StringPtrInput
// Forwarding policy priority.
Priority pulumi.IntPtrInput
// Forward action.
RuleActions ForwardingRuleRuleActionArrayInput
// Forwarding condition list.
RuleConditions ForwardingRuleRuleConditionArrayInput
}
func (ForwardingRuleState) ElementType() reflect.Type {
return reflect.TypeOf((*forwardingRuleState)(nil)).Elem()
}
type forwardingRuleArgs struct {
// The ID of the Global Accelerator instance.
AcceleratorId string `pulumi:"acceleratorId"`
// Forwarding policy name. The length of the name is 2-128 English or Chinese characters. It must start with uppercase and lowercase letters or Chinese characters. It can contain numbers, half width period (.), underscores (_) And dash (-).
ForwardingRuleName *string `pulumi:"forwardingRuleName"`
// The ID of the listener.
ListenerId string `pulumi:"listenerId"`
// Forwarding policy priority.
Priority *int `pulumi:"priority"`
// Forward action.
RuleActions []ForwardingRuleRuleAction `pulumi:"ruleActions"`
// Forwarding condition list.
RuleConditions []ForwardingRuleRuleCondition `pulumi:"ruleConditions"`
}
// The set of arguments for constructing a ForwardingRule resource.
type ForwardingRuleArgs struct {
// The ID of the Global Accelerator instance.
AcceleratorId pulumi.StringInput
// Forwarding policy name. The length of the name is 2-128 English or Chinese characters. It must start with uppercase and lowercase letters or Chinese characters. It can contain numbers, half width period (.), underscores (_) And dash (-).
ForwardingRuleName pulumi.StringPtrInput
// The ID of the listener.
ListenerId pulumi.StringInput
// Forwarding policy priority.
Priority pulumi.IntPtrInput
// Forward action.
RuleActions ForwardingRuleRuleActionArrayInput
// Forwarding condition list.
RuleConditions ForwardingRuleRuleConditionArrayInput
}
func (ForwardingRuleArgs) ElementType() reflect.Type {
return reflect.TypeOf((*forwardingRuleArgs)(nil)).Elem()
}
type ForwardingRuleInput interface {
pulumi.Input
ToForwardingRuleOutput() ForwardingRuleOutput
ToForwardingRuleOutputWithContext(ctx context.Context) ForwardingRuleOutput
}
func (*ForwardingRule) ElementType() reflect.Type {
return reflect.TypeOf((**ForwardingRule)(nil)).Elem()
}
func (i *ForwardingRule) ToForwardingRuleOutput() ForwardingRuleOutput {
return i.ToForwardingRuleOutputWithContext(context.Background())
}
func (i *ForwardingRule) ToForwardingRuleOutputWithContext(ctx context.Context) ForwardingRuleOutput {
return pulumi.ToOutputWithContext(ctx, i).(ForwardingRuleOutput)
}
// ForwardingRuleArrayInput is an input type that accepts ForwardingRuleArray and ForwardingRuleArrayOutput values.
// You can construct a concrete instance of `ForwardingRuleArrayInput` via:
//
// ForwardingRuleArray{ ForwardingRuleArgs{...} }
type ForwardingRuleArrayInput interface {
pulumi.Input
ToForwardingRuleArrayOutput() ForwardingRuleArrayOutput
ToForwardingRuleArrayOutputWithContext(context.Context) ForwardingRuleArrayOutput
}
type ForwardingRuleArray []ForwardingRuleInput
func (ForwardingRuleArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ForwardingRule)(nil)).Elem()
}
func (i ForwardingRuleArray) ToForwardingRuleArrayOutput() ForwardingRuleArrayOutput {
return i.ToForwardingRuleArrayOutputWithContext(context.Background())
}
func (i ForwardingRuleArray) ToForwardingRuleArrayOutputWithContext(ctx context.Context) ForwardingRuleArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ForwardingRuleArrayOutput)
}
// ForwardingRuleMapInput is an input type that accepts ForwardingRuleMap and ForwardingRuleMapOutput values.
// You can construct a concrete instance of `ForwardingRuleMapInput` via:
//
// ForwardingRuleMap{ "key": ForwardingRuleArgs{...} }
type ForwardingRuleMapInput interface {
pulumi.Input
ToForwardingRuleMapOutput() ForwardingRuleMapOutput
ToForwardingRuleMapOutputWithContext(context.Context) ForwardingRuleMapOutput
}
type ForwardingRuleMap map[string]ForwardingRuleInput
func (ForwardingRuleMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ForwardingRule)(nil)).Elem()
}
func (i ForwardingRuleMap) ToForwardingRuleMapOutput() ForwardingRuleMapOutput {
return i.ToForwardingRuleMapOutputWithContext(context.Background())
}
func (i ForwardingRuleMap) ToForwardingRuleMapOutputWithContext(ctx context.Context) ForwardingRuleMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ForwardingRuleMapOutput)
}
type ForwardingRuleOutput struct{ *pulumi.OutputState }
func (ForwardingRuleOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ForwardingRule)(nil)).Elem()
}
func (o ForwardingRuleOutput) ToForwardingRuleOutput() ForwardingRuleOutput {
return o
}
func (o ForwardingRuleOutput) ToForwardingRuleOutputWithContext(ctx context.Context) ForwardingRuleOutput {
return o
}
// The ID of the Global Accelerator instance.
func (o ForwardingRuleOutput) AcceleratorId() pulumi.StringOutput {
return o.ApplyT(func(v *ForwardingRule) pulumi.StringOutput { return v.AcceleratorId }).(pulumi.StringOutput)
}
// Forwarding Policy ID.
func (o ForwardingRuleOutput) ForwardingRuleId() pulumi.StringOutput {
return o.ApplyT(func(v *ForwardingRule) pulumi.StringOutput { return v.ForwardingRuleId }).(pulumi.StringOutput)
}
// Forwarding policy name. The length of the name is 2-128 English or Chinese characters. It must start with uppercase and lowercase letters or Chinese characters. It can contain numbers, half width period (.), underscores (_) And dash (-).
func (o ForwardingRuleOutput) ForwardingRuleName() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ForwardingRule) pulumi.StringPtrOutput { return v.ForwardingRuleName }).(pulumi.StringPtrOutput)
}
// Forwarding Policy Status.
func (o ForwardingRuleOutput) ForwardingRuleStatus() pulumi.StringOutput {
return o.ApplyT(func(v *ForwardingRule) pulumi.StringOutput { return v.ForwardingRuleStatus }).(pulumi.StringOutput)
}
// The ID of the listener.
func (o ForwardingRuleOutput) ListenerId() pulumi.StringOutput {
return o.ApplyT(func(v *ForwardingRule) pulumi.StringOutput { return v.ListenerId }).(pulumi.StringOutput)
}
// Forwarding policy priority.
func (o ForwardingRuleOutput) Priority() pulumi.IntOutput {
return o.ApplyT(func(v *ForwardingRule) pulumi.IntOutput { return v.Priority }).(pulumi.IntOutput)
}
// Forward action.
func (o ForwardingRuleOutput) RuleActions() ForwardingRuleRuleActionArrayOutput {
return o.ApplyT(func(v *ForwardingRule) ForwardingRuleRuleActionArrayOutput { return v.RuleActions }).(ForwardingRuleRuleActionArrayOutput)
}
// Forwarding condition list.
func (o ForwardingRuleOutput) RuleConditions() ForwardingRuleRuleConditionArrayOutput {
return o.ApplyT(func(v *ForwardingRule) ForwardingRuleRuleConditionArrayOutput { return v.RuleConditions }).(ForwardingRuleRuleConditionArrayOutput)
}
type ForwardingRuleArrayOutput struct{ *pulumi.OutputState }
func (ForwardingRuleArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ForwardingRule)(nil)).Elem()
}
func (o ForwardingRuleArrayOutput) ToForwardingRuleArrayOutput() ForwardingRuleArrayOutput {
return o
}
func (o ForwardingRuleArrayOutput) ToForwardingRuleArrayOutputWithContext(ctx context.Context) ForwardingRuleArrayOutput {
return o
}
func (o ForwardingRuleArrayOutput) Index(i pulumi.IntInput) ForwardingRuleOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ForwardingRule {
return vs[0].([]*ForwardingRule)[vs[1].(int)]
}).(ForwardingRuleOutput)
}
type ForwardingRuleMapOutput struct{ *pulumi.OutputState }
func (ForwardingRuleMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ForwardingRule)(nil)).Elem()
}
func (o ForwardingRuleMapOutput) ToForwardingRuleMapOutput() ForwardingRuleMapOutput {
return o
}
func (o ForwardingRuleMapOutput) ToForwardingRuleMapOutputWithContext(ctx context.Context) ForwardingRuleMapOutput {
return o
}
func (o ForwardingRuleMapOutput) MapIndex(k pulumi.StringInput) ForwardingRuleOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ForwardingRule {
return vs[0].(map[string]*ForwardingRule)[vs[1].(string)]
}).(ForwardingRuleOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ForwardingRuleInput)(nil)).Elem(), &ForwardingRule{})
pulumi.RegisterInputType(reflect.TypeOf((*ForwardingRuleArrayInput)(nil)).Elem(), ForwardingRuleArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ForwardingRuleMapInput)(nil)).Elem(), ForwardingRuleMap{})
pulumi.RegisterOutputType(ForwardingRuleOutput{})
pulumi.RegisterOutputType(ForwardingRuleArrayOutput{})
pulumi.RegisterOutputType(ForwardingRuleMapOutput{})
}