google-cloud-resource_manager-v3 0.6.2 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +72 -101
  3. data/lib/google/cloud/resource_manager/v3/folders/client.rb +42 -9
  4. data/lib/google/cloud/resource_manager/v3/folders/operations.rb +38 -7
  5. data/lib/google/cloud/resource_manager/v3/folders/rest/client.rb +253 -7
  6. data/lib/google/cloud/resource_manager/v3/folders/rest/operations.rb +108 -8
  7. data/lib/google/cloud/resource_manager/v3/folders/rest/service_stub.rb +14 -2
  8. data/lib/google/cloud/resource_manager/v3/organizations/client.rb +41 -9
  9. data/lib/google/cloud/resource_manager/v3/organizations/rest/client.rb +117 -7
  10. data/lib/google/cloud/resource_manager/v3/organizations/rest/service_stub.rb +14 -2
  11. data/lib/google/cloud/resource_manager/v3/projects/client.rb +42 -9
  12. data/lib/google/cloud/resource_manager/v3/projects/operations.rb +38 -7
  13. data/lib/google/cloud/resource_manager/v3/projects/rest/client.rb +253 -7
  14. data/lib/google/cloud/resource_manager/v3/projects/rest/operations.rb +108 -8
  15. data/lib/google/cloud/resource_manager/v3/projects/rest/service_stub.rb +14 -2
  16. data/lib/google/cloud/resource_manager/v3/tag_bindings/client.rb +42 -9
  17. data/lib/google/cloud/resource_manager/v3/tag_bindings/operations.rb +38 -7
  18. data/lib/google/cloud/resource_manager/v3/tag_bindings/rest/client.rb +120 -7
  19. data/lib/google/cloud/resource_manager/v3/tag_bindings/rest/operations.rb +108 -8
  20. data/lib/google/cloud/resource_manager/v3/tag_bindings/rest/service_stub.rb +14 -2
  21. data/lib/google/cloud/resource_manager/v3/tag_holds/client.rb +42 -9
  22. data/lib/google/cloud/resource_manager/v3/tag_holds/operations.rb +38 -7
  23. data/lib/google/cloud/resource_manager/v3/tag_holds/rest/client.rb +100 -7
  24. data/lib/google/cloud/resource_manager/v3/tag_holds/rest/operations.rb +108 -8
  25. data/lib/google/cloud/resource_manager/v3/tag_holds/rest/service_stub.rb +14 -2
  26. data/lib/google/cloud/resource_manager/v3/tag_keys/client.rb +42 -9
  27. data/lib/google/cloud/resource_manager/v3/tag_keys/operations.rb +38 -7
  28. data/lib/google/cloud/resource_manager/v3/tag_keys/rest/client.rb +203 -7
  29. data/lib/google/cloud/resource_manager/v3/tag_keys/rest/operations.rb +108 -8
  30. data/lib/google/cloud/resource_manager/v3/tag_keys/rest/service_stub.rb +14 -2
  31. data/lib/google/cloud/resource_manager/v3/tag_values/client.rb +42 -9
  32. data/lib/google/cloud/resource_manager/v3/tag_values/operations.rb +38 -7
  33. data/lib/google/cloud/resource_manager/v3/tag_values/rest/client.rb +203 -7
  34. data/lib/google/cloud/resource_manager/v3/tag_values/rest/operations.rb +108 -8
  35. data/lib/google/cloud/resource_manager/v3/tag_values/rest/service_stub.rb +14 -2
  36. data/lib/google/cloud/resource_manager/v3/version.rb +1 -1
  37. data/proto_docs/google/api/client.rb +14 -0
  38. data/proto_docs/google/api/field_behavior.rb +14 -0
  39. metadata +5 -5
@@ -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
  ##
@@ -208,6 +227,22 @@ module Google
208
227
  # @return [::Google::Cloud::ResourceManager::V3::Project]
209
228
  #
