google-cloud-os_config-v1alpha 0.6.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,6 +35,9 @@ module Google
35
35
  # manage package installations and patch jobs for Compute Engine VM instances.
36
36
  #
37
37
  class Client
38
+ # @private
39
+ DEFAULT_ENDPOINT_TEMPLATE = "osconfig.$UNIVERSE_DOMAIN$"
40
+
38
41
  include Paths
39
42
 
40
43
  # @private
@@ -100,6 +103,15 @@ module Google
100
103
  @config
101
104
  end
102
105
 
106
+ ##
107
+ # The effective universe domain
108
+ #
109
+ # @return [String]
110
+ #
111
+ def universe_domain
112
+ @os_config_zonal_service_stub.universe_domain
113
+ end
114
+
103
115
  ##
104
116
  # Create a new OsConfigZonalService REST client object.
105
117
  #
@@ -127,8 +139,9 @@ module Google
127
139
  credentials = @config.credentials
128
140
  # Use self-signed JWT if the endpoint is unchanged from default,
129
141
  # but only if the default endpoint does not have a region prefix.
130
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
131
- !@config.endpoint.split(".").first.include?("-")
142
+ enable_self_signed_jwt = @config.endpoint.nil? ||
143
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
144
+ !@config.endpoint.split(".").first.include?("-"))
132
145
  credentials ||= Credentials.default scope: @config.scope,
133
146
  enable_self_signed_jwt: enable_self_signed_jwt
134
147
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -142,9 +155,15 @@ module Google
142
155
  config.credentials = credentials
143
156
  config.quota_project = @quota_project_id
144
157
  config.endpoint = @config.endpoint
158
+ config.universe_domain = @config.universe_domain
145
159
  end
146
160
 
147
- @os_config_zonal_service_stub = ::Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
161
+ @os_config_zonal_service_stub = ::Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Rest::ServiceStub.new(
162
+ endpoint: @config.endpoint,
163
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
164
+ universe_domain: @config.universe_domain,
165
+ credentials: credentials
166
+ )
148
167
  end
149
168
 
150
169
  ##
@@ -203,6 +222,29 @@ module Google
203
222
  # @return [::Gapic::Operation]
204
223
  #
205
224
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
225
+ #
226
+ # @example Basic example
227
+ # require "google/cloud/os_config/v1alpha"
228
+ #
229
+ # # Create a client object. The client can be reused for multiple calls.
230
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Rest::Client.new
231
+ #
232
+ # # Create a request. To set request fields, pass in keyword arguments.
233
+ # request = Google::Cloud::OsConfig::V1alpha::CreateOSPolicyAssignmentRequest.new
234
+ #
235
+ # # Call the create_os_policy_assignment method.
236
+ # result = client.create_os_policy_assignment request
237
+ #
238
+ # # The returned object is of type Gapic::Operation. You can use it to
239
+ # # check the status of an operation, cancel it, or wait for results.
240
+ # # Here is how to wait for a response.
241
+ # result.wait_until_done! timeout: 60
242
+ # if result.response?
243
+ # p result.response
244
+ # else
245
+ # puts "No response received."
246
+ # end
247
+ #
206
248
  def create_os_policy_assignment request, options = nil
207
249
  raise ::ArgumentError, "request must be provided" if request.nil?
208
250
 
@@ -276,6 +318,29 @@ module Google
276
318
  # @return [::Gapic::Operation]
277
319
  #
278
320
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
321
+ #
322
+ # @example Basic example
323
+ # require "google/cloud/os_config/v1alpha"
324
+ #
325
+ # # Create a client object. The client can be reused for multiple calls.
326
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Rest::Client.new
327
+ #
328
+ # # Create a request. To set request fields, pass in keyword arguments.
329
+ # request = Google::Cloud::OsConfig::V1alpha::UpdateOSPolicyAssignmentRequest.new
330
+ #
331
+ # # Call the update_os_policy_assignment method.
332
+ # result = client.update_os_policy_assignment request
333
+ #
334
+ # # The returned object is of type Gapic::Operation. You can use it to
335
+ # # check the status of an operation, cancel it, or wait for results.
336
+ # # Here is how to wait for a response.
337
+ # result.wait_until_done! timeout: 60
338
+ # if result.response?
339
+ # p result.response
340
+ # else
341
+ # puts "No response received."
342
+ # end
343
+ #
279
344
  def update_os_policy_assignment request, options = nil
280
345
  raise ::ArgumentError, "request must be provided" if request.nil?
281
346
 
@@ -346,6 +411,22 @@ module Google
346
411
  # @return [::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment]
347
412
  #
