Skip to content
Open
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
1 change: 1 addition & 0 deletions google-cloud-storage-control-v2/.owlbot-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"snippets/storage_control/delete_folder_recursive.rb",
"snippets/storage_control/delete_managed_folder.rb",
"snippets/storage_control/disable_anywhere_cache.rb",
"snippets/storage_control/disable_rapid_cache.rb",
"snippets/storage_control/get_anywhere_cache.rb",
"snippets/storage_control/get_folder.rb",
"snippets/storage_control/get_folder_intelligence_config.rb",
Expand Down
5 changes: 5 additions & 0 deletions google-cloud-storage-control-v2/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@
"update_rapid_cache"
]
},
"DisableRapidCache": {
"methods": [
"disable_rapid_cache"
]
},
"GetRapidCache": {
"methods": [
"get_rapid_cache"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2482,6 +2482,108 @@ def update_rapid_cache request, options = nil
raise ::Google::Cloud::Error.from_error(e)
end

##
# Disables a Rapid Cache instance.
#
# @overload disable_rapid_cache(request, options = nil)
# Pass arguments to `disable_rapid_cache` via a request object, either of type
# {::Google::Cloud::Storage::Control::V2::DisableRapidCacheRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Storage::Control::V2::DisableRapidCacheRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload disable_rapid_cache(name: nil, request_id: nil)
# Pass arguments to `disable_rapid_cache` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param name [::String]
# Required. The name field in the request should be:
# `projects/{project}/buckets/{bucket}/rapidCaches/{rapid_cache}`
# @param request_id [::String]
# Optional. A unique identifier for this request. UUID is the recommended
# format, but other formats are still accepted. This request is only
# idempotent if a `request_id` is provided.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Gapic::Operation]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Gapic::Operation]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
# @example Basic example
# require "google/cloud/storage/control/v2"
#
# # Create a client object. The client can be reused for multiple calls.
# client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
#
# # Create a request. To set request fields, pass in keyword arguments.
# request = Google::Cloud::Storage::Control::V2::DisableRapidCacheRequest.new
#
# # Call the disable_rapid_cache method.
# result = client.disable_rapid_cache request
#
# # The returned object is of type Gapic::Operation. You can use it to
# # check the status of an operation, cancel it, or wait for results.
# # Here is how to wait for a response.
# result.wait_until_done! timeout: 60
# if result.response?
# p result.response
# else
# puts "No response received."
# end
#
def disable_rapid_cache request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?

request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::DisableRapidCacheRequest

# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

# Customize the options with defaults
metadata = @config.rpcs.disable_rapid_cache.metadata.to_h

# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

header_params = {}
if request.name
regex_match = %r{^(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/(?<__wildcard__>.*))?$}.match request.name
if regex_match
header_params["bucket"] = regex_match["bucket".to_s]
end
end

request_params_header = URI.encode_www_form header_params
metadata[:"x-goog-request-params"] ||= request_params_header

options.apply_defaults timeout: @config.rpcs.disable_rapid_cache.timeout,
metadata: metadata,
retry_policy: @config.rpcs.disable_rapid_cache.retry_policy

options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy

@storage_control_stub.call_rpc :disable_rapid_cache, request, options: options do |response, operation|
response = ::Gapic::Operation.new response, @operations_client, options: options
yield response, operation if block_given?
throw :response, response
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end

##
# Gets a Rapid Cache instance.
#
Expand Down Expand Up @@ -4434,6 +4536,11 @@ class Rpcs
#
attr_reader :update_rapid_cache
##
# RPC-specific configuration for `disable_rapid_cache`
# @return [::Gapic::Config::Method]
#
attr_reader :disable_rapid_cache
##
# RPC-specific configuration for `get_rapid_cache`
# @return [::Gapic::Config::Method]
#
Expand Down Expand Up @@ -4563,6 +4670,8 @@ def initialize parent_rpcs = nil
@create_rapid_cache = ::Gapic::Config::Method.new create_rapid_cache_config
update_rapid_cache_config = parent_rpcs.update_rapid_cache if parent_rpcs.respond_to? :update_rapid_cache
@update_rapid_cache = ::Gapic::Config::Method.new update_rapid_cache_config
disable_rapid_cache_config = parent_rpcs.disable_rapid_cache if parent_rpcs.respond_to? :disable_rapid_cache
@disable_rapid_cache = ::Gapic::Config::Method.new disable_rapid_cache_config
get_rapid_cache_config = parent_rpcs.get_rapid_cache if parent_rpcs.respond_to? :get_rapid_cache
@get_rapid_cache = ::Gapic::Config::Method.new get_rapid_cache_config
list_rapid_caches_config = parent_rpcs.list_rapid_caches if parent_rpcs.respond_to? :list_rapid_caches
Expand Down

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,26 @@ class UpdateRapidCacheMetadata
extend ::Google::Protobuf::MessageExts::ClassMethods
end

# Message returned in the metadata field of the Operation resource for
# DeleteRapidCache operation.
# @!attribute [rw] common_metadata
# @return [::Google::Cloud::Storage::Control::V2::CommonLongRunningOperationMetadata]
# Generic metadata for the long running operation.
# @!attribute [rw] rapid_cache_id
# @return [::String]
# Rapid Cache ID.
# @!attribute [rw] zone
# @return [::String]
# The zone in which the cache instance is running. For example,
# us-central1-a.
# @!attribute [rw] cache_type
# @return [::String]
# Optional. The type of cache. Either rapid cache or rapid cache ultra.
class DisableRapidCacheMetadata
include ::Google::Protobuf::MessageExts
extend ::Google::Protobuf::MessageExts::ClassMethods
end

# An Anywhere Cache Instance.
# @!attribute [rw] name
# @return [::String]
Expand Down Expand Up @@ -1001,6 +1021,21 @@ class UpdateRapidCacheRequest
extend ::Google::Protobuf::MessageExts::ClassMethods
end

# Request message for DisableRapidCache.
# @!attribute [rw] name
# @return [::String]
# Required. The name field in the request should be:
# `projects/{project}/buckets/{bucket}/rapidCaches/{rapid_cache}`
# @!attribute [rw] request_id
# @return [::String]
# Optional. A unique identifier for this request. UUID is the recommended
# format, but other formats are still accepted. This request is only
# idempotent if a `request_id` is provided.
class DisableRapidCacheRequest
include ::Google::Protobuf::MessageExts
extend ::Google::Protobuf::MessageExts::ClassMethods
end

# Request message for GetRapidCache.
# @!attribute [rw] name
# @return [::String]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,46 @@
}
]
},
{
"region_tag": "storage_v2_generated_StorageControl_DisableRapidCache_sync",
"title": "Snippet for the disable_rapid_cache call in the StorageControl service",
"description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Storage::Control::V2::StorageControl::Client#disable_rapid_cache.",
"file": "storage_control/disable_rapid_cache.rb",
"language": "RUBY",
"client_method": {
"short_name": "disable_rapid_cache",
"full_name": "::Google::Cloud::Storage::Control::V2::StorageControl::Client#disable_rapid_cache",
"async": false,
"parameters": [
{
"type": "::Google::Cloud::Storage::Control::V2::DisableRapidCacheRequest",
"name": "request"
}
],
"result_type": "::Google::Longrunning::Operation",
"client": {
"short_name": "StorageControl::Client",
"full_name": "::Google::Cloud::Storage::Control::V2::StorageControl::Client"
},
"method": {
"short_name": "DisableRapidCache",
"full_name": "google.storage.control.v2.StorageControl.DisableRapidCache",
"service": {
"short_name": "StorageControl",
"full_name": "google.storage.control.v2.StorageControl"
}
}
},
"canonical": true,
"origin": "API_DEFINITION",
"segments": [
{
"start": 20,
"end": 53,
"type": "FULL"
}
]
},
{
"region_tag": "storage_v2_generated_StorageControl_GetRapidCache_sync",
"title": "Snippet for the get_rapid_cache call in the StorageControl service",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# frozen_string_literal: true

# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Auto-generated by gapic-generator-ruby. DO NOT EDIT!

# [START storage_v2_generated_StorageControl_DisableRapidCache_sync]
require "google/cloud/storage/control/v2"

##
# Snippet for the disable_rapid_cache call in the StorageControl service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Storage::Control::V2::StorageControl::Client#disable_rapid_cache.
#
def disable_rapid_cache
# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Storage::Control::V2::DisableRapidCacheRequest.new

# Call the disable_rapid_cache method.
result = client.disable_rapid_cache request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
p result.response
else
puts "No response received."
end
end
# [END storage_v2_generated_StorageControl_DisableRapidCache_sync]
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,71 @@ def test_update_rapid_cache
end
end

def test_disable_rapid_cache
# Create GRPC objects.
grpc_response = ::Google::Longrunning::Operation.new
grpc_operation = GRPC::ActiveCall::Operation.new nil
grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
grpc_options = {}

# Create request parameters for a unary method.
name = "hello world"
request_id = "hello world"

disable_rapid_cache_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
assert_equal :disable_rapid_cache, name
assert_kind_of ::Google::Cloud::Storage::Control::V2::DisableRapidCacheRequest, request
assert_equal "hello world", request["name"]
assert_equal "hello world", request["request_id"]
refute_nil options
end

Gapic::ServiceStub.stub :new, disable_rapid_cache_client_stub do
# Create client
c = ::Google::Cloud::Storage::Control::V2::StorageControl::Client.new do |config|
config.credentials = grpc_channel
end

# Use hash object
c.disable_rapid_cache({ name: name, request_id: request_id }) do |response, operation|
assert_kind_of Gapic::Operation, response
assert_equal grpc_response, response.grpc_op
assert_equal grpc_operation, operation
end

# Use named arguments
c.disable_rapid_cache name: name, request_id: request_id do |response, operation|
assert_kind_of Gapic::Operation, response
assert_equal grpc_response, response.grpc_op
assert_equal grpc_operation, operation
end

# Use protobuf object
c.disable_rapid_cache ::Google::Cloud::Storage::Control::V2::DisableRapidCacheRequest.new(name: name, request_id: request_id) do |response, operation|
assert_kind_of Gapic::Operation, response
assert_equal grpc_response, response.grpc_op
assert_equal grpc_operation, operation
end

# Use hash object with options
c.disable_rapid_cache({ name: name, request_id: request_id }, grpc_options) do |response, operation|
assert_kind_of Gapic::Operation, response
assert_equal grpc_response, response.grpc_op
assert_equal grpc_operation, operation
end

# Use protobuf object with options
c.disable_rapid_cache(::Google::Cloud::Storage::Control::V2::DisableRapidCacheRequest.new(name: name, request_id: request_id), grpc_options) do |response, operation|
assert_kind_of Gapic::Operation, response
assert_equal grpc_response, response.grpc_op
assert_equal grpc_operation, operation
end

# Verify method calls
assert_equal 5, disable_rapid_cache_client_stub.call_rpc_count
end
end

def test_get_rapid_cache
# Create GRPC objects.
grpc_response = ::Google::Cloud::Storage::Control::V2::RapidCache.new
Expand Down
Loading