google-cloud-apigee_registry-v1 0.5.0 → 0.7.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
  # Registry.
36
36
  #
37
37
  class Client
38
+ # @private
39
+ DEFAULT_ENDPOINT_TEMPLATE = "apigeeregistry.$UNIVERSE_DOMAIN$"
40
+
38
41
  include Paths
39
42
 
40
43
  # @private
@@ -95,6 +98,15 @@ module Google
95
98
  @config
96
99
  end
97
100
 
101
+ ##
102
+ # The effective universe domain
103
+ #
104
+ # @return [String]
105
+ #
106
+ def universe_domain
107
+ @provisioning_stub.universe_domain
108
+ end
109
+
98
110
  ##
99
111
  # Create a new Provisioning REST client object.
100
112
  #
@@ -122,8 +134,9 @@ module Google
122
134
  credentials = @config.credentials
123
135
  # Use self-signed JWT if the endpoint is unchanged from default,
124
136
  # but only if the default endpoint does not have a region prefix.
125
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
126
- !@config.endpoint.split(".").first.include?("-")
137
+ enable_self_signed_jwt = @config.endpoint.nil? ||
138
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
139
+ !@config.endpoint.split(".").first.include?("-"))
127
140
  credentials ||= Credentials.default scope: @config.scope,
128
141
  enable_self_signed_jwt: enable_self_signed_jwt
129
142
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -137,12 +150,14 @@ module Google
137
150
  config.credentials = credentials
138
151
  config.quota_project = @quota_project_id
139
152
  config.endpoint = @config.endpoint
153
+ config.universe_domain = @config.universe_domain
140
154
  end
141
155
 
142
156
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
143
157
  config.credentials = credentials
144
158
  config.quota_project = @quota_project_id
145
159
  config.endpoint = @config.endpoint
160
+ config.universe_domain = @config.universe_domain
146
161
  config.bindings_override = @config.bindings_override
147
162
  end
148
163
 
@@ -150,10 +165,16 @@ module Google
150
165
  config.credentials = credentials
151
166
  config.quota_project = @quota_project_id
152
167
  config.endpoint = @config.endpoint
168
+ config.universe_domain = @config.universe_domain
153
169
  config.bindings_override = @config.bindings_override
154
170
  end
155
171
 
156
- @provisioning_stub = ::Google::Cloud::ApigeeRegistry::V1::Provisioning::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
172
+ @provisioning_stub = ::Google::Cloud::ApigeeRegistry::V1::Provisioning::Rest::ServiceStub.new(
173
+ endpoint: @config.endpoint,
174
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
175
+ universe_domain: @config.universe_domain,
176
+ credentials: credentials
177
+ )
157
178
  end
158
179
 
159
180
  ##
@@ -211,6 +232,29 @@ module Google
211
232
  # @return [::Gapic::Operation]
212
233
  #
213
234
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
235
+ #
236
+ # @example Basic example
237
+ # require "google/cloud/apigee_registry/v1"
238
+ #
239
+ # # Create a client object. The client can be reused for multiple calls.
240
+ # client = Google::Cloud::ApigeeRegistry::V1::Provisioning::Rest::Client.new
241
+ #
242
+ # # Create a request. To set request fields, pass in keyword arguments.
243
+ # request = Google::Cloud::ApigeeRegistry::V1::CreateInstanceRequest.new
244
+ #
245
+ # # Call the create_instance method.
246
+ # result = client.create_instance request
247
+ #
248
+ # # The returned object is of type Gapic::Operation. You can use it to
249
+ # # check the status of an operation, cancel it, or wait for results.
250
+ # # Here is how to wait for a response.
251
+ # result.wait_until_done! timeout: 60
252
+ # if result.response?
253
+ # p result.response
254
+ # else
255
+ # puts "No response received."
256
+ # end
257
+ #
214
258
  def create_instance request, options = nil
215
259
  raise ::ArgumentError, "request must be provided" if request.nil?
216
260
 
@@ -275,6 +319,29 @@ module Google
275
319
  # @return [::Gapic::Operation]
276
320
  #
