lib/google/cloud/datastream/v1alpha1/datastream/rest/service_stub.rb in google-cloud-datastream-v1alpha1-0.7.1 vs lib/google/cloud/datastream/v1alpha1/datastream/rest/service_stub.rb in google-cloud-datastream-v1alpha1-0.8.0
- old
+ new
@@ -28,21 +28,24 @@
# REST service stub for the Datastream 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 list_connection_profiles REST call
#
# @param request_pb [::Google::Cloud::Datastream::V1alpha1::ListConnectionProfilesRequest]
# 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: "list_connection_profiles",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Cloud::Datastream::V1alpha1::ListConnectionProfilesResponse.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_connection_profile 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: "get_connection_profile",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Cloud::Datastream::V1alpha1::ConnectionProfile.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_connection_profile 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_connection_profile",
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_connection_profile 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_connection_profile",
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_connection_profile 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_connection_profile",
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 discover_connection_profile 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: "discover_connection_profile",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Cloud::Datastream::V1alpha1::DiscoverConnectionProfileResponse.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_streams 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_streams",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Cloud::Datastream::V1alpha1::ListStreamsResponse.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_stream 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: "get_stream",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Cloud::Datastream::V1alpha1::Stream.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_stream 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_stream",
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_stream 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_stream",
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_stream 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_stream",
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 fetch_errors 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: "fetch_errors",
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 fetch_static_ips 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: "fetch_static_ips",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Cloud::Datastream::V1alpha1::FetchStaticIpsResponse.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_private_connection 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: "create_private_connection",
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_private_connection 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: "get_private_connection",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Cloud::Datastream::V1alpha1::PrivateConnection.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_private_connections 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: "list_private_connections",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Cloud::Datastream::V1alpha1::ListPrivateConnectionsResponse.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_private_connection 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_private_connection",
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 create_route 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: "create_route",
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_route 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: "get_route",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Cloud::Datastream::V1alpha1::Route.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_routes REST call
#
@@ -807,20 +857,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_routes",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Cloud::Datastream::V1alpha1::ListRoutesResponse.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_route REST call
#
@@ -845,19 +897,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: "delete_route",
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
##
# @private
#