-
Notifications
You must be signed in to change notification settings - Fork 155
/
originRequestPolicy.go
370 lines (310 loc) · 16.6 KB
/
originRequestPolicy.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
// *** 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 cloudfront
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// ## Example Usage
//
// The following example below creates a CloudFront origin request policy.
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/cloudfront"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := cloudfront.NewOriginRequestPolicy(ctx, "example", &cloudfront.OriginRequestPolicyArgs{
// Comment: pulumi.String("example comment"),
// CookiesConfig: &cloudfront.OriginRequestPolicyCookiesConfigArgs{
// CookieBehavior: pulumi.String("whitelist"),
// Cookies: &cloudfront.OriginRequestPolicyCookiesConfigCookiesArgs{
// Items: pulumi.StringArray{
// pulumi.String("example"),
// },
// },
// },
// HeadersConfig: &cloudfront.OriginRequestPolicyHeadersConfigArgs{
// HeaderBehavior: pulumi.String("whitelist"),
// Headers: &cloudfront.OriginRequestPolicyHeadersConfigHeadersArgs{
// Items: pulumi.StringArray{
// pulumi.String("example"),
// },
// },
// },
// QueryStringsConfig: &cloudfront.OriginRequestPolicyQueryStringsConfigArgs{
// QueryStringBehavior: pulumi.String("whitelist"),
// QueryStrings: &cloudfront.OriginRequestPolicyQueryStringsConfigQueryStringsArgs{
// Items: pulumi.StringArray{
// pulumi.String("example"),
// },
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
type OriginRequestPolicy struct {
pulumi.CustomResourceState
// Comment to describe the origin request policy.
Comment pulumi.StringPtrOutput `pulumi:"comment"`
// Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.
CookiesConfig OriginRequestPolicyCookiesConfigOutput `pulumi:"cookiesConfig"`
// The current version of the origin request policy.
Etag pulumi.StringOutput `pulumi:"etag"`
// Object that determines whether any HTTP headers (and if so, which headers) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.
HeadersConfig OriginRequestPolicyHeadersConfigOutput `pulumi:"headersConfig"`
// Unique name to identify the origin request policy.
Name pulumi.StringOutput `pulumi:"name"`
// Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Query Strings Config for more information.
QueryStringsConfig OriginRequestPolicyQueryStringsConfigOutput `pulumi:"queryStringsConfig"`
}
// NewOriginRequestPolicy registers a new resource with the given unique name, arguments, and options.
func NewOriginRequestPolicy(ctx *pulumi.Context,
name string, args *OriginRequestPolicyArgs, opts ...pulumi.ResourceOption) (*OriginRequestPolicy, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.CookiesConfig == nil {
return nil, errors.New("invalid value for required argument 'CookiesConfig'")
}
if args.HeadersConfig == nil {
return nil, errors.New("invalid value for required argument 'HeadersConfig'")
}
if args.QueryStringsConfig == nil {
return nil, errors.New("invalid value for required argument 'QueryStringsConfig'")
}
var resource OriginRequestPolicy
err := ctx.RegisterResource("aws:cloudfront/originRequestPolicy:OriginRequestPolicy", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetOriginRequestPolicy gets an existing OriginRequestPolicy 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 GetOriginRequestPolicy(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *OriginRequestPolicyState, opts ...pulumi.ResourceOption) (*OriginRequestPolicy, error) {
var resource OriginRequestPolicy
err := ctx.ReadResource("aws:cloudfront/originRequestPolicy:OriginRequestPolicy", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering OriginRequestPolicy resources.
type originRequestPolicyState struct {
// Comment to describe the origin request policy.
Comment *string `pulumi:"comment"`
// Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.
CookiesConfig *OriginRequestPolicyCookiesConfig `pulumi:"cookiesConfig"`
// The current version of the origin request policy.
Etag *string `pulumi:"etag"`
// Object that determines whether any HTTP headers (and if so, which headers) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.
HeadersConfig *OriginRequestPolicyHeadersConfig `pulumi:"headersConfig"`
// Unique name to identify the origin request policy.
Name *string `pulumi:"name"`
// Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Query Strings Config for more information.
QueryStringsConfig *OriginRequestPolicyQueryStringsConfig `pulumi:"queryStringsConfig"`
}
type OriginRequestPolicyState struct {
// Comment to describe the origin request policy.
Comment pulumi.StringPtrInput
// Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.
CookiesConfig OriginRequestPolicyCookiesConfigPtrInput
// The current version of the origin request policy.
Etag pulumi.StringPtrInput
// Object that determines whether any HTTP headers (and if so, which headers) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.
HeadersConfig OriginRequestPolicyHeadersConfigPtrInput
// Unique name to identify the origin request policy.
Name pulumi.StringPtrInput
// Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Query Strings Config for more information.
QueryStringsConfig OriginRequestPolicyQueryStringsConfigPtrInput
}
func (OriginRequestPolicyState) ElementType() reflect.Type {
return reflect.TypeOf((*originRequestPolicyState)(nil)).Elem()
}
type originRequestPolicyArgs struct {
// Comment to describe the origin request policy.
Comment *string `pulumi:"comment"`
// Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.
CookiesConfig OriginRequestPolicyCookiesConfig `pulumi:"cookiesConfig"`
// The current version of the origin request policy.
Etag *string `pulumi:"etag"`
// Object that determines whether any HTTP headers (and if so, which headers) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.
HeadersConfig OriginRequestPolicyHeadersConfig `pulumi:"headersConfig"`
// Unique name to identify the origin request policy.
Name *string `pulumi:"name"`
// Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Query Strings Config for more information.
QueryStringsConfig OriginRequestPolicyQueryStringsConfig `pulumi:"queryStringsConfig"`
}
// The set of arguments for constructing a OriginRequestPolicy resource.
type OriginRequestPolicyArgs struct {
// Comment to describe the origin request policy.
Comment pulumi.StringPtrInput
// Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.
CookiesConfig OriginRequestPolicyCookiesConfigInput
// The current version of the origin request policy.
Etag pulumi.StringPtrInput
// Object that determines whether any HTTP headers (and if so, which headers) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.
HeadersConfig OriginRequestPolicyHeadersConfigInput
// Unique name to identify the origin request policy.
Name pulumi.StringPtrInput
// Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Query Strings Config for more information.
QueryStringsConfig OriginRequestPolicyQueryStringsConfigInput
}
func (OriginRequestPolicyArgs) ElementType() reflect.Type {
return reflect.TypeOf((*originRequestPolicyArgs)(nil)).Elem()
}
type OriginRequestPolicyInput interface {
pulumi.Input
ToOriginRequestPolicyOutput() OriginRequestPolicyOutput
ToOriginRequestPolicyOutputWithContext(ctx context.Context) OriginRequestPolicyOutput
}
func (*OriginRequestPolicy) ElementType() reflect.Type {
return reflect.TypeOf((*OriginRequestPolicy)(nil))
}
func (i *OriginRequestPolicy) ToOriginRequestPolicyOutput() OriginRequestPolicyOutput {
return i.ToOriginRequestPolicyOutputWithContext(context.Background())
}
func (i *OriginRequestPolicy) ToOriginRequestPolicyOutputWithContext(ctx context.Context) OriginRequestPolicyOutput {
return pulumi.ToOutputWithContext(ctx, i).(OriginRequestPolicyOutput)
}
func (i *OriginRequestPolicy) ToOriginRequestPolicyPtrOutput() OriginRequestPolicyPtrOutput {
return i.ToOriginRequestPolicyPtrOutputWithContext(context.Background())
}
func (i *OriginRequestPolicy) ToOriginRequestPolicyPtrOutputWithContext(ctx context.Context) OriginRequestPolicyPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(OriginRequestPolicyPtrOutput)
}
type OriginRequestPolicyPtrInput interface {
pulumi.Input
ToOriginRequestPolicyPtrOutput() OriginRequestPolicyPtrOutput
ToOriginRequestPolicyPtrOutputWithContext(ctx context.Context) OriginRequestPolicyPtrOutput
}
type originRequestPolicyPtrType OriginRequestPolicyArgs
func (*originRequestPolicyPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**OriginRequestPolicy)(nil))
}
func (i *originRequestPolicyPtrType) ToOriginRequestPolicyPtrOutput() OriginRequestPolicyPtrOutput {
return i.ToOriginRequestPolicyPtrOutputWithContext(context.Background())
}
func (i *originRequestPolicyPtrType) ToOriginRequestPolicyPtrOutputWithContext(ctx context.Context) OriginRequestPolicyPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(OriginRequestPolicyPtrOutput)
}
// OriginRequestPolicyArrayInput is an input type that accepts OriginRequestPolicyArray and OriginRequestPolicyArrayOutput values.
// You can construct a concrete instance of `OriginRequestPolicyArrayInput` via:
//
// OriginRequestPolicyArray{ OriginRequestPolicyArgs{...} }
type OriginRequestPolicyArrayInput interface {
pulumi.Input
ToOriginRequestPolicyArrayOutput() OriginRequestPolicyArrayOutput
ToOriginRequestPolicyArrayOutputWithContext(context.Context) OriginRequestPolicyArrayOutput
}
type OriginRequestPolicyArray []OriginRequestPolicyInput
func (OriginRequestPolicyArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*OriginRequestPolicy)(nil))
}
func (i OriginRequestPolicyArray) ToOriginRequestPolicyArrayOutput() OriginRequestPolicyArrayOutput {
return i.ToOriginRequestPolicyArrayOutputWithContext(context.Background())
}
func (i OriginRequestPolicyArray) ToOriginRequestPolicyArrayOutputWithContext(ctx context.Context) OriginRequestPolicyArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(OriginRequestPolicyArrayOutput)
}
// OriginRequestPolicyMapInput is an input type that accepts OriginRequestPolicyMap and OriginRequestPolicyMapOutput values.
// You can construct a concrete instance of `OriginRequestPolicyMapInput` via:
//
// OriginRequestPolicyMap{ "key": OriginRequestPolicyArgs{...} }
type OriginRequestPolicyMapInput interface {
pulumi.Input
ToOriginRequestPolicyMapOutput() OriginRequestPolicyMapOutput
ToOriginRequestPolicyMapOutputWithContext(context.Context) OriginRequestPolicyMapOutput
}
type OriginRequestPolicyMap map[string]OriginRequestPolicyInput
func (OriginRequestPolicyMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*OriginRequestPolicy)(nil))
}
func (i OriginRequestPolicyMap) ToOriginRequestPolicyMapOutput() OriginRequestPolicyMapOutput {
return i.ToOriginRequestPolicyMapOutputWithContext(context.Background())
}
func (i OriginRequestPolicyMap) ToOriginRequestPolicyMapOutputWithContext(ctx context.Context) OriginRequestPolicyMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(OriginRequestPolicyMapOutput)
}
type OriginRequestPolicyOutput struct {
*pulumi.OutputState
}
func (OriginRequestPolicyOutput) ElementType() reflect.Type {
return reflect.TypeOf((*OriginRequestPolicy)(nil))
}
func (o OriginRequestPolicyOutput) ToOriginRequestPolicyOutput() OriginRequestPolicyOutput {
return o
}
func (o OriginRequestPolicyOutput) ToOriginRequestPolicyOutputWithContext(ctx context.Context) OriginRequestPolicyOutput {
return o
}
func (o OriginRequestPolicyOutput) ToOriginRequestPolicyPtrOutput() OriginRequestPolicyPtrOutput {
return o.ToOriginRequestPolicyPtrOutputWithContext(context.Background())
}
func (o OriginRequestPolicyOutput) ToOriginRequestPolicyPtrOutputWithContext(ctx context.Context) OriginRequestPolicyPtrOutput {
return o.ApplyT(func(v OriginRequestPolicy) *OriginRequestPolicy {
return &v
}).(OriginRequestPolicyPtrOutput)
}
type OriginRequestPolicyPtrOutput struct {
*pulumi.OutputState
}
func (OriginRequestPolicyPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**OriginRequestPolicy)(nil))
}
func (o OriginRequestPolicyPtrOutput) ToOriginRequestPolicyPtrOutput() OriginRequestPolicyPtrOutput {
return o
}
func (o OriginRequestPolicyPtrOutput) ToOriginRequestPolicyPtrOutputWithContext(ctx context.Context) OriginRequestPolicyPtrOutput {
return o
}
type OriginRequestPolicyArrayOutput struct{ *pulumi.OutputState }
func (OriginRequestPolicyArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]OriginRequestPolicy)(nil))
}
func (o OriginRequestPolicyArrayOutput) ToOriginRequestPolicyArrayOutput() OriginRequestPolicyArrayOutput {
return o
}
func (o OriginRequestPolicyArrayOutput) ToOriginRequestPolicyArrayOutputWithContext(ctx context.Context) OriginRequestPolicyArrayOutput {
return o
}
func (o OriginRequestPolicyArrayOutput) Index(i pulumi.IntInput) OriginRequestPolicyOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) OriginRequestPolicy {
return vs[0].([]OriginRequestPolicy)[vs[1].(int)]
}).(OriginRequestPolicyOutput)
}
type OriginRequestPolicyMapOutput struct{ *pulumi.OutputState }
func (OriginRequestPolicyMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]OriginRequestPolicy)(nil))
}
func (o OriginRequestPolicyMapOutput) ToOriginRequestPolicyMapOutput() OriginRequestPolicyMapOutput {
return o
}
func (o OriginRequestPolicyMapOutput) ToOriginRequestPolicyMapOutputWithContext(ctx context.Context) OriginRequestPolicyMapOutput {
return o
}
func (o OriginRequestPolicyMapOutput) MapIndex(k pulumi.StringInput) OriginRequestPolicyOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) OriginRequestPolicy {
return vs[0].(map[string]OriginRequestPolicy)[vs[1].(string)]
}).(OriginRequestPolicyOutput)
}
func init() {
pulumi.RegisterOutputType(OriginRequestPolicyOutput{})
pulumi.RegisterOutputType(OriginRequestPolicyPtrOutput{})
pulumi.RegisterOutputType(OriginRequestPolicyArrayOutput{})
pulumi.RegisterOutputType(OriginRequestPolicyMapOutput{})
}