google-cloud-notebooks-v1 0.6.1 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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_runtimes REST call
45
57
  #
@@ -32,6 +32,9 @@ module Google
32
32
  # API v1 service for Cloud AI Platform Notebooks.
33
33
  #
34
34
  class Client
35
+ # @private
36
+ DEFAULT_ENDPOINT_TEMPLATE = "notebooks.$UNIVERSE_DOMAIN$"
37
+
35
38
  include Paths
36
39
 
37
40
  # @private
@@ -161,6 +164,15 @@ module Google
161
164
  @config
162
165
  end
163
166
 
167
+ ##
168
+ # The effective universe domain
169
+ #
170
+ # @return [String]
171
+ #
172
+ def universe_domain
173
+ @notebook_service_stub.universe_domain
174
+ end
175
+
164
176
  ##
165
177
  # Create a new NotebookService client object.
166
178
  #
@@ -194,8 +206,9 @@ module Google
194
206
  credentials = @config.credentials
195
207
  # Use self-signed JWT if the endpoint is unchanged from default,
196
208
  # but only if the default endpoint does not have a region prefix.
197
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
198
- !@config.endpoint.split(".").first.include?("-")
209
+ enable_self_signed_jwt = @config.endpoint.nil? ||
210
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
211
+ !@config.endpoint.split(".").first.include?("-"))
199
212
  credentials ||= Credentials.default scope: @config.scope,
200
213
  enable_self_signed_jwt: enable_self_signed_jwt
201
214
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -208,26 +221,32 @@ module Google
208
221
  config.credentials = credentials
209
222
  config.quota_project = @quota_project_id
210
223
  config.endpoint = @config.endpoint
224
+ config.universe_domain = @config.universe_domain
211
225
  end
212
226
 
213
227
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
214
228
  config.credentials = credentials
215
229
  config.quota_project = @quota_project_id
216
230
  config.endpoint = @config.endpoint
231
+ config.universe_domain = @config.universe_domain
217
232
  end
218
233
 
219
234
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
220
235
  config.credentials = credentials
221
236
  config.quota_project = @quota_project_id
222
237
  config.endpoint = @config.endpoint
238
+ config.universe_domain = @config.universe_domain
223
239
  end
224
240
 
225
241
  @notebook_service_stub = ::Gapic::ServiceStub.new(
226
242
  ::Google::Cloud::Notebooks::V1::NotebookService::Stub,
227
- credentials: credentials,
228
- endpoint: @config.endpoint,
243
+ credentials: credentials,
244
+ endpoint: @config.endpoint,
245
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
246
+ universe_domain: @config.universe_domain,
229
247
  channel_args: @config.channel_args,
230
- interceptors: @config.interceptors
248
+ interceptors: @config.interceptors,
249
+ channel_pool_config: @config.channel_pool
231
250
  )
232
251
  end
233
252
 
@@ -3513,9 +3532,9 @@ module Google
3513
3532
  # end
3514
3533
  #
3515
3534
  # @!attribute [rw] endpoint
3516
- # The hostname or hostname:port of the service endpoint.
3517
- # Defaults to `"notebooks.googleapis.com"`.
3518
- # @return [::String]
3535
+ # A custom service endpoint, as a hostname or hostname:port. The default is
3536
+ # nil, indicating to use the default endpoint in the current universe domain.
3537
+ # @return [::String,nil]
3519
3538
  # @!attribute [rw] credentials
3520
3539
  # Credentials to send with calls. You may provide any of the following types:
3521
3540
  # * (`String`) The path to a service account key file in JSON format
@@ -3561,13 +3580,20 @@ module Google
3561
3580
  # @!attribute [rw] quota_project
3562
3581
  # A separate project against which to charge quota.
3563
3582
  # @return [::String]
3583
+ # @!attribute [rw] universe_domain
3584
+ # The universe domain within which to make requests. This determines the
3585
+ # default endpoint URL. The default value of nil uses the environment
3586
+ # universe (usually the default "googleapis.com" universe).
3587
+ # @return [::String,nil]
3564
3588
  #
3565
3589
  class Configuration
3566
3590
  extend ::Gapic::Config
3567
3591
 
