lib/google/cloud/functions/v1/cloud_functions_service/client.rb in google-cloud-functions-v1-0.4.0 vs lib/google/cloud/functions/v1/cloud_functions_service/client.rb in google-cloud-functions-v1-0.5.0

- old
+ new

@@ -219,10 +219,31 @@ # # @return [::Gapic::PagedEnumerable<::Google::Cloud::Functions::V1::CloudFunction>] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/functions/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Functions::V1::ListFunctionsRequest.new + # + # # Call the list_functions method. + # result = client.list_functions 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::Functions::V1::CloudFunction. + # p response + # end + # def list_functions request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::ListFunctionsRequest @@ -236,13 +257,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::Functions::V1::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_functions.timeout, metadata: metadata, @@ -288,10 +311,25 @@ # # @return [::Google::Cloud::Functions::V1::CloudFunction] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/functions/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Functions::V1::GetFunctionRequest.new + # + # # Call the get_function method. + # result = client.get_function request + # + # # The returned object is of type Google::Cloud::Functions::V1::CloudFunction. + # p result + # def get_function request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::GetFunctionRequest @@ -305,13 +343,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::Functions::V1::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_function.timeout, metadata: metadata, @@ -361,10 +401,32 @@ # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/functions/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Functions::V1::CreateFunctionRequest.new + # + # # Call the create_function method. + # result = client.create_function 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_function request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::CreateFunctionRequest @@ -378,13 +440,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::Functions::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - header_params = { - "location" => request.location - } + header_params = {} + if request.location + header_params["location"] = request.location + 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_function.timeout, metadata: metadata, @@ -432,10 +496,32 @@ # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/functions/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Functions::V1::UpdateFunctionRequest.new + # + # # Call the update_function method. + # result = client.update_function 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_function request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::UpdateFunctionRequest @@ -449,13 +535,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::Functions::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - header_params = { - "function.name" => request.function.name - } + header_params = {} + if request.function&.name + header_params["function.name"] = request.function.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_function.timeout, metadata: metadata, @@ -503,10 +591,32 @@ # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/functions/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Functions::V1::DeleteFunctionRequest.new + # + # # Call the delete_function method. + # result = client.delete_function 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_function request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::DeleteFunctionRequest @@ -520,13 +630,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::Functions::V1::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_function.timeout, metadata: metadata, @@ -577,10 +689,25 @@ # # @return [::Google::Cloud::Functions::V1::CallFunctionResponse] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/functions/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Functions::V1::CallFunctionRequest.new + # + # # Call the call_function method. + # result = client.call_function request + # + # # The returned object is of type Google::Cloud::Functions::V1::CallFunctionResponse. + # p result + # def call_function request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::CallFunctionRequest @@ -594,13 +721,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::Functions::V1::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.call_function.timeout, metadata: metadata, @@ -670,10 +799,25 @@ # # @return [::Google::Cloud::Functions::V1::GenerateUploadUrlResponse] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/functions/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Functions::V1::GenerateUploadUrlRequest.new + # + # # Call the generate_upload_url method. + # result = client.generate_upload_url request + # + # # The returned object is of type Google::Cloud::Functions::V1::GenerateUploadUrlResponse. + # p result + # def generate_upload_url request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::GenerateUploadUrlRequest @@ -687,13 +831,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::Functions::V1::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.generate_upload_url.timeout, metadata: metadata, @@ -746,10 +892,25 @@ # # @return [::Google::Cloud::Functions::V1::GenerateDownloadUrlResponse] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/functions/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Functions::V1::GenerateDownloadUrlRequest.new + # + # # Call the generate_download_url method. + # result = client.generate_download_url request + # + # # The returned object is of type Google::Cloud::Functions::V1::GenerateDownloadUrlResponse. + # p result + # def generate_download_url request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::GenerateDownloadUrlRequest @@ -763,13 +924,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::Functions::V1::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.generate_download_url.timeout, metadata: metadata, @@ -821,10 +984,25 @@ # # @return [::Google::Iam::V1::Policy] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/functions/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Iam::V1::SetIamPolicyRequest.new + # + # # Call the set_iam_policy method. + # result = client.set_iam_policy request + # + # # The returned object is of type Google::Iam::V1::Policy. + # p result + # def set_iam_policy request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest @@ -838,13 +1016,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::Functions::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - header_params = { - "resource" => request.resource - } + header_params = {} + if request.resource + header_params["resource"] = request.resource + 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.set_iam_policy.timeout, metadata: metadata, @@ -895,10 +1075,25 @@ # # @return [::Google::Iam::V1::Policy] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/functions/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Iam::V1::GetIamPolicyRequest.new + # + # # Call the get_iam_policy method. + # result = client.get_iam_policy request + # + # # The returned object is of type Google::Iam::V1::Policy. + # p result + # def get_iam_policy request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest @@ -912,13 +1107,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::Functions::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - header_params = { - "resource" => request.resource - } + header_params = {} + if request.resource + header_params["resource"] = request.resource + 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_iam_policy.timeout, metadata: metadata, @@ -972,10 +1169,25 @@ # # @return [::Google::Iam::V1::TestIamPermissionsResponse] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/functions/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Iam::V1::TestIamPermissionsRequest.new + # + # # Call the test_iam_permissions method. + # result = client.test_iam_permissions request + # + # # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse. + # p result + # def test_iam_permissions request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest @@ -989,12 +1201,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::Functions::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - header_params = { - "resource" => request.resource - } + header_params = {} + if request.resource + header_params["resource"] = request.resource + 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.test_iam_permissions.timeout, metadata: metadata,