google-cloud-resource_manager-v3 0.7.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +72 -101
  3. data/lib/google/cloud/resource_manager/v3/folders/client.rb +32 -8
  4. data/lib/google/cloud/resource_manager/v3/folders/operations.rb +28 -6
  5. data/lib/google/cloud/resource_manager/v3/folders/rest/client.rb +34 -7
  6. data/lib/google/cloud/resource_manager/v3/folders/rest/operations.rb +33 -8
  7. data/lib/google/cloud/resource_manager/v3/folders/rest/service_stub.rb +23 -2
  8. data/lib/google/cloud/resource_manager/v3/organizations/client.rb +31 -8
  9. data/lib/google/cloud/resource_manager/v3/organizations/rest/client.rb +33 -7
  10. data/lib/google/cloud/resource_manager/v3/organizations/rest/service_stub.rb +23 -2
  11. data/lib/google/cloud/resource_manager/v3/projects/client.rb +32 -8
  12. data/lib/google/cloud/resource_manager/v3/projects/operations.rb +28 -6
  13. data/lib/google/cloud/resource_manager/v3/projects/rest/client.rb +34 -7
  14. data/lib/google/cloud/resource_manager/v3/projects/rest/operations.rb +33 -8
  15. data/lib/google/cloud/resource_manager/v3/projects/rest/service_stub.rb +23 -2
  16. data/lib/google/cloud/resource_manager/v3/tag_bindings/client.rb +32 -8
  17. data/lib/google/cloud/resource_manager/v3/tag_bindings/operations.rb +28 -6
  18. data/lib/google/cloud/resource_manager/v3/tag_bindings/rest/client.rb +34 -7
  19. data/lib/google/cloud/resource_manager/v3/tag_bindings/rest/operations.rb +33 -8
  20. data/lib/google/cloud/resource_manager/v3/tag_bindings/rest/service_stub.rb +23 -2
  21. data/lib/google/cloud/resource_manager/v3/tag_holds/client.rb +32 -8
  22. data/lib/google/cloud/resource_manager/v3/tag_holds/operations.rb +28 -6
  23. data/lib/google/cloud/resource_manager/v3/tag_holds/rest/client.rb +34 -7
  24. data/lib/google/cloud/resource_manager/v3/tag_holds/rest/operations.rb +33 -8
  25. data/lib/google/cloud/resource_manager/v3/tag_holds/rest/service_stub.rb +23 -2
  26. data/lib/google/cloud/resource_manager/v3/tag_keys/client.rb +32 -8
  27. data/lib/google/cloud/resource_manager/v3/tag_keys/operations.rb +28 -6
  28. data/lib/google/cloud/resource_manager/v3/tag_keys/rest/client.rb +34 -7
  29. data/lib/google/cloud/resource_manager/v3/tag_keys/rest/operations.rb +33 -8
  30. data/lib/google/cloud/resource_manager/v3/tag_keys/rest/service_stub.rb +23 -2
  31. data/lib/google/cloud/resource_manager/v3/tag_values/client.rb +32 -8
  32. data/lib/google/cloud/resource_manager/v3/tag_values/operations.rb +28 -6
  33. data/lib/google/cloud/resource_manager/v3/tag_values/rest/client.rb +34 -7
  34. data/lib/google/cloud/resource_manager/v3/tag_values/rest/operations.rb +33 -8
  35. data/lib/google/cloud/resource_manager/v3/tag_values/rest/service_stub.rb +23 -2
  36. data/lib/google/cloud/resource_manager/v3/version.rb +1 -1
  37. data/proto_docs/google/api/client.rb +14 -0
  38. 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_folder REST call
45
66
  #
@@ -30,6 +30,9 @@ module Google
30
30
  # Allows users to manage their organization resources.
31
31
  #
32
32
  class Client
33
+ # @private
34
+ DEFAULT_ENDPOINT_TEMPLATE = "cloudresourcemanager.$UNIVERSE_DOMAIN$"
35
+
33
36
  include Paths
34
37
 
35
38
  # @private
@@ -104,6 +107,15 @@ module Google
104
107
  @config
105
108
  end
106
109
 
110
+ ##
111
+ # The effective universe domain
112
+ #
113
+ # @return [String]
114
+ #
115
+ def universe_domain
116
+ @organizations_stub.universe_domain
117
+ end
118
+
107
119
  ##
108
120
  # Create a new Organizations client object.
