lib/google/cloud/workstations/v1/workstations/rest/service_stub.rb in google-cloud-workstations-v1-0.1.3 vs lib/google/cloud/workstations/v1/workstations/rest/service_stub.rb in google-cloud-workstations-v1-0.2.0

- old
+ new

@@ -28,21 +28,24 @@ # REST service stub for the Workstations 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 get_workstation_cluster REST call # # @param request_pb [::Google::Cloud::Workstations::V1::GetWorkstationClusterRequest] # 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: "get_workstation_cluster", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Workstations::V1::WorkstationCluster.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_workstation_clusters 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: "list_workstation_clusters", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Workstations::V1::ListWorkstationClustersResponse.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 create_workstation_cluster 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: "create_workstation_cluster", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Longrunning::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 update_workstation_cluster 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: "update_workstation_cluster", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Longrunning::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 delete_workstation_cluster 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: "delete_workstation_cluster", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Longrunning::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_workstation_config 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_workstation_config", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Workstations::V1::WorkstationConfig.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_workstation_configs 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: "list_workstation_configs", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Workstations::V1::ListWorkstationConfigsResponse.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_usable_workstation_configs 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_usable_workstation_configs", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Workstations::V1::ListUsableWorkstationConfigsResponse.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 create_workstation_config 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: "create_workstation_config", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Longrunning::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 update_workstation_config 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: "update_workstation_config", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Longrunning::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 delete_workstation_config 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: "delete_workstation_config", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Longrunning::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_workstation 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: "get_workstation", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Workstations::V1::Workstation.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_workstations 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: "list_workstations", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Workstations::V1::ListWorkstationsResponse.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_usable_workstations REST call # @@ -579,20 +617,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_usable_workstations", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Workstations::V1::ListUsableWorkstationsResponse.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 create_workstation REST call # @@ -617,20 +657,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_workstation", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Longrunning::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 update_workstation REST call # @@ -655,20 +697,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: "update_workstation", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Longrunning::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 delete_workstation REST call # @@ -693,20 +737,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_workstation", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Longrunning::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 start_workstation REST call # @@ -731,20 +777,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: "start_workstation", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Longrunning::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 stop_workstation REST call # @@ -769,20 +817,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: "stop_workstation", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Longrunning::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 generate_access_token REST call # @@ -807,19 +857,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: "generate_access_token", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Workstations::V1::GenerateAccessTokenResponse.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 #