google-cloud-orchestration-airflow-service-v1 0.7.0 → 0.9.0

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.
@@ -34,6 +34,9 @@ module Google
34
34
  # Managed Apache Airflow Environments.
35
35
  #
36
36
  class Client
37
+ # @private
38
+ DEFAULT_ENDPOINT_TEMPLATE = "composer.$UNIVERSE_DOMAIN$"
39
+
37
40
  include Paths
38
41
 
39
42
  # @private
@@ -94,6 +97,15 @@ module Google
94
97
  @config
95
98
  end
96
99
 
100
+ ##
101
+ # The effective universe domain
102
+ #
103
+ # @return [String]
104
+ #
105
+ def universe_domain
106
+ @environments_stub.universe_domain
107
+ end
108
+
97
109
  ##
98
110
  # Create a new Environments REST client object.
99
111
  #
@@ -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)
@@ -136,9 +149,15 @@ module Google
136
149
  config.credentials = credentials
137
150
  config.quota_project = @quota_project_id
138
151
  config.endpoint = @config.endpoint
152
+ config.universe_domain = @config.universe_domain
139
153
  end
140
154
 
141
- @environments_stub = ::Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
155
+ @environments_stub = ::Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Rest::ServiceStub.new(
156
+ endpoint: @config.endpoint,
157
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
158
+ universe_domain: @config.universe_domain,
159
+ credentials: credentials
160
+ )
142
161
  end
143
162
 
144
163
  ##
@@ -180,6 +199,29 @@ module Google
180
199
  # @return [::Gapic::Operation]
181
200
  #
182
201
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
202
+ #
203
+ # @example Basic example
204
+ # require "google/cloud/orchestration/airflow/service/v1"
205
+ #
206
+ # # Create a client object. The client can be reused for multiple calls.
207
+ # client = Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Rest::Client.new
208
+ #
209
+ # # Create a request. To set request fields, pass in keyword arguments.
210
+ # request = Google::Cloud::Orchestration::Airflow::Service::V1::CreateEnvironmentRequest.new
211
+ #
212
+ # # Call the create_environment method.
213
+ # result = client.create_environment request
214
+ #
215
+ # # The returned object is of type Gapic::Operation. You can use it to
216
+ # # check the status of an operation, cancel it, or wait for results.
217
+ # # Here is how to wait for a response.
218
+ # result.wait_until_done! timeout: 60
219
+ # if result.response?
220
+ # p result.response
221
+ # else
222
+ # puts "No response received."
223
+ # end
224
+ #
183
225
  def create_environment request, options = nil
184
226
  raise ::ArgumentError, "request must be provided" if request.nil?
185
227
 
@@ -244,6 +286,22 @@ module Google
244
286
  # @return [::Google::Cloud::Orchestration::Airflow::Service::V1::Environment]
245
287
  #
246
288
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
289
+ #
290
+ # @example Basic example
291
+ # require "google/cloud/orchestration/airflow/service/v1"
292
+ #
293
+ # # Create a client object. The client can be reused for multiple calls.
294
+ # client = Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Rest::Client.new
295
+ #
296
+ # # Create a request. To set request fields, pass in keyword arguments.
297
+ # request = Google::Cloud::Orchestration::Airflow::Service::V1::GetEnvironmentRequest.new
298
+ #
299
+ # # Call the get_environment method.
300
+ # result = client.get_environment request
301
+ #
302
+ # # The returned object is of type Google::Cloud::Orchestration::Airflow::Service::V1::Environment.
303
+ # p result
304
+ #
247
305
  def get_environment request, options = nil
248
306
  raise ::ArgumentError, "request must be provided" if request.nil?
249
307
 
@@ -311,6 +369,26 @@ module Google
311
369
  # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Orchestration::Airflow::Service::V1::Environment>]
312
370
  #
313
371
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
372
+ #
373
+ # @example Basic example
374
+ # require "google/cloud/orchestration/airflow/service/v1"
375
+ #
376
+ # # Create a client object. The client can be reused for multiple calls.
377
+ # client = Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Rest::Client.new
378
+ #
379
+ # # Create a request. To set request fields, pass in keyword arguments.
380
+ # request = Google::Cloud::Orchestration::Airflow::Service::V1::ListEnvironmentsRequest.new
381
+ #
382
+ # # Call the list_environments method.
383
+ # result = client.list_environments request
384
+ #
385
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
386
+ # # over elements, and API calls will be issued to fetch pages as needed.
387
+ # result.each do |item|
388
+ # # Each element is of type ::Google::Cloud::Orchestration::Airflow::Service::V1::Environment.
389
+ # p item
390
+ # end
391
+ #
314
392
  def list_environments request, options = nil
