From f912e46c1384858109d963d352d5e8b9c116fc53 Mon Sep 17 00:00:00 2001 From: Martin Nowak Date: Fri, 10 Jan 2020 18:42:38 +0000 Subject: [PATCH] add defaultEventBasedHold to storage buckets Signed-off-by: Modular Magician --- docs/resources/google_storage_bucket.md | 2 ++ docs/resources/google_storage_buckets.md | 1 + libraries/google_storage_bucket.rb | 2 ++ libraries/google_storage_buckets.rb | 2 ++ 4 files changed, 7 insertions(+) diff --git a/docs/resources/google_storage_bucket.md b/docs/resources/google_storage_bucket.md index 38c04bc04..f39b1bc53 100644 --- a/docs/resources/google_storage_bucket.md +++ b/docs/resources/google_storage_bucket.md @@ -56,6 +56,8 @@ Properties that can be accessed from the `google_storage_bucket` resource: * `response_header`: The list of HTTP headers other than the simple response headers to give permission for the user-agent to share across domains. + * `default_event_based_hold`: Whether or not to automatically apply an eventBasedHold to new objects added to the bucket. + * `default_object_acl`: Default access controls to apply to new objects when no ACL is provided. * `bucket`: The name of the bucket. diff --git a/docs/resources/google_storage_buckets.md b/docs/resources/google_storage_buckets.md index 70da2f7c0..2ad74d8ca 100644 --- a/docs/resources/google_storage_buckets.md +++ b/docs/resources/google_storage_buckets.md @@ -19,6 +19,7 @@ Properties that can be accessed from the `google_storage_buckets` resource: See [google_storage_bucket.md](google_storage_bucket.md) for more detailed information * `acls`: an array of `google_storage_bucket` acl * `cors`: an array of `google_storage_bucket` cors + * `default_event_based_holds`: an array of `google_storage_bucket` default_event_based_hold * `default_object_acls`: an array of `google_storage_bucket` default_object_acl * `bucket_ids`: an array of `google_storage_bucket` id * `lifecycles`: an array of `google_storage_bucket` lifecycle diff --git a/libraries/google_storage_bucket.rb b/libraries/google_storage_bucket.rb index 69d31af01..1fd5b1028 100644 --- a/libraries/google_storage_bucket.rb +++ b/libraries/google_storage_bucket.rb @@ -33,6 +33,7 @@ class StorageBucket < GcpResourceBase attr_reader :params attr_reader :acl attr_reader :cors + attr_reader :default_event_based_hold attr_reader :default_object_acl attr_reader :id attr_reader :lifecycle @@ -60,6 +61,7 @@ def initialize(params) def parse @acl = GoogleInSpec::Storage::Property::BucketAclArray.parse(@fetched['acl'], to_s) @cors = GoogleInSpec::Storage::Property::BucketCorsArray.parse(@fetched['cors'], to_s) + @default_event_based_hold = @fetched['defaultEventBasedHold'] @default_object_acl = GoogleInSpec::Storage::Property::BucketDefaultObjectAclArray.parse(@fetched['defaultObjectAcl'], to_s) @id = @fetched['id'] @lifecycle = GoogleInSpec::Storage::Property::BucketLifecycle.new(@fetched['lifecycle'], to_s) diff --git a/libraries/google_storage_buckets.rb b/libraries/google_storage_buckets.rb index 0a4217afd..c98e3c99f 100644 --- a/libraries/google_storage_buckets.rb +++ b/libraries/google_storage_buckets.rb @@ -25,6 +25,7 @@ class StorageBuckets < GcpResourceBase filter_table_config.add(:acls, field: :acl) filter_table_config.add(:cors, field: :cors) + filter_table_config.add(:default_event_based_holds, field: :default_event_based_hold) filter_table_config.add(:default_object_acls, field: :default_object_acl) filter_table_config.add(:bucket_ids, field: :bucket_id) filter_table_config.add(:lifecycles, field: :lifecycle) @@ -82,6 +83,7 @@ def transformers { 'acl' => ->(obj) { return :acl, GoogleInSpec::Storage::Property::BucketAclArray.parse(obj['acl'], to_s) }, 'cors' => ->(obj) { return :cors, GoogleInSpec::Storage::Property::BucketCorsArray.parse(obj['cors'], to_s) }, + 'defaultEventBasedHold' => ->(obj) { return :default_event_based_hold, obj['defaultEventBasedHold'] }, 'defaultObjectAcl' => ->(obj) { return :default_object_acl, GoogleInSpec::Storage::Property::BucketDefaultObjectAclArray.parse(obj['defaultObjectAcl'], to_s) }, 'id' => ->(obj) { return :bucket_id, obj['id'] }, 'lifecycle' => ->(obj) { return :lifecycle, GoogleInSpec::Storage::Property::BucketLifecycle.new(obj['lifecycle'], to_s) },