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

- old
+ new

@@ -28,21 +28,24 @@ # REST service stub for the ForwardingRules 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 aggregated_list REST call # # @param request_pb [::Google::Cloud::Compute::V1::AggregatedListForwardingRulesRequest] # 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: "aggregated_list", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Compute::V1::ForwardingRuleAggregatedList.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 delete 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: "delete", 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 # @@ -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: "get", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Compute::V1::ForwardingRule.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 insert 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: "insert", 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 list 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: "list", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Compute::V1::ForwardingRuleList.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 patch 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: "patch", 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_labels 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: "set_labels", 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_target REST call # @@ -351,19 +377,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_target", 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 #