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_event_based_hold=, #default_event_based_hold?, #default_kms_key, #default_kms_key=, #delete, #exists?, #file, #files, #generate_signed_post_policy_v4, #id, #kind, #location, #location_type, #lock_retention_policy!, #logging_bucket, #logging_bucket=, #logging_prefix, #logging_prefix=, #metageneration, #name, #notification, #notifications, #policy, #policy_only=, #policy_only?, #policy_only_locked_at, #post_object, #reload!, #requester_pays, #requester_pays=, #retention_effective_at, #retention_period, #retention_period=, #retention_policy_locked?, #signed_url, #storage_class, #storage_class=, #test_permissions, #uniform_bucket_level_access=, #uniform_bucket_level_access?, #uniform_bucket_level_access_locked_at, #update, #update_policy, #versioning=, #versioning?, #website_404, #website_404=, #website_main, #website_main=

Constructor Details

#initialize(gapi) ⇒ Updater

Create an Updater object.



2577
2578
2579
2580
2581
2582
2583
# File 'lib/google/cloud/storage/bucket.rb', line 2577

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.



2574
2575
2576
# File 'lib/google/cloud/storage/bucket.rb', line 2574

def updates
  @updates
end

Instance Method Details

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

Yields:

  • (@cors_builder)


2613
2614
2615
2616
2617
2618
# File 'lib/google/cloud/storage/bucket.rb', line 2613

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))


2590
2591
2592
# File 'lib/google/cloud/storage/bucket.rb', line 2590

def labels
  @labels
end

#labels=(labels) ⇒ Object

Updates the hash of user-provided labels.

Parameters:

  • labels (Hash(String => String))

    The user-provided labels.



2599
2600
2601
2602
2603
# File 'lib/google/cloud/storage/bucket.rb', line 2599

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

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

Yields:

  • (@lifecycle_builder)


2629
2630
2631
2632
2633
2634
# File 'lib/google/cloud/storage/bucket.rb', line 2629

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