/
securityGroupRule.go
377 lines (317 loc) · 18.1 KB
/
securityGroupRule.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
// *** 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 ecs
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
type SecurityGroupRule struct {
pulumi.CustomResourceState
// The target IP address range. The default value is 0.0.0.0/0 (which means no restriction will be applied). Other supported formats include 10.159.6.18/12. Only IPv4 is supported.
CidrIp pulumi.StringPtrOutput `pulumi:"cidrIp"`
// The description of the security group rule. The description can be up to 1 to 512 characters in length. Defaults to null.
Description pulumi.StringPtrOutput `pulumi:"description"`
// The protocol. Can be `tcp`, `udp`, `icmp`, `gre` or `all`.
IpProtocol pulumi.StringOutput `pulumi:"ipProtocol"`
// Network type, can be either `internet` or `intranet`, the default value is `internet`.
NicType pulumi.StringOutput `pulumi:"nicType"`
// Authorization policy, can be either `accept` or `drop`, the default value is `accept`.
Policy pulumi.StringPtrOutput `pulumi:"policy"`
// The range of port numbers relevant to the IP protocol. Default to "-1/-1". When the protocol is tcp or udp, each side port number range from 1 to 65535 and '-1/-1' will be invalid.
// For example, `1/200` means that the range of the port numbers is 1-200. Other protocols' 'port_range' can only be "-1/-1", and other values will be invalid.
PortRange pulumi.StringPtrOutput `pulumi:"portRange"`
// Authorization policy priority, with parameter values: `1-100`, default value: 1.
Priority pulumi.IntPtrOutput `pulumi:"priority"`
// The security group to apply this rule to.
SecurityGroupId pulumi.StringOutput `pulumi:"securityGroupId"`
// The Alibaba Cloud user account Id of the target security group when security groups are authorized across accounts. This parameter is invalid if `cidrIp` has already been set.
SourceGroupOwnerAccount pulumi.StringPtrOutput `pulumi:"sourceGroupOwnerAccount"`
// The target security group ID within the same region. If this field is specified, the `nicType` can only select `intranet`.
SourceSecurityGroupId pulumi.StringPtrOutput `pulumi:"sourceSecurityGroupId"`
// The type of rule being created. Valid options are `ingress` (inbound) or `egress` (outbound).
Type pulumi.StringOutput `pulumi:"type"`
}
// NewSecurityGroupRule registers a new resource with the given unique name, arguments, and options.
func NewSecurityGroupRule(ctx *pulumi.Context,
name string, args *SecurityGroupRuleArgs, opts ...pulumi.ResourceOption) (*SecurityGroupRule, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.IpProtocol == nil {
return nil, errors.New("invalid value for required argument 'IpProtocol'")
}
if args.SecurityGroupId == nil {
return nil, errors.New("invalid value for required argument 'SecurityGroupId'")
}
if args.Type == nil {
return nil, errors.New("invalid value for required argument 'Type'")
}
var resource SecurityGroupRule
err := ctx.RegisterResource("alicloud:ecs/securityGroupRule:SecurityGroupRule", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetSecurityGroupRule gets an existing SecurityGroupRule 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 GetSecurityGroupRule(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *SecurityGroupRuleState, opts ...pulumi.ResourceOption) (*SecurityGroupRule, error) {
var resource SecurityGroupRule
err := ctx.ReadResource("alicloud:ecs/securityGroupRule:SecurityGroupRule", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering SecurityGroupRule resources.
type securityGroupRuleState struct {
// The target IP address range. The default value is 0.0.0.0/0 (which means no restriction will be applied). Other supported formats include 10.159.6.18/12. Only IPv4 is supported.
CidrIp *string `pulumi:"cidrIp"`
// The description of the security group rule. The description can be up to 1 to 512 characters in length. Defaults to null.
Description *string `pulumi:"description"`
// The protocol. Can be `tcp`, `udp`, `icmp`, `gre` or `all`.
IpProtocol *string `pulumi:"ipProtocol"`
// Network type, can be either `internet` or `intranet`, the default value is `internet`.
NicType *string `pulumi:"nicType"`
// Authorization policy, can be either `accept` or `drop`, the default value is `accept`.
Policy *string `pulumi:"policy"`
// The range of port numbers relevant to the IP protocol. Default to "-1/-1". When the protocol is tcp or udp, each side port number range from 1 to 65535 and '-1/-1' will be invalid.
// For example, `1/200` means that the range of the port numbers is 1-200. Other protocols' 'port_range' can only be "-1/-1", and other values will be invalid.
PortRange *string `pulumi:"portRange"`
// Authorization policy priority, with parameter values: `1-100`, default value: 1.
Priority *int `pulumi:"priority"`
// The security group to apply this rule to.
SecurityGroupId *string `pulumi:"securityGroupId"`
// The Alibaba Cloud user account Id of the target security group when security groups are authorized across accounts. This parameter is invalid if `cidrIp` has already been set.
SourceGroupOwnerAccount *string `pulumi:"sourceGroupOwnerAccount"`
// The target security group ID within the same region. If this field is specified, the `nicType` can only select `intranet`.
SourceSecurityGroupId *string `pulumi:"sourceSecurityGroupId"`
// The type of rule being created. Valid options are `ingress` (inbound) or `egress` (outbound).
Type *string `pulumi:"type"`
}
type SecurityGroupRuleState struct {
// The target IP address range. The default value is 0.0.0.0/0 (which means no restriction will be applied). Other supported formats include 10.159.6.18/12. Only IPv4 is supported.
CidrIp pulumi.StringPtrInput
// The description of the security group rule. The description can be up to 1 to 512 characters in length. Defaults to null.
Description pulumi.StringPtrInput
// The protocol. Can be `tcp`, `udp`, `icmp`, `gre` or `all`.
IpProtocol pulumi.StringPtrInput
// Network type, can be either `internet` or `intranet`, the default value is `internet`.
NicType pulumi.StringPtrInput
// Authorization policy, can be either `accept` or `drop`, the default value is `accept`.
Policy pulumi.StringPtrInput
// The range of port numbers relevant to the IP protocol. Default to "-1/-1". When the protocol is tcp or udp, each side port number range from 1 to 65535 and '-1/-1' will be invalid.
// For example, `1/200` means that the range of the port numbers is 1-200. Other protocols' 'port_range' can only be "-1/-1", and other values will be invalid.
PortRange pulumi.StringPtrInput
// Authorization policy priority, with parameter values: `1-100`, default value: 1.
Priority pulumi.IntPtrInput
// The security group to apply this rule to.
SecurityGroupId pulumi.StringPtrInput
// The Alibaba Cloud user account Id of the target security group when security groups are authorized across accounts. This parameter is invalid if `cidrIp` has already been set.
SourceGroupOwnerAccount pulumi.StringPtrInput
// The target security group ID within the same region. If this field is specified, the `nicType` can only select `intranet`.
SourceSecurityGroupId pulumi.StringPtrInput
// The type of rule being created. Valid options are `ingress` (inbound) or `egress` (outbound).
Type pulumi.StringPtrInput
}
func (SecurityGroupRuleState) ElementType() reflect.Type {
return reflect.TypeOf((*securityGroupRuleState)(nil)).Elem()
}
type securityGroupRuleArgs struct {
// The target IP address range. The default value is 0.0.0.0/0 (which means no restriction will be applied). Other supported formats include 10.159.6.18/12. Only IPv4 is supported.
CidrIp *string `pulumi:"cidrIp"`
// The description of the security group rule. The description can be up to 1 to 512 characters in length. Defaults to null.
Description *string `pulumi:"description"`
// The protocol. Can be `tcp`, `udp`, `icmp`, `gre` or `all`.
IpProtocol string `pulumi:"ipProtocol"`
// Network type, can be either `internet` or `intranet`, the default value is `internet`.
NicType *string `pulumi:"nicType"`
// Authorization policy, can be either `accept` or `drop`, the default value is `accept`.
Policy *string `pulumi:"policy"`
// The range of port numbers relevant to the IP protocol. Default to "-1/-1". When the protocol is tcp or udp, each side port number range from 1 to 65535 and '-1/-1' will be invalid.
// For example, `1/200` means that the range of the port numbers is 1-200. Other protocols' 'port_range' can only be "-1/-1", and other values will be invalid.
PortRange *string `pulumi:"portRange"`
// Authorization policy priority, with parameter values: `1-100`, default value: 1.
Priority *int `pulumi:"priority"`
// The security group to apply this rule to.
SecurityGroupId string `pulumi:"securityGroupId"`
// The Alibaba Cloud user account Id of the target security group when security groups are authorized across accounts. This parameter is invalid if `cidrIp` has already been set.
SourceGroupOwnerAccount *string `pulumi:"sourceGroupOwnerAccount"`
// The target security group ID within the same region. If this field is specified, the `nicType` can only select `intranet`.
SourceSecurityGroupId *string `pulumi:"sourceSecurityGroupId"`
// The type of rule being created. Valid options are `ingress` (inbound) or `egress` (outbound).
Type string `pulumi:"type"`
}
// The set of arguments for constructing a SecurityGroupRule resource.
type SecurityGroupRuleArgs struct {
// The target IP address range. The default value is 0.0.0.0/0 (which means no restriction will be applied). Other supported formats include 10.159.6.18/12. Only IPv4 is supported.
CidrIp pulumi.StringPtrInput
// The description of the security group rule. The description can be up to 1 to 512 characters in length. Defaults to null.
Description pulumi.StringPtrInput
// The protocol. Can be `tcp`, `udp`, `icmp`, `gre` or `all`.
IpProtocol pulumi.StringInput
// Network type, can be either `internet` or `intranet`, the default value is `internet`.
NicType pulumi.StringPtrInput
// Authorization policy, can be either `accept` or `drop`, the default value is `accept`.
Policy pulumi.StringPtrInput
// The range of port numbers relevant to the IP protocol. Default to "-1/-1". When the protocol is tcp or udp, each side port number range from 1 to 65535 and '-1/-1' will be invalid.
// For example, `1/200` means that the range of the port numbers is 1-200. Other protocols' 'port_range' can only be "-1/-1", and other values will be invalid.
PortRange pulumi.StringPtrInput
// Authorization policy priority, with parameter values: `1-100`, default value: 1.
Priority pulumi.IntPtrInput
// The security group to apply this rule to.
SecurityGroupId pulumi.StringInput
// The Alibaba Cloud user account Id of the target security group when security groups are authorized across accounts. This parameter is invalid if `cidrIp` has already been set.
SourceGroupOwnerAccount pulumi.StringPtrInput
// The target security group ID within the same region. If this field is specified, the `nicType` can only select `intranet`.
SourceSecurityGroupId pulumi.StringPtrInput
// The type of rule being created. Valid options are `ingress` (inbound) or `egress` (outbound).
Type pulumi.StringInput
}
func (SecurityGroupRuleArgs) ElementType() reflect.Type {
return reflect.TypeOf((*securityGroupRuleArgs)(nil)).Elem()
}
type SecurityGroupRuleInput interface {
pulumi.Input
ToSecurityGroupRuleOutput() SecurityGroupRuleOutput
ToSecurityGroupRuleOutputWithContext(ctx context.Context) SecurityGroupRuleOutput
}
func (*SecurityGroupRule) ElementType() reflect.Type {
return reflect.TypeOf((*SecurityGroupRule)(nil))
}
func (i *SecurityGroupRule) ToSecurityGroupRuleOutput() SecurityGroupRuleOutput {
return i.ToSecurityGroupRuleOutputWithContext(context.Background())
}
func (i *SecurityGroupRule) ToSecurityGroupRuleOutputWithContext(ctx context.Context) SecurityGroupRuleOutput {
return pulumi.ToOutputWithContext(ctx, i).(SecurityGroupRuleOutput)
}
func (i *SecurityGroupRule) ToSecurityGroupRulePtrOutput() SecurityGroupRulePtrOutput {
return i.ToSecurityGroupRulePtrOutputWithContext(context.Background())
}
func (i *SecurityGroupRule) ToSecurityGroupRulePtrOutputWithContext(ctx context.Context) SecurityGroupRulePtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(SecurityGroupRulePtrOutput)
}
type SecurityGroupRulePtrInput interface {
pulumi.Input
ToSecurityGroupRulePtrOutput() SecurityGroupRulePtrOutput
ToSecurityGroupRulePtrOutputWithContext(ctx context.Context) SecurityGroupRulePtrOutput
}
type securityGroupRulePtrType SecurityGroupRuleArgs
func (*securityGroupRulePtrType) ElementType() reflect.Type {
return reflect.TypeOf((**SecurityGroupRule)(nil))
}
func (i *securityGroupRulePtrType) ToSecurityGroupRulePtrOutput() SecurityGroupRulePtrOutput {
return i.ToSecurityGroupRulePtrOutputWithContext(context.Background())
}
func (i *securityGroupRulePtrType) ToSecurityGroupRulePtrOutputWithContext(ctx context.Context) SecurityGroupRulePtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(SecurityGroupRulePtrOutput)
}
// SecurityGroupRuleArrayInput is an input type that accepts SecurityGroupRuleArray and SecurityGroupRuleArrayOutput values.
// You can construct a concrete instance of `SecurityGroupRuleArrayInput` via:
//
// SecurityGroupRuleArray{ SecurityGroupRuleArgs{...} }
type SecurityGroupRuleArrayInput interface {
pulumi.Input
ToSecurityGroupRuleArrayOutput() SecurityGroupRuleArrayOutput
ToSecurityGroupRuleArrayOutputWithContext(context.Context) SecurityGroupRuleArrayOutput
}
type SecurityGroupRuleArray []SecurityGroupRuleInput
func (SecurityGroupRuleArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*SecurityGroupRule)(nil))
}
func (i SecurityGroupRuleArray) ToSecurityGroupRuleArrayOutput() SecurityGroupRuleArrayOutput {
return i.ToSecurityGroupRuleArrayOutputWithContext(context.Background())
}
func (i SecurityGroupRuleArray) ToSecurityGroupRuleArrayOutputWithContext(ctx context.Context) SecurityGroupRuleArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(SecurityGroupRuleArrayOutput)
}
// SecurityGroupRuleMapInput is an input type that accepts SecurityGroupRuleMap and SecurityGroupRuleMapOutput values.
// You can construct a concrete instance of `SecurityGroupRuleMapInput` via:
//
// SecurityGroupRuleMap{ "key": SecurityGroupRuleArgs{...} }
type SecurityGroupRuleMapInput interface {
pulumi.Input
ToSecurityGroupRuleMapOutput() SecurityGroupRuleMapOutput
ToSecurityGroupRuleMapOutputWithContext(context.Context) SecurityGroupRuleMapOutput
}
type SecurityGroupRuleMap map[string]SecurityGroupRuleInput
func (SecurityGroupRuleMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*SecurityGroupRule)(nil))
}
func (i SecurityGroupRuleMap) ToSecurityGroupRuleMapOutput() SecurityGroupRuleMapOutput {
return i.ToSecurityGroupRuleMapOutputWithContext(context.Background())
}
func (i SecurityGroupRuleMap) ToSecurityGroupRuleMapOutputWithContext(ctx context.Context) SecurityGroupRuleMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(SecurityGroupRuleMapOutput)
}
type SecurityGroupRuleOutput struct {
*pulumi.OutputState
}
func (SecurityGroupRuleOutput) ElementType() reflect.Type {
return reflect.TypeOf((*SecurityGroupRule)(nil))
}
func (o SecurityGroupRuleOutput) ToSecurityGroupRuleOutput() SecurityGroupRuleOutput {
return o
}
func (o SecurityGroupRuleOutput) ToSecurityGroupRuleOutputWithContext(ctx context.Context) SecurityGroupRuleOutput {
return o
}
func (o SecurityGroupRuleOutput) ToSecurityGroupRulePtrOutput() SecurityGroupRulePtrOutput {
return o.ToSecurityGroupRulePtrOutputWithContext(context.Background())
}
func (o SecurityGroupRuleOutput) ToSecurityGroupRulePtrOutputWithContext(ctx context.Context) SecurityGroupRulePtrOutput {
return o.ApplyT(func(v SecurityGroupRule) *SecurityGroupRule {
return &v
}).(SecurityGroupRulePtrOutput)
}
type SecurityGroupRulePtrOutput struct {
*pulumi.OutputState
}
func (SecurityGroupRulePtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**SecurityGroupRule)(nil))
}
func (o SecurityGroupRulePtrOutput) ToSecurityGroupRulePtrOutput() SecurityGroupRulePtrOutput {
return o
}
func (o SecurityGroupRulePtrOutput) ToSecurityGroupRulePtrOutputWithContext(ctx context.Context) SecurityGroupRulePtrOutput {
return o
}
type SecurityGroupRuleArrayOutput struct{ *pulumi.OutputState }
func (SecurityGroupRuleArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]SecurityGroupRule)(nil))
}
func (o SecurityGroupRuleArrayOutput) ToSecurityGroupRuleArrayOutput() SecurityGroupRuleArrayOutput {
return o
}
func (o SecurityGroupRuleArrayOutput) ToSecurityGroupRuleArrayOutputWithContext(ctx context.Context) SecurityGroupRuleArrayOutput {
return o
}
func (o SecurityGroupRuleArrayOutput) Index(i pulumi.IntInput) SecurityGroupRuleOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) SecurityGroupRule {
return vs[0].([]SecurityGroupRule)[vs[1].(int)]
}).(SecurityGroupRuleOutput)
}
type SecurityGroupRuleMapOutput struct{ *pulumi.OutputState }
func (SecurityGroupRuleMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]SecurityGroupRule)(nil))
}
func (o SecurityGroupRuleMapOutput) ToSecurityGroupRuleMapOutput() SecurityGroupRuleMapOutput {
return o
}
func (o SecurityGroupRuleMapOutput) ToSecurityGroupRuleMapOutputWithContext(ctx context.Context) SecurityGroupRuleMapOutput {
return o
}
func (o SecurityGroupRuleMapOutput) MapIndex(k pulumi.StringInput) SecurityGroupRuleOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) SecurityGroupRule {
return vs[0].(map[string]SecurityGroupRule)[vs[1].(string)]
}).(SecurityGroupRuleOutput)
}
func init() {
pulumi.RegisterOutputType(SecurityGroupRuleOutput{})
pulumi.RegisterOutputType(SecurityGroupRulePtrOutput{})
pulumi.RegisterOutputType(SecurityGroupRuleArrayOutput{})
pulumi.RegisterOutputType(SecurityGroupRuleMapOutput{})
}