/
cloudletsPolicy.go
407 lines (352 loc) · 17.3 KB
/
cloudletsPolicy.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
// 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 akamai
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Use the `CloudletsPolicy` resource to create and version a policy. For each Cloudlet instance on your contract, there can be any number of policies. A single policy is associated with a single property configuration. Within a policy version you define the rules that determine when the Cloudlet executes. You may want to create a new version of a policy to support a different business requirement, or to test new functionality.
//
// ## Example Usage
//
// Basic usage:
//
// ```go
// package main
//
// import (
//
// "fmt"
//
// "github.com/pulumi/pulumi-akamai/sdk/v3/go/akamai"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := akamai.NewCloudletsPolicy(ctx, "example", &akamai.CloudletsPolicyArgs{
// CloudletCode: pulumi.String("ER"),
// Description: pulumi.String("policy description"),
// GroupId: pulumi.String("grp_123"),
// MatchRules: pulumi.String(fmt.Sprintf(` [
// {
// "name": "rule1",
// "type": "erMatchRule",
// "useRelativeUrl": "none",
// "statusCode": 301,
// "redirectURL": "https://www.example.com",
// "matchURL": "example.com",
// "useIncomingQueryString": false,
// "useIncomingSchemeAndHost": false
// },
// {
// "name": "rule2",
// "type": "erMatchRule",
// "matches": [
// {
// "matchType": "path",
// "matchValue": "/example/website.html",
// "matchOperator": "equals",
// "caseSensitive": false,
// "negate": false
// }
// ],
// "useRelativeUrl": "copy_scheme_hostname",
// "statusCode": 301,
// "redirectURL": "/website.html",
// "useIncomingQueryString": false,
// "useIncomingSchemeAndHost": true
// }
//
// ]
// `)),
//
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// Basic usagehcl resource "akamai_cloudlets_policy" "example" {
//
// # (resource arguments)
//
// } You can import your Akamai Cloudlets policy using a policy name. For example
//
// ```sh
//
// $ pulumi import akamai:index/cloudletsPolicy:CloudletsPolicy example policy1
//
// ```
type CloudletsPolicy struct {
pulumi.CustomResourceState
// The two- or three- character code for the type of Cloudlet. Enter `ALB` for Application Load Balancer, `AP` for API Prioritization, `AS` for Audience Segmentation, `CD` for Phased Release, `ER` for Edge Redirector, `FR` for Forward Rewrite, `IG` for Request Control, `IV` for Input Validation, or `VP` for Visitor Prioritization.
CloudletCode pulumi.StringOutput `pulumi:"cloudletCode"`
// A unique identifier that corresponds to a Cloudlets policy type. Enter `0` for Edge Redirector, `1` for Visitor Prioritization, `3` for Forward Rewrite, `4` for Request Control, `5` for API Prioritization, `6` for Audience Segmentation, `7` for Phased Release, `8` for Input Validation, or `9` for Application Load Balancer.
CloudletId pulumi.IntOutput `pulumi:"cloudletId"`
// The description of this specific policy.
Description pulumi.StringPtrOutput `pulumi:"description"`
// Defines the group association for the policy. You must have edit privileges for the group.
GroupId pulumi.StringOutput `pulumi:"groupId"`
// The version of the Cloudlet-specific `matchRules`.
MatchRuleFormat pulumi.StringPtrOutput `pulumi:"matchRuleFormat"`
// A JSON structure that defines the rules for this policy
MatchRules pulumi.StringPtrOutput `pulumi:"matchRules"`
// The unique name of the policy.
Name pulumi.StringOutput `pulumi:"name"`
// The version number of the policy.
Version pulumi.IntOutput `pulumi:"version"`
// A JSON-encoded list of warnings.
Warnings pulumi.StringOutput `pulumi:"warnings"`
}
// NewCloudletsPolicy registers a new resource with the given unique name, arguments, and options.
func NewCloudletsPolicy(ctx *pulumi.Context,
name string, args *CloudletsPolicyArgs, opts ...pulumi.ResourceOption) (*CloudletsPolicy, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.CloudletCode == nil {
return nil, errors.New("invalid value for required argument 'CloudletCode'")
}
if args.GroupId == nil {
return nil, errors.New("invalid value for required argument 'GroupId'")
}
var resource CloudletsPolicy
err := ctx.RegisterResource("akamai:index/cloudletsPolicy:CloudletsPolicy", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetCloudletsPolicy gets an existing CloudletsPolicy 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 GetCloudletsPolicy(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *CloudletsPolicyState, opts ...pulumi.ResourceOption) (*CloudletsPolicy, error) {
var resource CloudletsPolicy
err := ctx.ReadResource("akamai:index/cloudletsPolicy:CloudletsPolicy", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering CloudletsPolicy resources.
type cloudletsPolicyState struct {
// The two- or three- character code for the type of Cloudlet. Enter `ALB` for Application Load Balancer, `AP` for API Prioritization, `AS` for Audience Segmentation, `CD` for Phased Release, `ER` for Edge Redirector, `FR` for Forward Rewrite, `IG` for Request Control, `IV` for Input Validation, or `VP` for Visitor Prioritization.
CloudletCode *string `pulumi:"cloudletCode"`
// A unique identifier that corresponds to a Cloudlets policy type. Enter `0` for Edge Redirector, `1` for Visitor Prioritization, `3` for Forward Rewrite, `4` for Request Control, `5` for API Prioritization, `6` for Audience Segmentation, `7` for Phased Release, `8` for Input Validation, or `9` for Application Load Balancer.
CloudletId *int `pulumi:"cloudletId"`
// The description of this specific policy.
Description *string `pulumi:"description"`
// Defines the group association for the policy. You must have edit privileges for the group.
GroupId *string `pulumi:"groupId"`
// The version of the Cloudlet-specific `matchRules`.
MatchRuleFormat *string `pulumi:"matchRuleFormat"`
// A JSON structure that defines the rules for this policy
MatchRules *string `pulumi:"matchRules"`
// The unique name of the policy.
Name *string `pulumi:"name"`
// The version number of the policy.
Version *int `pulumi:"version"`
// A JSON-encoded list of warnings.
Warnings *string `pulumi:"warnings"`
}
type CloudletsPolicyState struct {
// The two- or three- character code for the type of Cloudlet. Enter `ALB` for Application Load Balancer, `AP` for API Prioritization, `AS` for Audience Segmentation, `CD` for Phased Release, `ER` for Edge Redirector, `FR` for Forward Rewrite, `IG` for Request Control, `IV` for Input Validation, or `VP` for Visitor Prioritization.
CloudletCode pulumi.StringPtrInput
// A unique identifier that corresponds to a Cloudlets policy type. Enter `0` for Edge Redirector, `1` for Visitor Prioritization, `3` for Forward Rewrite, `4` for Request Control, `5` for API Prioritization, `6` for Audience Segmentation, `7` for Phased Release, `8` for Input Validation, or `9` for Application Load Balancer.
CloudletId pulumi.IntPtrInput
// The description of this specific policy.
Description pulumi.StringPtrInput
// Defines the group association for the policy. You must have edit privileges for the group.
GroupId pulumi.StringPtrInput
// The version of the Cloudlet-specific `matchRules`.
MatchRuleFormat pulumi.StringPtrInput
// A JSON structure that defines the rules for this policy
MatchRules pulumi.StringPtrInput
// The unique name of the policy.
Name pulumi.StringPtrInput
// The version number of the policy.
Version pulumi.IntPtrInput
// A JSON-encoded list of warnings.
Warnings pulumi.StringPtrInput
}
func (CloudletsPolicyState) ElementType() reflect.Type {
return reflect.TypeOf((*cloudletsPolicyState)(nil)).Elem()
}
type cloudletsPolicyArgs struct {
// The two- or three- character code for the type of Cloudlet. Enter `ALB` for Application Load Balancer, `AP` for API Prioritization, `AS` for Audience Segmentation, `CD` for Phased Release, `ER` for Edge Redirector, `FR` for Forward Rewrite, `IG` for Request Control, `IV` for Input Validation, or `VP` for Visitor Prioritization.
CloudletCode string `pulumi:"cloudletCode"`
// The description of this specific policy.
Description *string `pulumi:"description"`
// Defines the group association for the policy. You must have edit privileges for the group.
GroupId string `pulumi:"groupId"`
// The version of the Cloudlet-specific `matchRules`.
MatchRuleFormat *string `pulumi:"matchRuleFormat"`
// A JSON structure that defines the rules for this policy
MatchRules *string `pulumi:"matchRules"`
// The unique name of the policy.
Name *string `pulumi:"name"`
}
// The set of arguments for constructing a CloudletsPolicy resource.
type CloudletsPolicyArgs struct {
// The two- or three- character code for the type of Cloudlet. Enter `ALB` for Application Load Balancer, `AP` for API Prioritization, `AS` for Audience Segmentation, `CD` for Phased Release, `ER` for Edge Redirector, `FR` for Forward Rewrite, `IG` for Request Control, `IV` for Input Validation, or `VP` for Visitor Prioritization.
CloudletCode pulumi.StringInput
// The description of this specific policy.
Description pulumi.StringPtrInput
// Defines the group association for the policy. You must have edit privileges for the group.
GroupId pulumi.StringInput
// The version of the Cloudlet-specific `matchRules`.
MatchRuleFormat pulumi.StringPtrInput
// A JSON structure that defines the rules for this policy
MatchRules pulumi.StringPtrInput
// The unique name of the policy.
Name pulumi.StringPtrInput
}
func (CloudletsPolicyArgs) ElementType() reflect.Type {
return reflect.TypeOf((*cloudletsPolicyArgs)(nil)).Elem()
}
type CloudletsPolicyInput interface {
pulumi.Input
ToCloudletsPolicyOutput() CloudletsPolicyOutput
ToCloudletsPolicyOutputWithContext(ctx context.Context) CloudletsPolicyOutput
}
func (*CloudletsPolicy) ElementType() reflect.Type {
return reflect.TypeOf((**CloudletsPolicy)(nil)).Elem()
}
func (i *CloudletsPolicy) ToCloudletsPolicyOutput() CloudletsPolicyOutput {
return i.ToCloudletsPolicyOutputWithContext(context.Background())
}
func (i *CloudletsPolicy) ToCloudletsPolicyOutputWithContext(ctx context.Context) CloudletsPolicyOutput {
return pulumi.ToOutputWithContext(ctx, i).(CloudletsPolicyOutput)
}
// CloudletsPolicyArrayInput is an input type that accepts CloudletsPolicyArray and CloudletsPolicyArrayOutput values.
// You can construct a concrete instance of `CloudletsPolicyArrayInput` via:
//
// CloudletsPolicyArray{ CloudletsPolicyArgs{...} }
type CloudletsPolicyArrayInput interface {
pulumi.Input
ToCloudletsPolicyArrayOutput() CloudletsPolicyArrayOutput
ToCloudletsPolicyArrayOutputWithContext(context.Context) CloudletsPolicyArrayOutput
}
type CloudletsPolicyArray []CloudletsPolicyInput
func (CloudletsPolicyArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*CloudletsPolicy)(nil)).Elem()
}
func (i CloudletsPolicyArray) ToCloudletsPolicyArrayOutput() CloudletsPolicyArrayOutput {
return i.ToCloudletsPolicyArrayOutputWithContext(context.Background())
}
func (i CloudletsPolicyArray) ToCloudletsPolicyArrayOutputWithContext(ctx context.Context) CloudletsPolicyArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(CloudletsPolicyArrayOutput)
}
// CloudletsPolicyMapInput is an input type that accepts CloudletsPolicyMap and CloudletsPolicyMapOutput values.
// You can construct a concrete instance of `CloudletsPolicyMapInput` via:
//
// CloudletsPolicyMap{ "key": CloudletsPolicyArgs{...} }
type CloudletsPolicyMapInput interface {
pulumi.Input
ToCloudletsPolicyMapOutput() CloudletsPolicyMapOutput
ToCloudletsPolicyMapOutputWithContext(context.Context) CloudletsPolicyMapOutput
}
type CloudletsPolicyMap map[string]CloudletsPolicyInput
func (CloudletsPolicyMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*CloudletsPolicy)(nil)).Elem()
}
func (i CloudletsPolicyMap) ToCloudletsPolicyMapOutput() CloudletsPolicyMapOutput {
return i.ToCloudletsPolicyMapOutputWithContext(context.Background())
}
func (i CloudletsPolicyMap) ToCloudletsPolicyMapOutputWithContext(ctx context.Context) CloudletsPolicyMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(CloudletsPolicyMapOutput)
}
type CloudletsPolicyOutput struct{ *pulumi.OutputState }
func (CloudletsPolicyOutput) ElementType() reflect.Type {
return reflect.TypeOf((**CloudletsPolicy)(nil)).Elem()
}
func (o CloudletsPolicyOutput) ToCloudletsPolicyOutput() CloudletsPolicyOutput {
return o
}
func (o CloudletsPolicyOutput) ToCloudletsPolicyOutputWithContext(ctx context.Context) CloudletsPolicyOutput {
return o
}
// The two- or three- character code for the type of Cloudlet. Enter `ALB` for Application Load Balancer, `AP` for API Prioritization, `AS` for Audience Segmentation, `CD` for Phased Release, `ER` for Edge Redirector, `FR` for Forward Rewrite, `IG` for Request Control, `IV` for Input Validation, or `VP` for Visitor Prioritization.
func (o CloudletsPolicyOutput) CloudletCode() pulumi.StringOutput {
return o.ApplyT(func(v *CloudletsPolicy) pulumi.StringOutput { return v.CloudletCode }).(pulumi.StringOutput)
}
// A unique identifier that corresponds to a Cloudlets policy type. Enter `0` for Edge Redirector, `1` for Visitor Prioritization, `3` for Forward Rewrite, `4` for Request Control, `5` for API Prioritization, `6` for Audience Segmentation, `7` for Phased Release, `8` for Input Validation, or `9` for Application Load Balancer.
func (o CloudletsPolicyOutput) CloudletId() pulumi.IntOutput {
return o.ApplyT(func(v *CloudletsPolicy) pulumi.IntOutput { return v.CloudletId }).(pulumi.IntOutput)
}
// The description of this specific policy.
func (o CloudletsPolicyOutput) Description() pulumi.StringPtrOutput {
return o.ApplyT(func(v *CloudletsPolicy) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
}
// Defines the group association for the policy. You must have edit privileges for the group.
func (o CloudletsPolicyOutput) GroupId() pulumi.StringOutput {
return o.ApplyT(func(v *CloudletsPolicy) pulumi.StringOutput { return v.GroupId }).(pulumi.StringOutput)
}
// The version of the Cloudlet-specific `matchRules`.
func (o CloudletsPolicyOutput) MatchRuleFormat() pulumi.StringPtrOutput {
return o.ApplyT(func(v *CloudletsPolicy) pulumi.StringPtrOutput { return v.MatchRuleFormat }).(pulumi.StringPtrOutput)
}
// A JSON structure that defines the rules for this policy
func (o CloudletsPolicyOutput) MatchRules() pulumi.StringPtrOutput {
return o.ApplyT(func(v *CloudletsPolicy) pulumi.StringPtrOutput { return v.MatchRules }).(pulumi.StringPtrOutput)
}
// The unique name of the policy.
func (o CloudletsPolicyOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *CloudletsPolicy) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The version number of the policy.
func (o CloudletsPolicyOutput) Version() pulumi.IntOutput {
return o.ApplyT(func(v *CloudletsPolicy) pulumi.IntOutput { return v.Version }).(pulumi.IntOutput)
}
// A JSON-encoded list of warnings.
func (o CloudletsPolicyOutput) Warnings() pulumi.StringOutput {
return o.ApplyT(func(v *CloudletsPolicy) pulumi.StringOutput { return v.Warnings }).(pulumi.StringOutput)
}
type CloudletsPolicyArrayOutput struct{ *pulumi.OutputState }
func (CloudletsPolicyArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*CloudletsPolicy)(nil)).Elem()
}
func (o CloudletsPolicyArrayOutput) ToCloudletsPolicyArrayOutput() CloudletsPolicyArrayOutput {
return o
}
func (o CloudletsPolicyArrayOutput) ToCloudletsPolicyArrayOutputWithContext(ctx context.Context) CloudletsPolicyArrayOutput {
return o
}
func (o CloudletsPolicyArrayOutput) Index(i pulumi.IntInput) CloudletsPolicyOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *CloudletsPolicy {
return vs[0].([]*CloudletsPolicy)[vs[1].(int)]
}).(CloudletsPolicyOutput)
}
type CloudletsPolicyMapOutput struct{ *pulumi.OutputState }
func (CloudletsPolicyMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*CloudletsPolicy)(nil)).Elem()
}
func (o CloudletsPolicyMapOutput) ToCloudletsPolicyMapOutput() CloudletsPolicyMapOutput {
return o
}
func (o CloudletsPolicyMapOutput) ToCloudletsPolicyMapOutputWithContext(ctx context.Context) CloudletsPolicyMapOutput {
return o
}
func (o CloudletsPolicyMapOutput) MapIndex(k pulumi.StringInput) CloudletsPolicyOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *CloudletsPolicy {
return vs[0].(map[string]*CloudletsPolicy)[vs[1].(string)]
}).(CloudletsPolicyOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*CloudletsPolicyInput)(nil)).Elem(), &CloudletsPolicy{})
pulumi.RegisterInputType(reflect.TypeOf((*CloudletsPolicyArrayInput)(nil)).Elem(), CloudletsPolicyArray{})
pulumi.RegisterInputType(reflect.TypeOf((*CloudletsPolicyMapInput)(nil)).Elem(), CloudletsPolicyMap{})
pulumi.RegisterOutputType(CloudletsPolicyOutput{})
pulumi.RegisterOutputType(CloudletsPolicyArrayOutput{})
pulumi.RegisterOutputType(CloudletsPolicyMapOutput{})
}