This repository has been archived by the owner on Aug 15, 2022. It is now read-only.
generated from pulumi/pulumi-tf-provider-boilerplate
/
securityRule.go
297 lines (245 loc) · 10.9 KB
/
securityRule.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
// 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 gaap
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type SecurityRule struct {
pulumi.CustomResourceState
// Policy of the rule. Valid value: `ACCEPT` and `DROP`.
Action pulumi.StringOutput `pulumi:"action"`
// A network address block of the request source.
CidrIp pulumi.StringOutput `pulumi:"cidrIp"`
// Name of the security policy rule. Maximum length is 30.
Name pulumi.StringOutput `pulumi:"name"`
// ID of the security policy.
PolicyId pulumi.StringOutput `pulumi:"policyId"`
// Target port. Default value is `ALL`. Valid examples: `80`, `80,443` and `3306-20000`.
Port pulumi.StringPtrOutput `pulumi:"port"`
// Protocol of the security policy rule. Default value is `ALL`. Valid value: `TCP`, `UDP` and `ALL`.
Protocol pulumi.StringPtrOutput `pulumi:"protocol"`
}
// NewSecurityRule registers a new resource with the given unique name, arguments, and options.
func NewSecurityRule(ctx *pulumi.Context,
name string, args *SecurityRuleArgs, opts ...pulumi.ResourceOption) (*SecurityRule, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Action == nil {
return nil, errors.New("invalid value for required argument 'Action'")
}
if args.CidrIp == nil {
return nil, errors.New("invalid value for required argument 'CidrIp'")
}
if args.PolicyId == nil {
return nil, errors.New("invalid value for required argument 'PolicyId'")
}
var resource SecurityRule
err := ctx.RegisterResource("tctest:Gaap/securityRule:SecurityRule", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetSecurityRule gets an existing SecurityRule 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 GetSecurityRule(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *SecurityRuleState, opts ...pulumi.ResourceOption) (*SecurityRule, error) {
var resource SecurityRule
err := ctx.ReadResource("tctest:Gaap/securityRule:SecurityRule", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering SecurityRule resources.
type securityRuleState struct {
// Policy of the rule. Valid value: `ACCEPT` and `DROP`.
Action *string `pulumi:"action"`
// A network address block of the request source.
CidrIp *string `pulumi:"cidrIp"`
// Name of the security policy rule. Maximum length is 30.
Name *string `pulumi:"name"`
// ID of the security policy.
PolicyId *string `pulumi:"policyId"`
// Target port. Default value is `ALL`. Valid examples: `80`, `80,443` and `3306-20000`.
Port *string `pulumi:"port"`
// Protocol of the security policy rule. Default value is `ALL`. Valid value: `TCP`, `UDP` and `ALL`.
Protocol *string `pulumi:"protocol"`
}
type SecurityRuleState struct {
// Policy of the rule. Valid value: `ACCEPT` and `DROP`.
Action pulumi.StringPtrInput
// A network address block of the request source.
CidrIp pulumi.StringPtrInput
// Name of the security policy rule. Maximum length is 30.
Name pulumi.StringPtrInput
// ID of the security policy.
PolicyId pulumi.StringPtrInput
// Target port. Default value is `ALL`. Valid examples: `80`, `80,443` and `3306-20000`.
Port pulumi.StringPtrInput
// Protocol of the security policy rule. Default value is `ALL`. Valid value: `TCP`, `UDP` and `ALL`.
Protocol pulumi.StringPtrInput
}
func (SecurityRuleState) ElementType() reflect.Type {
return reflect.TypeOf((*securityRuleState)(nil)).Elem()
}
type securityRuleArgs struct {
// Policy of the rule. Valid value: `ACCEPT` and `DROP`.
Action string `pulumi:"action"`
// A network address block of the request source.
CidrIp string `pulumi:"cidrIp"`
// Name of the security policy rule. Maximum length is 30.
Name *string `pulumi:"name"`
// ID of the security policy.
PolicyId string `pulumi:"policyId"`
// Target port. Default value is `ALL`. Valid examples: `80`, `80,443` and `3306-20000`.
Port *string `pulumi:"port"`
// Protocol of the security policy rule. Default value is `ALL`. Valid value: `TCP`, `UDP` and `ALL`.
Protocol *string `pulumi:"protocol"`
}
// The set of arguments for constructing a SecurityRule resource.
type SecurityRuleArgs struct {
// Policy of the rule. Valid value: `ACCEPT` and `DROP`.
Action pulumi.StringInput
// A network address block of the request source.
CidrIp pulumi.StringInput
// Name of the security policy rule. Maximum length is 30.
Name pulumi.StringPtrInput
// ID of the security policy.
PolicyId pulumi.StringInput
// Target port. Default value is `ALL`. Valid examples: `80`, `80,443` and `3306-20000`.
Port pulumi.StringPtrInput
// Protocol of the security policy rule. Default value is `ALL`. Valid value: `TCP`, `UDP` and `ALL`.
Protocol pulumi.StringPtrInput
}
func (SecurityRuleArgs) ElementType() reflect.Type {
return reflect.TypeOf((*securityRuleArgs)(nil)).Elem()
}
type SecurityRuleInput interface {
pulumi.Input
ToSecurityRuleOutput() SecurityRuleOutput
ToSecurityRuleOutputWithContext(ctx context.Context) SecurityRuleOutput
}
func (*SecurityRule) ElementType() reflect.Type {
return reflect.TypeOf((**SecurityRule)(nil)).Elem()
}
func (i *SecurityRule) ToSecurityRuleOutput() SecurityRuleOutput {
return i.ToSecurityRuleOutputWithContext(context.Background())
}
func (i *SecurityRule) ToSecurityRuleOutputWithContext(ctx context.Context) SecurityRuleOutput {
return pulumi.ToOutputWithContext(ctx, i).(SecurityRuleOutput)
}
// SecurityRuleArrayInput is an input type that accepts SecurityRuleArray and SecurityRuleArrayOutput values.
// You can construct a concrete instance of `SecurityRuleArrayInput` via:
//
// SecurityRuleArray{ SecurityRuleArgs{...} }
type SecurityRuleArrayInput interface {
pulumi.Input
ToSecurityRuleArrayOutput() SecurityRuleArrayOutput
ToSecurityRuleArrayOutputWithContext(context.Context) SecurityRuleArrayOutput
}
type SecurityRuleArray []SecurityRuleInput
func (SecurityRuleArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*SecurityRule)(nil)).Elem()
}
func (i SecurityRuleArray) ToSecurityRuleArrayOutput() SecurityRuleArrayOutput {
return i.ToSecurityRuleArrayOutputWithContext(context.Background())
}
func (i SecurityRuleArray) ToSecurityRuleArrayOutputWithContext(ctx context.Context) SecurityRuleArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(SecurityRuleArrayOutput)
}
// SecurityRuleMapInput is an input type that accepts SecurityRuleMap and SecurityRuleMapOutput values.
// You can construct a concrete instance of `SecurityRuleMapInput` via:
//
// SecurityRuleMap{ "key": SecurityRuleArgs{...} }
type SecurityRuleMapInput interface {
pulumi.Input
ToSecurityRuleMapOutput() SecurityRuleMapOutput
ToSecurityRuleMapOutputWithContext(context.Context) SecurityRuleMapOutput
}
type SecurityRuleMap map[string]SecurityRuleInput
func (SecurityRuleMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*SecurityRule)(nil)).Elem()
}
func (i SecurityRuleMap) ToSecurityRuleMapOutput() SecurityRuleMapOutput {
return i.ToSecurityRuleMapOutputWithContext(context.Background())
}
func (i SecurityRuleMap) ToSecurityRuleMapOutputWithContext(ctx context.Context) SecurityRuleMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(SecurityRuleMapOutput)
}
type SecurityRuleOutput struct{ *pulumi.OutputState }
func (SecurityRuleOutput) ElementType() reflect.Type {
return reflect.TypeOf((**SecurityRule)(nil)).Elem()
}
func (o SecurityRuleOutput) ToSecurityRuleOutput() SecurityRuleOutput {
return o
}
func (o SecurityRuleOutput) ToSecurityRuleOutputWithContext(ctx context.Context) SecurityRuleOutput {
return o
}
// Policy of the rule. Valid value: `ACCEPT` and `DROP`.
func (o SecurityRuleOutput) Action() pulumi.StringOutput {
return o.ApplyT(func(v *SecurityRule) pulumi.StringOutput { return v.Action }).(pulumi.StringOutput)
}
// A network address block of the request source.
func (o SecurityRuleOutput) CidrIp() pulumi.StringOutput {
return o.ApplyT(func(v *SecurityRule) pulumi.StringOutput { return v.CidrIp }).(pulumi.StringOutput)
}
// Name of the security policy rule. Maximum length is 30.
func (o SecurityRuleOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *SecurityRule) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// ID of the security policy.
func (o SecurityRuleOutput) PolicyId() pulumi.StringOutput {
return o.ApplyT(func(v *SecurityRule) pulumi.StringOutput { return v.PolicyId }).(pulumi.StringOutput)
}
// Target port. Default value is `ALL`. Valid examples: `80`, `80,443` and `3306-20000`.
func (o SecurityRuleOutput) Port() pulumi.StringPtrOutput {
return o.ApplyT(func(v *SecurityRule) pulumi.StringPtrOutput { return v.Port }).(pulumi.StringPtrOutput)
}
// Protocol of the security policy rule. Default value is `ALL`. Valid value: `TCP`, `UDP` and `ALL`.
func (o SecurityRuleOutput) Protocol() pulumi.StringPtrOutput {
return o.ApplyT(func(v *SecurityRule) pulumi.StringPtrOutput { return v.Protocol }).(pulumi.StringPtrOutput)
}
type SecurityRuleArrayOutput struct{ *pulumi.OutputState }
func (SecurityRuleArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*SecurityRule)(nil)).Elem()
}
func (o SecurityRuleArrayOutput) ToSecurityRuleArrayOutput() SecurityRuleArrayOutput {
return o
}
func (o SecurityRuleArrayOutput) ToSecurityRuleArrayOutputWithContext(ctx context.Context) SecurityRuleArrayOutput {
return o
}
func (o SecurityRuleArrayOutput) Index(i pulumi.IntInput) SecurityRuleOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SecurityRule {
return vs[0].([]*SecurityRule)[vs[1].(int)]
}).(SecurityRuleOutput)
}
type SecurityRuleMapOutput struct{ *pulumi.OutputState }
func (SecurityRuleMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*SecurityRule)(nil)).Elem()
}
func (o SecurityRuleMapOutput) ToSecurityRuleMapOutput() SecurityRuleMapOutput {
return o
}
func (o SecurityRuleMapOutput) ToSecurityRuleMapOutputWithContext(ctx context.Context) SecurityRuleMapOutput {
return o
}
func (o SecurityRuleMapOutput) MapIndex(k pulumi.StringInput) SecurityRuleOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SecurityRule {
return vs[0].(map[string]*SecurityRule)[vs[1].(string)]
}).(SecurityRuleOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*SecurityRuleInput)(nil)).Elem(), &SecurityRule{})
pulumi.RegisterInputType(reflect.TypeOf((*SecurityRuleArrayInput)(nil)).Elem(), SecurityRuleArray{})
pulumi.RegisterInputType(reflect.TypeOf((*SecurityRuleMapInput)(nil)).Elem(), SecurityRuleMap{})
pulumi.RegisterOutputType(SecurityRuleOutput{})
pulumi.RegisterOutputType(SecurityRuleArrayOutput{})
pulumi.RegisterOutputType(SecurityRuleMapOutput{})
}