google-cloud-app_engine-v1 0.8.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +72 -101
  3. data/lib/google/cloud/app_engine/v1/applications/client.rb +32 -8
  4. data/lib/google/cloud/app_engine/v1/applications/operations.rb +28 -6
  5. data/lib/google/cloud/app_engine/v1/applications/rest/client.rb +34 -7
  6. data/lib/google/cloud/app_engine/v1/applications/rest/operations.rb +33 -8
  7. data/lib/google/cloud/app_engine/v1/applications/rest/service_stub.rb +23 -2
  8. data/lib/google/cloud/app_engine/v1/authorized_certificates/client.rb +31 -8
  9. data/lib/google/cloud/app_engine/v1/authorized_certificates/rest/client.rb +33 -7
  10. data/lib/google/cloud/app_engine/v1/authorized_certificates/rest/service_stub.rb +23 -2
  11. data/lib/google/cloud/app_engine/v1/authorized_domains/client.rb +31 -8
  12. data/lib/google/cloud/app_engine/v1/authorized_domains/rest/client.rb +33 -7
  13. data/lib/google/cloud/app_engine/v1/authorized_domains/rest/service_stub.rb +23 -2
  14. data/lib/google/cloud/app_engine/v1/domain_mappings/client.rb +32 -8
  15. data/lib/google/cloud/app_engine/v1/domain_mappings/operations.rb +28 -6
  16. data/lib/google/cloud/app_engine/v1/domain_mappings/rest/client.rb +34 -7
  17. data/lib/google/cloud/app_engine/v1/domain_mappings/rest/operations.rb +33 -8
  18. data/lib/google/cloud/app_engine/v1/domain_mappings/rest/service_stub.rb +23 -2
  19. data/lib/google/cloud/app_engine/v1/firewall/client.rb +31 -8
  20. data/lib/google/cloud/app_engine/v1/firewall/rest/client.rb +33 -7
  21. data/lib/google/cloud/app_engine/v1/firewall/rest/service_stub.rb +23 -2
  22. data/lib/google/cloud/app_engine/v1/instances/client.rb +32 -8
  23. data/lib/google/cloud/app_engine/v1/instances/operations.rb +28 -6
  24. data/lib/google/cloud/app_engine/v1/instances/rest/client.rb +34 -7
  25. data/lib/google/cloud/app_engine/v1/instances/rest/operations.rb +33 -8
  26. data/lib/google/cloud/app_engine/v1/instances/rest/service_stub.rb +23 -2
  27. data/lib/google/cloud/app_engine/v1/services/client.rb +32 -8
  28. data/lib/google/cloud/app_engine/v1/services/operations.rb +28 -6
  29. data/lib/google/cloud/app_engine/v1/services/rest/client.rb +34 -7
  30. data/lib/google/cloud/app_engine/v1/services/rest/operations.rb +33 -8
  31. data/lib/google/cloud/app_engine/v1/services/rest/service_stub.rb +23 -2
  32. data/lib/google/cloud/app_engine/v1/version.rb +1 -1
  33. data/lib/google/cloud/app_engine/v1/versions/client.rb +32 -8
  34. data/lib/google/cloud/app_engine/v1/versions/operations.rb +28 -6
  35. data/lib/google/cloud/app_engine/v1/versions/rest/client.rb +34 -7
  36. data/lib/google/cloud/app_engine/v1/versions/rest/operations.rb +33 -8
  37. data/lib/google/cloud/app_engine/v1/versions/rest/service_stub.rb +23 -2
  38. data/proto_docs/google/api/client.rb +14 -0
  39. metadata +5 -5
@@ -30,16 +30,37 @@ module Google
30
30
  # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
- def initialize endpoint:, credentials:
33
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
34
34
  # These require statements are intentionally placed here to initialize
35
35
  # the REST modules only when it's required.
36
36
  require "gapic/rest"
37
37
 
38
- @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
38
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
39
+ endpoint_template: endpoint_template,
40
+ universe_domain: universe_domain,
41
+ credentials: credentials,
39
42
  numeric_enums: true,
40
43
  raise_faraday_errors: false
41
44
  end
42
45
 
46
+ ##
47
+ # The effective universe domain
48
+ #
49
+ # @return [String]
50
+ #
51
+ def universe_domain
52
+ @client_stub.universe_domain
53
+ end
54
+
55
+ ##
56
+ # The effective endpoint
57
+ #
58
+ # @return [String]
59
+ #
60
+ def endpoint
61
+ @client_stub.endpoint
62
+ end
63
+
43
64
  ##
