google-cloud-kms-v1 0.22.1 → 0.24.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.
@@ -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 list_ekm_connections REST call
45
57
  #
@@ -43,6 +43,9 @@ module Google
43
43
  # [Using gRPC with Cloud KMS](https://cloud.google.com/kms/docs/grpc).
44
44
  #
45
45
  class Client
46
+ # @private
47
+ DEFAULT_ENDPOINT_TEMPLATE = "cloudkms.$UNIVERSE_DOMAIN$"
48
+
46
49
  include Paths
47
50
 
48
51
  # @private
@@ -227,6 +230,15 @@ module Google
227
230
  @config
228
231
  end
229
232
 
233
+ ##
234
+ # The effective universe domain
235
+ #
236
+ # @return [String]
237
+ #
238
+ def universe_domain
239
+ @key_management_service_stub.universe_domain
240
+ end
241
+
230
242
  ##
231
243
  # Create a new KeyManagementService client object.
232
244
  #
@@ -260,8 +272,9 @@ module Google
260
272
  credentials = @config.credentials
261
273
  # Use self-signed JWT if the endpoint is unchanged from default,
262
274
  # but only if the default endpoint does not have a region prefix.
263
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
264
- !@config.endpoint.split(".").first.include?("-")
275
+ enable_self_signed_jwt = @config.endpoint.nil? ||
276
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
277
+ !@config.endpoint.split(".").first.include?("-"))
265
278
  credentials ||= Credentials.default scope: @config.scope,
266
279
  enable_self_signed_jwt: enable_self_signed_jwt
267
280
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -274,20 +287,25 @@ module Google
274
287
  config.credentials = credentials
275
288
  config.quota_project = @quota_project_id
276
289
  config.endpoint = @config.endpoint
290
+ config.universe_domain = @config.universe_domain
277
291
  end
278
292
 
279
293
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
280
294
  config.credentials = credentials
281
295
  config.quota_project = @quota_project_id
282
296
  config.endpoint = @config.endpoint
297
+ config.universe_domain = @config.universe_domain
283
298
  end
284
299
 
285
300
  @key_management_service_stub = ::Gapic::ServiceStub.new(
286
301
  ::Google::Cloud::Kms::V1::KeyManagementService::Stub,
287
- credentials: credentials,
288
- endpoint: @config.endpoint,
302
+ credentials: credentials,
303
+ endpoint: @config.endpoint,
304
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
305
+ universe_domain: @config.universe_domain,
289
306
  channel_args: @config.channel_args,
290
- interceptors: @config.interceptors
307
+ interceptors: @config.interceptors,
308
+ channel_pool_config: @config.channel_pool
291
309
  )
292
310
  end
293
311
 
@@ -3491,9 +3509,9 @@ module Google
3491
3509
  # end
3492
3510
  #
3493
3511
  # @!attribute [rw] endpoint
3494
- # The hostname or hostname:port of the service endpoint.
3495
- # Defaults to `"cloudkms.googleapis.com"`.
3496
- # @return [::String]
3512
+ # A custom service endpoint, as a hostname or hostname:port. The default is
3513
+ # nil, indicating to use the default endpoint in the current universe domain.
3514
+ # @return [::String,nil]
3497
3515
  # @!attribute [rw] credentials
3498
3516
  # Credentials to send with calls. You may provide any of the following types:
3499
3517
  # * (`String`) The path to a service account key file in JSON format
@@ -3539,13 +3557,20 @@ module Google
3539
3557
  # @!attribute [rw] quota_project
3540
3558
  # A separate project against which to charge quota.
3541
3559
  # @return [::String]
3560
+ # @!attribute [rw] universe_domain
3561
+ # The universe domain within which to make requests. This determines the
3562
+ # default endpoint URL. The default value of nil uses the environment
3563
+ # universe (usually the default "googleapis.com" universe).
3564
+ # @return [::String,nil]
3542
3565
  #
3543
3566
  class Configuration
3544
3567
  extend ::Gapic::Config
3545
3568
 
3569
+ # @private
3570
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
3546
3571
  DEFAULT_ENDPOINT = "cloudkms.googleapis.com"
3547
3572
 
3548
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
3573
+ config_attr :endpoint, nil, ::String, nil
3549
3574
  config_attr :credentials, nil do |value|
3550
3575
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
3551
3576
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -3560,6 +3585,7 @@ module Google
3560
3585
  config_attr :metadata, nil, ::Hash, nil
3561
3586
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
3562
3587
  config_attr :quota_project, nil, ::String, nil
3588
+ config_attr :universe_domain, nil, ::String, nil
3563
3589
 
3564
3590
  # @private
3565
3591
  def initialize parent_config = nil
@@ -3580,6 +3606,14 @@ module Google
3580
3606
  end
3581
3607
  end
3582
3608
 
3609
+ ##
3610
+ # Configuration for the channel pool
3611
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
3612
+ #
3613
+ def channel_pool
3614
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
3615
+ end
3616
+
3583
3617
  ##
3584
3618
  # Configuration RPC class for the KeyManagementService API.
3585
3619
  #