315
393
  raise ::ArgumentError, "request must be provided" if request.nil?
316
394
 
@@ -502,6 +580,29 @@ module Google
502
580
  # @return [::Gapic::Operation]
503
581
  #
504
582
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
583
+ #
584
+ # @example Basic example
585
+ # require "google/cloud/orchestration/airflow/service/v1"
586
+ #
587
+ # # Create a client object. The client can be reused for multiple calls.
588
+ # client = Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Rest::Client.new
589
+ #
590
+ # # Create a request. To set request fields, pass in keyword arguments.
591
+ # request = Google::Cloud::Orchestration::Airflow::Service::V1::UpdateEnvironmentRequest.new
592
+ #
593
+ # # Call the update_environment method.
594
+ # result = client.update_environment request
595
+ #
596
+ # # The returned object is of type Gapic::Operation. You can use it to
597
+ # # check the status of an operation, cancel it, or wait for results.
598
+ # # Here is how to wait for a response.
599
+ # result.wait_until_done! timeout: 60
600
+ # if result.response?
601
+ # p result.response
602
+ # else
603
+ # puts "No response received."
604
+ # end
605
+ #
505
606
  def update_environment request, options = nil
506
607
  raise ::ArgumentError, "request must be provided" if request.nil?
507
608
 
@@ -566,6 +667,29 @@ module Google
566
667
  # @return [::Gapic::Operation]
567
668
  #
568
669
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
670
+ #
671
+ # @example Basic example
672
+ # require "google/cloud/orchestration/airflow/service/v1"
673
+ #
674
+ # # Create a client object. The client can be reused for multiple calls.
675
+ # client = Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Rest::Client.new
676
+ #
677
+ # # Create a request. To set request fields, pass in keyword arguments.
678
+ # request = Google::Cloud::Orchestration::Airflow::Service::V1::DeleteEnvironmentRequest.new
679
+ #
680
+ # # Call the delete_environment method.
681
+ # result = client.delete_environment request
682
+ #
683
+ # # The returned object is of type Gapic::Operation. You can use it to
684
+ # # check the status of an operation, cancel it, or wait for results.
685
+ # # Here is how to wait for a response.
686
+ # result.wait_until_done! timeout: 60
687
+ # if result.response?
688
+ # p result.response
689
+ # else
690
+ # puts "No response received."
691
+ # end
692
+ #
569
693
  def delete_environment request, options = nil
570
694
  raise ::ArgumentError, "request must be provided" if request.nil?
571
695
 
@@ -639,6 +763,22 @@ module Google
639
763
  # @return [::Google::Cloud::Orchestration::Airflow::Service::V1::ExecuteAirflowCommandResponse]
640
764
  #
641
765
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
766
+ #
767
+ # @example Basic example
768
+ # require "google/cloud/orchestration/airflow/service/v1"
769
+ #
770
+ # # Create a client object. The client can be reused for multiple calls.
771
+ # client = Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Rest::Client.new
772
+ #
773
+ # # Create a request. To set request fields, pass in keyword arguments.
774
+ # request = Google::Cloud::Orchestration::Airflow::Service::V1::ExecuteAirflowCommandRequest.new
775
+ #
776
+ # # Call the execute_airflow_command method.
777
+ # result = client.execute_airflow_command request
778
+ #
779
+ # # The returned object is of type Google::Cloud::Orchestration::Airflow::Service::V1::ExecuteAirflowCommandResponse.
780
+ # p result
781
+ #
642
782
  def execute_airflow_command request, options = nil
643
783
  raise ::ArgumentError, "request must be provided" if request.nil?
644
784
 
@@ -711,6 +851,22 @@ module Google
711
851
  # @return [::Google::Cloud::Orchestration::Airflow::Service::V1::StopAirflowCommandResponse]
712
852
  #