44
65
  # Baseline implementation for the get_application REST call
45
66
  #
@@ -31,6 +31,9 @@ module Google
31
31
  # administer any SSL certificates applicable to their authorized domains.
32
32
  #
33
33
  class Client
34
+ # @private
35
+ DEFAULT_ENDPOINT_TEMPLATE = "appengine.$UNIVERSE_DOMAIN$"
36
+
34
37
  # @private
35
38
  attr_reader :authorized_certificates_stub
36
39
 
@@ -89,6 +92,15 @@ module Google
89
92
  @config
90
93
  end
91
94
 
95
+ ##
96
+ # The effective universe domain
97
+ #
98
+ # @return [String]
99
+ #
100
+ def universe_domain
101
+ @authorized_certificates_stub.universe_domain
102
+ end
103
+
92
104
  ##
93
105
  # Create a new AuthorizedCertificates client object.
94
106
  #
@@ -122,8 +134,9 @@ module Google
122
134
  credentials = @config.credentials
123
135
  # Use self-signed JWT if the endpoint is unchanged from default,
124
136
  # but only if the default endpoint does not have a region prefix.
125
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
126
- !@config.endpoint.split(".").first.include?("-")
137
+ enable_self_signed_jwt = @config.endpoint.nil? ||
138
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
139
+ !@config.endpoint.split(".").first.include?("-"))
127
140
  credentials ||= Credentials.default scope: @config.scope,
128
141
  enable_self_signed_jwt: enable_self_signed_jwt
129
142
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -134,8 +147,10 @@ module Google
134
147
 
135
148
  @authorized_certificates_stub = ::Gapic::ServiceStub.new(
136
149
  ::Google::Cloud::AppEngine::V1::AuthorizedCertificates::Stub,
137
- credentials: credentials,
138
- endpoint: @config.endpoint,
150
+ credentials: credentials,
151
+ endpoint: @config.endpoint,
152
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
153
+ universe_domain: @config.universe_domain,
139
154
  channel_args: @config.channel_args,
140
155
  interceptors: @config.interceptors,
141
156
  channel_pool_config: @config.channel_pool
@@ -627,9 +642,9 @@ module Google
627
642
  # end
628
643
  #
629
644
  # @!attribute [rw] endpoint
630
- # The hostname or hostname:port of the service endpoint.
631
- # Defaults to `"appengine.googleapis.com"`.
632
- # @return [::String]
645
+ # A custom service endpoint, as a hostname or hostname:port. The default is
646
+ # nil, indicating to use the default endpoint in the current universe domain.
647
+ # @return [::String,nil]
633
648
  # @!attribute [rw] credentials
634
649
  # Credentials to send with calls. You may provide any of the following types:
635
650
  # * (`String`) The path to a service account key file in JSON format
@@ -675,13 +690,20 @@ module Google
675
690
  # @!attribute [rw] quota_project
676
691
  # A separate project against which to charge quota.
677
692
  # @return [::String]
693
+ # @!attribute [rw] universe_domain
694
+ # The universe domain within which to make requests. This determines the
695
+ # default endpoint URL. The default value of nil uses the environment
696
+ # universe (usually the default "googleapis.com" universe).
697
+ # @return [::String,nil]
678
698
  #
679
699
  class Configuration
680
700
  extend ::Gapic::Config
681
701
 
702
+ # @private
703
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
682
704
  DEFAULT_ENDPOINT = "appengine.googleapis.com"
683
705
 
684
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
706
+ config_attr :endpoint, nil, ::String, nil
685
707
  config_attr :credentials, nil do |value|
686
708
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
687
709
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -696,6 +718,7 @@ module Google
696
718
  config_attr :metadata, nil, ::Hash, nil
697
719
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
698
720
  config_attr :quota_project, nil, ::String, nil
721
+ config_attr :universe_domain, nil, ::String, nil
699
722
 
700
723
  # @private
701
724
  def initialize parent_config = nil
@@ -33,6 +33,9 @@ module Google
33
33
  # administer any SSL certificates applicable to their authorized domains.
34
34
  #
35
35
  class Client
36
+ # @private
37
+ DEFAULT_ENDPOINT_TEMPLATE = "appengine.$UNIVERSE_DOMAIN$"
38
+
36
39
  # @private
37
40
  attr_reader :authorized_certificates_stub
38
41
 
@@ -91,6 +94,15 @@ module Google
91
94
  @config
92
95
  end
93
96
 
97
+ ##
98
+ # The effective universe domain
99
+ #
100
+ # @return [String]
101
+ #
102
+ def universe_domain
103
+ @authorized_certificates_stub.universe_domain
104
+ end
105
+
94
106
  ##
95
107
  # Create a new AuthorizedCertificates REST client object.
96
108
  #
@@ -118,8 +130,9 @@ module Google
118
130
  credentials = @config.credentials
119
131
  # Use self-signed JWT if the endpoint is unchanged from default,
120
132
  # but only if the default endpoint does not have a region prefix.
121
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
122
- !@config.endpoint.split(".").first.include?("-")
133
+ enable_self_signed_jwt = @config.endpoint.nil? ||
134
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
135
+ !@config.endpoint.split(".").first.include?("-"))
123
136
  credentials ||= Credentials.default scope: @config.scope,