348
413
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
414
+ #
415
+ # @example Basic example
416
+ # require "google/cloud/os_config/v1alpha"
417
+ #
418
+ # # Create a client object. The client can be reused for multiple calls.
419
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Rest::Client.new
420
+ #
421
+ # # Create a request. To set request fields, pass in keyword arguments.
422
+ # request = Google::Cloud::OsConfig::V1alpha::GetOSPolicyAssignmentRequest.new
423
+ #
424
+ # # Call the get_os_policy_assignment method.
425
+ # result = client.get_os_policy_assignment request
426
+ #
427
+ # # The returned object is of type Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment.
428
+ # p result
429
+ #
349
430
  def get_os_policy_assignment request, options = nil
350
431
  raise ::ArgumentError, "request must be provided" if request.nil?
351
432
 
@@ -416,6 +497,26 @@ module Google
416
497
  # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment>]
417
498
  #
418
499
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
500
+ #
501
+ # @example Basic example
502
+ # require "google/cloud/os_config/v1alpha"
503
+ #
504
+ # # Create a client object. The client can be reused for multiple calls.
505
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Rest::Client.new
506
+ #
507
+ # # Create a request. To set request fields, pass in keyword arguments.
508
+ # request = Google::Cloud::OsConfig::V1alpha::ListOSPolicyAssignmentsRequest.new
509
+ #
510
+ # # Call the list_os_policy_assignments method.
511
+ # result = client.list_os_policy_assignments request
512
+ #
513
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
514
+ # # over elements, and API calls will be issued to fetch pages as needed.
515
+ # result.each do |item|
516
+ # # Each element is of type ::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment.
517
+ # p item
518
+ # end
519
+ #
419
520
  def list_os_policy_assignments request, options = nil
420
521
  raise ::ArgumentError, "request must be provided" if request.nil?
421
522
 
@@ -485,6 +586,26 @@ module Google
485
586
  # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment>]
486
587
  #
487
588
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
589
+ #
590
+ # @example Basic example
591
+ # require "google/cloud/os_config/v1alpha"
592
+ #
593
+ # # Create a client object. The client can be reused for multiple calls.
594
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Rest::Client.new
595
+ #
596
+ # # Create a request. To set request fields, pass in keyword arguments.
597
+ # request = Google::Cloud::OsConfig::V1alpha::ListOSPolicyAssignmentRevisionsRequest.new
598
+ #
599
+ # # Call the list_os_policy_assignment_revisions method.
600
+ # result = client.list_os_policy_assignment_revisions request
601
+ #
602
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
603
+ # # over elements, and API calls will be issued to fetch pages as needed.
604
+ # result.each do |item|
605
+ # # Each element is of type ::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment.
606
+ # p item
607
+ # end
608
+ #
488
609
  def list_os_policy_assignment_revisions request, options = nil
489
610
  raise ::ArgumentError, "request must be provided" if request.nil?
490
611
 
@@ -559,6 +680,29 @@ module Google
559
680
  # @return [::Gapic::Operation]
560
681
  #
561
682
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
683
+ #
684
+ # @example Basic example
685
+ # require "google/cloud/os_config/v1alpha"
686
+ #
687
+ # # Create a client object. The client can be reused for multiple calls.
688
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Rest::Client.new
689
+ #
690
+ # # Create a request. To set request fields, pass in keyword arguments.
691
+ # request = Google::Cloud::OsConfig::V1alpha::DeleteOSPolicyAssignmentRequest.new
692
+ #
693
+ # # Call the delete_os_policy_assignment method.
694
+ # result = client.delete_os_policy_assignment request
695
+ #
696
+ # # The returned object is of type Gapic::Operation. You can use it to
697
+ # # check the status of an operation, cancel it, or wait for results.
698
+ # # Here is how to wait for a response.
699
+ # result.wait_until_done! timeout: 60
700
+ # if result.response?
701
+ # p result.response
702
+ # else
703
+ # puts "No response received."
704
+ # end
705
+ #
562
706
  def delete_os_policy_assignment request, options = nil
563
707
  raise ::ArgumentError, "request must be provided" if request.nil?
564
708
 
@@ -631,6 +775,22 @@ module Google
631
775
  # @return [::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance]
632
776
  #
633
777
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
778
+ #
779
+ # @example Basic example
780
+ # require "google/cloud/os_config/v1alpha"
781
+ #
782
+ # # Create a client object. The client can be reused for multiple calls.
783
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Rest::Client.new
784
+ #
785
+ # # Create a request. To set request fields, pass in keyword arguments.
786
+ # request = Google::Cloud::OsConfig::V1alpha::GetInstanceOSPoliciesComplianceRequest.new
787
+ #
788
+ # # Call the get_instance_os_policies_compliance method.
789
+ # result = client.get_instance_os_policies_compliance request
790
+ #
791
+ # # The returned object is of type Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance.
792
+ # p result
793
+ #
634
794
  def get_instance_os_policies_compliance request, options = nil
635
795
  raise ::ArgumentError, "request must be provided" if request.nil?
636
796
 
