google-cloud-gke_connect-gateway-v1beta1 0.7.1 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d9e035af8d7406ffcef3291ca920fa30fcd2533052ef3864cf6d66f78e6a4c04
4
- data.tar.gz: 5efb2a24fc7c7bbf710ed57f79c8250fe214d18d45650528dc491be078e852a2
3
+ metadata.gz: f0f7083bad5bf609e9fe8a3d0e8ca91f4e78438a35e9b8dca185fbc5d800e08f
4
+ data.tar.gz: a93bef99926b0ef53f735bfbb5a46317464939fb9d56566ecdb1cb7b72949874
5
5
  SHA512:
6
- metadata.gz: cc68bac0d22d53397a0055d228ebd64a2a276d2def59bc36b9b32a95f449810226f1578707a8f191d1cd64840e0a9ab3cd52176b66b3d8aad526cf27eefebd4f
7
- data.tar.gz: 1ce4c20276b96fec7bdf26bea990de887e8717b7e6e25c3de263b5eb1363307078bdb3241ae99438cbc37cf95141876f2da7fc1fdfce388834db5f12f624b9cf
6
+ metadata.gz: 1eff37879511e1bcd3153de2b0d6fa8f81d826cefcdafef4bf6b5314d94b9bd3f6cd9c79b0a088ec25b309e83a482b4aa95dd5891538329db0fe8117840417a5
7
+ data.tar.gz: 8ac374a6b0b8fdb26b7ac9abb3c268e86c37643f7d8df8ca659314cf7e1b71942cccf320d63724a62f1ab3f4f4f224eb521c0a3e3b5e1bc5772c2aab85362e20
data/AUTHENTICATION.md CHANGED
@@ -56,7 +56,7 @@ To configure a credentials file for an individual client initialization:
56
56
  ```ruby
57
57
  require "google/cloud/gke_connect/gateway/v1beta1"
58
58
 
59
- client = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Client.new do |config|
59
+ client = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Rest::Client.new do |config|
60
60
  config.credentials = "path/to/credentialfile.json"
61
61
  end
62
62
  ```
@@ -66,11 +66,11 @@ To configure a credentials file globally for all clients:
66
66
  ```ruby
67
67
  require "google/cloud/gke_connect/gateway/v1beta1"
68
68
 
69
- ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Client.configure do |config|
69
+ ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Rest::Client.configure do |config|
70
70
  config.credentials = "path/to/credentialfile.json"
71
71
  end
72
72
 
73
- client = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Client.new
73
+ client = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Rest::Client.new
74
74
  ```
75
75
 
76
76
  ### Environment Variables
@@ -100,7 +100,7 @@ require "google/cloud/gke_connect/gateway/v1beta1"
100
100
 
101
101
  ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json"
102
102
 
103
- client = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Client.new
103
+ client = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Rest::Client.new
104
104
  ```
105
105
 
106
106
  ### Local ADC file
data/README.md CHANGED
@@ -32,7 +32,7 @@ In order to use this library, you first need to go through the following steps:
32
32
  ```ruby
33
33
  require "google/cloud/gke_connect/gateway/v1beta1"
34
34
 
35
- client = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Client.new
35
+ client = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Rest::Client.new
36
36
  request = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GenerateCredentialsRequest.new # (request fields as keyword arguments...)
37
37
  response = client.generate_credentials request
38
38
  ```
@@ -43,40 +43,50 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/anthos/multicluster-management/gateway/)
44
44
  for general usage information.
45
45
 
46
- ## Enabling Logging
47
-
48
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
-
54
- Configuring a Ruby stdlib logger:
46
+ ## Debug Logging
47
+
48
+ This library comes with opt-in Debug Logging that can help you troubleshoot
49
+ your application's integration with the API. When logging is activated, key
50
+ events such as requests and responses, along with data payloads and metadata
51
+ such as headers and client configuration, are logged to the standard error
52
+ stream.
53
+
54
+ **WARNING:** Client Library Debug Logging includes your data payloads in
55
+ plaintext, which could include sensitive data such as PII for yourself or your
56
+ customers, private keys, or other security data that could be compromising if
57
+ leaked. Always practice good data hygiene with your application logs, and follow
58
+ the principle of least access. Google also recommends that Client Library Debug
59
+ Logging be enabled only temporarily during active debugging, and not used
60
+ permanently in production.
61
+
62
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
63
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
64
+ list of client library gem names. This will select the default logging behavior,
65
+ which writes logs to the standard error stream. On a local workstation, this may
66
+ result in logs appearing on the console. When running on a Google Cloud hosting
67
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
68
+ results in logs appearing alongside your application logs in the
69
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
70
+
71
+ You can customize logging by modifying the `logger` configuration when
72
+ constructing a client object. For example:
55
73
 
56
74
  ```ruby