124
137
  enable_self_signed_jwt: enable_self_signed_jwt
125
138
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -129,7 +142,12 @@ module Google
129
142
  @quota_project_id = @config.quota_project
130
143
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
131
144
 
132
- @authorized_certificates_stub = ::Google::Cloud::AppEngine::V1::AuthorizedCertificates::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
145
+ @authorized_certificates_stub = ::Google::Cloud::AppEngine::V1::AuthorizedCertificates::Rest::ServiceStub.new(
146
+ endpoint: @config.endpoint,
147
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
148
+ universe_domain: @config.universe_domain,
149
+ credentials: credentials
150
+ )
133
151
  end
134
152
 
135
153
  # Service calls
@@ -582,9 +600,9 @@ module Google
582
600
  # end
583
601
  #
584
602
  # @!attribute [rw] endpoint
585
- # The hostname or hostname:port of the service endpoint.
586
- # Defaults to `"appengine.googleapis.com"`.
587
- # @return [::String]
603
+ # A custom service endpoint, as a hostname or hostname:port. The default is
604
+ # nil, indicating to use the default endpoint in the current universe domain.
605
+ # @return [::String,nil]
588
606
  # @!attribute [rw] credentials
589
607
  # Credentials to send with calls. You may provide any of the following types:
590
608
  # * (`String`) The path to a service account key file in JSON format
@@ -621,13 +639,20 @@ module Google
621
639
  # @!attribute [rw] quota_project
622
640
  # A separate project against which to charge quota.
623
641
  # @return [::String]
642
+ # @!attribute [rw] universe_domain
643
+ # The universe domain within which to make requests. This determines the
644
+ # default endpoint URL. The default value of nil uses the environment
645
+ # universe (usually the default "googleapis.com" universe).
646
+ # @return [::String,nil]
624
647
  #
625
648
  class Configuration
626
649
  extend ::Gapic::Config
627
650
 
651
+ # @private
652
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
628
653
  DEFAULT_ENDPOINT = "appengine.googleapis.com"
629
654
 
630
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
655
+ config_attr :endpoint, nil, ::String, nil
631
656
  config_attr :credentials, nil do |value|
632
657
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
633
658
  allowed.any? { |klass| klass === value }
@@ -639,6 +664,7 @@ module Google
639
664
  config_attr :metadata, nil, ::Hash, nil
640
665
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
641
666
  config_attr :quota_project, nil, ::String, nil
667
+ config_attr :universe_domain, nil, ::String, nil
642
668
 
643
669
  # @private
644
670
  def initialize parent_config = nil
@@ -30,16 +30,37 @@ module Google
30
30
  # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
- def initialize endpoint:, credentials:
33
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
34
34
  # These require statements are intentionally placed here to initialize
35
35
  # the REST modules only when it's required.
36
36
  require "gapic/rest"
37
37
 
38
- @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
38
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
39
+ endpoint_template: endpoint_template,
40
+ universe_domain: universe_domain,
41
+ credentials: credentials,
39
42
  numeric_enums: true,
40
43
  raise_faraday_errors: false
41
44
  end
42
45
 
