generated from hashicorp/terraform-provider-scaffolding
/
distribution_singular_data_source_gen.go
508 lines (495 loc) · 21.6 KB
/
distribution_singular_data_source_gen.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
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
// Code generated by generators/singular-data-source/main.go; DO NOT EDIT.
package lightsail
import (
"context"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-provider-awscc/internal/generic"
"github.com/hashicorp/terraform-provider-awscc/internal/registry"
)
func init() {
registry.AddDataSourceFactory("awscc_lightsail_distribution", distributionDataSource)
}
// distributionDataSource returns the Terraform awscc_lightsail_distribution data source.
// This Terraform data source corresponds to the CloudFormation AWS::Lightsail::Distribution resource.
func distributionDataSource(ctx context.Context) (datasource.DataSource, error) {
attributes := map[string]schema.Attribute{ /*START SCHEMA*/
// Property: AbleToUpdateBundle
// CloudFormation resource type schema:
//
// {
// "description": "Indicates whether the bundle that is currently applied to your distribution, specified using the distributionName parameter, can be changed to another bundle.",
// "type": "boolean"
// }
"able_to_update_bundle": schema.BoolAttribute{ /*START ATTRIBUTE*/
Description: "Indicates whether the bundle that is currently applied to your distribution, specified using the distributionName parameter, can be changed to another bundle.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: BundleId
// CloudFormation resource type schema:
//
// {
// "description": "The bundle ID to use for the distribution.",
// "type": "string"
// }
"bundle_id": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The bundle ID to use for the distribution.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: CacheBehaviorSettings
// CloudFormation resource type schema:
//
// {
// "additionalProperties": false,
// "description": "An object that describes the cache behavior settings for the distribution.",
// "properties": {
// "AllowedHTTPMethods": {
// "description": "The HTTP methods that are processed and forwarded to the distribution's origin.",
// "type": "string"
// },
// "CachedHTTPMethods": {
// "description": "The HTTP method responses that are cached by your distribution.",
// "type": "string"
// },
// "DefaultTTL": {
// "description": "The default amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the content has been updated.",
// "format": "int64",
// "type": "integer"
// },
// "ForwardedCookies": {
// "additionalProperties": false,
// "description": "An object that describes the cookies that are forwarded to the origin. Your content is cached based on the cookies that are forwarded.",
// "properties": {
// "CookiesAllowList": {
// "description": "The specific cookies to forward to your distribution's origin.",
// "insertionOrder": false,
// "items": {
// "type": "string"
// },
// "type": "array",
// "uniqueItems": true
// },
// "Option": {
// "description": "Specifies which cookies to forward to the distribution's origin for a cache behavior: all, none, or allow-list to forward only the cookies specified in the cookiesAllowList parameter.",
// "type": "string"
// }
// },
// "type": "object"
// },
// "ForwardedHeaders": {
// "additionalProperties": false,
// "description": "An object that describes the headers that are forwarded to the origin. Your content is cached based on the headers that are forwarded.",
// "properties": {
// "HeadersAllowList": {
// "description": "The specific headers to forward to your distribution's origin.",
// "insertionOrder": false,
// "items": {
// "type": "string"
// },
// "type": "array",
// "uniqueItems": true
// },
// "Option": {
// "description": "The headers that you want your distribution to forward to your origin and base caching on.",
// "type": "string"
// }
// },
// "type": "object"
// },
// "ForwardedQueryStrings": {
// "additionalProperties": false,
// "description": "An object that describes the query strings that are forwarded to the origin. Your content is cached based on the query strings that are forwarded.",
// "properties": {
// "Option": {
// "description": "Indicates whether the distribution forwards and caches based on query strings.",
// "type": "boolean"
// },
// "QueryStringsAllowList": {
// "description": "The specific query strings that the distribution forwards to the origin.",
// "insertionOrder": false,
// "items": {
// "type": "string"
// },
// "type": "array",
// "uniqueItems": true
// }
// },
// "type": "object"
// },
// "MaximumTTL": {
// "description": "The maximum amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the object has been updated.",
// "format": "int64",
// "type": "integer"
// },
// "MinimumTTL": {
// "description": "The minimum amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the object has been updated.",
// "format": "int64",
// "type": "integer"
// }
// },
// "type": "object"
// }
"cache_behavior_settings": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/
Attributes: map[string]schema.Attribute{ /*START SCHEMA*/
// Property: AllowedHTTPMethods
"allowed_http_methods": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The HTTP methods that are processed and forwarded to the distribution's origin.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: CachedHTTPMethods
"cached_http_methods": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The HTTP method responses that are cached by your distribution.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: DefaultTTL
"default_ttl": schema.Int64Attribute{ /*START ATTRIBUTE*/
Description: "The default amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the content has been updated.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: ForwardedCookies
"forwarded_cookies": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/
Attributes: map[string]schema.Attribute{ /*START SCHEMA*/
// Property: CookiesAllowList
"cookies_allow_list": schema.SetAttribute{ /*START ATTRIBUTE*/
ElementType: types.StringType,
Description: "The specific cookies to forward to your distribution's origin.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: Option
"option": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "Specifies which cookies to forward to the distribution's origin for a cache behavior: all, none, or allow-list to forward only the cookies specified in the cookiesAllowList parameter.",
Computed: true,
}, /*END ATTRIBUTE*/
}, /*END SCHEMA*/
Description: "An object that describes the cookies that are forwarded to the origin. Your content is cached based on the cookies that are forwarded.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: ForwardedHeaders
"forwarded_headers": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/
Attributes: map[string]schema.Attribute{ /*START SCHEMA*/
// Property: HeadersAllowList
"headers_allow_list": schema.SetAttribute{ /*START ATTRIBUTE*/
ElementType: types.StringType,
Description: "The specific headers to forward to your distribution's origin.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: Option
"option": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The headers that you want your distribution to forward to your origin and base caching on.",
Computed: true,
}, /*END ATTRIBUTE*/
}, /*END SCHEMA*/
Description: "An object that describes the headers that are forwarded to the origin. Your content is cached based on the headers that are forwarded.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: ForwardedQueryStrings
"forwarded_query_strings": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/
Attributes: map[string]schema.Attribute{ /*START SCHEMA*/
// Property: Option
"option": schema.BoolAttribute{ /*START ATTRIBUTE*/
Description: "Indicates whether the distribution forwards and caches based on query strings.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: QueryStringsAllowList
"query_strings_allow_list": schema.SetAttribute{ /*START ATTRIBUTE*/
ElementType: types.StringType,
Description: "The specific query strings that the distribution forwards to the origin.",
Computed: true,
}, /*END ATTRIBUTE*/
}, /*END SCHEMA*/
Description: "An object that describes the query strings that are forwarded to the origin. Your content is cached based on the query strings that are forwarded.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: MaximumTTL
"maximum_ttl": schema.Int64Attribute{ /*START ATTRIBUTE*/
Description: "The maximum amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the object has been updated.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: MinimumTTL
"minimum_ttl": schema.Int64Attribute{ /*START ATTRIBUTE*/
Description: "The minimum amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the object has been updated.",
Computed: true,
}, /*END ATTRIBUTE*/
}, /*END SCHEMA*/
Description: "An object that describes the cache behavior settings for the distribution.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: CacheBehaviors
// CloudFormation resource type schema:
//
// {
// "description": "An array of objects that describe the per-path cache behavior for the distribution.",
// "insertionOrder": false,
// "items": {
// "additionalProperties": false,
// "description": "Describes the per-path cache behavior of an Amazon Lightsail content delivery network (CDN) distribution.",
// "properties": {
// "Behavior": {
// "description": "The cache behavior for the specified path.",
// "type": "string"
// },
// "Path": {
// "description": "The path to a directory or file to cached, or not cache. Use an asterisk symbol to specify wildcard directories (path/to/assets/*), and file types (*.html, *jpg, *js). Directories and file paths are case-sensitive.",
// "type": "string"
// }
// },
// "type": "object"
// },
// "type": "array",
// "uniqueItems": true
// }
"cache_behaviors": schema.SetNestedAttribute{ /*START ATTRIBUTE*/
NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/
Attributes: map[string]schema.Attribute{ /*START SCHEMA*/
// Property: Behavior
"behavior": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The cache behavior for the specified path.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: Path
"path": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The path to a directory or file to cached, or not cache. Use an asterisk symbol to specify wildcard directories (path/to/assets/*), and file types (*.html, *jpg, *js). Directories and file paths are case-sensitive.",
Computed: true,
}, /*END ATTRIBUTE*/
}, /*END SCHEMA*/
}, /*END NESTED OBJECT*/
Description: "An array of objects that describe the per-path cache behavior for the distribution.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: CertificateName
// CloudFormation resource type schema:
//
// {
// "description": "The certificate attached to the Distribution.",
// "type": "string"
// }
"certificate_name": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The certificate attached to the Distribution.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: DefaultCacheBehavior
// CloudFormation resource type schema:
//
// {
// "additionalProperties": false,
// "description": "An object that describes the default cache behavior for the distribution.",
// "properties": {
// "Behavior": {
// "description": "The cache behavior of the distribution.",
// "type": "string"
// }
// },
// "type": "object"
// }
"default_cache_behavior": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/
Attributes: map[string]schema.Attribute{ /*START SCHEMA*/
// Property: Behavior
"behavior": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The cache behavior of the distribution.",
Computed: true,
}, /*END ATTRIBUTE*/
}, /*END SCHEMA*/
Description: "An object that describes the default cache behavior for the distribution.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: DistributionArn
// CloudFormation resource type schema:
//
// {
// "type": "string"
// }
"distribution_arn": schema.StringAttribute{ /*START ATTRIBUTE*/
Computed: true,
}, /*END ATTRIBUTE*/
// Property: DistributionName
// CloudFormation resource type schema:
//
// {
// "description": "The name for the distribution.",
// "pattern": "\\w[\\w\\-]*\\w",
// "type": "string"
// }
"distribution_name": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The name for the distribution.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: IpAddressType
// CloudFormation resource type schema:
//
// {
// "description": "The IP address type for the distribution.",
// "type": "string"
// }
"ip_address_type": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The IP address type for the distribution.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: IsEnabled
// CloudFormation resource type schema:
//
// {
// "description": "Indicates whether the distribution is enabled.",
// "type": "boolean"
// }
"is_enabled": schema.BoolAttribute{ /*START ATTRIBUTE*/
Description: "Indicates whether the distribution is enabled.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: Origin
// CloudFormation resource type schema:
//
// {
// "additionalProperties": false,
// "description": "An object that describes the origin resource for the distribution, such as a Lightsail instance or load balancer.",
// "properties": {
// "Name": {
// "description": "The name of the origin resource.",
// "type": "string"
// },
// "ProtocolPolicy": {
// "description": "The protocol that your Amazon Lightsail distribution uses when establishing a connection with your origin to pull content.",
// "type": "string"
// },
// "RegionName": {
// "description": "The AWS Region name of the origin resource.",
// "type": "string"
// }
// },
// "type": "object"
// }
"origin": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/
Attributes: map[string]schema.Attribute{ /*START SCHEMA*/
// Property: Name
"name": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The name of the origin resource.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: ProtocolPolicy
"protocol_policy": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The protocol that your Amazon Lightsail distribution uses when establishing a connection with your origin to pull content.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: RegionName
"region_name": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The AWS Region name of the origin resource.",
Computed: true,
}, /*END ATTRIBUTE*/
}, /*END SCHEMA*/
Description: "An object that describes the origin resource for the distribution, such as a Lightsail instance or load balancer.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: Status
// CloudFormation resource type schema:
//
// {
// "description": "The status of the distribution.",
// "type": "string"
// }
"status": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The status of the distribution.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: Tags
// CloudFormation resource type schema:
//
// {
// "description": "An array of key-value pairs to apply to this resource.",
// "insertionOrder": false,
// "items": {
// "additionalProperties": false,
// "description": "A key-value pair to associate with a resource.",
// "properties": {
// "Key": {
// "description": "The key name of the tag. You can specify a value that is 1 to 128 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.",
// "maxLength": 128,
// "minLength": 1,
// "type": "string"
// },
// "Value": {
// "description": "The value for the tag. You can specify a value that is 0 to 256 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.",
// "maxLength": 256,
// "minLength": 0,
// "type": "string"
// }
// },
// "required": [
// "Key"
// ],
// "type": "object"
// },
// "type": "array",
// "uniqueItems": true
// }
"tags": schema.SetNestedAttribute{ /*START ATTRIBUTE*/
NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/
Attributes: map[string]schema.Attribute{ /*START SCHEMA*/
// Property: Key
"key": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The key name of the tag. You can specify a value that is 1 to 128 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.",
Computed: true,
}, /*END ATTRIBUTE*/
// Property: Value
"value": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The value for the tag. You can specify a value that is 0 to 256 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.",
Computed: true,
}, /*END ATTRIBUTE*/
}, /*END SCHEMA*/
}, /*END NESTED OBJECT*/
Description: "An array of key-value pairs to apply to this resource.",
Computed: true,
}, /*END ATTRIBUTE*/
} /*END SCHEMA*/
attributes["id"] = schema.StringAttribute{
Description: "Uniquely identifies the resource.",
Required: true,
}
schema := schema.Schema{
Description: "Data Source schema for AWS::Lightsail::Distribution",
Attributes: attributes,
}
var opts generic.DataSourceOptions
opts = opts.WithCloudFormationTypeName("AWS::Lightsail::Distribution").WithTerraformTypeName("awscc_lightsail_distribution")
opts = opts.WithTerraformSchema(schema)
opts = opts.WithAttributeNameMap(map[string]string{
"able_to_update_bundle": "AbleToUpdateBundle",
"allowed_http_methods": "AllowedHTTPMethods",
"behavior": "Behavior",
"bundle_id": "BundleId",
"cache_behavior_settings": "CacheBehaviorSettings",
"cache_behaviors": "CacheBehaviors",
"cached_http_methods": "CachedHTTPMethods",
"certificate_name": "CertificateName",
"cookies_allow_list": "CookiesAllowList",
"default_cache_behavior": "DefaultCacheBehavior",
"default_ttl": "DefaultTTL",
"distribution_arn": "DistributionArn",
"distribution_name": "DistributionName",
"forwarded_cookies": "ForwardedCookies",
"forwarded_headers": "ForwardedHeaders",
"forwarded_query_strings": "ForwardedQueryStrings",
"headers_allow_list": "HeadersAllowList",
"ip_address_type": "IpAddressType",
"is_enabled": "IsEnabled",
"key": "Key",
"maximum_ttl": "MaximumTTL",
"minimum_ttl": "MinimumTTL",
"name": "Name",
"option": "Option",
"origin": "Origin",
"path": "Path",
"protocol_policy": "ProtocolPolicy",
"query_strings_allow_list": "QueryStringsAllowList",
"region_name": "RegionName",
"status": "Status",
"tags": "Tags",
"value": "Value",
})
v, err := generic.NewSingularDataSource(ctx, opts...)
if err != nil {
return nil, err
}
return v, nil
}