Class: Google::Cloud::Storage::Bucket::Updater

Inherits:
Google::Cloud::Storage::Bucket show all
Defined in:
lib/google/cloud/storage/bucket.rb

Overview

Yielded to a block to accumulate changes for a patch request.

Instance Attribute Summary collapse

Attributes inherited from Google::Cloud::Storage::Bucket

#user_project

Instance Method Summary collapse

Methods inherited from Google::Cloud::Storage::Bucket

#acl, #api_url, #compose, #create_file, #create_notification, #created_at, #default_acl, #default_kms_key, #default_kms_key=, #delete, #exists?, #file, #files, #id, #kind, #location, #logging_bucket, #logging_bucket=, #logging_prefix, #logging_prefix=, #name, #notification, #notifications, #policy, #post_object, #reload!, #requester_pays, #requester_pays=, #signed_url, #storage_class, #storage_class=, #test_permissions, #update, #update_policy, #versioning=, #versioning?, #website_404, #website_404=, #website_main, #website_main=

Constructor Details

#initialize(gapi) ⇒ Updater

Create an Updater object.



1719
1720
1721
1722
1723
1724
1725
# File 'lib/google/cloud/storage/bucket.rb', line 1719

def initialize gapi
  @updates = []
  @gapi = gapi
  @labels = @gapi.labels.to_h.dup
  @cors_builder = nil
  @lifecycle_builder = nil
end

Instance Attribute Details

#updatesObject (readonly)

Returns the value of attribute updates.



1716
1717
1718
# File 'lib/google/cloud/storage/bucket.rb', line 1716

def updates
  @updates
end

Instance Method Details

#cors {|@cors_builder| ... } ⇒ Object

Yields:

  • (@cors_builder)


1755
1756
1757
1758
1759
1760
# File 'lib/google/cloud/storage/bucket.rb', line 1755

def cors
  # Same as Bucket#cors, but not frozen
  @cors_builder ||= Bucket::Cors.from_gapi @gapi.cors_configurations
  yield @cors_builder if block_given?
  @cors_builder
end

#labelsHash(String => String)

A hash of user-provided labels. Changes are allowed.

Returns:

  • (Hash(String => String))


1732
1733
1734
# File 'lib/google/cloud/storage/bucket.rb', line 1732

def labels
  @labels
end

#labels=(labels) ⇒ Object

Updates the hash of user-provided labels.

Parameters:

  • labels (Hash(String => String))

    The user-provided labels.



1741
1742
1743
1744
1745
# File 'lib/google/cloud/storage/bucket.rb', line 1741

def labels= labels
  @labels = labels
  @gapi.labels = @labels
  patch_gapi! :labels
end

#lifecycle {|@lifecycle_builder| ... } ⇒ Object

Yields:

  • (@lifecycle_builder)


1771
1772
1773
1774
1775
1776
# File 'lib/google/cloud/storage/bucket.rb', line 1771

def lifecycle
  # Same as Bucket#lifecycle, but not frozen
  @lifecycle_builder ||= Bucket::Lifecycle.from_gapi @gapi.lifecycle
  yield @lifecycle_builder if block_given?
  @lifecycle_builder
end