210
229
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
230
+ #
231
+ # @example Basic example
232
+ # require "google/cloud/resource_manager/v3"
233
+ #
234
+ # # Create a client object. The client can be reused for multiple calls.
235
+ # client = Google::Cloud::ResourceManager::V3::Projects::Rest::Client.new
236
+ #
237
+ # # Create a request. To set request fields, pass in keyword arguments.
238
+ # request = Google::Cloud::ResourceManager::V3::GetProjectRequest.new
239
+ #
240
+ # # Call the get_project method.
241
+ # result = client.get_project request
242
+ #
243
+ # # The returned object is of type Google::Cloud::ResourceManager::V3::Project.
244
+ # p result
245
+ #
211
246
  def get_project request, options = nil
212
247
  raise ::ArgumentError, "request must be provided" if request.nil?
213
248
 
@@ -291,6 +326,26 @@ module Google
291
326
  # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::Project>]
292
327
  #
293
328
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
329
+ #
330
+ # @example Basic example
331
+ # require "google/cloud/resource_manager/v3"
332
+ #
333
+ # # Create a client object. The client can be reused for multiple calls.
334
+ # client = Google::Cloud::ResourceManager::V3::Projects::Rest::Client.new
335
+ #
336
+ # # Create a request. To set request fields, pass in keyword arguments.
337
+ # request = Google::Cloud::ResourceManager::V3::ListProjectsRequest.new
338
+ #
339
+ # # Call the list_projects method.
340
+ # result = client.list_projects request
341
+ #
342
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
343
+ # # over elements, and API calls will be issued to fetch pages as needed.
344
+ # result.each do |item|
345
+ # # Each element is of type ::Google::Cloud::ResourceManager::V3::Project.
346
+ # p item
347
+ # end
348
+ #
294
349
  def list_projects request, options = nil
295
350
  raise ::ArgumentError, "request must be provided" if request.nil?
296
351
 
@@ -403,6 +458,26 @@ module Google
403
458
  # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::Project>]
404
459
  #
405
460
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
461
+ #
462
+ # @example Basic example
463
+ # require "google/cloud/resource_manager/v3"
464
+ #
465
+ # # Create a client object. The client can be reused for multiple calls.
466
+ # client = Google::Cloud::ResourceManager::V3::Projects::Rest::Client.new
467
+ #
468
+ # # Create a request. To set request fields, pass in keyword arguments.
469
+ # request = Google::Cloud::ResourceManager::V3::SearchProjectsRequest.new
470
+ #
471
+ # # Call the search_projects method.
472
+ # result = client.search_projects request
473
+ #
474
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
475
+ # # over elements, and API calls will be issued to fetch pages as needed.
476
+ # result.each do |item|
477
+ # # Each element is of type ::Google::Cloud::ResourceManager::V3::Project.
478
+ # p item
479
+ # end
480
+ #
406
481
  def search_projects request, options = nil
407
482
  raise ::ArgumentError, "request must be provided" if request.nil?
408
483
 
@@ -478,6 +553,29 @@ module Google
478
553
  # @return [::Gapic::Operation]
479
554
  #
480
555
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
556
+ #
557
+ # @example Basic example
558
+ # require "google/cloud/resource_manager/v3"
559
+ #
560
+ # # Create a client object. The client can be reused for multiple calls.
561
+ # client = Google::Cloud::ResourceManager::V3::Projects::Rest::Client.new
562
+ #
563
+ # # Create a request. To set request fields, pass in keyword arguments.
564
+ # request = Google::Cloud::ResourceManager::V3::CreateProjectRequest.new
565
+ #
566
+ # # Call the create_project method.
567
+ # result = client.create_project request
568
+ #
569
+ # # The returned object is of type Gapic::Operation. You can use it to
570
+ # # check the status of an operation, cancel it, or wait for results.
571
+ # # Here is how to wait for a response.
572
+ # result.wait_until_done! timeout: 60
573
+ # if result.response?
574
+ # p result.response
575
+ # else
576
+ # puts "No response received."
577
+ # end
578
+ #
481
579
  def create_project request, options = nil