713
853
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
854
+ #
855
+ # @example Basic example
856
+ # require "google/cloud/orchestration/airflow/service/v1"
857
+ #
858
+ # # Create a client object. The client can be reused for multiple calls.
859
+ # client = Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Rest::Client.new
860
+ #
861
+ # # Create a request. To set request fields, pass in keyword arguments.
862
+ # request = Google::Cloud::Orchestration::Airflow::Service::V1::StopAirflowCommandRequest.new
863
+ #
864
+ # # Call the stop_airflow_command method.
865
+ # result = client.stop_airflow_command request
866
+ #
867
+ # # The returned object is of type Google::Cloud::Orchestration::Airflow::Service::V1::StopAirflowCommandResponse.
868
+ # p result
869
+ #
714
870
  def stop_airflow_command request, options = nil
715
871
  raise ::ArgumentError, "request must be provided" if request.nil?
716
872
 
@@ -782,6 +938,22 @@ module Google
782
938
  # @return [::Google::Cloud::Orchestration::Airflow::Service::V1::PollAirflowCommandResponse]
783
939
  #
784
940
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
941
+ #
942
+ # @example Basic example
943
+ # require "google/cloud/orchestration/airflow/service/v1"
944
+ #
945
+ # # Create a client object. The client can be reused for multiple calls.
946
+ # client = Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Rest::Client.new
947
+ #
948
+ # # Create a request. To set request fields, pass in keyword arguments.
949
+ # request = Google::Cloud::Orchestration::Airflow::Service::V1::PollAirflowCommandRequest.new
950
+ #
951
+ # # Call the poll_airflow_command method.
952
+ # result = client.poll_airflow_command request
953
+ #
954
+ # # The returned object is of type Google::Cloud::Orchestration::Airflow::Service::V1::PollAirflowCommandResponse.
955
+ # p result
956
+ #
785
957
  def poll_airflow_command request, options = nil
786
958
  raise ::ArgumentError, "request must be provided" if request.nil?
787
959
 
@@ -851,6 +1023,29 @@ module Google
851
1023
  # @return [::Gapic::Operation]
852
1024
  #
853
1025
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1026
+ #
1027
+ # @example Basic example
1028
+ # require "google/cloud/orchestration/airflow/service/v1"
1029
+ #
1030
+ # # Create a client object. The client can be reused for multiple calls.
1031
+ # client = Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Rest::Client.new
1032
+ #
1033
+ # # Create a request. To set request fields, pass in keyword arguments.
1034
+ # request = Google::Cloud::Orchestration::Airflow::Service::V1::SaveSnapshotRequest.new
1035
+ #
1036
+ # # Call the save_snapshot method.
1037
+ # result = client.save_snapshot request
1038
+ #
1039
+ # # The returned object is of type Gapic::Operation. You can use it to
1040
+ # # check the status of an operation, cancel it, or wait for results.
1041
+ # # Here is how to wait for a response.
1042
+ # result.wait_until_done! timeout: 60
1043
+ # if result.response?
1044
+ # p result.response
1045
+ # else
1046
+ # puts "No response received."
1047
+ # end
1048
+ #
854
1049
  def save_snapshot request, options = nil
855
1050
  raise ::ArgumentError, "request must be provided" if request.nil?
856
1051
 
@@ -933,6 +1128,29 @@ module Google
933
1128
  # @return [::Gapic::Operation]
934
1129
  #
935
1130
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1131
+ #
1132
+ # @example Basic example
1133
+ # require "google/cloud/orchestration/airflow/service/v1"
1134
+ #
1135
+ # # Create a client object. The client can be reused for multiple calls.
1136
+ # client = Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Rest::Client.new
1137
+ #
1138
+ # # Create a request. To set request fields, pass in keyword arguments.
1139
+ # request = Google::Cloud::Orchestration::Airflow::Service::V1::LoadSnapshotRequest.new
1140
+ #
1141
+ # # Call the load_snapshot method.
1142
+ # result = client.load_snapshot request
1143
+ #
1144
+ # # The returned object is of type Gapic::Operation. You can use it to
1145
+ # # check the status of an operation, cancel it, or wait for results.
1146
+ # # Here is how to wait for a response.
1147
+ # result.wait_until_done! timeout: 60
1148
+ # if result.response?
1149
+ # p result.response
1150
+ # else
1151
+ # puts "No response received."
1152
+ # end
1153
+ #
936
1154
  def load_snapshot request, options = nil
937
1155
  raise ::ArgumentError, "request must be provided" if request.nil?
938
1156
 
