Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
add defaultEventBasedHold to storage buckets (#300)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>

Co-authored-by: Martin Nowak <code@dawg.eu>
  • Loading branch information
2 people authored and Stuart Paterson committed Apr 6, 2020
1 parent c24c9dd commit e241427
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/resources/google_storage_bucket.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions docs/resources/google_storage_buckets.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions libraries/google_storage_bucket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions libraries/google_storage_buckets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) },
Expand Down

0 comments on commit e241427

Please sign in to comment.