lib/google/cloud/app_engine/v1/instances/rest/operations.rb in google-cloud-app_engine-v1-0.8.0 vs lib/google/cloud/app_engine/v1/instances/rest/operations.rb in google-cloud-app_engine-v1-0.9.0
- old
+ new
@@ -25,10 +25,13 @@
module Instances
module Rest
# Service that implements Longrunning Operations API.
class Operations
# @private
+ DEFAULT_ENDPOINT_TEMPLATE = "appengine.$UNIVERSE_DOMAIN$"
+
+ # @private
attr_reader :operations_stub
##
# Configuration for the Instances Operations API.
#
@@ -59,10 +62,19 @@
yield @config if block_given?
@config
end
##
+ # The effective universe domain
+ #
+ # @return [String]
+ #
+ def universe_domain
+ @operations_stub.universe_domain
+ end
+
+ ##
# Create a new Operations client object.
#
# @yield [config] Configure the Client client.
# @yieldparam config [Operations::Configuration]
#
@@ -82,12 +94,14 @@
@quota_project_id = @config.quota_project
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
@operations_stub = OperationsServiceStub.new(
- endpoint: @config.endpoint,
- credentials: credentials
+ endpoint: @config.endpoint,
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
+ universe_domain: @config.universe_domain,
+ credentials: credentials
)
# Used by an LRO wrapper for some methods of this service
@operations_client = self
end
@@ -476,13 +490,13 @@
# config.timeout = 10.0
# config.rpcs.list_operations.timeout = 20.0
# end
#
# @!attribute [rw] endpoint
- # The hostname or hostname:port of the service endpoint.
- # Defaults to `"appengine.googleapis.com"`.
- # @return [::String]
+ # A custom service endpoint, as a hostname or hostname:port. The default is
+ # nil, indicating to use the default endpoint in the current universe domain.
+ # @return [::String,nil]
# @!attribute [rw] credentials
# Credentials to send with calls. You may provide any of the following types:
# * (`String`) The path to a service account key file in JSON format
# * (`Hash`) A service account key as a Hash
# * (`Google::Auth::Credentials`) A googleauth credentials object
@@ -515,17 +529,24 @@
# trigger a retry.
# @return [::Hash]
# @!attribute [rw] quota_project
# A separate project against which to charge quota.
# @return [::String]
+ # @!attribute [rw] universe_domain
+ # The universe domain within which to make requests. This determines the
+ # default endpoint URL. The default value of nil uses the environment
+ # universe (usually the default "googleapis.com" universe).
+ # @return [::String,nil]
#
class Configuration
extend ::Gapic::Config
+ # @private
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
DEFAULT_ENDPOINT = "appengine.googleapis.com"
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
+ config_attr :endpoint, nil, ::String, nil
config_attr :credentials, nil do |value|
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
allowed.any? { |klass| klass === value }
end
config_attr :scope, nil, ::String, ::Array, nil
@@ -533,10 +554,11 @@
config_attr :lib_version, nil, ::String, nil
config_attr :timeout, nil, ::Numeric, nil
config_attr :metadata, nil, ::Hash, nil
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
config_attr :quota_project, nil, ::String, nil
+ config_attr :universe_domain, nil, ::String, nil
# @private
def initialize parent_config = nil
@parent_config = parent_config unless parent_config.nil?
@@ -615,15 +637,18 @@
# @private
# REST service stub for the Longrunning Operations API.
# Service stub contains baseline method implementations
# including transcoding, making the REST call, and deserialing the response.
class OperationsServiceStub
- def initialize endpoint:, credentials:
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
# 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, credentials: credentials
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
+ endpoint_template: endpoint_template,
+ universe_domain: universe_domain,
+ credentials: credentials
end
##
# Baseline implementation for the list_operations REST call
#