482
580
  raise ::ArgumentError, "request must be provided" if request.nil?
483
581
 
@@ -548,6 +646,29 @@ module Google
548
646
  # @return [::Gapic::Operation]
549
647
  #
550
648
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
649
+ #
650
+ # @example Basic example
651
+ # require "google/cloud/resource_manager/v3"
652
+ #
653
+ # # Create a client object. The client can be reused for multiple calls.
654
+ # client = Google::Cloud::ResourceManager::V3::Projects::Rest::Client.new
655
+ #
656
+ # # Create a request. To set request fields, pass in keyword arguments.
657
+ # request = Google::Cloud::ResourceManager::V3::UpdateProjectRequest.new
658
+ #
659
+ # # Call the update_project method.
660
+ # result = client.update_project request
661
+ #
662
+ # # The returned object is of type Gapic::Operation. You can use it to
663
+ # # check the status of an operation, cancel it, or wait for results.
664
+ # # Here is how to wait for a response.
665
+ # result.wait_until_done! timeout: 60
666
+ # if result.response?
667
+ # p result.response
668
+ # else
669
+ # puts "No response received."
670
+ # end
671
+ #
551
672
  def update_project request, options = nil
552
673
  raise ::ArgumentError, "request must be provided" if request.nil?
553
674
 
@@ -626,6 +747,29 @@ module Google
626
747
  # @return [::Gapic::Operation]
627
748
  #
628
749
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
750
+ #
751
+ # @example Basic example
752
+ # require "google/cloud/resource_manager/v3"
753
+ #
754
+ # # Create a client object. The client can be reused for multiple calls.
755
+ # client = Google::Cloud::ResourceManager::V3::Projects::Rest::Client.new
756
+ #
757
+ # # Create a request. To set request fields, pass in keyword arguments.
758
+ # request = Google::Cloud::ResourceManager::V3::MoveProjectRequest.new
759
+ #
760
+ # # Call the move_project method.
761
+ # result = client.move_project request
762
+ #
763
+ # # The returned object is of type Gapic::Operation. You can use it to
764
+ # # check the status of an operation, cancel it, or wait for results.
765
+ # # Here is how to wait for a response.
766
+ # result.wait_until_done! timeout: 60
767
+ # if result.response?
768
+ # p result.response
769
+ # else
770
+ # puts "No response received."
771
+ # end
772
+ #
629
773
  def move_project request, options = nil
630
774
  raise ::ArgumentError, "request must be provided" if request.nil?
631
775
 
@@ -721,6 +865,29 @@ module Google
721
865
  # @return [::Gapic::Operation]
722
866
  #
723
867
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
868
+ #
869
+ # @example Basic example
870
+ # require "google/cloud/resource_manager/v3"
871
+ #
872
+ # # Create a client object. The client can be reused for multiple calls.
873
+ # client = Google::Cloud::ResourceManager::V3::Projects::Rest::Client.new
874
+ #
875
+ # # Create a request. To set request fields, pass in keyword arguments.
876
+ # request = Google::Cloud::ResourceManager::V3::DeleteProjectRequest.new
877
+ #
878
+ # # Call the delete_project method.
879
+ # result = client.delete_project request
880
+ #
881
+ # # The returned object is of type Gapic::Operation. You can use it to
882
+ # # check the status of an operation, cancel it, or wait for results.
883
+ # # Here is how to wait for a response.
884
+ # result.wait_until_done! timeout: 60
885
+ # if result.response?
886
+ # p result.response
887
+ # else
888
+ # puts "No response received."
889
+ # end
890
+ #
724
891
  def delete_project request, options = nil
725
892
  raise ::ArgumentError, "request must be provided" if request.nil?
726
893
 
@@ -794,6 +961,29 @@ module Google
794
961
  # @return [::Gapic::Operation]
