/
securityPolicy.go
358 lines (305 loc) · 14.1 KB
/
securityPolicy.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
// 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 alb
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a ALB Security Policy resource.
//
// For information about ALB Security Policy and how to use it, see [What is Security Policy](https://www.alibabacloud.com/help/en/slb/application-load-balancer/developer-reference/api-alb-2020-06-16-createsecuritypolicy).
//
// > **NOTE:** Available since v1.130.0.
//
// ## Example Usage
//
// # Basic Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/alb"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := alb.NewSecurityPolicy(ctx, "default", &alb.SecurityPolicyArgs{
// SecurityPolicyName: pulumi.String("tf_example"),
// TlsVersions: pulumi.StringArray{
// pulumi.String("TLSv1.0"),
// },
// Ciphers: pulumi.StringArray{
// pulumi.String("ECDHE-ECDSA-AES128-SHA"),
// pulumi.String("AES256-SHA"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// ALB Security Policy can be imported using the id, e.g.
//
// ```sh
// $ pulumi import alicloud:alb/securityPolicy:SecurityPolicy example <id>
// ```
type SecurityPolicy struct {
pulumi.CustomResourceState
// The supported cipher suites, which are determined by the TLS protocol version.The specified cipher suites must be supported by at least one TLS protocol version that you select.
Ciphers pulumi.StringArrayOutput `pulumi:"ciphers"`
// The dry run.
DryRun pulumi.BoolPtrOutput `pulumi:"dryRun"`
// The ID of the resource group.
ResourceGroupId pulumi.StringOutput `pulumi:"resourceGroupId"`
// The name of the resource. The name must be 2 to 128 characters in length and must start with a letter. It can contain digits, periods (.), underscores (_), and hyphens (-).
SecurityPolicyName pulumi.StringOutput `pulumi:"securityPolicyName"`
// The status of the resource.
Status pulumi.StringOutput `pulumi:"status"`
// A mapping of tags to assign to the resource.
Tags pulumi.MapOutput `pulumi:"tags"`
// The TLS protocol versions that are supported. Valid values: TLSv1.0, TLSv1.1, TLSv1.2 and TLSv1.3.
TlsVersions pulumi.StringArrayOutput `pulumi:"tlsVersions"`
}
// NewSecurityPolicy registers a new resource with the given unique name, arguments, and options.
func NewSecurityPolicy(ctx *pulumi.Context,
name string, args *SecurityPolicyArgs, opts ...pulumi.ResourceOption) (*SecurityPolicy, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Ciphers == nil {
return nil, errors.New("invalid value for required argument 'Ciphers'")
}
if args.SecurityPolicyName == nil {
return nil, errors.New("invalid value for required argument 'SecurityPolicyName'")
}
if args.TlsVersions == nil {
return nil, errors.New("invalid value for required argument 'TlsVersions'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource SecurityPolicy
err := ctx.RegisterResource("alicloud:alb/securityPolicy:SecurityPolicy", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetSecurityPolicy gets an existing SecurityPolicy 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 GetSecurityPolicy(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *SecurityPolicyState, opts ...pulumi.ResourceOption) (*SecurityPolicy, error) {
var resource SecurityPolicy
err := ctx.ReadResource("alicloud:alb/securityPolicy:SecurityPolicy", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering SecurityPolicy resources.
type securityPolicyState struct {
// The supported cipher suites, which are determined by the TLS protocol version.The specified cipher suites must be supported by at least one TLS protocol version that you select.
Ciphers []string `pulumi:"ciphers"`
// The dry run.
DryRun *bool `pulumi:"dryRun"`
// The ID of the resource group.
ResourceGroupId *string `pulumi:"resourceGroupId"`
// The name of the resource. The name must be 2 to 128 characters in length and must start with a letter. It can contain digits, periods (.), underscores (_), and hyphens (-).
SecurityPolicyName *string `pulumi:"securityPolicyName"`
// The status of the resource.
Status *string `pulumi:"status"`
// A mapping of tags to assign to the resource.
Tags map[string]interface{} `pulumi:"tags"`
// The TLS protocol versions that are supported. Valid values: TLSv1.0, TLSv1.1, TLSv1.2 and TLSv1.3.
TlsVersions []string `pulumi:"tlsVersions"`
}
type SecurityPolicyState struct {
// The supported cipher suites, which are determined by the TLS protocol version.The specified cipher suites must be supported by at least one TLS protocol version that you select.
Ciphers pulumi.StringArrayInput
// The dry run.
DryRun pulumi.BoolPtrInput
// The ID of the resource group.
ResourceGroupId pulumi.StringPtrInput
// The name of the resource. The name must be 2 to 128 characters in length and must start with a letter. It can contain digits, periods (.), underscores (_), and hyphens (-).
SecurityPolicyName pulumi.StringPtrInput
// The status of the resource.
Status pulumi.StringPtrInput
// A mapping of tags to assign to the resource.
Tags pulumi.MapInput
// The TLS protocol versions that are supported. Valid values: TLSv1.0, TLSv1.1, TLSv1.2 and TLSv1.3.
TlsVersions pulumi.StringArrayInput
}
func (SecurityPolicyState) ElementType() reflect.Type {
return reflect.TypeOf((*securityPolicyState)(nil)).Elem()
}
type securityPolicyArgs struct {
// The supported cipher suites, which are determined by the TLS protocol version.The specified cipher suites must be supported by at least one TLS protocol version that you select.
Ciphers []string `pulumi:"ciphers"`
// The dry run.
DryRun *bool `pulumi:"dryRun"`
// The ID of the resource group.
ResourceGroupId *string `pulumi:"resourceGroupId"`
// The name of the resource. The name must be 2 to 128 characters in length and must start with a letter. It can contain digits, periods (.), underscores (_), and hyphens (-).
SecurityPolicyName string `pulumi:"securityPolicyName"`
// A mapping of tags to assign to the resource.
Tags map[string]interface{} `pulumi:"tags"`
// The TLS protocol versions that are supported. Valid values: TLSv1.0, TLSv1.1, TLSv1.2 and TLSv1.3.
TlsVersions []string `pulumi:"tlsVersions"`
}
// The set of arguments for constructing a SecurityPolicy resource.
type SecurityPolicyArgs struct {
// The supported cipher suites, which are determined by the TLS protocol version.The specified cipher suites must be supported by at least one TLS protocol version that you select.
Ciphers pulumi.StringArrayInput
// The dry run.
DryRun pulumi.BoolPtrInput
// The ID of the resource group.
ResourceGroupId pulumi.StringPtrInput
// The name of the resource. The name must be 2 to 128 characters in length and must start with a letter. It can contain digits, periods (.), underscores (_), and hyphens (-).
SecurityPolicyName pulumi.StringInput
// A mapping of tags to assign to the resource.
Tags pulumi.MapInput
// The TLS protocol versions that are supported. Valid values: TLSv1.0, TLSv1.1, TLSv1.2 and TLSv1.3.
TlsVersions pulumi.StringArrayInput
}
func (SecurityPolicyArgs) ElementType() reflect.Type {
return reflect.TypeOf((*securityPolicyArgs)(nil)).Elem()
}
type SecurityPolicyInput interface {
pulumi.Input
ToSecurityPolicyOutput() SecurityPolicyOutput
ToSecurityPolicyOutputWithContext(ctx context.Context) SecurityPolicyOutput
}
func (*SecurityPolicy) ElementType() reflect.Type {
return reflect.TypeOf((**SecurityPolicy)(nil)).Elem()
}
func (i *SecurityPolicy) ToSecurityPolicyOutput() SecurityPolicyOutput {
return i.ToSecurityPolicyOutputWithContext(context.Background())
}
func (i *SecurityPolicy) ToSecurityPolicyOutputWithContext(ctx context.Context) SecurityPolicyOutput {
return pulumi.ToOutputWithContext(ctx, i).(SecurityPolicyOutput)
}
// SecurityPolicyArrayInput is an input type that accepts SecurityPolicyArray and SecurityPolicyArrayOutput values.
// You can construct a concrete instance of `SecurityPolicyArrayInput` via:
//
// SecurityPolicyArray{ SecurityPolicyArgs{...} }
type SecurityPolicyArrayInput interface {
pulumi.Input
ToSecurityPolicyArrayOutput() SecurityPolicyArrayOutput
ToSecurityPolicyArrayOutputWithContext(context.Context) SecurityPolicyArrayOutput
}
type SecurityPolicyArray []SecurityPolicyInput
func (SecurityPolicyArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*SecurityPolicy)(nil)).Elem()
}
func (i SecurityPolicyArray) ToSecurityPolicyArrayOutput() SecurityPolicyArrayOutput {
return i.ToSecurityPolicyArrayOutputWithContext(context.Background())
}
func (i SecurityPolicyArray) ToSecurityPolicyArrayOutputWithContext(ctx context.Context) SecurityPolicyArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(SecurityPolicyArrayOutput)
}
// SecurityPolicyMapInput is an input type that accepts SecurityPolicyMap and SecurityPolicyMapOutput values.
// You can construct a concrete instance of `SecurityPolicyMapInput` via:
//
// SecurityPolicyMap{ "key": SecurityPolicyArgs{...} }
type SecurityPolicyMapInput interface {
pulumi.Input
ToSecurityPolicyMapOutput() SecurityPolicyMapOutput
ToSecurityPolicyMapOutputWithContext(context.Context) SecurityPolicyMapOutput
}
type SecurityPolicyMap map[string]SecurityPolicyInput
func (SecurityPolicyMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*SecurityPolicy)(nil)).Elem()
}
func (i SecurityPolicyMap) ToSecurityPolicyMapOutput() SecurityPolicyMapOutput {
return i.ToSecurityPolicyMapOutputWithContext(context.Background())
}
func (i SecurityPolicyMap) ToSecurityPolicyMapOutputWithContext(ctx context.Context) SecurityPolicyMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(SecurityPolicyMapOutput)
}
type SecurityPolicyOutput struct{ *pulumi.OutputState }
func (SecurityPolicyOutput) ElementType() reflect.Type {
return reflect.TypeOf((**SecurityPolicy)(nil)).Elem()
}
func (o SecurityPolicyOutput) ToSecurityPolicyOutput() SecurityPolicyOutput {
return o
}
func (o SecurityPolicyOutput) ToSecurityPolicyOutputWithContext(ctx context.Context) SecurityPolicyOutput {
return o
}
// The supported cipher suites, which are determined by the TLS protocol version.The specified cipher suites must be supported by at least one TLS protocol version that you select.
func (o SecurityPolicyOutput) Ciphers() pulumi.StringArrayOutput {
return o.ApplyT(func(v *SecurityPolicy) pulumi.StringArrayOutput { return v.Ciphers }).(pulumi.StringArrayOutput)
}
// The dry run.
func (o SecurityPolicyOutput) DryRun() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *SecurityPolicy) pulumi.BoolPtrOutput { return v.DryRun }).(pulumi.BoolPtrOutput)
}
// The ID of the resource group.
func (o SecurityPolicyOutput) ResourceGroupId() pulumi.StringOutput {
return o.ApplyT(func(v *SecurityPolicy) pulumi.StringOutput { return v.ResourceGroupId }).(pulumi.StringOutput)
}
// The name of the resource. The name must be 2 to 128 characters in length and must start with a letter. It can contain digits, periods (.), underscores (_), and hyphens (-).
func (o SecurityPolicyOutput) SecurityPolicyName() pulumi.StringOutput {
return o.ApplyT(func(v *SecurityPolicy) pulumi.StringOutput { return v.SecurityPolicyName }).(pulumi.StringOutput)
}
// The status of the resource.
func (o SecurityPolicyOutput) Status() pulumi.StringOutput {
return o.ApplyT(func(v *SecurityPolicy) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
}
// A mapping of tags to assign to the resource.
func (o SecurityPolicyOutput) Tags() pulumi.MapOutput {
return o.ApplyT(func(v *SecurityPolicy) pulumi.MapOutput { return v.Tags }).(pulumi.MapOutput)
}
// The TLS protocol versions that are supported. Valid values: TLSv1.0, TLSv1.1, TLSv1.2 and TLSv1.3.
func (o SecurityPolicyOutput) TlsVersions() pulumi.StringArrayOutput {
return o.ApplyT(func(v *SecurityPolicy) pulumi.StringArrayOutput { return v.TlsVersions }).(pulumi.StringArrayOutput)
}
type SecurityPolicyArrayOutput struct{ *pulumi.OutputState }
func (SecurityPolicyArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*SecurityPolicy)(nil)).Elem()
}
func (o SecurityPolicyArrayOutput) ToSecurityPolicyArrayOutput() SecurityPolicyArrayOutput {
return o
}
func (o SecurityPolicyArrayOutput) ToSecurityPolicyArrayOutputWithContext(ctx context.Context) SecurityPolicyArrayOutput {
return o
}
func (o SecurityPolicyArrayOutput) Index(i pulumi.IntInput) SecurityPolicyOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SecurityPolicy {
return vs[0].([]*SecurityPolicy)[vs[1].(int)]
}).(SecurityPolicyOutput)
}
type SecurityPolicyMapOutput struct{ *pulumi.OutputState }
func (SecurityPolicyMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*SecurityPolicy)(nil)).Elem()
}
func (o SecurityPolicyMapOutput) ToSecurityPolicyMapOutput() SecurityPolicyMapOutput {
return o
}
func (o SecurityPolicyMapOutput) ToSecurityPolicyMapOutputWithContext(ctx context.Context) SecurityPolicyMapOutput {
return o
}
func (o SecurityPolicyMapOutput) MapIndex(k pulumi.StringInput) SecurityPolicyOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SecurityPolicy {
return vs[0].(map[string]*SecurityPolicy)[vs[1].(string)]
}).(SecurityPolicyOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*SecurityPolicyInput)(nil)).Elem(), &SecurityPolicy{})
pulumi.RegisterInputType(reflect.TypeOf((*SecurityPolicyArrayInput)(nil)).Elem(), SecurityPolicyArray{})
pulumi.RegisterInputType(reflect.TypeOf((*SecurityPolicyMapInput)(nil)).Elem(), SecurityPolicyMap{})
pulumi.RegisterOutputType(SecurityPolicyOutput{})
pulumi.RegisterOutputType(SecurityPolicyArrayOutput{})
pulumi.RegisterOutputType(SecurityPolicyMapOutput{})
}