@@ -997,6 +1215,29 @@ module Google
997
1215
  # @return [::Gapic::Operation]
998
1216
  #
999
1217
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1218
+ #
1219
+ # @example Basic example
1220
+ # require "google/cloud/orchestration/airflow/service/v1"
1221
+ #
1222
+ # # Create a client object. The client can be reused for multiple calls.
1223
+ # client = Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Rest::Client.new
1224
+ #
1225
+ # # Create a request. To set request fields, pass in keyword arguments.
1226
+ # request = Google::Cloud::Orchestration::Airflow::Service::V1::DatabaseFailoverRequest.new
1227
+ #
1228
+ # # Call the database_failover method.
1229
+ # result = client.database_failover request
1230
+ #
1231
+ # # The returned object is of type Gapic::Operation. You can use it to
1232
+ # # check the status of an operation, cancel it, or wait for results.
1233
+ # # Here is how to wait for a response.
1234
+ # result.wait_until_done! timeout: 60
1235
+ # if result.response?
1236
+ # p result.response
1237
+ # else
1238
+ # puts "No response received."
1239
+ # end
1240
+ #
1000
1241
  def database_failover request, options = nil
1001
1242
  raise ::ArgumentError, "request must be provided" if request.nil?
1002
1243
 
@@ -1061,6 +1302,22 @@ module Google
1061
1302
  # @return [::Google::Cloud::Orchestration::Airflow::Service::V1::FetchDatabasePropertiesResponse]
1062
1303
  #
1063
1304
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1305
+ #
1306
+ # @example Basic example
1307
+ # require "google/cloud/orchestration/airflow/service/v1"
1308
+ #
1309
+ # # Create a client object. The client can be reused for multiple calls.
1310
+ # client = Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Rest::Client.new
1311
+ #
1312
+ # # Create a request. To set request fields, pass in keyword arguments.
1313
+ # request = Google::Cloud::Orchestration::Airflow::Service::V1::FetchDatabasePropertiesRequest.new
1314
+ #
1315
+ # # Call the fetch_database_properties method.
1316
+ # result = client.fetch_database_properties request
1317
+ #
1318
+ # # The returned object is of type Google::Cloud::Orchestration::Airflow::Service::V1::FetchDatabasePropertiesResponse.
1319
+ # p result
1320
+ #
1064
1321
  def fetch_database_properties request, options = nil
1065
1322
  raise ::ArgumentError, "request must be provided" if request.nil?
1066
1323
 
@@ -1126,9 +1383,9 @@ module Google
1126
1383
  # end
1127
1384
  #
1128
1385
  # @!attribute [rw] endpoint
1129
- # The hostname or hostname:port of the service endpoint.
1130
- # Defaults to `"composer.googleapis.com"`.
1131
- # @return [::String]
1386
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1387
+ # nil, indicating to use the default endpoint in the current universe domain.
1388
+ # @return [::String,nil]
1132
1389
  # @!attribute [rw] credentials
1133
1390
  # Credentials to send with calls. You may provide any of the following types:
1134
1391
  # * (`String`) The path to a service account key file in JSON format
@@ -1165,13 +1422,20 @@ module Google
1165
1422
  # @!attribute [rw] quota_project
1166
1423
  # A separate project against which to charge quota.
1167
1424
  # @return [::String]
1425
+ # @!attribute [rw] universe_domain
1426
+ # The universe domain within which to make requests. This determines the
1427
+ # default endpoint URL. The default value of nil uses the environment
1428
+ # universe (usually the default "googleapis.com" universe).
1429
+ # @return [::String,nil]
1168
1430
  #
1169
1431
  class Configuration
1170
1432
  extend ::Gapic::Config
1171
1433
 
1434
+ # @private
1435
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1172
1436
  DEFAULT_ENDPOINT = "composer.googleapis.com"
1173
1437
 
1174
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1438
+ config_attr :endpoint, nil, ::String, nil
1175
1439
  config_attr :credentials, nil do |value|
1176
1440
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1177
1441
  allowed.any? { |klass| klass === value }
@@ -1183,6 +1447,7 @@ module Google
1183
1447
  config_attr :metadata, nil, ::Hash, nil
1184
1448
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1185
1449
  config_attr :quota_project, nil, ::String, nil
1450
+ config_attr :universe_domain, nil, ::String, nil
1186
1451
 
