lib/google/cloud/memcache/v1beta2/cloud_memcache/client.rb in google-cloud-memcache-v1beta2-0.2.3 vs lib/google/cloud/memcache/v1beta2/cloud_memcache/client.rb in google-cloud-memcache-v1beta2-0.2.4

- old
+ new

@@ -230,10 +230,31 @@ # # @return [::Gapic::PagedEnumerable<::Google::Cloud::Memcache::V1beta2::Instance>] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/memcache/v1beta2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Memcache::V1beta2::CloudMemcache::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Memcache::V1beta2::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::Memcache::V1beta2::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::Memcache::V1beta2::ListInstancesRequest @@ -247,13 +268,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::Memcache::V1beta2::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, @@ -301,10 +324,25 @@ # # @return [::Google::Cloud::Memcache::V1beta2::Instance] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/memcache/v1beta2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Memcache::V1beta2::CloudMemcache::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Memcache::V1beta2::GetInstanceRequest.new + # + # # Call the get_instance method. + # result = client.get_instance request + # + # # The returned object is of type Google::Cloud::Memcache::V1beta2::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::Memcache::V1beta2::GetInstanceRequest @@ -318,13 +356,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::Memcache::V1beta2::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, @@ -384,10 +424,32 @@ # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/memcache/v1beta2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Memcache::V1beta2::CloudMemcache::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Memcache::V1beta2::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::Memcache::V1beta2::CreateInstanceRequest @@ -401,13 +463,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::Memcache::V1beta2::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, @@ -457,10 +521,32 @@ # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/memcache/v1beta2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Memcache::V1beta2::CloudMemcache::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Memcache::V1beta2::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::Memcache::V1beta2::UpdateInstanceRequest @@ -474,13 +560,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::Memcache::V1beta2::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - header_params = { - "resource.name" => request.resource.name - } + header_params = {} + if request.resource&.name + header_params["resource.name"] = request.resource.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, @@ -534,10 +622,32 @@ # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/memcache/v1beta2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Memcache::V1beta2::CloudMemcache::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Memcache::V1beta2::UpdateParametersRequest.new + # + # # Call the update_parameters method. + # result = client.update_parameters 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_parameters request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memcache::V1beta2::UpdateParametersRequest @@ -551,13 +661,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::Memcache::V1beta2::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.update_parameters.timeout, metadata: metadata, @@ -605,10 +717,32 @@ # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/memcache/v1beta2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Memcache::V1beta2::CloudMemcache::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Memcache::V1beta2::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::Memcache::V1beta2::DeleteInstanceRequest @@ -622,13 +756,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::Memcache::V1beta2::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, @@ -682,10 +818,32 @@ # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/memcache/v1beta2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Memcache::V1beta2::CloudMemcache::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Memcache::V1beta2::ApplyParametersRequest.new + # + # # Call the apply_parameters method. + # result = client.apply_parameters 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 apply_parameters request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memcache::V1beta2::ApplyParametersRequest @@ -699,13 +857,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::Memcache::V1beta2::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.apply_parameters.timeout, metadata: metadata, @@ -759,10 +919,32 @@ # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/memcache/v1beta2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Memcache::V1beta2::CloudMemcache::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Memcache::V1beta2::ApplySoftwareUpdateRequest.new + # + # # Call the apply_software_update method. + # result = client.apply_software_update 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 apply_software_update request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memcache::V1beta2::ApplySoftwareUpdateRequest @@ -776,12 +958,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::Memcache::V1beta2::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - header_params = { - "instance" => request.instance - } + header_params = {} + if request.instance + header_params["instance"] = request.instance + 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.apply_software_update.timeout, metadata: metadata,