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

add defaultEventBasedHold to storage buckets #300

Merged
merged 1 commit into from
Jan 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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