module Gapic::UniverseDomainConcerns

def setup_universe_domain universe_domain: nil,

Other tags:
    Private: -
def setup_universe_domain universe_domain: nil,
                          endpoint: nil,
                          endpoint_template: nil,
                          credentials: nil
  raise ArgumentError, "endpoint or endpoint_template is required" if endpoint.nil? && endpoint_template.nil?
  raise ArgumentError, "credentials is required" if credentials.nil?
  universe_domain ||= ENV["GOOGLE_CLOUD_UNIVERSE_DOMAIN"] || "googleapis.com"
  endpoint ||= endpoint_template.sub ENDPOINT_SUBSTITUTION, universe_domain
  if !(credentials.respond_to?(:disable_universe_domain_check) && credentials.disable_universe_domain_check) &&
     credentials.respond_to?(:universe_domain) && credentials.universe_domain != universe_domain
    raise UniverseDomainMismatch,
          "Universe domain is #{universe_domain} but credentials are in #{credentials.universe_domain}"
  end
  @universe_domain = universe_domain
  @endpoint = endpoint
  @credentials = credentials
end