46
+ ##
47
+ # The effective universe domain
48
+ #
49
+ # @return [String]
50
+ #
51
+ def universe_domain
52
+ @client_stub.universe_domain
53
+ end
54
+
55
+ ##
56
+ # The effective endpoint
57
+ #
58
+ # @return [String]
59
+ #
60
+ def endpoint
61
+ @client_stub.endpoint
62
+ end
63
+
43
64
  ##
44
65
  # Baseline implementation for the list_authorized_certificates REST call
45
66
  #
@@ -32,6 +32,9 @@ module Google
32
32
  # [Webmaster Central](https://www.google.com/webmasters/verification/home).
33
33
  #
34
34
  class Client
35
+ # @private
36
+ DEFAULT_ENDPOINT_TEMPLATE = "appengine.$UNIVERSE_DOMAIN$"
37
+
35
38
  # @private
36
39
  attr_reader :authorized_domains_stub
37
40
 
@@ -90,6 +93,15 @@ module Google
90
93
  @config
91
94
  end
92
95
 
96
+ ##
97
+ # The effective universe domain
98
+ #
99
+ # @return [String]
100
+ #
101
+ def universe_domain
102
+ @authorized_domains_stub.universe_domain
103
+ end
104
+
93
105
  ##
94
106
  # Create a new AuthorizedDomains client object.
95
107
  #
@@ -123,8 +135,9 @@ module Google
123
135
  credentials = @config.credentials
124
136
  # Use self-signed JWT if the endpoint is unchanged from default,
125
137
  # but only if the default endpoint does not have a region prefix.
126
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
127
- !@config.endpoint.split(".").first.include?("-")
138
+ enable_self_signed_jwt = @config.endpoint.nil? ||
139
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
140
+ !@config.endpoint.split(".").first.include?("-"))
128
141
  credentials ||= Credentials.default scope: @config.scope,
129
142
  enable_self_signed_jwt: enable_self_signed_jwt
130
143
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -135,8 +148,10 @@ module Google
135
148
 
136
149
  @authorized_domains_stub = ::Gapic::ServiceStub.new(
137
150
  ::Google::Cloud::AppEngine::V1::AuthorizedDomains::Stub,
138
- credentials: credentials,
139
- endpoint: @config.endpoint,
151
+ credentials: credentials,
152
+ endpoint: @config.endpoint,
153
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
154
+ universe_domain: @config.universe_domain,
140
155
  channel_args: @config.channel_args,
141
156
  interceptors: @config.interceptors,
142
157
  channel_pool_config: @config.channel_pool
@@ -269,9 +284,9 @@ module Google
269
284
  # end
270
285
  #
271
286
  # @!attribute [rw] endpoint
272
- # The hostname or hostname:port of the service endpoint.
273
- # Defaults to `"appengine.googleapis.com"`.
274
- # @return [::String]
287
+ # A custom service endpoint, as a hostname or hostname:port. The default is
288
+ # nil, indicating to use the default endpoint in the current universe domain.
289
+ # @return [::String,nil]
275
290
  # @!attribute [rw] credentials
276
291
  # Credentials to send with calls. You may provide any of the following types:
277
292
  # * (`String`) The path to a service account key file in JSON format
@@ -317,13 +332,20 @@ module Google
317
332
  # @!attribute [rw] quota_project
318
333
  # A separate project against which to charge quota.
319
334
  # @return [::String]
335
+ # @!attribute [rw] universe_domain
336
+ # The universe domain within which to make requests. This determines the
337
+ # default endpoint URL. The default value of nil uses the environment
338
+ # universe (usually the default "googleapis.com" universe).
339
+ # @return [::String,nil]
320
340
  #
321
341
  class Configuration
322
342
  extend ::Gapic::Config
323
343
 
344
+ # @private
345
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
324
346
  DEFAULT_ENDPOINT = "appengine.googleapis.com"
325
347
 
326
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
348
+ config_attr :endpoint, nil, ::String, nil
327
349
  config_attr :credentials, nil do |value|
328
350
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
329
351
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -338,6 +360,7 @@ module Google
338
360
  config_attr :metadata, nil, ::Hash, nil
339
361
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
340
362
  config_attr :quota_project, nil, ::String, nil
363
+ config_attr :universe_domain, nil, ::String, nil
341
364
 
342
365
  # @private
343
366
  def initialize parent_config = nil
@@ -34,6 +34,9 @@ module Google
34
34
  # [Webmaster Central](https://www.google.com/webmasters/verification/home).
35
35
  #
36
36
  class Client
37
+ # @private
38
+ DEFAULT_ENDPOINT_TEMPLATE = "appengine.$UNIVERSE_DOMAIN$"
39
+
37
40
  # @private
38
41
  attr_reader :authorized_domains_stub
39
42
 
@@ -92,6 +95,15 @@ module Google
92
95
  @config
93
96
  end
94
97
 
98
+ ##
99
+ # The effective universe domain
100
+ #
101
+ # @return [String]
102
+ #
103
+ def universe_domain
104
+ @authorized_domains_stub.universe_domain
105
+ end
106
+
95
107
  ##
96
108
  # Create a new AuthorizedDomains REST client object.
97
109
  #
@@ -119,8 +131,9 @@ module Google
119
131
  credentials = @config.credentials
120
132
  # Use self-signed JWT if the endpoint is unchanged from default,
121
133
  # but only if the default endpoint does not have a region prefix.
122
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
123
- !@config.endpoint.split(".").first.include?("-")
134
+ enable_self_signed_jwt = @config.endpoint.nil? ||
135
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
136
+ !@config.endpoint.split(".").first.include?("-"))
124
137
  credentials ||= Credentials.default scope: @config.scope,