795
962
  #
796
963
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
964
+ #
965
+ # @example Basic example
966
+ # require "google/cloud/resource_manager/v3"
967
+ #
968
+ # # Create a client object. The client can be reused for multiple calls.
969
+ # client = Google::Cloud::ResourceManager::V3::Projects::Rest::Client.new
970
+ #
971
+ # # Create a request. To set request fields, pass in keyword arguments.
972
+ # request = Google::Cloud::ResourceManager::V3::UndeleteProjectRequest.new
973
+ #
974
+ # # Call the undelete_project method.
975
+ # result = client.undelete_project request
976
+ #
977
+ # # The returned object is of type Gapic::Operation. You can use it to
978
+ # # check the status of an operation, cancel it, or wait for results.
979
+ # # Here is how to wait for a response.
980
+ # result.wait_until_done! timeout: 60
981
+ # if result.response?
982
+ # p result.response
983
+ # else
984
+ # puts "No response received."
985
+ # end
986
+ #
797
987
  def undelete_project request, options = nil
798
988
  raise ::ArgumentError, "request must be provided" if request.nil?
799
989
 
@@ -863,6 +1053,22 @@ module Google
863
1053
  # @return [::Google::Iam::V1::Policy]
864
1054
  #
865
1055
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1056
+ #
1057
+ # @example Basic example
1058
+ # require "google/cloud/resource_manager/v3"
1059
+ #
1060
+ # # Create a client object. The client can be reused for multiple calls.
1061
+ # client = Google::Cloud::ResourceManager::V3::Projects::Rest::Client.new
1062
+ #
1063
+ # # Create a request. To set request fields, pass in keyword arguments.
1064
+ # request = Google::Iam::V1::GetIamPolicyRequest.new
1065
+ #
1066
+ # # Call the get_iam_policy method.
1067
+ # result = client.get_iam_policy request
1068
+ #
1069
+ # # The returned object is of type Google::Iam::V1::Policy.
1070
+ # p result
1071
+ #
866
1072
  def get_iam_policy request, options = nil
867
1073
  raise ::ArgumentError, "request must be provided" if request.nil?
868
1074
 
@@ -977,6 +1183,22 @@ module Google
977
1183
  # @return [::Google::Iam::V1::Policy]
978
1184
  #
979
1185
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1186
+ #
1187
+ # @example Basic example
1188
+ # require "google/cloud/resource_manager/v3"
1189
+ #
1190
+ # # Create a client object. The client can be reused for multiple calls.
1191
+ # client = Google::Cloud::ResourceManager::V3::Projects::Rest::Client.new
1192
+ #
1193
+ # # Create a request. To set request fields, pass in keyword arguments.
1194
+ # request = Google::Iam::V1::SetIamPolicyRequest.new
1195
+ #
1196
+ # # Call the set_iam_policy method.
1197
+ # result = client.set_iam_policy request
1198
+ #
1199
+ # # The returned object is of type Google::Iam::V1::Policy.
1200
+ # p result
1201
+ #
980
1202
  def set_iam_policy request, options = nil
981
1203
  raise ::ArgumentError, "request must be provided" if request.nil?
982
1204
 
@@ -1046,6 +1268,22 @@ module Google
1046
1268
  # @return [::Google::Iam::V1::TestIamPermissionsResponse]
1047
1269
  #
1048
1270
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1271
+ #
1272
+ # @example Basic example
1273
+ # require "google/cloud/resource_manager/v3"
1274
+ #
1275
+ # # Create a client object. The client can be reused for multiple calls.
1276
+ # client = Google::Cloud::ResourceManager::V3::Projects::Rest::Client.new
1277
+ #
1278
+ # # Create a request. To set request fields, pass in keyword arguments.
1279
+ # request = Google::Iam::V1::TestIamPermissionsRequest.new
1280
+ #
1281
+ # # Call the test_iam_permissions method.
1282
+ # result = client.test_iam_permissions request
1283
+ #
1284
+ # # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
1285
+ # p result
1286
+ #
1049
1287
  def test_iam_permissions request, options = nil