1187
1452
  # @private
1188
1453
  def initialize parent_config = nil
@@ -28,6 +28,9 @@ module Google
28
28
  module Rest
29
29
  # Service that implements Longrunning Operations API.
30
30
  class Operations
31
+ # @private
32
+ DEFAULT_ENDPOINT_TEMPLATE = "composer.$UNIVERSE_DOMAIN$"
33
+
31
34
  # @private
32
35
  attr_reader :operations_stub
33
36
 
@@ -62,6 +65,15 @@ module Google
62
65
  @config
63
66
  end
64
67
 
68
+ ##
69
+ # The effective universe domain
70
+ #
71
+ # @return [String]
72
+ #
73
+ def universe_domain
74
+ @operations_stub.universe_domain
75
+ end
76
+
65
77
  ##
66
78
  # Create a new Operations client object.
67
79
  #
@@ -86,8 +98,10 @@ module Google
86
98
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
87
99
 
88
100
  @operations_stub = OperationsServiceStub.new(
89
- endpoint: @config.endpoint,
90
- credentials: credentials
101
+ endpoint: @config.endpoint,
102
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
103
+ universe_domain: @config.universe_domain,
104
+ credentials: credentials
91
105
  )
92
106
 
93
107
  # Used by an LRO wrapper for some methods of this service
@@ -138,6 +152,26 @@ module Google
138
152
  # @return [::Gapic::Operation]
139
153
  #
140
154
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
155
+ #
156
+ # @example Basic example
157
+ # require "google/longrunning"
158
+ #
159
+ # # Create a client object. The client can be reused for multiple calls.
160
+ # client = Google::Longrunning::Operations::Rest::Client.new
161
+ #
162
+ # # Create a request. To set request fields, pass in keyword arguments.
163
+ # request = Google::Longrunning::ListOperationsRequest.new
164
+ #
165
+ # # Call the list_operations method.
166
+ # result = client.list_operations request
167
+ #
168
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
169
+ # # over elements, and API calls will be issued to fetch pages as needed.
170
+ # result.each do |item|
171
+ # # Each element is of type ::Google::Longrunning::Operation.
172
+ # p item
173
+ # end
174
+ #
141
175
  def list_operations request, options = nil
142
176
  raise ::ArgumentError, "request must be provided" if request.nil?
143
177
 
@@ -203,6 +237,29 @@ module Google
203
237
  # @return [::Gapic::Operation]
204
238
  #
205
239
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
240
+ #
241
+ # @example Basic example
242
+ # require "google/longrunning"
243
+ #
244
+ # # Create a client object. The client can be reused for multiple calls.
245
+ # client = Google::Longrunning::Operations::Rest::Client.new
246
+ #
247
+ # # Create a request. To set request fields, pass in keyword arguments.
248
+ # request = Google::Longrunning::GetOperationRequest.new
249
+ #
250
+ # # Call the get_operation method.
251
+ # result = client.get_operation request
252
+ #
253
+ # # The returned object is of type Gapic::Operation. You can use it to
254
+ # # check the status of an operation, cancel it, or wait for results.
255
+ # # Here is how to wait for a response.
256
+ # result.wait_until_done! timeout: 60
257
+ # if result.response?
258
+ # p result.response
259
+ # else
260
+ # puts "No response received."
261
+ # end
262
+ #
206
263
  def get_operation request, options = nil
207
264
  raise ::ArgumentError, "request must be provided" if request.nil?
208
265
 
@@ -269,6 +326,22 @@ module Google
269
326
  # @return [::Google::Protobuf::Empty]
270
327
  #
271
328
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
329
+ #
330
+ # @example Basic example
331
+ # require "google/longrunning"
332
+ #
333
+ # # Create a client object. The client can be reused for multiple calls.
334
+ # client = Google::Longrunning::Operations::Rest::Client.new
335
+ #
336
+ # # Create a request. To set request fields, pass in keyword arguments.
337
+ # request = Google::Longrunning::DeleteOperationRequest.new
338
+ #
339
+ # # Call the delete_operation method.
340
+ # result = client.delete_operation request
341
+ #
342
+ # # The returned object is of type Google::Protobuf::Empty.
343
+ # p result
344
+ #
272
345
  def delete_operation request, options = nil
273
346
  raise ::ArgumentError, "request must be provided" if request.nil?