125
138
  enable_self_signed_jwt: enable_self_signed_jwt
126
139
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -130,7 +143,12 @@ module Google
130
143
  @quota_project_id = @config.quota_project
131
144
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
132
145
 
133
- @authorized_domains_stub = ::Google::Cloud::AppEngine::V1::AuthorizedDomains::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
146
+ @authorized_domains_stub = ::Google::Cloud::AppEngine::V1::AuthorizedDomains::Rest::ServiceStub.new(
147
+ endpoint: @config.endpoint,
148
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
149
+ universe_domain: @config.universe_domain,
150
+ credentials: credentials
151
+ )
134
152
  end
135
153
 
136
154
  # Service calls
@@ -252,9 +270,9 @@ module Google
252
270
  # end
253
271
  #
254
272
  # @!attribute [rw] endpoint
255
- # The hostname or hostname:port of the service endpoint.
256
- # Defaults to `"appengine.googleapis.com"`.
257
- # @return [::String]
273
+ # A custom service endpoint, as a hostname or hostname:port. The default is
274
+ # nil, indicating to use the default endpoint in the current universe domain.
275
+ # @return [::String,nil]
258
276
  # @!attribute [rw] credentials
259
277
  # Credentials to send with calls. You may provide any of the following types:
260
278
  # * (`String`) The path to a service account key file in JSON format
@@ -291,13 +309,20 @@ module Google
291
309
  # @!attribute [rw] quota_project
292
310
  # A separate project against which to charge quota.
293
311
  # @return [::String]
312
+ # @!attribute [rw] universe_domain
313
+ # The universe domain within which to make requests. This determines the
314
+ # default endpoint URL. The default value of nil uses the environment
315
+ # universe (usually the default "googleapis.com" universe).
316
+ # @return [::String,nil]
294
317
  #
295
318
  class Configuration
296
319
  extend ::Gapic::Config
297
320
 
321
+ # @private
322
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
298
323
  DEFAULT_ENDPOINT = "appengine.googleapis.com"
299
324
 
300
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
325
+ config_attr :endpoint, nil, ::String, nil
301
326
  config_attr :credentials, nil do |value|
302
327
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
303
328
  allowed.any? { |klass| klass === value }
@@ -309,6 +334,7 @@ module Google
309
334
  config_attr :metadata, nil, ::Hash, nil
310
335
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
311
336
  config_attr :quota_project, nil, ::String, nil
337
+ config_attr :universe_domain, nil, ::String, nil
312
338
 
313
339
  # @private
314
340
  def initialize parent_config = nil
@@ -30,16 +30,37 @@ module Google
30
30
  # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
- def initialize endpoint:, credentials:
33
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
34
34
  # These require statements are intentionally placed here to initialize
35
35
  # the REST modules only when it's required.
36
36
  require "gapic/rest"
37
37
 
38
- @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
38
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
39
+ endpoint_template: endpoint_template,
40
+ universe_domain: universe_domain,
41
+ credentials: credentials,
39
42
  numeric_enums: true,
40
43
  raise_faraday_errors: false
41
44
  end
42
45
 