109
121
  #
@@ -137,8 +149,9 @@ module Google
137
149
  credentials = @config.credentials
138
150
  # Use self-signed JWT if the endpoint is unchanged from default,
139
151
  # but only if the default endpoint does not have a region prefix.
140
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
141
- !@config.endpoint.split(".").first.include?("-")
152
+ enable_self_signed_jwt = @config.endpoint.nil? ||
153
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
154
+ !@config.endpoint.split(".").first.include?("-"))
142
155
  credentials ||= Credentials.default scope: @config.scope,
143
156
  enable_self_signed_jwt: enable_self_signed_jwt
144
157
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -149,8 +162,10 @@ module Google
149
162
 
150
163
  @organizations_stub = ::Gapic::ServiceStub.new(
151
164
  ::Google::Cloud::ResourceManager::V3::Organizations::Stub,
152
- credentials: credentials,
153
- endpoint: @config.endpoint,
165
+ credentials: credentials,
166
+ endpoint: @config.endpoint,
167
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
168
+ universe_domain: @config.universe_domain,
154
169
  channel_args: @config.channel_args,
155
170
  interceptors: @config.interceptors,
156
171
  channel_pool_config: @config.channel_pool
@@ -680,9 +695,9 @@ module Google
680
695
  # end
681
696
  #
682
697
  # @!attribute [rw] endpoint
683
- # The hostname or hostname:port of the service endpoint.
684
- # Defaults to `"cloudresourcemanager.googleapis.com"`.
685
- # @return [::String]
698
+ # A custom service endpoint, as a hostname or hostname:port. The default is
699
+ # nil, indicating to use the default endpoint in the current universe domain.
700
+ # @return [::String,nil]
686
701
  # @!attribute [rw] credentials
687
702
  # Credentials to send with calls. You may provide any of the following types:
688
703
  # * (`String`) The path to a service account key file in JSON format
@@ -728,13 +743,20 @@ module Google
728
743
  # @!attribute [rw] quota_project
729
744
  # A separate project against which to charge quota.
730
745
  # @return [::String]
746
+ # @!attribute [rw] universe_domain
747
+ # The universe domain within which to make requests. This determines the
748
+ # default endpoint URL. The default value of nil uses the environment
749
+ # universe (usually the default "googleapis.com" universe).
750
+ # @return [::String,nil]
731
751
  #
732
752
  class Configuration
733
753
  extend ::Gapic::Config
734
754
 
755
+ # @private
756
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
735
757
  DEFAULT_ENDPOINT = "cloudresourcemanager.googleapis.com"
736
758
 
737
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
759
+ config_attr :endpoint, nil, ::String, nil
738
760
  config_attr :credentials, nil do |value|
739
761
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
740
762
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -749,6 +771,7 @@ module Google
749
771
  config_attr :metadata, nil, ::Hash, nil
750
772
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
751
773
  config_attr :quota_project, nil, ::String, nil
774
+ config_attr :universe_domain, nil, ::String, nil
752
775
 
753
776
  # @private
754
777
  def initialize parent_config = nil
@@ -32,6 +32,9 @@ module Google
32
32
  # Allows users to manage their organization resources.
33
33
  #
34
34
  class Client
35
+ # @private
36
+ DEFAULT_ENDPOINT_TEMPLATE = "cloudresourcemanager.$UNIVERSE_DOMAIN$"
37
+
35
38
  include Paths
36
39
 
37
40
  # @private
@@ -106,6 +109,15 @@ module Google
106
109
  @config
107
110
  end
108
111
 
112
+ ##
113
+ # The effective universe domain
114
+ #
115
+ # @return [String]
116
+ #
117
+ def universe_domain
118
+ @organizations_stub.universe_domain
119
+ end
120
+
109
121
  ##
110
122
  # Create a new Organizations REST client object.
111
123
  #
@@ -133,8 +145,9 @@ module Google
133
145
  credentials = @config.credentials
134
146
  # Use self-signed JWT if the endpoint is unchanged from default,
135
147
  # but only if the default endpoint does not have a region prefix.
136
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
137
- !@config.endpoint.split(".").first.include?("-")
148
+ enable_self_signed_jwt = @config.endpoint.nil? ||
149
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
150
+ !@config.endpoint.split(".").first.include?("-"))
138
151
  credentials ||= Credentials.default scope: @config.scope,
139
152
  enable_self_signed_jwt: enable_self_signed_jwt
