lib/google/cloud/compute/v1/region_commitments/rest/service_stub.rb in google-cloud-compute-v1-1.0.0 vs lib/google/cloud/compute/v1/region_commitments/rest/service_stub.rb in google-cloud-compute-v1-1.1.0

- old
+ new

@@ -223,9 +223,57 @@ query_string_params["pageToken"] = request_pb.page_token.to_s if request_pb.has_page_token? query_string_params["returnPartialSuccess"] = request_pb.return_partial_success.to_s if request_pb.has_return_partial_success? [uri, body, query_string_params] end + + ## + # Baseline implementation for the update REST call + # + # @param request_pb [::Google::Cloud::Compute::V1::UpdateRegionCommitmentRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Google::Cloud::Compute::V1::Operation] + # @yieldparam response [::Faraday::Response] + # + # @return [::Google::Cloud::Compute::V1::Operation] + # A result object deserialized from the server's reply + def update request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + uri, body, query_string_params = transcode_update_request request_pb + response = @client_stub.make_patch_request( + uri: uri, + body: body, + params: query_string_params, + options: options + ) + result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true + + yield result, response if block_given? + result + end + + ## + # GRPC transcoding helper method for the update REST call + # + # @param request_pb [::Google::Cloud::Compute::V1::UpdateRegionCommitmentRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def transcode_update_request request_pb + uri = "/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/commitments/#{request_pb.commitment}" + body = request_pb.commitment_resource.to_json + query_string_params = {} + query_string_params["paths"] = request_pb.paths.to_s if request_pb.has_paths? + query_string_params["requestId"] = request_pb.request_id.to_s if request_pb.has_request_id? + query_string_params["updateMask"] = request_pb.update_mask.to_s if request_pb.has_update_mask? + + [uri, body, query_string_params] + end end end end end end