277
321
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
322
+ #
323
+ # @example Basic example
324
+ # require "google/cloud/apigee_registry/v1"
325
+ #
326
+ # # Create a client object. The client can be reused for multiple calls.
327
+ # client = Google::Cloud::ApigeeRegistry::V1::Provisioning::Rest::Client.new
328
+ #
329
+ # # Create a request. To set request fields, pass in keyword arguments.
330
+ # request = Google::Cloud::ApigeeRegistry::V1::DeleteInstanceRequest.new
331
+ #
332
+ # # Call the delete_instance method.
333
+ # result = client.delete_instance request
334
+ #
335
+ # # The returned object is of type Gapic::Operation. You can use it to
336
+ # # check the status of an operation, cancel it, or wait for results.
337
+ # # Here is how to wait for a response.
338
+ # result.wait_until_done! timeout: 60
339
+ # if result.response?
340
+ # p result.response
341
+ # else
342
+ # puts "No response received."
343
+ # end
344
+ #
278
345
  def delete_instance request, options = nil
279
346
  raise ::ArgumentError, "request must be provided" if request.nil?
280
347
 
@@ -339,6 +406,22 @@ module Google
339
406
  # @return [::Google::Cloud::ApigeeRegistry::V1::Instance]
340
407
  #
341
408
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
409
+ #
410
+ # @example Basic example
411
+ # require "google/cloud/apigee_registry/v1"
412
+ #
413
+ # # Create a client object. The client can be reused for multiple calls.
414
+ # client = Google::Cloud::ApigeeRegistry::V1::Provisioning::Rest::Client.new
415
+ #
416
+ # # Create a request. To set request fields, pass in keyword arguments.
417
+ # request = Google::Cloud::ApigeeRegistry::V1::GetInstanceRequest.new
418
+ #
419
+ # # Call the get_instance method.
420
+ # result = client.get_instance request
421
+ #
422
+ # # The returned object is of type Google::Cloud::ApigeeRegistry::V1::Instance.
423
+ # p result
424
+ #
342
425
  def get_instance request, options = nil
343
426
  raise ::ArgumentError, "request must be provided" if request.nil?
344
427
 
@@ -404,9 +487,9 @@ module Google
404
487
  # end
405
488
  #
406
489
  # @!attribute [rw] endpoint
407
- # The hostname or hostname:port of the service endpoint.
408
- # Defaults to `"apigeeregistry.googleapis.com"`.
409
- # @return [::String]
490
+ # A custom service endpoint, as a hostname or hostname:port. The default is
491
+ # nil, indicating to use the default endpoint in the current universe domain.
492
+ # @return [::String,nil]
410
493
  # @!attribute [rw] credentials
411
494
  # Credentials to send with calls. You may provide any of the following types:
412
495
  # * (`String`) The path to a service account key file in JSON format
@@ -443,13 +526,20 @@ module Google
443
526
  # @!attribute [rw] quota_project
444
527
  # A separate project against which to charge quota.
445
528
  # @return [::String]
529
+ # @!attribute [rw] universe_domain
530
+ # The universe domain within which to make requests. This determines the
531
+ # default endpoint URL. The default value of nil uses the environment
532
+ # universe (usually the default "googleapis.com" universe).
533
+ # @return [::String,nil]
446
534
  #
447
535
  class Configuration
448
536
  extend ::Gapic::Config
449
537
 
538
+ # @private
539
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
450
540
  DEFAULT_ENDPOINT = "apigeeregistry.googleapis.com"
451
541
 
452
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
542
+ config_attr :endpoint, nil, ::String, nil
453
543
  config_attr :credentials, nil do |value|
454
544
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
455
545
  allowed.any? { |klass| klass === value }
@@ -461,6 +551,7 @@ module Google
461
551
  config_attr :metadata, nil, ::Hash, nil
462
552
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
463
553
  config_attr :quota_project, nil, ::String, nil
554
+ config_attr :universe_domain, nil, ::String, nil
464
555
 
465
556
  # @private
466
557
  # Overrides for http bindings for the RPCs of this service
@@ -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 = "apigeeregistry.$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 `"apigeeregistry.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 = "apigeeregistry.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 create_instance REST call
45
57
  #
@@ -32,6 +32,9 @@ module Google
32
32
  # The Registry service allows teams to manage descriptions of APIs.
33
33
  #
34
34
  class Client
35
+ # @private
36
+ DEFAULT_ENDPOINT_TEMPLATE = "apigeeregistry.$UNIVERSE_DOMAIN$"
37
+
35
38
  include Paths
36
39
 
37
40
  # @private
@@ -261,6 +264,15 @@ module Google
261
264
  @config
262
265
  end
263
266
 
