lib/google/cloud/dataflow/v1beta3/templates_service/rest/service_stub.rb in google-cloud-dataflow-v1beta3-0.9.1 vs lib/google/cloud/dataflow/v1beta3/templates_service/rest/service_stub.rb in google-cloud-dataflow-v1beta3-0.10.0

- old
+ new

@@ -28,21 +28,24 @@ # REST service stub for the TemplatesService 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: true, - 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 create_job_from_template REST call # # @param request_pb [::Google::Cloud::Dataflow::V1beta3::CreateJobFromTemplateRequest] # 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: "create_job_from_template", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Dataflow::V1beta3::Job.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 launch_template 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: "launch_template", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Dataflow::V1beta3::LaunchTemplateResponse.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_template REST call # @@ -161,19 +177,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: "get_template", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Dataflow::V1beta3::GetTemplateResponse.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 #