@@ -708,6 +868,26 @@ module Google
708
868
  # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance>]
709
869
  #
710
870
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
871
+ #
872
+ # @example Basic example
873
+ # require "google/cloud/os_config/v1alpha"
874
+ #
875
+ # # Create a client object. The client can be reused for multiple calls.
876
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Rest::Client.new
877
+ #
878
+ # # Create a request. To set request fields, pass in keyword arguments.
879
+ # request = Google::Cloud::OsConfig::V1alpha::ListInstanceOSPoliciesCompliancesRequest.new
880
+ #
881
+ # # Call the list_instance_os_policies_compliances method.
882
+ # result = client.list_instance_os_policies_compliances request
883
+ #
884
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
885
+ # # over elements, and API calls will be issued to fetch pages as needed.
886
+ # result.each do |item|
887
+ # # Each element is of type ::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance.
888
+ # p item
889
+ # end
890
+ #
711
891
  def list_instance_os_policies_compliances request, options = nil
712
892
  raise ::ArgumentError, "request must be provided" if request.nil?
713
893
 
@@ -780,6 +960,22 @@ module Google
780
960
  # @return [::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignmentReport]
781
961
  #
782
962
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
963
+ #
964
+ # @example Basic example
965
+ # require "google/cloud/os_config/v1alpha"
966
+ #
967
+ # # Create a client object. The client can be reused for multiple calls.
968
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Rest::Client.new
969
+ #
970
+ # # Create a request. To set request fields, pass in keyword arguments.
971
+ # request = Google::Cloud::OsConfig::V1alpha::GetOSPolicyAssignmentReportRequest.new
972
+ #
973
+ # # Call the get_os_policy_assignment_report method.
974
+ # result = client.get_os_policy_assignment_report request
975
+ #
976
+ # # The returned object is of type Google::Cloud::OsConfig::V1alpha::OSPolicyAssignmentReport.
977
+ # p result
978
+ #
783
979
  def get_os_policy_assignment_report request, options = nil
784
980
  raise ::ArgumentError, "request must be provided" if request.nil?
785
981
 
@@ -872,6 +1068,26 @@ module Google
872
1068
  # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignmentReport>]
873
1069
  #
874
1070
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1071
+ #
1072
+ # @example Basic example
1073
+ # require "google/cloud/os_config/v1alpha"
1074
+ #
1075
+ # # Create a client object. The client can be reused for multiple calls.
1076
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Rest::Client.new
1077
+ #
1078
+ # # Create a request. To set request fields, pass in keyword arguments.
1079
+ # request = Google::Cloud::OsConfig::V1alpha::ListOSPolicyAssignmentReportsRequest.new
1080
+ #
1081
+ # # Call the list_os_policy_assignment_reports method.
1082
+ # result = client.list_os_policy_assignment_reports request
1083
+ #
1084
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1085
+ # # over elements, and API calls will be issued to fetch pages as needed.
1086
+ # result.each do |item|
1087
+ # # Each element is of type ::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignmentReport.
1088
+ # p item
1089
+ # end
1090
+ #
875
1091
  def list_os_policy_assignment_reports request, options = nil
876
1092
  raise ::ArgumentError, "request must be provided" if request.nil?
877
1093
 
@@ -946,6 +1162,22 @@ module Google
946
1162
  # @return [::Google::Cloud::OsConfig::V1alpha::Inventory]
947
1163
  #
948
1164
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1165
+ #
1166
+ # @example Basic example
1167
+ # require "google/cloud/os_config/v1alpha"
1168
+ #
1169
+ # # Create a client object. The client can be reused for multiple calls.
1170
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Rest::Client.new
1171
+ #
1172
+ # # Create a request. To set request fields, pass in keyword arguments.
1173
+ # request = Google::Cloud::OsConfig::V1alpha::GetInventoryRequest.new
1174
+ #
1175
+ # # Call the get_inventory method.
1176
+ # result = client.get_inventory request
1177
+ #
1178
+ # # The returned object is of type Google::Cloud::OsConfig::V1alpha::Inventory.
1179
+ # p result
1180
+ #
949
1181
  def get_inventory request, options = nil
950
1182
  raise ::ArgumentError, "request must be provided" if request.nil?
951
1183
 
@@ -1024,6 +1256,26 @@ module Google
1024
1256
  # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::Inventory>]
1025
1257
  #
1026
1258
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1259
+ #
1260
+ # @example Basic example
1261
+ # require "google/cloud/os_config/v1alpha"
1262
+ #
1263
+ # # Create a client object. The client can be reused for multiple calls.
1264
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Rest::Client.new
1265
+ #
1266
+ # # Create a request. To set request fields, pass in keyword arguments.
1267
+ # request = Google::Cloud::OsConfig::V1alpha::ListInventoriesRequest.new
1268
+ #
1269
+ # # Call the list_inventories method.
1270
+ # result = client.list_inventories request
1271
+ #
1272
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1273
+ # # over elements, and API calls will be issued to fetch pages as needed.
1274
+ # result.each do |item|
1275
+ # # Each element is of type ::Google::Cloud::OsConfig::V1alpha::Inventory.
1276
+ # p item
1277
+ # end
1278
+ #
1027
1279
  def list_inventories request, options = nil