267
+ ##
268
+ # The effective universe domain
269
+ #
270
+ # @return [String]
271
+ #
272
+ def universe_domain
273
+ @registry_stub.universe_domain
274
+ end
275
+
264
276
  ##
265
277
  # Create a new Registry client object.
266
278
  #
@@ -294,8 +306,9 @@ module Google
294
306
  credentials = @config.credentials
295
307
  # Use self-signed JWT if the endpoint is unchanged from default,
296
308
  # but only if the default endpoint does not have a region prefix.
297
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
298
- !@config.endpoint.split(".").first.include?("-")
309
+ enable_self_signed_jwt = @config.endpoint.nil? ||
310
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
311
+ !@config.endpoint.split(".").first.include?("-"))
299
312
  credentials ||= Credentials.default scope: @config.scope,
300
313
  enable_self_signed_jwt: enable_self_signed_jwt
301
314
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -308,20 +321,25 @@ module Google
308
321
  config.credentials = credentials
309
322
  config.quota_project = @quota_project_id
310
323
  config.endpoint = @config.endpoint
324
+ config.universe_domain = @config.universe_domain
311
325
  end
312
326
 
313
327
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
314
328
  config.credentials = credentials
315
329
  config.quota_project = @quota_project_id
316
330
  config.endpoint = @config.endpoint
331
+ config.universe_domain = @config.universe_domain
317
332
  end
318
333
 
319
334
  @registry_stub = ::Gapic::ServiceStub.new(
320
335
  ::Google::Cloud::ApigeeRegistry::V1::Registry::Stub,
321
- credentials: credentials,
322
- endpoint: @config.endpoint,
336
+ credentials: credentials,
337
+ endpoint: @config.endpoint,
338
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
339
+ universe_domain: @config.universe_domain,
323
340
  channel_args: @config.channel_args,
324
- interceptors: @config.interceptors
341
+ interceptors: @config.interceptors,
342
+ channel_pool_config: @config.channel_pool
325
343
  )
326
344
  end
327
345
 
@@ -3631,9 +3649,9 @@ module Google
3631
3649
  # end
3632
3650
  #
3633
3651
  # @!attribute [rw] endpoint
3634
- # The hostname or hostname:port of the service endpoint.
3635
- # Defaults to `"apigeeregistry.googleapis.com"`.
3636
- # @return [::String]
3652
+ # A custom service endpoint, as a hostname or hostname:port. The default is
3653
+ # nil, indicating to use the default endpoint in the current universe domain.
3654
+ # @return [::String,nil]
3637
3655
  # @!attribute [rw] credentials
3638
3656
  # Credentials to send with calls. You may provide any of the following types:
3639
3657
  # * (`String`) The path to a service account key file in JSON format
@@ -3679,13 +3697,20 @@ module Google
3679
3697
  # @!attribute [rw] quota_project
3680
3698
  # A separate project against which to charge quota.
3681
3699
  # @return [::String]
3700
+ # @!attribute [rw] universe_domain
3701
+ # The universe domain within which to make requests. This determines the
3702
+ # default endpoint URL. The default value of nil uses the environment
3703
+ # universe (usually the default "googleapis.com" universe).
3704
+ # @return [::String,nil]
3682
3705
  #
3683
3706
  class Configuration
3684
3707
  extend ::Gapic::Config
3685
3708
 
3709
+ # @private
3710
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
3686
3711
  DEFAULT_ENDPOINT = "apigeeregistry.googleapis.com"
3687
3712
 
3688
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
3713
+ config_attr :endpoint, nil, ::String, nil
3689
3714
  config_attr :credentials, nil do |value|
3690
3715
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
3691
3716
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -3700,6 +3725,7 @@ module Google
3700
3725
  config_attr :metadata, nil, ::Hash, nil
3701
3726
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
3702
3727
  config_attr :quota_project, nil, ::String, nil
3728
+ config_attr :universe_domain, nil, ::String, nil
3703
3729
 
3704
3730
  # @private
3705
3731
  def initialize parent_config = nil
@@ -3720,6 +3746,14 @@ module Google
3720
3746
  end
3721
3747
  end
3722
3748
 
3749
+ ##
3750
+ # Configuration for the channel pool
3751
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
3752
+ #
3753
+ def channel_pool
3754
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
3755
+ end
3756
+
3723
3757
  ##
3724
3758
  # Configuration RPC class for the Registry API.
3725
3759
  #