140
153
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -144,7 +157,12 @@ module Google
144
157
  @quota_project_id = @config.quota_project
145
158
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
146
159
 
147
- @organizations_stub = ::Google::Cloud::ResourceManager::V3::Organizations::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
160
+ @organizations_stub = ::Google::Cloud::ResourceManager::V3::Organizations::Rest::ServiceStub.new(
161
+ endpoint: @config.endpoint,
162
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
163
+ universe_domain: @config.universe_domain,
164
+ credentials: credentials
165
+ )
148
166
  end
149
167
 
150
168
  # Service calls
@@ -643,9 +661,9 @@ module Google
643
661
  # end
644
662
  #
645
663
  # @!attribute [rw] endpoint
646
- # The hostname or hostname:port of the service endpoint.
647
- # Defaults to `"cloudresourcemanager.googleapis.com"`.
648
- # @return [::String]
664
+ # A custom service endpoint, as a hostname or hostname:port. The default is
665
+ # nil, indicating to use the default endpoint in the current universe domain.
666
+ # @return [::String,nil]
649
667
  # @!attribute [rw] credentials
650
668
  # Credentials to send with calls. You may provide any of the following types:
651
669
  # * (`String`) The path to a service account key file in JSON format
@@ -682,13 +700,20 @@ module Google
682
700
  # @!attribute [rw] quota_project
683
701
  # A separate project against which to charge quota.
684
702
  # @return [::String]
703
+ # @!attribute [rw] universe_domain
704
+ # The universe domain within which to make requests. This determines the
705
+ # default endpoint URL. The default value of nil uses the environment
706
+ # universe (usually the default "googleapis.com" universe).
707
+ # @return [::String,nil]
685
708
  #
686
709
  class Configuration
687
710
  extend ::Gapic::Config
688
711
 
712
+ # @private
713
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
689
714
  DEFAULT_ENDPOINT = "cloudresourcemanager.googleapis.com"
690
715
 
691
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
716
+ config_attr :endpoint, nil, ::String, nil
692
717
  config_attr :credentials, nil do |value|
693
718
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
694
719
  allowed.any? { |klass| klass === value }
@@ -700,6 +725,7 @@ module Google
700
725
  config_attr :metadata, nil, ::Hash, nil
701
726
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
702
727
  config_attr :quota_project, nil, ::String, nil
728
+ config_attr :universe_domain, nil, ::String, nil
703
729
 
704
730
  # @private
705
731
  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 get_organization REST call
45
66
  #
@@ -30,6 +30,9 @@ module Google
30
30
  # Manages Google Cloud Projects.
31
31
  #
32
32
  class Client
33
+ # @private
34
+ DEFAULT_ENDPOINT_TEMPLATE = "cloudresourcemanager.$UNIVERSE_DOMAIN$"
35
+
33
36
  include Paths
34
37
 
35
38
  # @private
@@ -119,6 +122,15 @@ module Google
119
122
  @config
120
123
  end
121
124
 
125
+ ##
126
+ # The effective universe domain
127
+ #
128
+ # @return [String]
129
+ #
130
+ def universe_domain
131
+ @projects_stub.universe_domain
132
+ end
133
+
122
134
  ##
123
135
  # Create a new Projects client object.
124
136
  #
@@ -152,8 +164,9 @@ module Google
152
164
  credentials = @config.credentials
153
165
  # Use self-signed JWT if the endpoint is unchanged from default,
154
166
  # but only if the default endpoint does not have a region prefix.
155
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
156
- !@config.endpoint.split(".").first.include?("-")
167
+ enable_self_signed_jwt = @config.endpoint.nil? ||
168
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
169
+ !@config.endpoint.split(".").first.include?("-"))
157
170
  credentials ||= Credentials.default scope: @config.scope,
158
171
  enable_self_signed_jwt: enable_self_signed_jwt
159
172
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -166,12 +179,15 @@ module Google
166
179
  config.credentials = credentials
167
180
  config.quota_project = @quota_project_id
168
181
  config.endpoint = @config.endpoint
182
+ config.universe_domain = @config.universe_domain
169
183
  end
170
184
 