46
+ ##
47
+ # The effective universe domain
48
+ #
49
+ # @return [String]
50
+ #
51
+ def universe_domain
52
+ @client_stub.universe_domain
53
+ end
54
+
55
+ ##
56
+ # The effective endpoint
57
+ #
58
+ # @return [String]
59
+ #
60
+ def endpoint
61
+ @client_stub.endpoint
62
+ end
63
+
43
64
  ##
44
65
  # Baseline implementation for the list_authorized_domains REST call
45
66
  #
@@ -30,6 +30,9 @@ module Google
30
30
  # Manages domains serving an application.
31
31
  #
32
32
  class Client
33
+ # @private
34
+ DEFAULT_ENDPOINT_TEMPLATE = "appengine.$UNIVERSE_DOMAIN$"
35
+
33
36
  # @private
34
37
  attr_reader :domain_mappings_stub
35
38
 
@@ -88,6 +91,15 @@ module Google
88
91
  @config
89
92
  end
90
93
 
94
+ ##
95
+ # The effective universe domain
96
+ #
97
+ # @return [String]
98
+ #
99
+ def universe_domain
100
+ @domain_mappings_stub.universe_domain
101
+ end
102
+
91
103
  ##
92
104
  # Create a new DomainMappings client object.
93
105
  #
@@ -121,8 +133,9 @@ module Google
121
133
  credentials = @config.credentials
122
134
  # Use self-signed JWT if the endpoint is unchanged from default,
123
135
  # but only if the default endpoint does not have a region prefix.
124
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
125
- !@config.endpoint.split(".").first.include?("-")
136
+ enable_self_signed_jwt = @config.endpoint.nil? ||
137
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
138
+ !@config.endpoint.split(".").first.include?("-"))
126
139
  credentials ||= Credentials.default scope: @config.scope,
127
140
  enable_self_signed_jwt: enable_self_signed_jwt
128
141
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -135,12 +148,15 @@ module Google
135
148
  config.credentials = credentials
136
149
  config.quota_project = @quota_project_id
137
150
  config.endpoint = @config.endpoint
151
+ config.universe_domain = @config.universe_domain
138
152
  end
139
153
 
140
154
  @domain_mappings_stub = ::Gapic::ServiceStub.new(
141
155
  ::Google::Cloud::AppEngine::V1::DomainMappings::Stub,
142
- credentials: credentials,
143
- endpoint: @config.endpoint,
156
+ credentials: credentials,
157
+ endpoint: @config.endpoint,
158
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
159
+ universe_domain: @config.universe_domain,
144
160
  channel_args: @config.channel_args,
145
161
  interceptors: @config.interceptors,
146
162
  channel_pool_config: @config.channel_pool
@@ -664,9 +680,9 @@ module Google
664
680
  # end
665
681
  #
666
682
  # @!attribute [rw] endpoint
667
- # The hostname or hostname:port of the service endpoint.
668
- # Defaults to `"appengine.googleapis.com"`.
669
- # @return [::String]
683
+ # A custom service endpoint, as a hostname or hostname:port. The default is
684
+ # nil, indicating to use the default endpoint in the current universe domain.
685
+ # @return [::String,nil]
670
686
  # @!attribute [rw] credentials
671
687
  # Credentials to send with calls. You may provide any of the following types:
672
688
  # * (`String`) The path to a service account key file in JSON format
@@ -712,13 +728,20 @@ module Google
712
728
  # @!attribute [rw] quota_project
713
729
  # A separate project against which to charge quota.
714
730
  # @return [::String]
731
+ # @!attribute [rw] universe_domain
732
+ # The universe domain within which to make requests. This determines the
733
+ # default endpoint URL. The default value of nil uses the environment
734
+ # universe (usually the default "googleapis.com" universe).
735
+ # @return [::String,nil]
715
736
  #
716
737
  class Configuration
717
738
  extend ::Gapic::Config
718
739
 
740
+ # @private
741
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
719
742
  DEFAULT_ENDPOINT = "appengine.googleapis.com"
720
743
 
721
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
744
+ config_attr :endpoint, nil, ::String, nil
722
745
  config_attr :credentials, nil do |value|
723
746
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
724
747
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -733,6 +756,7 @@ module Google
733
756
  config_attr :metadata, nil, ::Hash, nil
734
757
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
735
758
  config_attr :quota_project, nil, ::String, nil
759
+ config_attr :universe_domain, nil, ::String, nil
736
760
 
737
761
  # @private
738
762
  def initialize parent_config = nil