1050
1288
  raise ::ArgumentError, "request must be provided" if request.nil?
1051
1289
 
@@ -1111,9 +1349,9 @@ module Google
1111
1349
  # end
1112
1350
  #
1113
1351
  # @!attribute [rw] endpoint
1114
- # The hostname or hostname:port of the service endpoint.
1115
- # Defaults to `"cloudresourcemanager.googleapis.com"`.
1116
- # @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]
1117
1355
  # @!attribute [rw] credentials
1118
1356
  # Credentials to send with calls. You may provide any of the following types:
1119
1357
  # * (`String`) The path to a service account key file in JSON format
@@ -1150,13 +1388,20 @@ module Google
1150
1388
  # @!attribute [rw] quota_project
1151
1389
  # A separate project against which to charge quota.
1152
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]
1153
1396
  #
1154
1397
  class Configuration
1155
1398
  extend ::Gapic::Config
1156
1399
 
1400
+ # @private
1401
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1157
1402
  DEFAULT_ENDPOINT = "cloudresourcemanager.googleapis.com"
1158
1403
 
1159
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1404
+ config_attr :endpoint, nil, ::String, nil
1160
1405
  config_attr :credentials, nil do |value|
1161
1406
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1162
1407
  allowed.any? { |klass| klass === value }
@@ -1168,6 +1413,7 @@ module Google
1168
1413
  config_attr :metadata, nil, ::Hash, nil
1169
1414
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1170
1415
  config_attr :quota_project, nil, ::String, nil
1416
+ config_attr :universe_domain, nil, ::String, nil
1171
1417
 
1172
1418
  # @private
1173
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
@@ -136,6 +150,26 @@ module Google
136
150
  # @return [::Gapic::Operation]
137
151
  #
138
152
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
153
+ #
154
+ # @example Basic example
155
+ # require "google/longrunning"
156
+ #
157
+ # # Create a client object. The client can be reused for multiple calls.
158
+ # client = Google::Longrunning::Operations::Rest::Client.new
159
+ #
160
+ # # Create a request. To set request fields, pass in keyword arguments.
161
+ # request = Google::Longrunning::ListOperationsRequest.new
162
+ #
163
+ # # Call the list_operations method.
164
+ # result = client.list_operations request
165
+ #
166
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
167
+ # # over elements, and API calls will be issued to fetch pages as needed.
168
+ # result.each do |item|
169
+ # # Each element is of type ::Google::Longrunning::Operation.
170
+ # p item
171
+ # end
172
+ #
139
173
  def list_operations request, options = nil
140
174
  raise ::ArgumentError, "request must be provided" if request.nil?
141
175
 
@@ -201,6 +235,29 @@ module Google
201
235
  # @return [::Gapic::Operation]
202
236
  #
203
237
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
238
+ #
239
+ # @example Basic example
240
+ # require "google/longrunning"
241
+ #
242
+ # # Create a client object. The client can be reused for multiple calls.
243
+ # client = Google::Longrunning::Operations::Rest::Client.new
244
+ #
245
+ # # Create a request. To set request fields, pass in keyword arguments.
246
+ # request = Google::Longrunning::GetOperationRequest.new
247
+ #
248
+ # # Call the get_operation method.
249
+ # result = client.get_operation request
250
+ #
251
+ # # The returned object is of type Gapic::Operation. You can use it to
252
+ # # check the status of an operation, cancel it, or wait for results.
253
+ # # Here is how to wait for a response.
254
+ # result.wait_until_done! timeout: 60
255
+ # if result.response?
256
+ # p result.response
257
+ # else
258
+ # puts "No response received."
259
+ # end
260
+ #
204
261
  def get_operation request, options = nil