171
185
  @projects_stub = ::Gapic::ServiceStub.new(
172
186
  ::Google::Cloud::ResourceManager::V3::Projects::Stub,
173
- credentials: credentials,
174
- endpoint: @config.endpoint,
187
+ credentials: credentials,
188
+ endpoint: @config.endpoint,
189
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
190
+ universe_domain: @config.universe_domain,
175
191
  channel_args: @config.channel_args,
176
192
  interceptors: @config.interceptors,
177
193
  channel_pool_config: @config.channel_pool
@@ -1393,9 +1409,9 @@ module Google
1393
1409
  # end
1394
1410
  #
1395
1411
  # @!attribute [rw] endpoint
1396
- # The hostname or hostname:port of the service endpoint.
1397
- # Defaults to `"cloudresourcemanager.googleapis.com"`.
1398
- # @return [::String]
1412
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1413
+ # nil, indicating to use the default endpoint in the current universe domain.
1414
+ # @return [::String,nil]
1399
1415
  # @!attribute [rw] credentials
1400
1416
  # Credentials to send with calls. You may provide any of the following types:
1401
1417
  # * (`String`) The path to a service account key file in JSON format
@@ -1441,13 +1457,20 @@ module Google
1441
1457
  # @!attribute [rw] quota_project
1442
1458
  # A separate project against which to charge quota.
1443
1459
  # @return [::String]
1460
+ # @!attribute [rw] universe_domain
1461
+ # The universe domain within which to make requests. This determines the
1462
+ # default endpoint URL. The default value of nil uses the environment
1463
+ # universe (usually the default "googleapis.com" universe).
1464
+ # @return [::String,nil]
1444
1465
  #
1445
1466
  class Configuration
1446
1467
  extend ::Gapic::Config
1447
1468
 
1469
+ # @private
1470
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1448
1471
  DEFAULT_ENDPOINT = "cloudresourcemanager.googleapis.com"
1449
1472
 
1450
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1473
+ config_attr :endpoint, nil, ::String, nil
1451
1474
  config_attr :credentials, nil do |value|
1452
1475
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1453
1476
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -1462,6 +1485,7 @@ module Google
1462
1485
  config_attr :metadata, nil, ::Hash, nil
1463
1486
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1464
1487
  config_attr :quota_project, nil, ::String, nil
1488
+ config_attr :universe_domain, nil, ::String, nil
1465
1489
 
1466
1490
  # @private
1467
1491
  def initialize parent_config = nil
@@ -26,6 +26,9 @@ module Google
26
26
  module Projects
27
27
  # Service that implements Longrunning Operations API.
28
28
  class Operations
29
+ # @private
30
+ DEFAULT_ENDPOINT_TEMPLATE = "cloudresourcemanager.$UNIVERSE_DOMAIN$"
31
+
29
32
  # @private
30
33
  attr_reader :operations_stub
31
34
 
@@ -60,6 +63,15 @@ module Google
60
63
  @config
61
64
  end
62
65
 
66
+ ##
67
+ # The effective universe domain
68
+ #
69
+ # @return [String]
70
+ #
71
+ def universe_domain
72
+ @operations_stub.universe_domain
73
+ end
74
+
63
75
  ##
64
76
  # Create a new Operations client object.
65
77
  #
@@ -90,8 +102,10 @@ module Google
90
102
 
91
103
  @operations_stub = ::Gapic::ServiceStub.new(
92
104
  ::Google::Longrunning::Operations::Stub,
93
- credentials: credentials,
94
- endpoint: @config.endpoint,
105
+ credentials: credentials,
106
+ endpoint: @config.endpoint,
107
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
108
+ universe_domain: @config.universe_domain,
95
109
  channel_args: @config.channel_args,
96
110
  interceptors: @config.interceptors,
97
111
  channel_pool_config: @config.channel_pool
@@ -613,9 +627,9 @@ module Google
613
627
  # end
614
628
  #
615
629
  # @!attribute [rw] endpoint
616
- # The hostname or hostname:port of the service endpoint.
617
- # Defaults to `"cloudresourcemanager.googleapis.com"`.
618
- # @return [::String]
630
+ # A custom service endpoint, as a hostname or hostname:port. The default is
631
+ # nil, indicating to use the default endpoint in the current universe domain.
632
+ # @return [::String,nil]
619
633
  # @!attribute [rw] credentials
620
634
  # Credentials to send with calls. You may provide any of the following types:
621
635
  # * (`String`) The path to a service account key file in JSON format
@@ -661,13 +675,20 @@ module Google
661
675
  # @!attribute [rw] quota_project
662
676
  # A separate project against which to charge quota.
663
677
  # @return [::String]
678
+ # @!attribute [rw] universe_domain
679
+ # The universe domain within which to make requests. This determines the
680
+ # default endpoint URL. The default value of nil uses the environment
681
+ # universe (usually the default "googleapis.com" universe).
682
+ # @return [::String,nil]
664
683
  #
665
684
  class Configuration
666
685
  extend ::Gapic::Config
667
686
 
687
+ # @private
688
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
668
689
  DEFAULT_ENDPOINT = "cloudresourcemanager.googleapis.com"
669
690
 
670
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
691
+ config_attr :endpoint, nil, ::String, nil
671
692
  config_attr :credentials, nil do |value|
672
693
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
673
694
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -682,6 +703,7 @@ module Google
682
703
  config_attr :metadata, nil, ::Hash, nil
683
704
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
684
705
  config_attr :quota_project, nil, ::String, nil
706
+ config_attr :universe_domain, nil, ::String, nil
685
707
 
686
708
  # @private
687
709
  def initialize parent_config = nil
@@ -32,6 +32,9 @@ module Google
32
32
  # Manages Google Cloud Projects.
33
33
  #
34
34
  class Client
35
+ # @private
36
+ DEFAULT_ENDPOINT_TEMPLATE = "cloudresourcemanager.$UNIVERSE_DOMAIN$"
37
+
35
38
  include Paths
36
39
 
37
40
  # @private
@@ -121,6 +124,15 @@ module Google
121
124
  @config
122
125
  end
123
126
 
127
+ ##
128
+ # The effective universe domain
129
+ #
130
+ # @return [String]
131
+ #
132
+ def universe_domain
133
+ @projects_stub.universe_domain
134
+ end
135
+
124
136
  ##
125
137
  # Create a new Projects REST client object.
126
138
  #
@@ -148,8 +160,9 @@ module Google
148
160
  credentials = @config.credentials
149
161
  # Use self-signed JWT if the endpoint is unchanged from default,
150
162
  # but only if the default endpoint does not have a region prefix.
151
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
152
- !@config.endpoint.split(".").first.include?("-")
163
+ enable_self_signed_jwt = @config.endpoint.nil? ||
164
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
165
+ !@config.endpoint.split(".").first.include?("-"))
153
166
  credentials ||= Credentials.default scope: @config.scope,
154
167
  enable_self_signed_jwt: enable_self_signed_jwt
155
168
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -163,9 +176,15 @@ module Google
163
176
  config.credentials = credentials
164
177
  config.quota_project = @quota_project_id
165
178
  config.endpoint = @config.endpoint
179
+ config.universe_domain = @config.universe_domain
166
180
  end
167
181
 
168
- @projects_stub = ::Google::Cloud::ResourceManager::V3::Projects::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
182
+ @projects_stub = ::Google::Cloud::ResourceManager::V3::Projects::Rest::ServiceStub.new(
183
+ endpoint: @config.endpoint,
184
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
185
+ universe_domain: @config.universe_domain,
186
+ credentials: credentials
187
+ )
169
188
  end
170
189
 
171
190
  ##
@@ -1330,9 +1349,9 @@ module Google
1330
1349
  # end
1331
1350
  #
1332
1351
  # @!attribute [rw] endpoint
1333
- # The hostname or hostname:port of the service endpoint.
1334
- # Defaults to `"cloudresourcemanager.googleapis.com"`.
1335
- # @return [::String]
1352
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1353
+ # nil, indicating to use the default endpoint in the current universe domain.
1354
+ # @return [::String,nil]
1336
1355
  # @!attribute [rw] credentials
1337
1356
  # Credentials to send with calls. You may provide any of the following types:
1338
1357
  # * (`String`) The path to a service account key file in JSON format
@@ -1369,13 +1388,20 @@ module Google
1369
1388
  # @!attribute [rw] quota_project
1370
1389
  # A separate project against which to charge quota.
1371
1390
  # @return [::String]
1391
+ # @!attribute [rw] universe_domain
1392
+ # The universe domain within which to make requests. This determines the
1393
+ # default endpoint URL. The default value of nil uses the environment
1394
+ # universe (usually the default "googleapis.com" universe).
1395
+ # @return [::String,nil]
1372
1396
  #
1373
1397
  class Configuration
1374
1398
  extend ::Gapic::Config
1375
1399
 
1400
+ # @private
1401
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1376
1402
  DEFAULT_ENDPOINT = "cloudresourcemanager.googleapis.com"
1377
1403
 
1378
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1404
+ config_attr :endpoint, nil, ::String, nil
1379
1405
  config_attr :credentials, nil do |value|
1380
1406
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1381
1407
  allowed.any? { |klass| klass === value }
@@ -1387,6 +1413,7 @@ module Google
1387
1413
  config_attr :metadata, nil, ::Hash, nil
1388
1414
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1389
1415
  config_attr :quota_project, nil, ::String, nil
1416
+ config_attr :universe_domain, nil, ::String, nil
1390
1417
 
1391
1418
  # @private
1392
1419
  def initialize parent_config = nil
@@ -26,6 +26,9 @@ module Google
26
26
  module Rest
27
27
  # Service that implements Longrunning Operations API.
28
28
  class Operations
29
+ # @private
30
+ DEFAULT_ENDPOINT_TEMPLATE = "cloudresourcemanager.$UNIVERSE_DOMAIN$"
31
+
29
32
  # @private
30
33
  attr_reader :operations_stub
31
34
 
@@ -60,6 +63,15 @@ module Google
60
63
  @config
61
64
  end
62
65
 
66
+ ##
67
+ # The effective universe domain
68
+ #
69
+ # @return [String]
70
+ #
71
+ def universe_domain
72
+ @operations_stub.universe_domain
73
+ end
74
+
63
75
  ##
64
76
  # Create a new Operations client object.
65
77
  #
@@ -84,8 +96,10 @@ module Google
84
96
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
85
97
 
86
98
  @operations_stub = OperationsServiceStub.new(
87
- endpoint: @config.endpoint,
88
- credentials: credentials
99
+ endpoint: @config.endpoint,
100
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
101
+ universe_domain: @config.universe_domain,
102
+ credentials: credentials
89
103
  )
90
104
 
91
105
  # Used by an LRO wrapper for some methods of this service
@@ -478,9 +492,9 @@ module Google
478
492
  # end
479
493
  #
480
494
  # @!attribute [rw] endpoint
481
- # The hostname or hostname:port of the service endpoint.
482
- # Defaults to `"cloudresourcemanager.googleapis.com"`.
483
- # @return [::String]
495
+ # A custom service endpoint, as a hostname or hostname:port. The default is
496
+ # nil, indicating to use the default endpoint in the current universe domain.
497
+ # @return [::String,nil]
484
498
  # @!attribute [rw] credentials
485
499
  # Credentials to send with calls. You may provide any of the following types:
486
500
  # * (`String`) The path to a service account key file in JSON format
@@ -517,13 +531,20 @@ module Google
517
531
  # @!attribute [rw] quota_project
518
532
  # A separate project against which to charge quota.
519
533
  # @return [::String]
534
+ # @!attribute [rw] universe_domain
535
+ # The universe domain within which to make requests. This determines the
536
+ # default endpoint URL. The default value of nil uses the environment
537
+ # universe (usually the default "googleapis.com" universe).
538
+ # @return [::String,nil]
520
539
  #
521
540
  class Configuration
522
541
  extend ::Gapic::Config
523
542
 
543
+ # @private
544
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
524
545
  DEFAULT_ENDPOINT = "cloudresourcemanager.googleapis.com"
525
546
 
526
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
547
+ config_attr :endpoint, nil, ::String, nil
527
548
  config_attr :credentials, nil do |value|
528
549
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
529
550
  allowed.any? { |klass| klass === value }
@@ -535,6 +556,7 @@ module Google
535
556
  config_attr :metadata, nil, ::Hash, nil
536
557
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
537
558
  config_attr :quota_project, nil, ::String, nil
559
+ config_attr :universe_domain, nil, ::String, nil
538
560
 
539
561
  # @private
540
562
  def initialize parent_config = nil
@@ -617,12 +639,15 @@ module Google
617
639
  # Service stub contains baseline method implementations
618
640
  # including transcoding, making the REST call, and deserialing the response.
619
641
  class OperationsServiceStub
620
- def initialize endpoint:, credentials:
642
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
621
643
  # These require statements are intentionally placed here to initialize
622
644
  # the REST modules only when it's required.
623
645
  require "gapic/rest"
624
646
 
625
- @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials
647
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
648
+ endpoint_template: endpoint_template,
649
+ universe_domain: universe_domain,
650
+ credentials: credentials
626
651
  end
627
652
 
628
653
  ##