1028
1280
  raise ::ArgumentError, "request must be provided" if request.nil?
1029
1281
 
@@ -1095,6 +1347,22 @@ module Google
1095
1347
  # @return [::Google::Cloud::OsConfig::V1alpha::VulnerabilityReport]
1096
1348
  #
1097
1349
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1350
+ #
1351
+ # @example Basic example
1352
+ # require "google/cloud/os_config/v1alpha"
1353
+ #
1354
+ # # Create a client object. The client can be reused for multiple calls.
1355
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Rest::Client.new
1356
+ #
1357
+ # # Create a request. To set request fields, pass in keyword arguments.
1358
+ # request = Google::Cloud::OsConfig::V1alpha::GetVulnerabilityReportRequest.new
1359
+ #
1360
+ # # Call the get_vulnerability_report method.
1361
+ # result = client.get_vulnerability_report request
1362
+ #
1363
+ # # The returned object is of type Google::Cloud::OsConfig::V1alpha::VulnerabilityReport.
1364
+ # p result
1365
+ #
1098
1366
  def get_vulnerability_report request, options = nil
1099
1367
  raise ::ArgumentError, "request must be provided" if request.nil?
1100
1368
 
@@ -1170,6 +1438,26 @@ module Google
1170
1438
  # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::VulnerabilityReport>]
1171
1439
  #
1172
1440
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1441
+ #
1442
+ # @example Basic example
1443
+ # require "google/cloud/os_config/v1alpha"
1444
+ #
1445
+ # # Create a client object. The client can be reused for multiple calls.
1446
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Rest::Client.new
1447
+ #
1448
+ # # Create a request. To set request fields, pass in keyword arguments.
1449
+ # request = Google::Cloud::OsConfig::V1alpha::ListVulnerabilityReportsRequest.new
1450
+ #
1451
+ # # Call the list_vulnerability_reports method.
1452
+ # result = client.list_vulnerability_reports request
1453
+ #
1454
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1455
+ # # over elements, and API calls will be issued to fetch pages as needed.
1456
+ # result.each do |item|
1457
+ # # Each element is of type ::Google::Cloud::OsConfig::V1alpha::VulnerabilityReport.
1458
+ # p item
1459
+ # end
1460
+ #
1173
1461
  def list_vulnerability_reports request, options = nil
1174
1462
  raise ::ArgumentError, "request must be provided" if request.nil?
1175
1463
 
@@ -1236,9 +1524,9 @@ module Google
1236
1524
  # end
1237
1525
  #
1238
1526
  # @!attribute [rw] endpoint
1239
- # The hostname or hostname:port of the service endpoint.
1240
- # Defaults to `"osconfig.googleapis.com"`.
1241
- # @return [::String]
1527
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1528
+ # nil, indicating to use the default endpoint in the current universe domain.
1529
+ # @return [::String,nil]
1242
1530
  # @!attribute [rw] credentials
1243
1531
  # Credentials to send with calls. You may provide any of the following types:
1244
1532
  # * (`String`) The path to a service account key file in JSON format
@@ -1275,13 +1563,20 @@ module Google
1275
1563
  # @!attribute [rw] quota_project
1276
1564
  # A separate project against which to charge quota.
1277
1565
  # @return [::String]
1566
+ # @!attribute [rw] universe_domain
1567
+ # The universe domain within which to make requests. This determines the
1568
+ # default endpoint URL. The default value of nil uses the environment
1569
+ # universe (usually the default "googleapis.com" universe).
1570
+ # @return [::String,nil]
1278
1571
  #
1279
1572
  class Configuration
1280
1573
  extend ::Gapic::Config
1281
1574
 
1575
+ # @private
1576
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1282
1577
  DEFAULT_ENDPOINT = "osconfig.googleapis.com"
1283
1578
 
1284
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1579
+ config_attr :endpoint, nil, ::String, nil
1285
1580
  config_attr :credentials, nil do |value|
1286
1581
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1287
1582
  allowed.any? { |klass| klass === value }
@@ -1293,6 +1588,7 @@ module Google
1293
1588
  config_attr :metadata, nil, ::Hash, nil
1294
1589
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1295
1590
  config_attr :quota_project, nil, ::String, nil
1591
+ config_attr :universe_domain, nil, ::String, nil
1296
1592
 
1297
1593
  # @private
1298
1594
  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 = "osconfig.$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 `"osconfig.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 = "osconfig.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
  ##