lib/google/cloud/redis/v1beta1/cloud_redis/client.rb in google-cloud-redis-v1beta1-0.4.3 vs lib/google/cloud/redis/v1beta1/cloud_redis/client.rb in google-cloud-redis-v1beta1-0.4.4

- old
+ new

@@ -236,10 +236,31 @@ # # @return [::Gapic::PagedEnumerable<::Google::Cloud::Redis::V1beta1::Instance>] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/redis/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::V1beta1::CloudRedis::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::V1beta1::ListInstancesRequest.new + # + # # Call the list_instances method. + # result = client.list_instances request + # + # # The returned object is of type Gapic::PagedEnumerable. You can + # # iterate over all elements by calling #each, and the enumerable + # # will lazily make API calls to fetch subsequent pages. Other + # # methods are also available for managing paging directly. + # result.each do |response| + # # Each element is of type ::Google::Cloud::Redis::V1beta1::Instance. + # p response + # end + # def list_instances request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::ListInstancesRequest @@ -253,13 +274,15 @@ 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::Redis::V1beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - header_params = { - "parent" => request.parent - } + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_instances.timeout, metadata: metadata, @@ -307,10 +330,25 @@ # # @return [::Google::Cloud::Redis::V1beta1::Instance] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/redis/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::V1beta1::CloudRedis::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::V1beta1::GetInstanceRequest.new + # + # # Call the get_instance method. + # result = client.get_instance request + # + # # The returned object is of type Google::Cloud::Redis::V1beta1::Instance. + # p result + # def get_instance request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::GetInstanceRequest @@ -324,13 +362,15 @@ 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::Redis::V1beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - header_params = { - "name" => request.name - } + header_params = {} + if request.name + header_params["name"] = request.name + end + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_instance.timeout, metadata: metadata, @@ -399,10 +439,32 @@ # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/redis/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::V1beta1::CloudRedis::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::V1beta1::CreateInstanceRequest.new + # + # # Call the create_instance method. + # result = client.create_instance request + # + # # The returned object is of type Gapic::Operation. You can use this + # # object to check the status of an operation, cancel it, or wait + # # for results. Here is how to block until completion: + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "Error!" + # end + # def create_instance request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::CreateInstanceRequest @@ -416,13 +478,15 @@ 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::Redis::V1beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - header_params = { - "parent" => request.parent - } + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.create_instance.timeout, metadata: metadata, @@ -482,10 +546,32 @@ # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/redis/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::V1beta1::CloudRedis::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::V1beta1::UpdateInstanceRequest.new + # + # # Call the update_instance method. + # result = client.update_instance request + # + # # The returned object is of type Gapic::Operation. You can use this + # # object to check the status of an operation, cancel it, or wait + # # for results. Here is how to block until completion: + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "Error!" + # end + # def update_instance request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::UpdateInstanceRequest @@ -499,13 +585,15 @@ 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::Redis::V1beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - header_params = { - "instance.name" => request.instance.name - } + header_params = {} + if request.instance&.name + header_params["instance.name"] = request.instance.name + end + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.update_instance.timeout, metadata: metadata, @@ -556,10 +644,32 @@ # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/redis/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::V1beta1::CloudRedis::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::V1beta1::UpgradeInstanceRequest.new + # + # # Call the upgrade_instance method. + # result = client.upgrade_instance request + # + # # The returned object is of type Gapic::Operation. You can use this + # # object to check the status of an operation, cancel it, or wait + # # for results. Here is how to block until completion: + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "Error!" + # end + # def upgrade_instance request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::UpgradeInstanceRequest @@ -573,13 +683,15 @@ 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::Redis::V1beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - header_params = { - "name" => request.name - } + header_params = {} + if request.name + header_params["name"] = request.name + end + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.upgrade_instance.timeout, metadata: metadata, @@ -636,10 +748,32 @@ # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/redis/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::V1beta1::CloudRedis::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::V1beta1::ImportInstanceRequest.new + # + # # Call the import_instance method. + # result = client.import_instance request + # + # # The returned object is of type Gapic::Operation. You can use this + # # object to check the status of an operation, cancel it, or wait + # # for results. Here is how to block until completion: + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "Error!" + # end + # def import_instance request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::ImportInstanceRequest @@ -653,13 +787,15 @@ 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::Redis::V1beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - header_params = { - "name" => request.name - } + header_params = {} + if request.name + header_params["name"] = request.name + end + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.import_instance.timeout, metadata: metadata, @@ -714,10 +850,32 @@ # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/redis/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::V1beta1::CloudRedis::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::V1beta1::ExportInstanceRequest.new + # + # # Call the export_instance method. + # result = client.export_instance request + # + # # The returned object is of type Gapic::Operation. You can use this + # # object to check the status of an operation, cancel it, or wait + # # for results. Here is how to block until completion: + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "Error!" + # end + # def export_instance request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::ExportInstanceRequest @@ -731,13 +889,15 @@ 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::Redis::V1beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - header_params = { - "name" => request.name - } + header_params = {} + if request.name + header_params["name"] = request.name + end + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.export_instance.timeout, metadata: metadata, @@ -789,10 +949,32 @@ # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/redis/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::V1beta1::CloudRedis::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::V1beta1::FailoverInstanceRequest.new + # + # # Call the failover_instance method. + # result = client.failover_instance request + # + # # The returned object is of type Gapic::Operation. You can use this + # # object to check the status of an operation, cancel it, or wait + # # for results. Here is how to block until completion: + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "Error!" + # end + # def failover_instance request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::FailoverInstanceRequest @@ -806,13 +988,15 @@ 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::Redis::V1beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - header_params = { - "name" => request.name - } + header_params = {} + if request.name + header_params["name"] = request.name + end + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.failover_instance.timeout, metadata: metadata, @@ -861,10 +1045,32 @@ # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/redis/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::V1beta1::CloudRedis::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::V1beta1::DeleteInstanceRequest.new + # + # # Call the delete_instance method. + # result = client.delete_instance request + # + # # The returned object is of type Gapic::Operation. You can use this + # # object to check the status of an operation, cancel it, or wait + # # for results. Here is how to block until completion: + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "Error!" + # end + # def delete_instance request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::DeleteInstanceRequest @@ -878,12 +1084,14 @@ 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::Redis::V1beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - header_params = { - "name" => request.name - } + header_params = {} + if request.name + header_params["name"] = request.name + end + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.delete_instance.timeout, metadata: metadata,