Skip to content

Commit 31d11d4

Browse files
updates
1 parent c0b5885 commit 31d11d4

7 files changed

Lines changed: 8 additions & 15 deletions

google-cloud-storage-control/samples/storage_control_create_anywhere_cache.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414

1515
# [START storage_control_create_anywhere_cache]
1616
def create_anywhere_cache bucket_name:, zone:
17-
require "google/cloud/storage/control/v2"
18-
1917
# The ID of your GCS bucket
2018
# bucket_name = "your-unique-bucket-name"
2119

2220
# Zone where you want to create cache
2321
# zone = "your-zone-name"
22+
require "google/cloud/storage/control/v2"
2423

2524
# Create a client object. The client can be reused for multiple calls.
2625
storage_control_client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new

google-cloud-storage-control/samples/storage_control_disable_anywhere_cache.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414

1515
# [START storage_control_disable_anywhere_cache]
1616
def disable_anywhere_cache bucket_name:, anywhere_cache_id:
17-
require "google/cloud/storage/control/v2"
18-
1917
# The ID of your GCS bucket
2018
# bucket_name = "your-unique-bucket-name"
2119

2220
# A value that, along with the bucket's name, uniquely identifies the cache
2321
# anywhere_cache_id = value that, along with the bucket's name, uniquely identifies the cache
22+
require "google/cloud/storage/control/v2"
2423

2524
# Create a client object. The client can be reused for multiple calls.
2625
storage_control_client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new

google-cloud-storage-control/samples/storage_control_get_anywhere_cache.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414

1515
# [START storage_control_get_anywhere_cache]
1616
def get_anywhere_cache bucket_name:, anywhere_cache_id:
17-
require "google/cloud/storage/control/v2"
18-
1917
# The ID of your GCS bucket
2018
# bucket_name = "your-unique-bucket-name"
2119

2220
# A value that, along with the bucket's name, uniquely identifies the cache
2321
# anywhere_cache_id = value that, along with the bucket's name, uniquely identifies the cache
22+
require "google/cloud/storage/control/v2"
2423

2524
# Create a client object. The client can be reused for multiple calls.
2625
storage_control_client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new

google-cloud-storage-control/samples/storage_control_list_anywhere_caches.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
def list_anywhere_caches bucket_name:
1717
# The ID of your GCS bucket
1818
# bucket_name = "your-unique-bucket-name"
19-
2019
require "google/cloud/storage/control/v2"
2120

2221
# Create a client object. The client can be reused for multiple calls.

google-cloud-storage-control/samples/storage_control_pause_anywhere_cache.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414

1515
# [START storage_control_create_anywhere_cache]
1616
def pause_anywhere_cache bucket_name:, anywhere_cache_id:
17-
require "google/cloud/storage/control/v2"
18-
1917
# The ID of your GCS bucket
2018
# bucket_name = "your-unique-bucket-name"
2119

2220
# A value that, along with the bucket's name, uniquely identifies the cache
2321
# anywhere_cache_id = value that, along with the bucket's name, uniquely identifies the cache
22+
require "google/cloud/storage/control/v2"
2423

2524
# Create a client object. The client can be reused for multiple calls.
2625
storage_control_client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new

google-cloud-storage-control/samples/storage_control_resume_anywhere_cache.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@
1414

1515
# [START storage_control_resume_anywhere_cache]
1616
def resume_anywhere_cache bucket_name:, anywhere_cache_id:
17-
require "google/cloud/storage/control/v2"
18-
1917
# The ID of your GCS bucket
2018
# bucket_name = "your-unique-bucket-name"
2119

2220
# A value that, along with the bucket's name, uniquely identifies the cache
2321
# anywhere_cache_id = value that, along with the bucket's name, uniquely identifies the cache
22+
require "google/cloud/storage/control/v2"
2423

2524
# Create a client object. The client can be reused for multiple calls.
26-
client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
25+
storage_control_client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
2726
parent = "projects/_/buckets/#{bucket_name}"
2827
name = "#{parent}/anywhereCaches/#{anywhere_cache_id}"
2928

@@ -35,7 +34,7 @@ def resume_anywhere_cache bucket_name:, anywhere_cache_id:
3534
# The cache is resumed in the specified bucket.
3635
# The cache is identified by the specified ID.
3736
# Call the resume_anywhere_cache method.
38-
result = client.resume_anywhere_cache request
37+
result = storage_control_client.resume_anywhere_cache request
3938
puts "AnywhereCache #{result.name} #{result.state}"
4039
end
4140
# [END storage_control_resume_anywhere_cache]

google-cloud-storage-control/samples/storage_control_update_anywhere_cache.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414

1515
# [START storage_control_update_anywhere_cache]
1616
def update_anywhere_cache bucket_name:, anywhere_cache_id:
17-
require "google/cloud/storage/control/v2"
18-
1917
# The ID of your GCS bucket
2018
# bucket_name = "your-unique-bucket-name"
2119

2220
# A value that, along with the bucket's name, uniquely identifies the cache
2321
# anywhere_cache_id = value that, along with the bucket's name, uniquely identifies the cache
22+
require "google/cloud/storage/control/v2"
2423

2524
# Create a client object. The client can be reused for multiple calls.
2625
storage_control_client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new

0 commit comments

Comments
 (0)