3592
+ # @private
3593
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
3568
3594
  DEFAULT_ENDPOINT = "notebooks.googleapis.com"
3569
3595
 
3570
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
3596
+ config_attr :endpoint, nil, ::String, nil
3571
3597
  config_attr :credentials, nil do |value|
3572
3598
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
3573
3599
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -3582,6 +3608,7 @@ module Google
3582
3608
  config_attr :metadata, nil, ::Hash, nil
3583
3609
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
3584
3610
  config_attr :quota_project, nil, ::String, nil
3611
+ config_attr :universe_domain, nil, ::String, nil
3585
3612
 
3586
3613
  # @private
3587
3614
  def initialize parent_config = nil
@@ -3602,6 +3629,14 @@ module Google
3602
3629
  end
3603
3630
  end
3604
3631
 
3632
+ ##
3633
+ # Configuration for the channel pool
3634
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
3635
+ #
3636
+ def channel_pool
3637
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
3638
+ end
3639
+
3605
3640
  ##
3606
3641
  # Configuration RPC class for the NotebookService API.
3607
3642
  #
@@ -26,6 +26,9 @@ module Google
26
26
  module NotebookService
27
27
  # Service that implements Longrunning Operations API.
28
28
  class Operations
29
+ # @private
30
+ DEFAULT_ENDPOINT_TEMPLATE = "notebooks.$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
  #
@@ -90,10 +102,13 @@ module Google
90
102
 
91
103
  @operations_stub = ::Gapic::ServiceStub.new(
92
104
  ::Google::Longrunning::Operations::Stub,
93
- credentials: credentials,
94
- endpoint: @config.endpoint,
105
+ credentials: credentials,
106
+ endpoint: @config.endpoint,
107
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
108
+ universe_domain: @config.universe_domain,
95
109
  channel_args: @config.channel_args,
96
- interceptors: @config.interceptors
110
+ interceptors: @config.interceptors,
111
+ channel_pool_config: @config.channel_pool
97
112
  )
98
113
 
99
114
  # Used by an LRO wrapper for some methods of this service
@@ -612,9 +627,9 @@ module Google
612
627
  # end
613
628
  #
614
629
  # @!attribute [rw] endpoint
615
- # The hostname or hostname:port of the service endpoint.
616
- # Defaults to `"notebooks.googleapis.com"`.
617
- # @return [::String]
630
+ # A custom service endpoint, as a hostname or hostname:port. The default is
631
+ # nil, indicating to use the default endpoint in the current universe domain.
632
+ # @return [::String,nil]
618
633
  # @!attribute [rw] credentials
619
634
  # Credentials to send with calls. You may provide any of the following types:
620
635
  # * (`String`) The path to a service account key file in JSON format
@@ -660,13 +675,20 @@ module Google
660
675
  # @!attribute [rw] quota_project
661
676
  # A separate project against which to charge quota.
662
677
  # @return [::String]
678
+ # @!attribute [rw] universe_domain
679
+ # The universe domain within which to make requests. This determines the
680
+ # default endpoint URL. The default value of nil uses the environment
681
+ # universe (usually the default "googleapis.com" universe).
682
+ # @return [::String,nil]
663
683
  #
664
684
  class Configuration
665
685
  extend ::Gapic::Config
666
686
 
687
+ # @private
688
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
667
689
  DEFAULT_ENDPOINT = "notebooks.googleapis.com"
668
690
 
669
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
691
+ config_attr :endpoint, nil, ::String, nil
670
692
  config_attr :credentials, nil do |value|
671
693
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
672
694
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -681,6 +703,7 @@ module Google
681
703
  config_attr :metadata, nil, ::Hash, nil
682
704
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
683
705
  config_attr :quota_project, nil, ::String, nil
706
+ config_attr :universe_domain, nil, ::String, nil
684
707
 
685
708
  # @private
686
709
  def initialize parent_config = nil
@@ -701,6 +724,14 @@ module Google
701
724
  end
702
725
  end
703
726
 
727
+ ##
728
+ # Configuration for the channel pool
729
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
730
+ #
731
+ def channel_pool
732
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
733
+ end
734
+
704
735
  ##
705
736
  # Configuration RPC class for the Operations API.
706
737
  #