75
+ require "google/cloud/gke_connect/gateway/v1beta1"
57
76
  require "logger"
58
77
 
59
- module MyLogger
60
- LOGGER = Logger.new $stderr, level: Logger::WARN
61
- def logger
62
- LOGGER
63
- end
64
- end
65
-
66
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
67
- module GRPC
68
- extend MyLogger
78
+ client = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Rest::Client.new do |config|
79
+ config.logger = Logger.new "my-app.log"
69
80
  end
70
81
  ```
71
82
 
72
-
73
83
  ## Google Cloud Samples
74
84
 
75
85
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
76
86
 
77
87
  ## Supported Ruby Versions
78
88
 
79
- This library is supported on Ruby 2.7+.
89
+ This library is supported on Ruby 3.0+.
80
90
 
81
91
  Google provides official support for Ruby versions that are actively supported
82
92
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
@@ -154,8 +154,28 @@ module Google
154
154
  endpoint: @config.endpoint,
155
155
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
156
156
  universe_domain: @config.universe_domain,
157
- credentials: credentials
157
+ credentials: credentials,
158
+ logger: @config.logger
158
159
  )
160
+
161
+ @gateway_control_stub.logger(stub: true)&.info do |entry|
162
+ entry.set_system_name
163
+ entry.set_service
164
+ entry.message = "Created client for #{entry.service}"
165
+ entry.set_credentials_fields credentials
166
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
167
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
168
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
169
+ end
170
+ end
171
+
172
+ ##
173
+ # The logger used for request/response debug logging.
174
+ #
175
+ # @return [Logger]
176
+ #
177
+ def logger
178
+ @gateway_control_stub.logger
159
179
  end
160
180
 
161
181
  # Service calls
@@ -253,7 +273,6 @@ module Google
253
273
 
254
274
  @gateway_control_stub.generate_credentials request, options do |result, operation|
255
275
  yield result, operation if block_given?
256
- return result
257
276
  end
258
277
  rescue ::Gapic::Rest::Error => e
259
278
  raise ::Google::Cloud::Error.from_error(e)
@@ -301,6 +320,13 @@ module Google
301
320
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
302
321
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
303
322
  # * (`nil`) indicating no credentials
323
+ #
324
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
325
+ # external source for authentication to Google Cloud, you must validate it before
326
+ # providing it to a Google API client library. Providing an unvalidated credential
327
+ # configuration to Google APIs can compromise the security of your systems and data.
328
+ # For more information, refer to [Validate credential configurations from external
329
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
304
330
  # @return [::Object]
305
331
  # @!attribute [rw] scope
306
332
  # The OAuth scopes
@@ -333,6 +359,11 @@ module Google
333
359
  # default endpoint URL. The default value of nil uses the environment
334
360
  # universe (usually the default "googleapis.com" universe).
335
361
  # @return [::String,nil]
362
+ # @!attribute [rw] logger
363
+ # A custom logger to use for request/response debug logging, or the value
364
+ # `:default` (the default) to construct a default logger, or `nil` to
365
+ # explicitly disable logging.
366
+ # @return [::Logger,:default,nil]
336
367
  #
337
368
  class Configuration
338
369
  extend ::Gapic::Config
@@ -354,6 +385,7 @@ module Google
354
385
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
355
386
  config_attr :quota_project, nil, ::String, nil
356
387
  config_attr :universe_domain, nil, ::String, nil
388
+ config_attr :logger, :default, ::Logger, nil, :default
357
389
 
358
390
  # @private
359
391
  def initialize parent_config = nil
@@ -31,7 +31,8 @@ module Google
31
31
  # including transcoding, making the REST call, and deserialing the response.
32
32
  #
33
33
  class ServiceStub
34
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
34
+ # @private
35
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
35
36
  # These require statements are intentionally placed here to initialize
36
37
  # the REST modules only when it's required.
37
38
  require "gapic/rest"
@@ -41,7 +42,9 @@ module Google
41
42
  universe_domain: universe_domain,
42
43
  credentials: credentials,
43
44
  numeric_enums: false,
44
- raise_faraday_errors: false
45
+ service_name: self.class,
46
+ raise_faraday_errors: false,
47
+ logger: logger
45
48
  end
46
49
 
47
50
  ##
@@ -62,6 +65,15 @@ module Google
62
65
  @client_stub.endpoint
63
66
  end
64
67
 
68
+ ##
69
+ # The logger used for request/response debug logging.
70
+ #
71
+ # @return [Logger]
72
+ #
73
+ def logger stub: false
74
+ stub ? @client_stub.stub_logger : @client_stub.logger
75
+ end
76
+
65
77
  ##
66
78
  # Baseline implementation for the generate_credentials REST call
67
79
  #
@@ -88,16 +100,18 @@ module Google
88
100
 
89
101
  response = @client_stub.make_http_request(
90
102
  verb,
91
- uri: uri,
92
- body: body || "",
93
- params: query_string_params,
103
+ uri: uri,
104
+ body: body || "",
105
+ params: query_string_params,
106
+ method_name: "generate_credentials",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GenerateCredentialsResponse.decode_json response.body, ignore_unknown_fields: true
98
-
99
- yield result, operation if block_given?
100
- result
111
+ catch :response do
112
+ yield result, operation if block_given?
113
+ result
114
+ end
101
115
  end
102
116
 
103
117
  ##
@@ -16,14 +16,12 @@
16
16
 
17
17
  # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
18
 
19
- require "gapic/common"
20
19
  require "gapic/config"
21
20
  require "gapic/config/method"
22
21
 
23
22
  require "google/cloud/gke_connect/gateway/v1beta1/version"
24
23
 
25
24
  require "google/cloud/gke_connect/gateway/v1beta1/gateway_control/credentials"
26
- require "google/cloud/gke_connect/gateway/v1beta1/gateway_control/client"
27
25
  require "google/cloud/gke_connect/gateway/v1beta1/gateway_control/rest"
28
26
 
29
27
  module Google
@@ -34,11 +32,6 @@ module Google
34
32
  ##
35
33
  # GatewayControl is the control plane API for Connect Gateway.
36
34
  #
37
- # @example Load this service and instantiate a gRPC client
38
- #
39
- # require "google/cloud/gke_connect/gateway/v1beta1/gateway_control"
40
- # client = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Client.new
41
- #
42
35
  # @example Load this service and instantiate a REST client
43
36
  #
44
37
  # require "google/cloud/gke_connect/gateway/v1beta1/gateway_control/rest"
@@ -22,7 +22,7 @@ module Google
22
22
  module GkeConnect
23
23
  module Gateway
24
24
  module V1beta1
25
- VERSION = "0.7.1"
25
+ VERSION = "0.9.0"
26
26
  end
27
27
  end
28
28
  end
@@ -26,11 +26,6 @@ module Google
26
26
  ##
27
27
  # API client module.
28
28
  #
29
- # @example Load this package, including all its services, and instantiate a gRPC client
30
- #
31
- # require "google/cloud/gke_connect/gateway/v1beta1"
32
- # client = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Client.new
33
- #
34
29
  # @example Load this package, including all its services, and instantiate a REST client
35
30
  #
36
31
  # require "google/cloud/gke_connect/gateway/v1beta1"
@@ -28,6 +28,9 @@ module Google
28
28
  # @!attribute [rw] destinations
29
29
  # @return [::Array<::Google::Api::ClientLibraryDestination>]
30
30
  # The destination where API teams want this client library to be published.
31
+ # @!attribute [rw] selective_gapic_generation
32
+ # @return [::Google::Api::SelectiveGapicGeneration]
33
+ # Configuration for which RPCs should be generated in the GAPIC client.
31
34
  class CommonLanguageSettings
32
35
  include ::Google::Protobuf::MessageExts
33
36
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -212,6 +215,12 @@ module Google
212
215
  # enabled. By default, asynchronous REST clients will not be generated.
213
216
  # This feature will be enabled by default 1 month after launching the
214
217
  # feature in preview packages.
218
+ # @!attribute [rw] protobuf_pythonic_types_enabled
219
+ # @return [::Boolean]
220
+ # Enables generation of protobuf code using new types that are more
221
+ # Pythonic which are included in `protobuf>=5.29.x`. This feature will be
222
+ # enabled by default 1 month after launching the feature in preview
223
+ # packages.
215
224
  class ExperimentalFeatures
216
225
  include ::Google::Protobuf::MessageExts
217
226
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -297,9 +306,28 @@ module Google
297
306
  # @!attribute [rw] common
298
307
  # @return [::Google::Api::CommonLanguageSettings]
299
308
  # Some settings.
309
+ # @!attribute [rw] renamed_services
310
+ # @return [::Google::Protobuf::Map{::String => ::String}]
311
+ # Map of service names to renamed services. Keys are the package relative
312
+ # service names and values are the name to be used for the service client
313
+ # and call options.
314
+ #
315
+ # publishing:
316
+ # go_settings:
317
+ # renamed_services:
318
+ # Publisher: TopicAdmin
300
319
  class GoSettings
301
320
  include ::Google::Protobuf::MessageExts
302
321
  extend ::Google::Protobuf::MessageExts::ClassMethods
322
+
323
+ # @!attribute [rw] key
324
+ # @return [::String]
325
+ # @!attribute [rw] value
326
+ # @return [::String]
327
+ class RenamedServicesEntry
328
+ include ::Google::Protobuf::MessageExts
329
+ extend ::Google::Protobuf::MessageExts::ClassMethods
330
+ end
303
331
  end
304
332
 
305
333
  # Describes the generator configuration for a method.
@@ -375,6 +403,17 @@ module Google
375
403
  end
376
404
  end
377
405
 
406
+ # This message is used to configure the generation of a subset of the RPCs in
407
+ # a service for client libraries.
408
+ # @!attribute [rw] methods
409
+ # @return [::Array<::String>]
410
+ # An allowlist of the fully qualified names of RPCs that should be included
411
+ # on public client surfaces.
412
+ class SelectiveGapicGeneration
413
+ include ::Google::Protobuf::MessageExts
414
+ extend ::Google::Protobuf::MessageExts::ClassMethods
415
+ end
416
+
378
417
  # The organization for which the client libraries are being published.
379
418
  # Affects the url where generated docs are published, etc.
380
419
  module ClientLibraryOrganization
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-gke_connect-gateway-v1beta1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-08-30 00:00:00.000000000 Z
10
+ date: 2025-01-29 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: gapic-common
@@ -16,7 +15,7 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: 0.21.1
18
+ version: 0.25.0
20
19
  - - "<"
21
20
  - !ruby/object:Gem::Version
22
21
  version: 2.a
@@ -26,7 +25,7 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- version: 0.21.1
28
+ version: 0.25.0
30
29
  - - "<"
31
30
  - !ruby/object:Gem::Version
32
31
  version: 2.a
@@ -63,7 +62,6 @@ files:
63
62
  - lib/google-cloud-gke_connect-gateway-v1beta1.rb
64
63
  - lib/google/cloud/gke_connect/gateway/v1beta1.rb
65
64
  - lib/google/cloud/gke_connect/gateway/v1beta1/gateway_control.rb
66
- - lib/google/cloud/gke_connect/gateway/v1beta1/gateway_control/client.rb
67
65
  - lib/google/cloud/gke_connect/gateway/v1beta1/gateway_control/credentials.rb
68
66
  - lib/google/cloud/gke_connect/gateway/v1beta1/gateway_control/rest.rb
69
67
  - lib/google/cloud/gke_connect/gateway/v1beta1/gateway_control/rest/client.rb
@@ -83,7 +81,6 @@ homepage: https://github.com/googleapis/google-cloud-ruby
83
81
  licenses:
84
82
  - Apache-2.0
85
83
  metadata: {}
86
- post_install_message:
87
84
  rdoc_options: []
88
85
  require_paths:
89
86
  - lib
@@ -91,15 +88,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
88
  requirements:
92
89
  - - ">="
93
90
  - !ruby/object:Gem::Version
94
- version: '2.7'
91
+ version: '3.0'
95
92
  required_rubygems_version: !ruby/object:Gem::Requirement
96
93
  requirements:
97
94
  - - ">="
98
95
  - !ruby/object:Gem::Version
99
96
  version: '0'
100
97
  requirements: []
101
- rubygems_version: 3.5.6
102
- signing_key:
98
+ rubygems_version: 3.6.2
103
99
  specification_version: 4
104
100
  summary: The Connect Gateway service allows connectivity from external parties to
105
101
  connected Kubernetes clusters.
@@ -1,450 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright 2024 Google LLC
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # https://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
-
17
- # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
-
19
- require "google/cloud/errors"
20
- require "google/cloud/gkeconnect/gateway/v1beta1/control_pb"
21
-
22
- module Google
23
- module Cloud
24
- module GkeConnect
25
- module Gateway
26
- module V1beta1
27
- module GatewayControl
28
- ##
29
- # Client for the GatewayControl service.
30
- #
31
- # GatewayControl is the control plane API for Connect Gateway.
32
- #
33
- class Client
34
- # @private
35
- API_VERSION = ""
36
-
37
- # @private
38
- DEFAULT_ENDPOINT_TEMPLATE = "connectgateway.$UNIVERSE_DOMAIN$"
39
-
40
- # @private
41
- attr_reader :gateway_control_stub
42
-
43
- ##
44
- # Configure the GatewayControl Client class.
45
- #
46
- # See {::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Client::Configuration}
47
- # for a description of the configuration fields.
48
- #
49
- # @example
50
- #
51
- # # Modify the configuration for all GatewayControl clients
52
- # ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Client.configure do |config|
53
- # config.timeout = 10.0
54
- # end
55
- #
56
- # @yield [config] Configure the Client client.
57
- # @yieldparam config [Client::Configuration]
58
- #
59
- # @return [Client::Configuration]
60
- #
61
- def self.configure
62
- @configure ||= begin
63
- namespace = ["Google", "Cloud", "GkeConnect", "Gateway", "V1beta1"]
64
- parent_config = while namespace.any?
65
- parent_name = namespace.join "::"
66
- parent_const = const_get parent_name
67
- break parent_const.configure if parent_const.respond_to? :configure
68
- namespace.pop
69
- end
70
- default_config = Client::Configuration.new parent_config
71
-
72
- default_config.rpcs.generate_credentials.timeout = 60.0
73
- default_config.rpcs.generate_credentials.retry_policy = {
74
- initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
75
- }
76
-
77
- default_config
78
- end
79
- yield @configure if block_given?
80
- @configure
81
- end
82
-
83
- ##
84
- # Configure the GatewayControl Client instance.
85
- #
86
- # The configuration is set to the derived mode, meaning that values can be changed,
87
- # but structural changes (adding new fields, etc.) are not allowed. Structural changes
88
- # should be made on {Client.configure}.
89
- #
90
- # See {::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Client::Configuration}
91
- # for a description of the configuration fields.
92
- #
93
- # @yield [config] Configure the Client client.
94
- # @yieldparam config [Client::Configuration]
95
- #
96
- # @return [Client::Configuration]
97
- #
98
- def configure
99
- yield @config if block_given?
100
- @config
101
- end
102
-
103
- ##
104
- # The effective universe domain
105
- #
106
- # @return [String]
107
- #
108
- def universe_domain
109
- @gateway_control_stub.universe_domain
110
- end
111
-
112
- ##
113
- # Create a new GatewayControl client object.
114
- #
115
- # @example
116
- #
117
- # # Create a client using the default configuration
118
- # client = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Client.new
119
- #
120
- # # Create a client using a custom configuration
121
- # client = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Client.new do |config|
122
- # config.timeout = 10.0
123
- # end
124
- #
125
- # @yield [config] Configure the GatewayControl client.
126
- # @yieldparam config [Client::Configuration]
127
- #
128
- def initialize
129
- # These require statements are intentionally placed here to initialize
130
- # the gRPC module only when it's required.
131
- # See https://github.com/googleapis/toolkit/issues/446
132
- require "gapic/grpc"
133
- require "google/cloud/gkeconnect/gateway/v1beta1/control_services_pb"
134
-
135
- # Create the configuration object
136
- @config = Configuration.new Client.configure
137
-
138
- # Yield the configuration if needed
139
- yield @config if block_given?
140
-
141
- # Create credentials
142
- credentials = @config.credentials
143
- # Use self-signed JWT if the endpoint is unchanged from default,
144
- # but only if the default endpoint does not have a region prefix.
145
- enable_self_signed_jwt = @config.endpoint.nil? ||
146
- (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
147
- !@config.endpoint.split(".").first.include?("-"))
148
- credentials ||= Credentials.default scope: @config.scope,
149
- enable_self_signed_jwt: enable_self_signed_jwt
150
- if credentials.is_a?(::String) || credentials.is_a?(::Hash)
151
- credentials = Credentials.new credentials, scope: @config.scope
152
- end
153
- @quota_project_id = @config.quota_project
154
- @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
155
-
156
- @gateway_control_stub = ::Gapic::ServiceStub.new(
157
- ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Stub,
158
- credentials: credentials,
159
- endpoint: @config.endpoint,
160
- endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
161
- universe_domain: @config.universe_domain,
162
- channel_args: @config.channel_args,
163
- interceptors: @config.interceptors,
164
- channel_pool_config: @config.channel_pool
165
- )
166
- end
167
-
168
- # Service calls
169
-
170
- ##
171
- # GenerateCredentials provides connection information that allows a user to
172
- # access the specified membership using Connect Gateway.
173
- #
174
- # @overload generate_credentials(request, options = nil)
175
- # Pass arguments to `generate_credentials` via a request object, either of type
176
- # {::Google::Cloud::GkeConnect::Gateway::V1beta1::GenerateCredentialsRequest} or an equivalent Hash.
177
- #
178
- # @param request [::Google::Cloud::GkeConnect::Gateway::V1beta1::GenerateCredentialsRequest, ::Hash]
179
- # A request object representing the call parameters. Required. To specify no
180
- # parameters, or to keep all the default parameter values, pass an empty Hash.
181
- # @param options [::Gapic::CallOptions, ::Hash]
182
- # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
183
- #
184
- # @overload generate_credentials(name: nil, force_use_agent: nil, version: nil, kubernetes_namespace: nil, operating_system: nil)
185
- # Pass arguments to `generate_credentials` via keyword arguments. Note that at
186
- # least one keyword argument is required. To specify no parameters, or to keep all
187
- # the default parameter values, pass an empty Hash as a request object (see above).
188
- #
189
- # @param name [::String]
190
- # Required. The Fleet membership resource.
191
- # @param force_use_agent [::Boolean]
192
- # Optional. Whether to force the use of Connect Agent-based transport.
193
- #
194
- # This will return a configuration that uses Connect Agent as the underlying
195
- # transport mechanism for cluster types that would otherwise have used a
196
- # different transport. Requires that Connect Agent be installed on the
197
- # cluster. Setting this field to false is equivalent to not setting it.
198
- # @param version [::String]
199
- # Optional. The Connect Gateway version to be used in the resulting
200
- # configuration.
201
- #
202
- # Leave this field blank to let the server choose the version (recommended).
203
- # @param kubernetes_namespace [::String]
204
- # Optional. The namespace to use in the kubeconfig context.
205
- #
206
- # If this field is specified, the server will set the `namespace` field in
207
- # kubeconfig context. If not specified, the `namespace` field is omitted.
208
- # @param operating_system [::Google::Cloud::GkeConnect::Gateway::V1beta1::GenerateCredentialsRequest::OperatingSystem]
209
- # Optional. The operating system where the kubeconfig will be used.
210
- #
211
- # @yield [response, operation] Access the result along with the RPC operation
212
- # @yieldparam response [::Google::Cloud::GkeConnect::Gateway::V1beta1::GenerateCredentialsResponse]
213
- # @yieldparam operation [::GRPC::ActiveCall::Operation]
214
- #
215
- # @return [::Google::Cloud::GkeConnect::Gateway::V1beta1::GenerateCredentialsResponse]
216
- #
217
- # @raise [::Google::Cloud::Error] if the RPC is aborted.
218
- #
219
- # @example Basic example
220
- # require "google/cloud/gke_connect/gateway/v1beta1"
221
- #
222
- # # Create a client object. The client can be reused for multiple calls.
223
- # client = Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Client.new
224
- #
225
- # # Create a request. To set request fields, pass in keyword arguments.
226
- # request = Google::Cloud::GkeConnect::Gateway::V1beta1::GenerateCredentialsRequest.new
227
- #
228
- # # Call the generate_credentials method.
229
- # result = client.generate_credentials request
230
- #
231
- # # The returned object is of type Google::Cloud::GkeConnect::Gateway::V1beta1::GenerateCredentialsResponse.
232
- # p result
233
- #
234
- def generate_credentials request, options = nil
235
- raise ::ArgumentError, "request must be provided" if request.nil?
236
-
237
- request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeConnect::Gateway::V1beta1::GenerateCredentialsRequest
238
-
239
- # Converts hash and nil to an options object
240
- options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
241
-
242
- # Customize the options with defaults
243
- metadata = @config.rpcs.generate_credentials.metadata.to_h
244
-
245
- # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
246
- metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
247
- lib_name: @config.lib_name, lib_version: @config.lib_version,
248
- gapic_version: ::Google::Cloud::GkeConnect::Gateway::V1beta1::VERSION
249
- metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
250
- metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
251
-
252
- header_params = {}
253
- if request.name
254
- header_params["name"] = request.name
255
- end
256
-
257
- request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
258
- metadata[:"x-goog-request-params"] ||= request_params_header
259
-
260
- options.apply_defaults timeout: @config.rpcs.generate_credentials.timeout,
261
- metadata: metadata,
262
- retry_policy: @config.rpcs.generate_credentials.retry_policy
263
-
264
- options.apply_defaults timeout: @config.timeout,
265
- metadata: @config.metadata,
266
- retry_policy: @config.retry_policy
267
-
268
- @gateway_control_stub.call_rpc :generate_credentials, request, options: options do |response, operation|
269
- yield response, operation if block_given?
270
- return response
271
- end
272
- rescue ::GRPC::BadStatus => e
273
- raise ::Google::Cloud::Error.from_error(e)
274
- end
275
-
276
- ##
277
- # Configuration class for the GatewayControl API.
278
- #
279
- # This class represents the configuration for GatewayControl,
280
- # providing control over timeouts, retry behavior, logging, transport
281
- # parameters, and other low-level controls. Certain parameters can also be
282
- # applied individually to specific RPCs. See
283
- # {::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Client::Configuration::Rpcs}
284
- # for a list of RPCs that can be configured independently.
285
- #
286
- # Configuration can be applied globally to all clients, or to a single client
287
- # on construction.
288
- #
289
- # @example
290
- #
291
- # # Modify the global config, setting the timeout for
292
- # # generate_credentials to 20 seconds,
293
- # # and all remaining timeouts to 10 seconds.
294
- # ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Client.configure do |config|
295
- # config.timeout = 10.0
296
- # config.rpcs.generate_credentials.timeout = 20.0
297
- # end
298
- #
299
- # # Apply the above configuration only to a new client.
300
- # client = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayControl::Client.new do |config|
301
- # config.timeout = 10.0
302
- # config.rpcs.generate_credentials.timeout = 20.0
303
- # end
304
- #
305
- # @!attribute [rw] endpoint
306
- # A custom service endpoint, as a hostname or hostname:port. The default is
307
- # nil, indicating to use the default endpoint in the current universe domain.
308
- # @return [::String,nil]
309
- # @!attribute [rw] credentials
310
- # Credentials to send with calls. You may provide any of the following types:
311
- # * (`String`) The path to a service account key file in JSON format
312
- # * (`Hash`) A service account key as a Hash
313
- # * (`Google::Auth::Credentials`) A googleauth credentials object
314
- # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
315
- # * (`Signet::OAuth2::Client`) A signet oauth2 client object
316
- # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
317
- # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
318
- # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
319
- # * (`nil`) indicating no credentials
320
- # @return [::Object]
321
- # @!attribute [rw] scope
322
- # The OAuth scopes
323
- # @return [::Array<::String>]
324
- # @!attribute [rw] lib_name
325
- # The library name as recorded in instrumentation and logging
326
- # @return [::String]
327
- # @!attribute [rw] lib_version
328
- # The library version as recorded in instrumentation and logging
329
- # @return [::String]
330
- # @!attribute [rw] channel_args
331
- # Extra parameters passed to the gRPC channel. Note: this is ignored if a
332
- # `GRPC::Core::Channel` object is provided as the credential.
333
- # @return [::Hash]
334
- # @!attribute [rw] interceptors
335
- # An array of interceptors that are run before calls are executed.
336
- # @return [::Array<::GRPC::ClientInterceptor>]
337
- # @!attribute [rw] timeout
338
- # The call timeout in seconds.
339
- # @return [::Numeric]
340
- # @!attribute [rw] metadata
341
- # Additional gRPC headers to be sent with the call.
342
- # @return [::Hash{::Symbol=>::String}]
343
- # @!attribute [rw] retry_policy
344
- # The retry policy. The value is a hash with the following keys:
345
- # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
346
- # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
347
- # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
348
- # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
349
- # trigger a retry.
350
- # @return [::Hash]
351
- # @!attribute [rw] quota_project
352
- # A separate project against which to charge quota.
353
- # @return [::String]
354
- # @!attribute [rw] universe_domain
355
- # The universe domain within which to make requests. This determines the
356
- # default endpoint URL. The default value of nil uses the environment
357
- # universe (usually the default "googleapis.com" universe).
358
- # @return [::String,nil]
359
- #
360
- class Configuration
361
- extend ::Gapic::Config
362
-
363
- # @private
364
- # The endpoint specific to the default "googleapis.com" universe. Deprecated.
365
- DEFAULT_ENDPOINT = "connectgateway.googleapis.com"
366
-
367
- config_attr :endpoint, nil, ::String, nil
368
- config_attr :credentials, nil do |value|
369
- allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
370
- allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
371
- allowed.any? { |klass| klass === value }
372
- end
373
- config_attr :scope, nil, ::String, ::Array, nil
374
- config_attr :lib_name, nil, ::String, nil
375
- config_attr :lib_version, nil, ::String, nil
376
- config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
377
- config_attr :interceptors, nil, ::Array, nil
378
- config_attr :timeout, nil, ::Numeric, nil
379
- config_attr :metadata, nil, ::Hash, nil
380
- config_attr :retry_policy, nil, ::Hash, ::Proc, nil
381
- config_attr :quota_project, nil, ::String, nil
382
- config_attr :universe_domain, nil, ::String, nil
383
-
384
- # @private
385
- def initialize parent_config = nil
386
- @parent_config = parent_config unless parent_config.nil?
387
-
388
- yield self if block_given?
389
- end
390
-
391
- ##
392
- # Configurations for individual RPCs
393
- # @return [Rpcs]
394
- #
395
- def rpcs
396
- @rpcs ||= begin
397
- parent_rpcs = nil
398
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
399
- Rpcs.new parent_rpcs
400
- end
401
- end
402
-
403
- ##
404
- # Configuration for the channel pool
405
- # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
406
- #
407
- def channel_pool
408
- @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
409
- end
410
-
411
- ##
412
- # Configuration RPC class for the GatewayControl API.
413
- #
414
- # Includes fields providing the configuration for each RPC in this service.
415
- # Each configuration object is of type `Gapic::Config::Method` and includes
416
- # the following configuration fields:
417
- #
418
- # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
419
- # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
420
- # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
421
- # include the following keys:
422
- # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
423
- # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
424
- # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
425
- # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
426
- # trigger a retry.
427
- #
428
- class Rpcs
429
- ##
430
- # RPC-specific configuration for `generate_credentials`
431
- # @return [::Gapic::Config::Method]
432
- #
433
- attr_reader :generate_credentials
434
-
435
- # @private
436
- def initialize parent_rpcs = nil
437
- generate_credentials_config = parent_rpcs.generate_credentials if parent_rpcs.respond_to? :generate_credentials
438
- @generate_credentials = ::Gapic::Config::Method.new generate_credentials_config
439
-
440
- yield self if block_given?
441
- end
442
- end
443
- end
444
- end
445
- end
446
- end
447
- end
448
- end
449
- end
450
- end