205
262
  raise ::ArgumentError, "request must be provided" if request.nil?
206
263
 
@@ -267,6 +324,22 @@ module Google
267
324
  # @return [::Google::Protobuf::Empty]
268
325
  #
269
326
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
327
+ #
328
+ # @example Basic example
329
+ # require "google/longrunning"
330
+ #
331
+ # # Create a client object. The client can be reused for multiple calls.
332
+ # client = Google::Longrunning::Operations::Rest::Client.new
333
+ #
334
+ # # Create a request. To set request fields, pass in keyword arguments.
335
+ # request = Google::Longrunning::DeleteOperationRequest.new
336
+ #
337
+ # # Call the delete_operation method.
338
+ # result = client.delete_operation request
339
+ #
340
+ # # The returned object is of type Google::Protobuf::Empty.
341
+ # p result
342
+ #
270
343
  def delete_operation request, options = nil
271
344
  raise ::ArgumentError, "request must be provided" if request.nil?
272
345
 
@@ -338,6 +411,22 @@ module Google
338
411
  # @return [::Google::Protobuf::Empty]
339
412
  #
340
413
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
414
+ #
415
+ # @example Basic example
416
+ # require "google/longrunning"
417
+ #
418
+ # # Create a client object. The client can be reused for multiple calls.
419
+ # client = Google::Longrunning::Operations::Rest::Client.new
420
+ #
421
+ # # Create a request. To set request fields, pass in keyword arguments.
422
+ # request = Google::Longrunning::CancelOperationRequest.new
423
+ #
424
+ # # Call the cancel_operation method.
425
+ # result = client.cancel_operation request
426
+ #
427
+ # # The returned object is of type Google::Protobuf::Empty.
428
+ # p result
429
+ #
341
430
  def cancel_operation request, options = nil
342
431
  raise ::ArgumentError, "request must be provided" if request.nil?
343
432
 
@@ -403,9 +492,9 @@ module Google
403
492
  # end
404
493
  #
405
494
  # @!attribute [rw] endpoint
406
- # The hostname or hostname:port of the service endpoint.
407
- # Defaults to `"cloudresourcemanager.googleapis.com"`.
408
- # @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]
409
498
  # @!attribute [rw] credentials
410
499
  # Credentials to send with calls. You may provide any of the following types:
411
500
  # * (`String`) The path to a service account key file in JSON format
@@ -442,13 +531,20 @@ module Google
442
531
  # @!attribute [rw] quota_project
443
532
  # A separate project against which to charge quota.
444
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]
445
539
  #
446
540
  class Configuration
447
541
  extend ::Gapic::Config
448
542
 
543
+ # @private
544
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
449
545
  DEFAULT_ENDPOINT = "cloudresourcemanager.googleapis.com"
450
546
 
451
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
547
+ config_attr :endpoint, nil, ::String, nil
452
548
  config_attr :credentials, nil do |value|
453
549
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
454
550
  allowed.any? { |klass| klass === value }
@@ -460,6 +556,7 @@ module Google
460
556
  config_attr :metadata, nil, ::Hash, nil
461
557
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
462
558
  config_attr :quota_project, nil, ::String, nil
559
+ config_attr :universe_domain, nil, ::String, nil
463
560
 
464
561
  # @private
465
562
  def initialize parent_config = nil
@@ -542,12 +639,15 @@ module Google
542
639
  # Service stub contains baseline method implementations
543
640
  # including transcoding, making the REST call, and deserialing the response.
544
641
  class OperationsServiceStub
545
- def initialize endpoint:, credentials:
642
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
546
643
  # These require statements are intentionally placed here to initialize
547
644
  # the REST modules only when it's required.
548
645
  require "gapic/rest"
549
646
 
550
- @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
551
651
  end
552
652
 
553
653
  ##
@@ -30,16 +30,28 @@ 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
+
43
55
  ##
44
56
  # Baseline implementation for the get_project REST call
45
57
  #