google-cloud-gke_connect-gateway-v1 0.a → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +122 -0
- data/README.md +118 -8
- data/lib/google/cloud/gke_connect/gateway/v1/gateway_control/credentials.rb +49 -0
- data/lib/google/cloud/gke_connect/gateway/v1/gateway_control/rest/client.rb +417 -0
- data/lib/google/cloud/gke_connect/gateway/v1/gateway_control/rest/service_stub.rb +130 -0
- data/lib/google/cloud/gke_connect/gateway/v1/gateway_control/rest.rb +53 -0
- data/lib/google/cloud/gke_connect/gateway/v1/gateway_control.rb +49 -0
- data/lib/google/cloud/gke_connect/gateway/v1/rest.rb +39 -0
- data/lib/google/cloud/gke_connect/gateway/v1/version.rb +7 -2
- data/lib/google/cloud/gke_connect/gateway/v1.rb +42 -0
- data/lib/google/cloud/gkeconnect/gateway/v1/control_pb.rb +50 -0
- data/lib/google/cloud/gkeconnect/gateway/v1/control_services_pb.rb +48 -0
- data/lib/google-cloud-gke_connect-gateway-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +440 -0
- data/proto_docs/google/api/field_behavior.rb +85 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/api/resource.rb +227 -0
- data/proto_docs/google/cloud/gkeconnect/gateway/v1/control.rb +84 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- metadata +65 -11
@@ -0,0 +1,417 @@
|
|
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/v1/control_pb"
|
21
|
+
require "google/cloud/gke_connect/gateway/v1/gateway_control/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module GkeConnect
|
26
|
+
module Gateway
|
27
|
+
module V1
|
28
|
+
module GatewayControl
|
29
|
+
module Rest
|
30
|
+
##
|
31
|
+
# REST client for the GatewayControl service.
|
32
|
+
#
|
33
|
+
# GatewayControl is the control plane API for Connect Gateway.
|
34
|
+
#
|
35
|
+
class Client
|
36
|
+
# @private
|
37
|
+
API_VERSION = ""
|
38
|
+
|
39
|
+
# @private
|
40
|
+
DEFAULT_ENDPOINT_TEMPLATE = "connectgateway.$UNIVERSE_DOMAIN$"
|
41
|
+
|
42
|
+
# @private
|
43
|
+
attr_reader :gateway_control_stub
|
44
|
+
|
45
|
+
##
|
46
|
+
# Configure the GatewayControl Client class.
|
47
|
+
#
|
48
|
+
# See {::Google::Cloud::GkeConnect::Gateway::V1::GatewayControl::Rest::Client::Configuration}
|
49
|
+
# for a description of the configuration fields.
|
50
|
+
#
|
51
|
+
# @example
|
52
|
+
#
|
53
|
+
# # Modify the configuration for all GatewayControl clients
|
54
|
+
# ::Google::Cloud::GkeConnect::Gateway::V1::GatewayControl::Rest::Client.configure do |config|
|
55
|
+
# config.timeout = 10.0
|
56
|
+
# end
|
57
|
+
#
|
58
|
+
# @yield [config] Configure the Client client.
|
59
|
+
# @yieldparam config [Client::Configuration]
|
60
|
+
#
|
61
|
+
# @return [Client::Configuration]
|
62
|
+
#
|
63
|
+
def self.configure
|
64
|
+
@configure ||= begin
|
65
|
+
namespace = ["Google", "Cloud", "GkeConnect", "Gateway", "V1"]
|
66
|
+
parent_config = while namespace.any?
|
67
|
+
parent_name = namespace.join "::"
|
68
|
+
parent_const = const_get parent_name
|
69
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
70
|
+
namespace.pop
|
71
|
+
end
|
72
|
+
default_config = Client::Configuration.new parent_config
|
73
|
+
|
74
|
+
default_config.rpcs.generate_credentials.timeout = 60.0
|
75
|
+
default_config.rpcs.generate_credentials.retry_policy = {
|
76
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
77
|
+
}
|
78
|
+
|
79
|
+
default_config
|
80
|
+
end
|
81
|
+
yield @configure if block_given?
|
82
|
+
@configure
|
83
|
+
end
|
84
|
+
|
85
|
+
##
|
86
|
+
# Configure the GatewayControl Client instance.
|
87
|
+
#
|
88
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
89
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
90
|
+
# should be made on {Client.configure}.
|
91
|
+
#
|
92
|
+
# See {::Google::Cloud::GkeConnect::Gateway::V1::GatewayControl::Rest::Client::Configuration}
|
93
|
+
# for a description of the configuration fields.
|
94
|
+
#
|
95
|
+
# @yield [config] Configure the Client client.
|
96
|
+
# @yieldparam config [Client::Configuration]
|
97
|
+
#
|
98
|
+
# @return [Client::Configuration]
|
99
|
+
#
|
100
|
+
def configure
|
101
|
+
yield @config if block_given?
|
102
|
+
@config
|
103
|
+
end
|
104
|
+
|
105
|
+
##
|
106
|
+
# The effective universe domain
|
107
|
+
#
|
108
|
+
# @return [String]
|
109
|
+
#
|
110
|
+
def universe_domain
|
111
|
+
@gateway_control_stub.universe_domain
|
112
|
+
end
|
113
|
+
|
114
|
+
##
|
115
|
+
# Create a new GatewayControl REST client object.
|
116
|
+
#
|
117
|
+
# @example
|
118
|
+
#
|
119
|
+
# # Create a client using the default configuration
|
120
|
+
# client = ::Google::Cloud::GkeConnect::Gateway::V1::GatewayControl::Rest::Client.new
|
121
|
+
#
|
122
|
+
# # Create a client using a custom configuration
|
123
|
+
# client = ::Google::Cloud::GkeConnect::Gateway::V1::GatewayControl::Rest::Client.new do |config|
|
124
|
+
# config.timeout = 10.0
|
125
|
+
# end
|
126
|
+
#
|
127
|
+
# @yield [config] Configure the GatewayControl client.
|
128
|
+
# @yieldparam config [Client::Configuration]
|
129
|
+
#
|
130
|
+
def initialize
|
131
|
+
# Create the configuration object
|
132
|
+
@config = Configuration.new Client.configure
|
133
|
+
|
134
|
+
# Yield the configuration if needed
|
135
|
+
yield @config if block_given?
|
136
|
+
|
137
|
+
# Create credentials
|
138
|
+
credentials = @config.credentials
|
139
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
140
|
+
# but only if the default endpoint does not have a region prefix.
|
141
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
142
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
143
|
+
!@config.endpoint.split(".").first.include?("-"))
|
144
|
+
credentials ||= Credentials.default scope: @config.scope,
|
145
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
146
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
147
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
148
|
+
end
|
149
|
+
|
150
|
+
@quota_project_id = @config.quota_project
|
151
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
152
|
+
|
153
|
+
@gateway_control_stub = ::Google::Cloud::GkeConnect::Gateway::V1::GatewayControl::Rest::ServiceStub.new(
|
154
|
+
endpoint: @config.endpoint,
|
155
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
156
|
+
universe_domain: @config.universe_domain,
|
157
|
+
credentials: credentials
|
158
|
+
)
|
159
|
+
end
|
160
|
+
|
161
|
+
# Service calls
|
162
|
+
|
163
|
+
##
|
164
|
+
# GenerateCredentials provides connection information that allows a user to
|
165
|
+
# access the specified membership using Connect Gateway.
|
166
|
+
#
|
167
|
+
# @overload generate_credentials(request, options = nil)
|
168
|
+
# Pass arguments to `generate_credentials` via a request object, either of type
|
169
|
+
# {::Google::Cloud::GkeConnect::Gateway::V1::GenerateCredentialsRequest} or an equivalent Hash.
|
170
|
+
#
|
171
|
+
# @param request [::Google::Cloud::GkeConnect::Gateway::V1::GenerateCredentialsRequest, ::Hash]
|
172
|
+
# A request object representing the call parameters. Required. To specify no
|
173
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
174
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
175
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
176
|
+
#
|
177
|
+
# @overload generate_credentials(name: nil, force_use_agent: nil, version: nil, kubernetes_namespace: nil, operating_system: nil)
|
178
|
+
# Pass arguments to `generate_credentials` via keyword arguments. Note that at
|
179
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
180
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
181
|
+
#
|
182
|
+
# @param name [::String]
|
183
|
+
# Required. The Fleet membership resource.
|
184
|
+
# @param force_use_agent [::Boolean]
|
185
|
+
# Optional. Whether to force the use of Connect Agent-based transport.
|
186
|
+
#
|
187
|
+
# This will return a configuration that uses Connect Agent as the underlying
|
188
|
+
# transport mechanism for cluster types that would otherwise have used a
|
189
|
+
# different transport. Requires that Connect Agent be installed on the
|
190
|
+
# cluster. Setting this field to false is equivalent to not setting it.
|
191
|
+
# @param version [::String]
|
192
|
+
# Optional. The Connect Gateway version to be used in the resulting
|
193
|
+
# configuration.
|
194
|
+
#
|
195
|
+
# Leave this field blank to let the server choose the version (recommended).
|
196
|
+
# @param kubernetes_namespace [::String]
|
197
|
+
# Optional. The namespace to use in the kubeconfig context.
|
198
|
+
#
|
199
|
+
# If this field is specified, the server will set the `namespace` field in
|
200
|
+
# kubeconfig context. If not specified, the `namespace` field is omitted.
|
201
|
+
# @param operating_system [::Google::Cloud::GkeConnect::Gateway::V1::GenerateCredentialsRequest::OperatingSystem]
|
202
|
+
# Optional. The operating system where the kubeconfig will be used.
|
203
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
204
|
+
# @yieldparam result [::Google::Cloud::GkeConnect::Gateway::V1::GenerateCredentialsResponse]
|
205
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
206
|
+
#
|
207
|
+
# @return [::Google::Cloud::GkeConnect::Gateway::V1::GenerateCredentialsResponse]
|
208
|
+
#
|
209
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
210
|
+
#
|
211
|
+
# @example Basic example
|
212
|
+
# require "google/cloud/gke_connect/gateway/v1"
|
213
|
+
#
|
214
|
+
# # Create a client object. The client can be reused for multiple calls.
|
215
|
+
# client = Google::Cloud::GkeConnect::Gateway::V1::GatewayControl::Rest::Client.new
|
216
|
+
#
|
217
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
218
|
+
# request = Google::Cloud::GkeConnect::Gateway::V1::GenerateCredentialsRequest.new
|
219
|
+
#
|
220
|
+
# # Call the generate_credentials method.
|
221
|
+
# result = client.generate_credentials request
|
222
|
+
#
|
223
|
+
# # The returned object is of type Google::Cloud::GkeConnect::Gateway::V1::GenerateCredentialsResponse.
|
224
|
+
# p result
|
225
|
+
#
|
226
|
+
def generate_credentials request, options = nil
|
227
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
228
|
+
|
229
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeConnect::Gateway::V1::GenerateCredentialsRequest
|
230
|
+
|
231
|
+
# Converts hash and nil to an options object
|
232
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
233
|
+
|
234
|
+
# Customize the options with defaults
|
235
|
+
call_metadata = @config.rpcs.generate_credentials.metadata.to_h
|
236
|
+
|
237
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
238
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
239
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
240
|
+
gapic_version: ::Google::Cloud::GkeConnect::Gateway::V1::VERSION,
|
241
|
+
transports_version_send: [:rest]
|
242
|
+
|
243
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
244
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
245
|
+
|
246
|
+
options.apply_defaults timeout: @config.rpcs.generate_credentials.timeout,
|
247
|
+
metadata: call_metadata,
|
248
|
+
retry_policy: @config.rpcs.generate_credentials.retry_policy
|
249
|
+
|
250
|
+
options.apply_defaults timeout: @config.timeout,
|
251
|
+
metadata: @config.metadata,
|
252
|
+
retry_policy: @config.retry_policy
|
253
|
+
|
254
|
+
@gateway_control_stub.generate_credentials request, options do |result, operation|
|
255
|
+
yield result, operation if block_given?
|
256
|
+
return result
|
257
|
+
end
|
258
|
+
rescue ::Gapic::Rest::Error => e
|
259
|
+
raise ::Google::Cloud::Error.from_error(e)
|
260
|
+
end
|
261
|
+
|
262
|
+
##
|
263
|
+
# Configuration class for the GatewayControl REST API.
|
264
|
+
#
|
265
|
+
# This class represents the configuration for GatewayControl REST,
|
266
|
+
# providing control over timeouts, retry behavior, logging, transport
|
267
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
268
|
+
# applied individually to specific RPCs. See
|
269
|
+
# {::Google::Cloud::GkeConnect::Gateway::V1::GatewayControl::Rest::Client::Configuration::Rpcs}
|
270
|
+
# for a list of RPCs that can be configured independently.
|
271
|
+
#
|
272
|
+
# Configuration can be applied globally to all clients, or to a single client
|
273
|
+
# on construction.
|
274
|
+
#
|
275
|
+
# @example
|
276
|
+
#
|
277
|
+
# # Modify the global config, setting the timeout for
|
278
|
+
# # generate_credentials to 20 seconds,
|
279
|
+
# # and all remaining timeouts to 10 seconds.
|
280
|
+
# ::Google::Cloud::GkeConnect::Gateway::V1::GatewayControl::Rest::Client.configure do |config|
|
281
|
+
# config.timeout = 10.0
|
282
|
+
# config.rpcs.generate_credentials.timeout = 20.0
|
283
|
+
# end
|
284
|
+
#
|
285
|
+
# # Apply the above configuration only to a new client.
|
286
|
+
# client = ::Google::Cloud::GkeConnect::Gateway::V1::GatewayControl::Rest::Client.new do |config|
|
287
|
+
# config.timeout = 10.0
|
288
|
+
# config.rpcs.generate_credentials.timeout = 20.0
|
289
|
+
# end
|
290
|
+
#
|
291
|
+
# @!attribute [rw] endpoint
|
292
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
293
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
294
|
+
# @return [::String,nil]
|
295
|
+
# @!attribute [rw] credentials
|
296
|
+
# Credentials to send with calls. You may provide any of the following types:
|
297
|
+
# * (`String`) The path to a service account key file in JSON format
|
298
|
+
# * (`Hash`) A service account key as a Hash
|
299
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
300
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
301
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
302
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
303
|
+
# * (`nil`) indicating no credentials
|
304
|
+
# @return [::Object]
|
305
|
+
# @!attribute [rw] scope
|
306
|
+
# The OAuth scopes
|
307
|
+
# @return [::Array<::String>]
|
308
|
+
# @!attribute [rw] lib_name
|
309
|
+
# The library name as recorded in instrumentation and logging
|
310
|
+
# @return [::String]
|
311
|
+
# @!attribute [rw] lib_version
|
312
|
+
# The library version as recorded in instrumentation and logging
|
313
|
+
# @return [::String]
|
314
|
+
# @!attribute [rw] timeout
|
315
|
+
# The call timeout in seconds.
|
316
|
+
# @return [::Numeric]
|
317
|
+
# @!attribute [rw] metadata
|
318
|
+
# Additional headers to be sent with the call.
|
319
|
+
# @return [::Hash{::Symbol=>::String}]
|
320
|
+
# @!attribute [rw] retry_policy
|
321
|
+
# The retry policy. The value is a hash with the following keys:
|
322
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
323
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
324
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
325
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
326
|
+
# trigger a retry.
|
327
|
+
# @return [::Hash]
|
328
|
+
# @!attribute [rw] quota_project
|
329
|
+
# A separate project against which to charge quota.
|
330
|
+
# @return [::String]
|
331
|
+
# @!attribute [rw] universe_domain
|
332
|
+
# The universe domain within which to make requests. This determines the
|
333
|
+
# default endpoint URL. The default value of nil uses the environment
|
334
|
+
# universe (usually the default "googleapis.com" universe).
|
335
|
+
# @return [::String,nil]
|
336
|
+
#
|
337
|
+
class Configuration
|
338
|
+
extend ::Gapic::Config
|
339
|
+
|
340
|
+
# @private
|
341
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
342
|
+
DEFAULT_ENDPOINT = "connectgateway.googleapis.com"
|
343
|
+
|
344
|
+
config_attr :endpoint, nil, ::String, nil
|
345
|
+
config_attr :credentials, nil do |value|
|
346
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
347
|
+
allowed.any? { |klass| klass === value }
|
348
|
+
end
|
349
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
350
|
+
config_attr :lib_name, nil, ::String, nil
|
351
|
+
config_attr :lib_version, nil, ::String, nil
|
352
|
+
config_attr :timeout, nil, ::Numeric, nil
|
353
|
+
config_attr :metadata, nil, ::Hash, nil
|
354
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
355
|
+
config_attr :quota_project, nil, ::String, nil
|
356
|
+
config_attr :universe_domain, nil, ::String, nil
|
357
|
+
|
358
|
+
# @private
|
359
|
+
def initialize parent_config = nil
|
360
|
+
@parent_config = parent_config unless parent_config.nil?
|
361
|
+
|
362
|
+
yield self if block_given?
|
363
|
+
end
|
364
|
+
|
365
|
+
##
|
366
|
+
# Configurations for individual RPCs
|
367
|
+
# @return [Rpcs]
|
368
|
+
#
|
369
|
+
def rpcs
|
370
|
+
@rpcs ||= begin
|
371
|
+
parent_rpcs = nil
|
372
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
373
|
+
Rpcs.new parent_rpcs
|
374
|
+
end
|
375
|
+
end
|
376
|
+
|
377
|
+
##
|
378
|
+
# Configuration RPC class for the GatewayControl API.
|
379
|
+
#
|
380
|
+
# Includes fields providing the configuration for each RPC in this service.
|
381
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
382
|
+
# the following configuration fields:
|
383
|
+
#
|
384
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
385
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
386
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
387
|
+
# include the following keys:
|
388
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
389
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
390
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
391
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
392
|
+
# trigger a retry.
|
393
|
+
#
|
394
|
+
class Rpcs
|
395
|
+
##
|
396
|
+
# RPC-specific configuration for `generate_credentials`
|
397
|
+
# @return [::Gapic::Config::Method]
|
398
|
+
#
|
399
|
+
attr_reader :generate_credentials
|
400
|
+
|
401
|
+
# @private
|
402
|
+
def initialize parent_rpcs = nil
|
403
|
+
generate_credentials_config = parent_rpcs.generate_credentials if parent_rpcs.respond_to? :generate_credentials
|
404
|
+
@generate_credentials = ::Gapic::Config::Method.new generate_credentials_config
|
405
|
+
|
406
|
+
yield self if block_given?
|
407
|
+
end
|
408
|
+
end
|
409
|
+
end
|
410
|
+
end
|
411
|
+
end
|
412
|
+
end
|
413
|
+
end
|
414
|
+
end
|
415
|
+
end
|
416
|
+
end
|
417
|
+
end
|
@@ -0,0 +1,130 @@
|
|
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/gkeconnect/gateway/v1/control_pb"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module GkeConnect
|
24
|
+
module Gateway
|
25
|
+
module V1
|
26
|
+
module GatewayControl
|
27
|
+
module Rest
|
28
|
+
##
|
29
|
+
# REST service stub for the GatewayControl service.
|
30
|
+
# Service stub contains baseline method implementations
|
31
|
+
# including transcoding, making the REST call, and deserialing the response.
|
32
|
+
#
|
33
|
+
class ServiceStub
|
34
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
|
35
|
+
# These require statements are intentionally placed here to initialize
|
36
|
+
# the REST modules only when it's required.
|
37
|
+
require "gapic/rest"
|
38
|
+
|
39
|
+
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
|
40
|
+
endpoint_template: endpoint_template,
|
41
|
+
universe_domain: universe_domain,
|
42
|
+
credentials: credentials,
|
43
|
+
numeric_enums: true,
|
44
|
+
raise_faraday_errors: false
|
45
|
+
end
|
46
|
+
|
47
|
+
##
|
48
|
+
# The effective universe domain
|
49
|
+
#
|
50
|
+
# @return [String]
|
51
|
+
#
|
52
|
+
def universe_domain
|
53
|
+
@client_stub.universe_domain
|
54
|
+
end
|
55
|
+
|
56
|
+
##
|
57
|
+
# The effective endpoint
|
58
|
+
#
|
59
|
+
# @return [String]
|
60
|
+
#
|
61
|
+
def endpoint
|
62
|
+
@client_stub.endpoint
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# Baseline implementation for the generate_credentials REST call
|
67
|
+
#
|
68
|
+
# @param request_pb [::Google::Cloud::GkeConnect::Gateway::V1::GenerateCredentialsRequest]
|
69
|
+
# A request object representing the call parameters. Required.
|
70
|
+
# @param options [::Gapic::CallOptions]
|
71
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
72
|
+
#
|
73
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
74
|
+
# @yieldparam result [::Google::Cloud::GkeConnect::Gateway::V1::GenerateCredentialsResponse]
|
75
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
76
|
+
#
|
77
|
+
# @return [::Google::Cloud::GkeConnect::Gateway::V1::GenerateCredentialsResponse]
|
78
|
+
# A result object deserialized from the server's reply
|
79
|
+
def generate_credentials request_pb, options = nil
|
80
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
81
|
+
|
82
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_generate_credentials_request request_pb
|
83
|
+
query_string_params = if query_string_params.any?
|
84
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
85
|
+
else
|
86
|
+
{}
|
87
|
+
end
|
88
|
+
|
89
|
+
response = @client_stub.make_http_request(
|
90
|
+
verb,
|
91
|
+
uri: uri,
|
92
|
+
body: body || "",
|
93
|
+
params: query_string_params,
|
94
|
+
options: options
|
95
|
+
)
|
96
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
97
|
+
result = ::Google::Cloud::GkeConnect::Gateway::V1::GenerateCredentialsResponse.decode_json response.body, ignore_unknown_fields: true
|
98
|
+
|
99
|
+
yield result, operation if block_given?
|
100
|
+
result
|
101
|
+
end
|
102
|
+
|
103
|
+
##
|
104
|
+
# @private
|
105
|
+
#
|
106
|
+
# GRPC transcoding helper method for the generate_credentials REST call
|
107
|
+
#
|
108
|
+
# @param request_pb [::Google::Cloud::GkeConnect::Gateway::V1::GenerateCredentialsRequest]
|
109
|
+
# A request object representing the call parameters. Required.
|
110
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
111
|
+
# Uri, Body, Query string parameters
|
112
|
+
def self.transcode_generate_credentials_request request_pb
|
113
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
114
|
+
.with_bindings(
|
115
|
+
uri_method: :get,
|
116
|
+
uri_template: "/v1/{name}:generateCredentials",
|
117
|
+
matches: [
|
118
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/memberships/[^/]+/?$}, false]
|
119
|
+
]
|
120
|
+
)
|
121
|
+
transcoder.transcode request_pb
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,53 @@
|
|
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 "gapic/rest"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/gke_connect/gateway/v1/version"
|
24
|
+
|
25
|
+
require "google/cloud/gke_connect/gateway/v1/gateway_control/credentials"
|
26
|
+
require "google/cloud/gke_connect/gateway/v1/gateway_control/rest/client"
|
27
|
+
|
28
|
+
module Google
|
29
|
+
module Cloud
|
30
|
+
module GkeConnect
|
31
|
+
module Gateway
|
32
|
+
module V1
|
33
|
+
##
|
34
|
+
# GatewayControl is the control plane API for Connect Gateway.
|
35
|
+
#
|
36
|
+
# To load this service and instantiate a REST client:
|
37
|
+
#
|
38
|
+
# require "google/cloud/gke_connect/gateway/v1/gateway_control/rest"
|
39
|
+
# client = ::Google::Cloud::GkeConnect::Gateway::V1::GatewayControl::Rest::Client.new
|
40
|
+
#
|
41
|
+
module GatewayControl
|
42
|
+
# Client for the REST transport
|
43
|
+
module Rest
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
helper_path = ::File.join __dir__, "rest", "helpers.rb"
|
53
|
+
require "google/cloud/gke_connect/gateway/v1/gateway_control/rest/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,49 @@
|
|
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 "gapic/config"
|
20
|
+
require "gapic/config/method"
|
21
|
+
|
22
|
+
require "google/cloud/gke_connect/gateway/v1/version"
|
23
|
+
|
24
|
+
require "google/cloud/gke_connect/gateway/v1/gateway_control/credentials"
|
25
|
+
require "google/cloud/gke_connect/gateway/v1/gateway_control/rest"
|
26
|
+
|
27
|
+
module Google
|
28
|
+
module Cloud
|
29
|
+
module GkeConnect
|
30
|
+
module Gateway
|
31
|
+
module V1
|
32
|
+
##
|
33
|
+
# GatewayControl is the control plane API for Connect Gateway.
|
34
|
+
#
|
35
|
+
# @example Load this service and instantiate a REST client
|
36
|
+
#
|
37
|
+
# require "google/cloud/gke_connect/gateway/v1/gateway_control/rest"
|
38
|
+
# client = ::Google::Cloud::GkeConnect::Gateway::V1::GatewayControl::Rest::Client.new
|
39
|
+
#
|
40
|
+
module GatewayControl
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
helper_path = ::File.join __dir__, "gateway_control", "helpers.rb"
|
49
|
+
require "google/cloud/gke_connect/gateway/v1/gateway_control/helpers" if ::File.file? helper_path
|