lib/google/cloud/compute/v1/projects/rest/service_stub.rb in google-cloud-compute-v1-2.14.0 vs lib/google/cloud/compute/v1/projects/rest/service_stub.rb in google-cloud-compute-v1-2.15.0

- old
+ new

@@ -28,21 +28,24 @@ # REST service stub for the Projects service. # Service stub contains baseline method implementations # including transcoding, making the REST call, and deserialing the response. # class ServiceStub - def initialize endpoint:, endpoint_template:, universe_domain:, credentials: + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: # These require statements are intentionally placed here to initialize # the REST modules only when it's required. require "gapic/rest" @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, endpoint_template: endpoint_template, universe_domain: universe_domain, credentials: credentials, numeric_enums: false, - raise_faraday_errors: false + service_name: self.class, + raise_faraday_errors: false, + logger: logger end ## # The effective universe domain # @@ -60,10 +63,19 @@ def endpoint @client_stub.endpoint end ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## # Baseline implementation for the disable_xpn_host REST call # # @param request_pb [::Google::Cloud::Compute::V1::DisableXpnHostProjectRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] @@ -85,20 +97,22 @@ {} end response = @client_stub.make_http_request( verb, - uri: uri, - body: body || "", - params: query_string_params, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "disable_xpn_host", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true - - yield result, operation if block_given? - result + catch :response do + yield result, operation if block_given? + result + end end ## # Baseline implementation for the disable_xpn_resource REST call # @@ -123,20 +137,22 @@ {} end response = @client_stub.make_http_request( verb, - uri: uri, - body: body || "", - params: query_string_params, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "disable_xpn_resource", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true - - yield result, operation if block_given? - result + catch :response do + yield result, operation if block_given? + result + end end ## # Baseline implementation for the enable_xpn_host REST call # @@ -161,20 +177,22 @@ {} end response = @client_stub.make_http_request( verb, - uri: uri, - body: body || "", - params: query_string_params, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "enable_xpn_host", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true - - yield result, operation if block_given? - result + catch :response do + yield result, operation if block_given? + result + end end ## # Baseline implementation for the enable_xpn_resource REST call # @@ -199,20 +217,22 @@ {} end response = @client_stub.make_http_request( verb, - uri: uri, - body: body || "", - params: query_string_params, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "enable_xpn_resource", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true - - yield result, operation if block_given? - result + catch :response do + yield result, operation if block_given? + result + end end ## # Baseline implementation for the get REST call # @@ -237,20 +257,22 @@ {} end response = @client_stub.make_http_request( verb, - uri: uri, - body: body || "", - params: query_string_params, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Compute::V1::Project.decode_json response.body, ignore_unknown_fields: true - - yield result, operation if block_given? - result + catch :response do + yield result, operation if block_given? + result + end end ## # Baseline implementation for the get_xpn_host REST call # @@ -275,20 +297,22 @@ {} end response = @client_stub.make_http_request( verb, - uri: uri, - body: body || "", - params: query_string_params, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_xpn_host", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Compute::V1::Project.decode_json response.body, ignore_unknown_fields: true - - yield result, operation if block_given? - result + catch :response do + yield result, operation if block_given? + result + end end ## # Baseline implementation for the get_xpn_resources REST call # @@ -313,20 +337,22 @@ {} end response = @client_stub.make_http_request( verb, - uri: uri, - body: body || "", - params: query_string_params, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_xpn_resources", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Compute::V1::ProjectsGetXpnResources.decode_json response.body, ignore_unknown_fields: true - - yield result, operation if block_given? - result + catch :response do + yield result, operation if block_given? + result + end end ## # Baseline implementation for the list_xpn_hosts REST call # @@ -351,20 +377,22 @@ {} end response = @client_stub.make_http_request( verb, - uri: uri, - body: body || "", - params: query_string_params, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_xpn_hosts", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Compute::V1::XpnHostList.decode_json response.body, ignore_unknown_fields: true - - yield result, operation if block_given? - result + catch :response do + yield result, operation if block_given? + result + end end ## # Baseline implementation for the move_disk REST call # @@ -389,20 +417,22 @@ {} end response = @client_stub.make_http_request( verb, - uri: uri, - body: body || "", - params: query_string_params, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "move_disk", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true - - yield result, operation if block_given? - result + catch :response do + yield result, operation if block_given? + result + end end ## # Baseline implementation for the move_instance REST call # @@ -427,20 +457,22 @@ {} end response = @client_stub.make_http_request( verb, - uri: uri, - body: body || "", - params: query_string_params, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "move_instance", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true - - yield result, operation if block_given? - result + catch :response do + yield result, operation if block_given? + result + end end ## # Baseline implementation for the set_cloud_armor_tier REST call # @@ -465,20 +497,22 @@ {} end response = @client_stub.make_http_request( verb, - uri: uri, - body: body || "", - params: query_string_params, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "set_cloud_armor_tier", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true - - yield result, operation if block_given? - result + catch :response do + yield result, operation if block_given? + result + end end ## # Baseline implementation for the set_common_instance_metadata REST call # @@ -503,20 +537,22 @@ {} end response = @client_stub.make_http_request( verb, - uri: uri, - body: body || "", - params: query_string_params, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "set_common_instance_metadata", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true - - yield result, operation if block_given? - result + catch :response do + yield result, operation if block_given? + result + end end ## # Baseline implementation for the set_default_network_tier REST call # @@ -541,20 +577,22 @@ {} end response = @client_stub.make_http_request( verb, - uri: uri, - body: body || "", - params: query_string_params, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "set_default_network_tier", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true - - yield result, operation if block_given? - result + catch :response do + yield result, operation if block_given? + result + end end ## # Baseline implementation for the set_usage_export_bucket REST call # @@ -579,19 +617,21 @@ {} end response = @client_stub.make_http_request( verb, - uri: uri, - body: body || "", - params: query_string_params, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "set_usage_export_bucket", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true - - yield result, operation if block_given? - result + catch :response do + yield result, operation if block_given? + result + end end ## # @private #