Skip to content

Commit fa2f7a2

Browse files
authored
Merge pull request inspec#127 from modular-magician/codegen-pr-1504
Add backend bucket signed URL key (for CDN) support
2 parents a09ef08 + 5224af4 commit fa2f7a2

7 files changed

+49
-0
lines changed

docs/resources/google_compute_backend_bucket.md

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ Properties that can be accessed from the `google_compute_backend_bucket` resourc
2525

2626
* `bucket_name`: Cloud Storage bucket name.
2727

28+
* `cdn_policy`: Cloud CDN configuration for this Backend Bucket.
29+
30+
* `signed_url_cache_max_age_sec`: Maximum number of seconds the response to a signed URL request will be considered fresh. Defaults to 1hr (3600s). After this time period, the response will be revalidated before being served. When serving responses to signed URL requests, Cloud CDN will internally behave as though all responses from this backend had a "Cache-Control: public, max-age=[TTL]" header, regardless of any existing Cache-Control header. The actual headers served in responses will not be altered.
31+
2832
* `creation_timestamp`: Creation timestamp in RFC3339 text format.
2933

3034
* `description`: An optional textual description of the resource; provided by the client when the resource is created.

docs/resources/google_compute_backend_buckets.md

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Properties that can be accessed from the `google_compute_backend_buckets` resour
1919

2020
See [google_compute_backend_bucket.md](google_compute_backend_bucket.md) for more detailed information
2121
* `bucket_names`: an array of `google_compute_backend_bucket` bucket_name
22+
* `cdn_policies`: an array of `google_compute_backend_bucket` cdn_policy
2223
* `creation_timestamps`: an array of `google_compute_backend_bucket` creation_timestamp
2324
* `descriptions`: an array of `google_compute_backend_bucket` description
2425
* `enable_cdns`: an array of `google_compute_backend_bucket` enable_cdn

docs/resources/google_compute_backend_service.md

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ Properties that can be accessed from the `google_compute_backend_service` resour
5151

5252
* `cache_key_policy`: The CacheKeyPolicy for this CdnPolicy.
5353

54+
* `signed_url_cache_max_age_sec`: Maximum number of seconds the response to a signed URL request will be considered fresh, defaults to 1hr (3600s). After this time period, the response will be revalidated before being served. When serving responses to signed URL requests, Cloud CDN will internally behave as though all responses from this backend had a "Cache-Control: public, max-age=[TTL]" header, regardless of any existing Cache-Control header. The actual headers served in responses will not be altered.
55+
5456
* `connection_draining`: Settings for connection draining
5557

5658
* `draining_timeout_sec`: Time for which instance will be drained (not accept new connections, but still work to finish started).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# frozen_string_literal: false
2+
3+
# ----------------------------------------------------------------------------
4+
#
5+
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
6+
#
7+
# ----------------------------------------------------------------------------
8+
#
9+
# This file is automatically generated by Magic Modules and manual
10+
# changes will be clobbered when the file is regenerated.
11+
#
12+
# Please read more about how to change this file in README.md and
13+
# CONTRIBUTING.md located at the root of this package.
14+
#
15+
# ----------------------------------------------------------------------------
16+
module GoogleInSpec
17+
module Compute
18+
module Property
19+
class BackendBucketCdnPolicy
20+
attr_reader :signed_url_cache_max_age_sec
21+
22+
def initialize(args = nil, parent_identifier = nil)
23+
return if args.nil?
24+
@parent_identifier = parent_identifier
25+
@signed_url_cache_max_age_sec = args['signedUrlCacheMaxAgeSec']
26+
end
27+
28+
def to_s
29+
"#{@parent_identifier} BackendBucketCdnPolicy"
30+
end
31+
end
32+
end
33+
end
34+
end

libraries/google/compute/property/backendservice_cdn_policy.rb

+3
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@ module Property
2020
class BackendServiceCdnPolicy
2121
attr_reader :cache_key_policy
2222

23+
attr_reader :signed_url_cache_max_age_sec
24+
2325
def initialize(args = nil, parent_identifier = nil)
2426
return if args.nil?
2527
@parent_identifier = parent_identifier
2628
@cache_key_policy = GoogleInSpec::Compute::Property::BackendServiceCdnPolicyCacheKeyPolicy.new(args['cacheKeyPolicy'], to_s)
29+
@signed_url_cache_max_age_sec = args['signedUrlCacheMaxAgeSec']
2730
end
2831

2932
def to_s

libraries/google_compute_backend_bucket.rb

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#
1515
# ----------------------------------------------------------------------------
1616
require 'gcp_backend'
17+
require 'google/compute/property/backendbucket_cdn_policy'
1718

1819
# A provider to manage Compute Engine resources.
1920
class BackendBucket < GcpResourceBase
@@ -23,6 +24,7 @@ class BackendBucket < GcpResourceBase
2324

2425
attr_reader :params
2526
attr_reader :bucket_name
27+
attr_reader :cdn_policy
2628
attr_reader :creation_timestamp
2729
attr_reader :description
2830
attr_reader :enable_cdn
@@ -38,6 +40,7 @@ def initialize(params)
3840

3941
def parse
4042
@bucket_name = @fetched['bucketName']
43+
@cdn_policy = GoogleInSpec::Compute::Property::BackendBucketCdnPolicy.new(@fetched['cdnPolicy'], to_s)
4144
@creation_timestamp = parse_time_string(@fetched['creationTimestamp'])
4245
@description = @fetched['description']
4346
@enable_cdn = @fetched['enableCdn']

libraries/google_compute_backend_buckets.rb

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class BackendBuckets < GcpResourceBase
2424
filter_table_config = FilterTable.create
2525

2626
filter_table_config.add(:bucket_names, field: :bucket_name)
27+
filter_table_config.add(:cdn_policies, field: :cdn_policy)
2728
filter_table_config.add(:creation_timestamps, field: :creation_timestamp)
2829
filter_table_config.add(:descriptions, field: :description)
2930
filter_table_config.add(:enable_cdns, field: :enable_cdn)
@@ -69,6 +70,7 @@ def transform(key, value)
6970
def transformers
7071
{
7172
'bucketName' => ->(obj) { return :bucket_name, obj['bucketName'] },
73+
'cdnPolicy' => ->(obj) { return :cdn_policy, GoogleInSpec::Compute::Property::BackendBucketCdnPolicy.new(obj['cdnPolicy'], to_s) },
7274
'creationTimestamp' => ->(obj) { return :creation_timestamp, parse_time_string(obj['creationTimestamp']) },
7375
'description' => ->(obj) { return :description, obj['description'] },
7476
'enableCdn' => ->(obj) { return :enable_cdn, obj['enableCdn'] },

0 commit comments

Comments
 (0)