google-cloud-gke_connect-gateway-v1beta1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/gke_connect/gateway/v1beta1"
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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/gke_connect/gateway/v1beta1/gateway_service"
20
+ require "google/cloud/gke_connect/gateway/v1beta1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module GkeConnect
25
+ module Gateway
26
+ ##
27
+ # To load this package, including all its services, and instantiate a client:
28
+ #
29
+ # require "google/cloud/gke_connect/gateway/v1beta1"
30
+ # client = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayService::Client.new
31
+ #
32
+ module V1beta1
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+ helper_path = ::File.join __dir__, "v1beta1", "_helpers.rb"
40
+ require "google/cloud/gke_connect/gateway/v1beta1/_helpers" if ::File.file? helper_path
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/gke_connect/gateway/v1beta1/version"
24
+
25
+ require "google/cloud/gke_connect/gateway/v1beta1/gateway_service/credentials"
26
+ require "google/cloud/gke_connect/gateway/v1beta1/gateway_service/client"
27
+
28
+ module Google
29
+ module Cloud
30
+ module GkeConnect
31
+ module Gateway
32
+ module V1beta1
33
+ ##
34
+ # Gateway service is a public API which works as a Kubernetes resource model
35
+ # proxy between end users and registered Kubernetes clusters. Each RPC in this
36
+ # service matches with an HTTP verb. End user will initiate kubectl commands
37
+ # against the Gateway service, and Gateway service will forward user requests
38
+ # to clusters.
39
+ #
40
+ # To load this service and instantiate a client:
41
+ #
42
+ # require "google/cloud/gke_connect/gateway/v1beta1/gateway_service"
43
+ # client = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayService::Client.new
44
+ #
45
+ module GatewayService
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ helper_path = ::File.join __dir__, "gateway_service", "helpers.rb"
54
+ require "google/cloud/gke_connect/gateway/v1beta1/gateway_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,666 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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/gateway_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module GkeConnect
25
+ module Gateway
26
+ module V1beta1
27
+ module GatewayService
28
+ ##
29
+ # Client for the GatewayService service.
30
+ #
31
+ # Gateway service is a public API which works as a Kubernetes resource model
32
+ # proxy between end users and registered Kubernetes clusters. Each RPC in this
33
+ # service matches with an HTTP verb. End user will initiate kubectl commands
34
+ # against the Gateway service, and Gateway service will forward user requests
35
+ # to clusters.
36
+ #
37
+ class Client
38
+ # @private
39
+ attr_reader :gateway_service_stub
40
+
41
+ ##
42
+ # Configure the GatewayService Client class.
43
+ #
44
+ # See {::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayService::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # ## Example
48
+ #
49
+ # To modify the configuration for all GatewayService clients:
50
+ #
51
+ # ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayService::Client.configure do |config|
52
+ # config.timeout = 10.0
53
+ # end
54
+ #
55
+ # @yield [config] Configure the Client client.
56
+ # @yieldparam config [Client::Configuration]
57
+ #
58
+ # @return [Client::Configuration]
59
+ #
60
+ def self.configure
61
+ @configure ||= begin
62
+ namespace = ["Google", "Cloud", "GkeConnect", "Gateway", "V1beta1"]
63
+ parent_config = while namespace.any?
64
+ parent_name = namespace.join "::"
65
+ parent_const = const_get parent_name
66
+ break parent_const.configure if parent_const.respond_to? :configure
67
+ namespace.pop
68
+ end
69
+ default_config = Client::Configuration.new parent_config
70
+
71
+ default_config
72
+ end
73
+ yield @configure if block_given?
74
+ @configure
75
+ end
76
+
77
+ ##
78
+ # Configure the GatewayService Client instance.
79
+ #
80
+ # The configuration is set to the derived mode, meaning that values can be changed,
81
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
82
+ # should be made on {Client.configure}.
83
+ #
84
+ # See {::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayService::Client::Configuration}
85
+ # for a description of the configuration fields.
86
+ #
87
+ # @yield [config] Configure the Client client.
88
+ # @yieldparam config [Client::Configuration]
89
+ #
90
+ # @return [Client::Configuration]
91
+ #
92
+ def configure
93
+ yield @config if block_given?
94
+ @config
95
+ end
96
+
97
+ ##
98
+ # Create a new GatewayService client object.
99
+ #
100
+ # ## Examples
101
+ #
102
+ # To create a new GatewayService client with the default
103
+ # configuration:
104
+ #
105
+ # client = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayService::Client.new
106
+ #
107
+ # To create a new GatewayService client with a custom
108
+ # configuration:
109
+ #
110
+ # client = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayService::Client.new do |config|
111
+ # config.timeout = 10.0
112
+ # end
113
+ #
114
+ # @yield [config] Configure the GatewayService client.
115
+ # @yieldparam config [Client::Configuration]
116
+ #
117
+ def initialize
118
+ # These require statements are intentionally placed here to initialize
119
+ # the gRPC module only when it's required.
120
+ # See https://github.com/googleapis/toolkit/issues/446
121
+ require "gapic/grpc"
122
+ require "google/cloud/gkeconnect/gateway/v1beta1/gateway_services_pb"
123
+
124
+ # Create the configuration object
125
+ @config = Configuration.new Client.configure
126
+
127
+ # Yield the configuration if needed
128
+ yield @config if block_given?
129
+
130
+ # Create credentials
131
+ credentials = @config.credentials
132
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
133
+ # but only if the default endpoint does not have a region prefix.
134
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
135
+ @config.endpoint == Client.configure.endpoint &&
136
+ !@config.endpoint.split(".").first.include?("-")
137
+ credentials ||= Credentials.default scope: @config.scope,
138
+ enable_self_signed_jwt: enable_self_signed_jwt
139
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
140
+ credentials = Credentials.new credentials, scope: @config.scope
141
+ end
142
+ @quota_project_id = @config.quota_project
143
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
144
+
145
+ @gateway_service_stub = ::Gapic::ServiceStub.new(
146
+ ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayService::Stub,
147
+ credentials: credentials,
148
+ endpoint: @config.endpoint,
149
+ channel_args: @config.channel_args,
150
+ interceptors: @config.interceptors
151
+ )
152
+ end
153
+
154
+ # Service calls
155
+
156
+ ##
157
+ # GetResource performs an HTTP GET request on the Kubernetes API Server.
158
+ #
159
+ # @overload get_resource(request, options = nil)
160
+ # Pass arguments to `get_resource` via a request object, either of type
161
+ # {::Google::Api::HttpBody} or an equivalent Hash.
162
+ #
163
+ # @param request [::Google::Api::HttpBody, ::Hash]
164
+ # A request object representing the call parameters. Required. To specify no
165
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
166
+ # @param options [::Gapic::CallOptions, ::Hash]
167
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
168
+ #
169
+ # @overload get_resource(content_type: nil, data: nil, extensions: nil)
170
+ # Pass arguments to `get_resource` via keyword arguments. Note that at
171
+ # least one keyword argument is required. To specify no parameters, or to keep all
172
+ # the default parameter values, pass an empty Hash as a request object (see above).
173
+ #
174
+ # @param content_type [::String]
175
+ # The HTTP Content-Type header value specifying the content type of the body.
176
+ # @param data [::String]
177
+ # The HTTP request/response body as raw binary.
178
+ # @param extensions [::Array<::Google::Protobuf::Any, ::Hash>]
179
+ # Application specific response metadata. Must be set in the first response
180
+ # for streaming APIs.
181
+ #
182
+ # @yield [response, operation] Access the result along with the RPC operation
183
+ # @yieldparam response [::Google::Api::HttpBody]
184
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
185
+ #
186
+ # @return [::Google::Api::HttpBody]
187
+ #
188
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
189
+ #
190
+ def get_resource request, options = nil
191
+ raise ::ArgumentError, "request must be provided" if request.nil?
192
+
193
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Api::HttpBody
194
+
195
+ # Converts hash and nil to an options object
196
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
197
+
198
+ # Customize the options with defaults
199
+ metadata = @config.rpcs.get_resource.metadata.to_h
200
+
201
+ # Set x-goog-api-client and x-goog-user-project headers
202
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
203
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
204
+ gapic_version: ::Google::Cloud::GkeConnect::Gateway::V1beta1::VERSION
205
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
206
+
207
+ options.apply_defaults timeout: @config.rpcs.get_resource.timeout,
208
+ metadata: metadata,
209
+ retry_policy: @config.rpcs.get_resource.retry_policy
210
+ options.apply_defaults metadata: @config.metadata,
211
+ retry_policy: @config.retry_policy
212
+
213
+ @gateway_service_stub.call_rpc :get_resource, request, options: options do |response, operation|
214
+ yield response, operation if block_given?
215
+ return response
216
+ end
217
+ rescue ::GRPC::BadStatus => e
218
+ raise ::Google::Cloud::Error.from_error(e)
219
+ end
220
+
221
+ ##
222
+ # PostResource performs an HTTP POST on the Kubernetes API Server.
223
+ #
224
+ # @overload post_resource(request, options = nil)
225
+ # Pass arguments to `post_resource` via a request object, either of type
226
+ # {::Google::Api::HttpBody} or an equivalent Hash.
227
+ #
228
+ # @param request [::Google::Api::HttpBody, ::Hash]
229
+ # A request object representing the call parameters. Required. To specify no
230
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
231
+ # @param options [::Gapic::CallOptions, ::Hash]
232
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
233
+ #
234
+ # @overload post_resource(content_type: nil, data: nil, extensions: nil)
235
+ # Pass arguments to `post_resource` via keyword arguments. Note that at
236
+ # least one keyword argument is required. To specify no parameters, or to keep all
237
+ # the default parameter values, pass an empty Hash as a request object (see above).
238
+ #
239
+ # @param content_type [::String]
240
+ # The HTTP Content-Type header value specifying the content type of the body.
241
+ # @param data [::String]
242
+ # The HTTP request/response body as raw binary.
243
+ # @param extensions [::Array<::Google::Protobuf::Any, ::Hash>]
244
+ # Application specific response metadata. Must be set in the first response
245
+ # for streaming APIs.
246
+ #
247
+ # @yield [response, operation] Access the result along with the RPC operation
248
+ # @yieldparam response [::Google::Api::HttpBody]
249
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
250
+ #
251
+ # @return [::Google::Api::HttpBody]
252
+ #
253
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
254
+ #
255
+ def post_resource request, options = nil
256
+ raise ::ArgumentError, "request must be provided" if request.nil?
257
+
258
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Api::HttpBody
259
+
260
+ # Converts hash and nil to an options object
261
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
262
+
263
+ # Customize the options with defaults
264
+ metadata = @config.rpcs.post_resource.metadata.to_h
265
+
266
+ # Set x-goog-api-client and x-goog-user-project headers
267
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
268
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
269
+ gapic_version: ::Google::Cloud::GkeConnect::Gateway::V1beta1::VERSION
270
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
271
+
272
+ options.apply_defaults timeout: @config.rpcs.post_resource.timeout,
273
+ metadata: metadata,
274
+ retry_policy: @config.rpcs.post_resource.retry_policy
275
+ options.apply_defaults metadata: @config.metadata,
276
+ retry_policy: @config.retry_policy
277
+
278
+ @gateway_service_stub.call_rpc :post_resource, request, options: options do |response, operation|
279
+ yield response, operation if block_given?
280
+ return response
281
+ end
282
+ rescue ::GRPC::BadStatus => e
283
+ raise ::Google::Cloud::Error.from_error(e)
284
+ end
285
+
286
+ ##
287
+ # DeleteResource performs an HTTP DELETE on the Kubernetes API Server.
288
+ #
289
+ # @overload delete_resource(request, options = nil)
290
+ # Pass arguments to `delete_resource` via a request object, either of type
291
+ # {::Google::Api::HttpBody} or an equivalent Hash.
292
+ #
293
+ # @param request [::Google::Api::HttpBody, ::Hash]
294
+ # A request object representing the call parameters. Required. To specify no
295
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
296
+ # @param options [::Gapic::CallOptions, ::Hash]
297
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
298
+ #
299
+ # @overload delete_resource(content_type: nil, data: nil, extensions: nil)
300
+ # Pass arguments to `delete_resource` via keyword arguments. Note that at
301
+ # least one keyword argument is required. To specify no parameters, or to keep all
302
+ # the default parameter values, pass an empty Hash as a request object (see above).
303
+ #
304
+ # @param content_type [::String]
305
+ # The HTTP Content-Type header value specifying the content type of the body.
306
+ # @param data [::String]
307
+ # The HTTP request/response body as raw binary.
308
+ # @param extensions [::Array<::Google::Protobuf::Any, ::Hash>]
309
+ # Application specific response metadata. Must be set in the first response
310
+ # for streaming APIs.
311
+ #
312
+ # @yield [response, operation] Access the result along with the RPC operation
313
+ # @yieldparam response [::Google::Api::HttpBody]
314
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
315
+ #
316
+ # @return [::Google::Api::HttpBody]
317
+ #
318
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
319
+ #
320
+ def delete_resource request, options = nil
321
+ raise ::ArgumentError, "request must be provided" if request.nil?
322
+
323
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Api::HttpBody
324
+
325
+ # Converts hash and nil to an options object
326
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
327
+
328
+ # Customize the options with defaults
329
+ metadata = @config.rpcs.delete_resource.metadata.to_h
330
+
331
+ # Set x-goog-api-client and x-goog-user-project headers
332
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
333
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
334
+ gapic_version: ::Google::Cloud::GkeConnect::Gateway::V1beta1::VERSION
335
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
336
+
337
+ options.apply_defaults timeout: @config.rpcs.delete_resource.timeout,
338
+ metadata: metadata,
339
+ retry_policy: @config.rpcs.delete_resource.retry_policy
340
+ options.apply_defaults metadata: @config.metadata,
341
+ retry_policy: @config.retry_policy
342
+
343
+ @gateway_service_stub.call_rpc :delete_resource, request, options: options do |response, operation|
344
+ yield response, operation if block_given?
345
+ return response
346
+ end
347
+ rescue ::GRPC::BadStatus => e
348
+ raise ::Google::Cloud::Error.from_error(e)
349
+ end
350
+
351
+ ##
352
+ # PutResource performs an HTTP PUT on the Kubernetes API Server.
353
+ #
354
+ # @overload put_resource(request, options = nil)
355
+ # Pass arguments to `put_resource` via a request object, either of type
356
+ # {::Google::Api::HttpBody} or an equivalent Hash.
357
+ #
358
+ # @param request [::Google::Api::HttpBody, ::Hash]
359
+ # A request object representing the call parameters. Required. To specify no
360
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
361
+ # @param options [::Gapic::CallOptions, ::Hash]
362
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
363
+ #
364
+ # @overload put_resource(content_type: nil, data: nil, extensions: nil)
365
+ # Pass arguments to `put_resource` via keyword arguments. Note that at
366
+ # least one keyword argument is required. To specify no parameters, or to keep all
367
+ # the default parameter values, pass an empty Hash as a request object (see above).
368
+ #
369
+ # @param content_type [::String]
370
+ # The HTTP Content-Type header value specifying the content type of the body.
371
+ # @param data [::String]
372
+ # The HTTP request/response body as raw binary.
373
+ # @param extensions [::Array<::Google::Protobuf::Any, ::Hash>]
374
+ # Application specific response metadata. Must be set in the first response
375
+ # for streaming APIs.
376
+ #
377
+ # @yield [response, operation] Access the result along with the RPC operation
378
+ # @yieldparam response [::Google::Api::HttpBody]
379
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
380
+ #
381
+ # @return [::Google::Api::HttpBody]
382
+ #
383
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
384
+ #
385
+ def put_resource request, options = nil
386
+ raise ::ArgumentError, "request must be provided" if request.nil?
387
+
388
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Api::HttpBody
389
+
390
+ # Converts hash and nil to an options object
391
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
392
+
393
+ # Customize the options with defaults
394
+ metadata = @config.rpcs.put_resource.metadata.to_h
395
+
396
+ # Set x-goog-api-client and x-goog-user-project headers
397
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
398
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
399
+ gapic_version: ::Google::Cloud::GkeConnect::Gateway::V1beta1::VERSION
400
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
401
+
402
+ options.apply_defaults timeout: @config.rpcs.put_resource.timeout,
403
+ metadata: metadata,
404
+ retry_policy: @config.rpcs.put_resource.retry_policy
405
+ options.apply_defaults metadata: @config.metadata,
406
+ retry_policy: @config.retry_policy
407
+
408
+ @gateway_service_stub.call_rpc :put_resource, request, options: options do |response, operation|
409
+ yield response, operation if block_given?
410
+ return response
411
+ end
412
+ rescue ::GRPC::BadStatus => e
413
+ raise ::Google::Cloud::Error.from_error(e)
414
+ end
415
+
416
+ ##
417
+ # PatchResource performs an HTTP PATCH on the Kubernetes API Server.
418
+ #
419
+ # @overload patch_resource(request, options = nil)
420
+ # Pass arguments to `patch_resource` via a request object, either of type
421
+ # {::Google::Api::HttpBody} or an equivalent Hash.
422
+ #
423
+ # @param request [::Google::Api::HttpBody, ::Hash]
424
+ # A request object representing the call parameters. Required. To specify no
425
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
426
+ # @param options [::Gapic::CallOptions, ::Hash]
427
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
428
+ #
429
+ # @overload patch_resource(content_type: nil, data: nil, extensions: nil)
430
+ # Pass arguments to `patch_resource` via keyword arguments. Note that at
431
+ # least one keyword argument is required. To specify no parameters, or to keep all
432
+ # the default parameter values, pass an empty Hash as a request object (see above).
433
+ #
434
+ # @param content_type [::String]
435
+ # The HTTP Content-Type header value specifying the content type of the body.
436
+ # @param data [::String]
437
+ # The HTTP request/response body as raw binary.
438
+ # @param extensions [::Array<::Google::Protobuf::Any, ::Hash>]
439
+ # Application specific response metadata. Must be set in the first response
440
+ # for streaming APIs.
441
+ #
442
+ # @yield [response, operation] Access the result along with the RPC operation
443
+ # @yieldparam response [::Google::Api::HttpBody]
444
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
445
+ #
446
+ # @return [::Google::Api::HttpBody]
447
+ #
448
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
449
+ #
450
+ def patch_resource request, options = nil
451
+ raise ::ArgumentError, "request must be provided" if request.nil?
452
+
453
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Api::HttpBody
454
+
455
+ # Converts hash and nil to an options object
456
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
457
+
458
+ # Customize the options with defaults
459
+ metadata = @config.rpcs.patch_resource.metadata.to_h
460
+
461
+ # Set x-goog-api-client and x-goog-user-project headers
462
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
463
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
464
+ gapic_version: ::Google::Cloud::GkeConnect::Gateway::V1beta1::VERSION
465
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
466
+
467
+ options.apply_defaults timeout: @config.rpcs.patch_resource.timeout,
468
+ metadata: metadata,
469
+ retry_policy: @config.rpcs.patch_resource.retry_policy
470
+ options.apply_defaults metadata: @config.metadata,
471
+ retry_policy: @config.retry_policy
472
+
473
+ @gateway_service_stub.call_rpc :patch_resource, request, options: options do |response, operation|
474
+ yield response, operation if block_given?
475
+ return response
476
+ end
477
+ rescue ::GRPC::BadStatus => e
478
+ raise ::Google::Cloud::Error.from_error(e)
479
+ end
480
+
481
+ ##
482
+ # Configuration class for the GatewayService API.
483
+ #
484
+ # This class represents the configuration for GatewayService,
485
+ # providing control over timeouts, retry behavior, logging, transport
486
+ # parameters, and other low-level controls. Certain parameters can also be
487
+ # applied individually to specific RPCs. See
488
+ # {::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayService::Client::Configuration::Rpcs}
489
+ # for a list of RPCs that can be configured independently.
490
+ #
491
+ # Configuration can be applied globally to all clients, or to a single client
492
+ # on construction.
493
+ #
494
+ # # Examples
495
+ #
496
+ # To modify the global config, setting the timeout for get_resource
497
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
498
+ #
499
+ # ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayService::Client.configure do |config|
500
+ # config.timeout = 10.0
501
+ # config.rpcs.get_resource.timeout = 20.0
502
+ # end
503
+ #
504
+ # To apply the above configuration only to a new client:
505
+ #
506
+ # client = ::Google::Cloud::GkeConnect::Gateway::V1beta1::GatewayService::Client.new do |config|
507
+ # config.timeout = 10.0
508
+ # config.rpcs.get_resource.timeout = 20.0
509
+ # end
510
+ #
511
+ # @!attribute [rw] endpoint
512
+ # The hostname or hostname:port of the service endpoint.
513
+ # Defaults to `"connectgateway.googleapis.com"`.
514
+ # @return [::String]
515
+ # @!attribute [rw] credentials
516
+ # Credentials to send with calls. You may provide any of the following types:
517
+ # * (`String`) The path to a service account key file in JSON format
518
+ # * (`Hash`) A service account key as a Hash
519
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
520
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
521
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
522
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
523
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
524
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
525
+ # * (`nil`) indicating no credentials
526
+ # @return [::Object]
527
+ # @!attribute [rw] scope
528
+ # The OAuth scopes
529
+ # @return [::Array<::String>]
530
+ # @!attribute [rw] lib_name
531
+ # The library name as recorded in instrumentation and logging
532
+ # @return [::String]
533
+ # @!attribute [rw] lib_version
534
+ # The library version as recorded in instrumentation and logging
535
+ # @return [::String]
536
+ # @!attribute [rw] channel_args
537
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
538
+ # `GRPC::Core::Channel` object is provided as the credential.
539
+ # @return [::Hash]
540
+ # @!attribute [rw] interceptors
541
+ # An array of interceptors that are run before calls are executed.
542
+ # @return [::Array<::GRPC::ClientInterceptor>]
543
+ # @!attribute [rw] timeout
544
+ # The call timeout in seconds.
545
+ # @return [::Numeric]
546
+ # @!attribute [rw] metadata
547
+ # Additional gRPC headers to be sent with the call.
548
+ # @return [::Hash{::Symbol=>::String}]
549
+ # @!attribute [rw] retry_policy
550
+ # The retry policy. The value is a hash with the following keys:
551
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
552
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
553
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
554
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
555
+ # trigger a retry.
556
+ # @return [::Hash]
557
+ # @!attribute [rw] quota_project
558
+ # A separate project against which to charge quota.
559
+ # @return [::String]
560
+ #
561
+ class Configuration
562
+ extend ::Gapic::Config
563
+
564
+ config_attr :endpoint, "connectgateway.googleapis.com", ::String
565
+ config_attr :credentials, nil do |value|
566
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
567
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
568
+ allowed.any? { |klass| klass === value }
569
+ end
570
+ config_attr :scope, nil, ::String, ::Array, nil
571
+ config_attr :lib_name, nil, ::String, nil
572
+ config_attr :lib_version, nil, ::String, nil
573
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
574
+ config_attr :interceptors, nil, ::Array, nil
575
+ config_attr :timeout, nil, ::Numeric, nil
576
+ config_attr :metadata, nil, ::Hash, nil
577
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
578
+ config_attr :quota_project, nil, ::String, nil
579
+
580
+ # @private
581
+ def initialize parent_config = nil
582
+ @parent_config = parent_config unless parent_config.nil?
583
+
584
+ yield self if block_given?
585
+ end
586
+
587
+ ##
588
+ # Configurations for individual RPCs
589
+ # @return [Rpcs]
590
+ #
591
+ def rpcs
592
+ @rpcs ||= begin
593
+ parent_rpcs = nil
594
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
595
+ Rpcs.new parent_rpcs
596
+ end
597
+ end
598
+
599
+ ##
600
+ # Configuration RPC class for the GatewayService API.
601
+ #
602
+ # Includes fields providing the configuration for each RPC in this service.
603
+ # Each configuration object is of type `Gapic::Config::Method` and includes
604
+ # the following configuration fields:
605
+ #
606
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
607
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
608
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
609
+ # include the following keys:
610
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
611
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
612
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
613
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
614
+ # trigger a retry.
615
+ #
616
+ class Rpcs
617
+ ##
618
+ # RPC-specific configuration for `get_resource`
619
+ # @return [::Gapic::Config::Method]
620
+ #
621
+ attr_reader :get_resource
622
+ ##
623
+ # RPC-specific configuration for `post_resource`
624
+ # @return [::Gapic::Config::Method]
625
+ #
626
+ attr_reader :post_resource
627
+ ##
628
+ # RPC-specific configuration for `delete_resource`
629
+ # @return [::Gapic::Config::Method]
630
+ #
631
+ attr_reader :delete_resource
632
+ ##
633
+ # RPC-specific configuration for `put_resource`
634
+ # @return [::Gapic::Config::Method]
635
+ #
636
+ attr_reader :put_resource
637
+ ##
638
+ # RPC-specific configuration for `patch_resource`
639
+ # @return [::Gapic::Config::Method]
640
+ #
641
+ attr_reader :patch_resource
642
+
643
+ # @private
644
+ def initialize parent_rpcs = nil
645
+ get_resource_config = parent_rpcs.get_resource if parent_rpcs.respond_to? :get_resource
646
+ @get_resource = ::Gapic::Config::Method.new get_resource_config
647
+ post_resource_config = parent_rpcs.post_resource if parent_rpcs.respond_to? :post_resource
648
+ @post_resource = ::Gapic::Config::Method.new post_resource_config
649
+ delete_resource_config = parent_rpcs.delete_resource if parent_rpcs.respond_to? :delete_resource
650
+ @delete_resource = ::Gapic::Config::Method.new delete_resource_config
651
+ put_resource_config = parent_rpcs.put_resource if parent_rpcs.respond_to? :put_resource
652
+ @put_resource = ::Gapic::Config::Method.new put_resource_config
653
+ patch_resource_config = parent_rpcs.patch_resource if parent_rpcs.respond_to? :patch_resource
654
+ @patch_resource = ::Gapic::Config::Method.new patch_resource_config
655
+
656
+ yield self if block_given?
657
+ end
658
+ end
659
+ end
660
+ end
661
+ end
662
+ end
663
+ end
664
+ end
665
+ end
666
+ end