274
347
 
@@ -340,6 +413,22 @@ module Google
340
413
  # @return [::Google::Protobuf::Empty]
341
414
  #
342
415
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
416
+ #
417
+ # @example Basic example
418
+ # require "google/longrunning"
419
+ #
420
+ # # Create a client object. The client can be reused for multiple calls.
421
+ # client = Google::Longrunning::Operations::Rest::Client.new
422
+ #
423
+ # # Create a request. To set request fields, pass in keyword arguments.
424
+ # request = Google::Longrunning::CancelOperationRequest.new
425
+ #
426
+ # # Call the cancel_operation method.
427
+ # result = client.cancel_operation request
428
+ #
429
+ # # The returned object is of type Google::Protobuf::Empty.
430
+ # p result
431
+ #
343
432
  def cancel_operation request, options = nil
344
433
  raise ::ArgumentError, "request must be provided" if request.nil?
345
434
 
@@ -405,9 +494,9 @@ module Google
405
494
  # end
406
495
  #
407
496
  # @!attribute [rw] endpoint
408
- # The hostname or hostname:port of the service endpoint.
409
- # Defaults to `"composer.googleapis.com"`.
410
- # @return [::String]
497
+ # A custom service endpoint, as a hostname or hostname:port. The default is
498
+ # nil, indicating to use the default endpoint in the current universe domain.
499
+ # @return [::String,nil]
411
500
  # @!attribute [rw] credentials
412
501
  # Credentials to send with calls. You may provide any of the following types:
413
502
  # * (`String`) The path to a service account key file in JSON format
@@ -444,13 +533,20 @@ module Google
444
533
  # @!attribute [rw] quota_project
445
534
  # A separate project against which to charge quota.
446
535
  # @return [::String]
536
+ # @!attribute [rw] universe_domain
537
+ # The universe domain within which to make requests. This determines the
538
+ # default endpoint URL. The default value of nil uses the environment
539
+ # universe (usually the default "googleapis.com" universe).
540
+ # @return [::String,nil]
447
541
  #
448
542
  class Configuration
449
543
  extend ::Gapic::Config
450
544
 
545
+ # @private
546
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
451
547
  DEFAULT_ENDPOINT = "composer.googleapis.com"
452
548
 
453
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
549
+ config_attr :endpoint, nil, ::String, nil
454
550
  config_attr :credentials, nil do |value|
455
551
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
456
552
  allowed.any? { |klass| klass === value }
@@ -462,6 +558,7 @@ module Google
462
558
  config_attr :metadata, nil, ::Hash, nil
463
559
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
464
560
  config_attr :quota_project, nil, ::String, nil
561
+ config_attr :universe_domain, nil, ::String, nil
465
562
 
466
563
  # @private
467
564
  def initialize parent_config = nil
@@ -544,12 +641,15 @@ module Google
544
641
  # Service stub contains baseline method implementations
545
642
  # including transcoding, making the REST call, and deserialing the response.
546
643
  class OperationsServiceStub
547
- def initialize endpoint:, credentials:
644
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
548
645
  # These require statements are intentionally placed here to initialize
549
646
  # the REST modules only when it's required.
550
647
  require "gapic/rest"
551
648
 
552
- @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials
649
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
650
+ endpoint_template: endpoint_template,
651
+ universe_domain: universe_domain,
652
+ credentials: credentials
553
653
  end
554
654
 
555
655
  ##
@@ -32,16 +32,28 @@ module Google
32
32
  # including transcoding, making the REST call, and deserialing the response.
33
33
  #
34
34
  class ServiceStub
35
- def initialize endpoint:, credentials:
35
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
36
36
  # These require statements are intentionally placed here to initialize
37
37
  # the REST modules only when it's required.
38
38
  require "gapic/rest"
39
39
 
40
- @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
40
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
41
+ endpoint_template: endpoint_template,
42
+ universe_domain: universe_domain,
43
+ credentials: credentials,
41
44
  numeric_enums: true,
42
45
  raise_faraday_errors: false
43
46
  end
44
47
 
48
+ ##
49
+ # The effective universe domain
50
+ #
51
+ # @return [String]
52
+ #
53
+ def universe_domain
54
+ @client_stub.universe_domain
55
+ end
56
+
45
57
  ##
46
58
  # Baseline implementation for the create_environment REST call
47
59
  #