google-cloud-gke_hub-v1 0.3.0 → 0.4.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.
@@ -0,0 +1,1302 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/gkehub/v1/service_pb"
21
+ require "google/cloud/gke_hub/v1/gke_hub/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module GkeHub
26
+ module V1
27
+ module GkeHub
28
+ module Rest
29
+ ##
30
+ # REST client for the GkeHub service.
31
+ #
32
+ # The GKE Hub service handles the registration of many Kubernetes clusters to
33
+ # Google Cloud, and the management of multi-cluster features over those
34
+ # clusters.
35
+ #
36
+ # The GKE Hub service operates on the following resources:
37
+ #
38
+ # * {::Google::Cloud::GkeHub::V1::Membership Membership}
39
+ # * {::Google::Cloud::GkeHub::V1::Feature Feature}
40
+ #
41
+ # GKE Hub is currently only available in the global region.
42
+ #
43
+ # **Membership management may be non-trivial:** it is recommended to use one
44
+ # of the Google-provided client libraries or tools where possible when working
45
+ # with Membership resources.
46
+ #
47
+ class Client
48
+ include Paths
49
+
50
+ # @private
51
+ attr_reader :gke_hub_stub
52
+
53
+ ##
54
+ # Configure the GkeHub Client class.
55
+ #
56
+ # See {::Google::Cloud::GkeHub::V1::GkeHub::Rest::Client::Configuration}
57
+ # for a description of the configuration fields.
58
+ #
59
+ # @example
60
+ #
61
+ # # Modify the configuration for all GkeHub clients
62
+ # ::Google::Cloud::GkeHub::V1::GkeHub::Rest::Client.configure do |config|
63
+ # config.timeout = 10.0
64
+ # end
65
+ #
66
+ # @yield [config] Configure the Client client.
67
+ # @yieldparam config [Client::Configuration]
68
+ #
69
+ # @return [Client::Configuration]
70
+ #
71
+ def self.configure
72
+ @configure ||= begin
73
+ namespace = ["Google", "Cloud", "GkeHub", "V1"]
74
+ parent_config = while namespace.any?
75
+ parent_name = namespace.join "::"
76
+ parent_const = const_get parent_name
77
+ break parent_const.configure if parent_const.respond_to? :configure
78
+ namespace.pop
79
+ end
80
+ default_config = Client::Configuration.new parent_config
81
+
82
+ default_config.timeout = 60.0
83
+ default_config.retry_policy = {
84
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
85
+ }
86
+
87
+ default_config
88
+ end
89
+ yield @configure if block_given?
90
+ @configure
91
+ end
92
+
93
+ ##
94
+ # Configure the GkeHub Client instance.
95
+ #
96
+ # The configuration is set to the derived mode, meaning that values can be changed,
97
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
98
+ # should be made on {Client.configure}.
99
+ #
100
+ # See {::Google::Cloud::GkeHub::V1::GkeHub::Rest::Client::Configuration}
101
+ # for a description of the configuration fields.
102
+ #
103
+ # @yield [config] Configure the Client client.
104
+ # @yieldparam config [Client::Configuration]
105
+ #
106
+ # @return [Client::Configuration]
107
+ #
108
+ def configure
109
+ yield @config if block_given?
110
+ @config
111
+ end
112
+
113
+ ##
114
+ # Create a new GkeHub REST client object.
115
+ #
116
+ # @example
117
+ #
118
+ # # Create a client using the default configuration
119
+ # client = ::Google::Cloud::GkeHub::V1::GkeHub::Rest::Client.new
120
+ #
121
+ # # Create a client using a custom configuration
122
+ # client = ::Google::Cloud::GkeHub::V1::GkeHub::Rest::Client.new do |config|
123
+ # config.timeout = 10.0
124
+ # end
125
+ #
126
+ # @yield [config] Configure the GkeHub client.
127
+ # @yieldparam config [Client::Configuration]
128
+ #
129
+ def initialize
130
+ # Create the configuration object
131
+ @config = Configuration.new Client.configure
132
+
133
+ # Yield the configuration if needed
134
+ yield @config if block_given?
135
+
136
+ # Create credentials
137
+ credentials = @config.credentials
138
+ # Use self-signed JWT if the endpoint is unchanged from default,
139
+ # but only if the default endpoint does not have a region prefix.
140
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
141
+ !@config.endpoint.split(".").first.include?("-")
142
+ credentials ||= Credentials.default scope: @config.scope,
143
+ enable_self_signed_jwt: enable_self_signed_jwt
144
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
145
+ credentials = Credentials.new credentials, scope: @config.scope
146
+ end
147
+
148
+ @quota_project_id = @config.quota_project
149
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
150
+
151
+ @operations_client = ::Google::Cloud::GkeHub::V1::GkeHub::Rest::Operations.new do |config|
152
+ config.credentials = credentials
153
+ config.quota_project = @quota_project_id
154
+ config.endpoint = @config.endpoint
155
+ end
156
+
157
+ @gke_hub_stub = ::Google::Cloud::GkeHub::V1::GkeHub::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
158
+ end
159
+
160
+ ##
161
+ # Get the associated client for long-running operations.
162
+ #
163
+ # @return [::Google::Cloud::GkeHub::V1::GkeHub::Rest::Operations]
164
+ #
165
+ attr_reader :operations_client
166
+
167
+ # Service calls
168
+
169
+ ##
170
+ # Lists Memberships in a given project and location.
171
+ #
172
+ # @overload list_memberships(request, options = nil)
173
+ # Pass arguments to `list_memberships` via a request object, either of type
174
+ # {::Google::Cloud::GkeHub::V1::ListMembershipsRequest} or an equivalent Hash.
175
+ #
176
+ # @param request [::Google::Cloud::GkeHub::V1::ListMembershipsRequest, ::Hash]
177
+ # A request object representing the call parameters. Required. To specify no
178
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
179
+ # @param options [::Gapic::CallOptions, ::Hash]
180
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
181
+ #
182
+ # @overload list_memberships(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
183
+ # Pass arguments to `list_memberships` via keyword arguments. Note that at
184
+ # least one keyword argument is required. To specify no parameters, or to keep all
185
+ # the default parameter values, pass an empty Hash as a request object (see above).
186
+ #
187
+ # @param parent [::String]
188
+ # Required. The parent (project and location) where the Memberships will be listed.
189
+ # Specified in the format `projects/*/locations/*`.
190
+ # @param page_size [::Integer]
191
+ # Optional. When requesting a 'page' of resources, `page_size` specifies number of
192
+ # resources to return. If unspecified or set to 0, all resources will
193
+ # be returned.
194
+ # @param page_token [::String]
195
+ # Optional. Token returned by previous call to `ListMemberships` which
196
+ # specifies the position in the list from where to continue listing the
197
+ # resources.
198
+ # @param filter [::String]
199
+ # Optional. Lists Memberships that match the filter expression, following the syntax
200
+ # outlined in https://google.aip.dev/160.
201
+ #
202
+ # Examples:
203
+ #
204
+ # - Name is `bar` in project `foo-proj` and location `global`:
205
+ #
206
+ # name = "projects/foo-proj/locations/global/membership/bar"
207
+ #
208
+ # - Memberships that have a label called `foo`:
209
+ #
210
+ # labels.foo:*
211
+ #
212
+ # - Memberships that have a label called `foo` whose value is `bar`:
213
+ #
214
+ # labels.foo = bar
215
+ #
216
+ # - Memberships in the CREATING state:
217
+ #
218
+ # state = CREATING
219
+ # @param order_by [::String]
220
+ # Optional. One or more fields to compare and use to sort the output.
221
+ # See https://google.aip.dev/132#ordering.
222
+ # @yield [result, operation] Access the result along with the TransportOperation object
223
+ # @yieldparam result [::Google::Cloud::GkeHub::V1::ListMembershipsResponse]
224
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
225
+ #
226
+ # @return [::Google::Cloud::GkeHub::V1::ListMembershipsResponse]
227
+ #
228
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
229
+ def list_memberships request, options = nil
230
+ raise ::ArgumentError, "request must be provided" if request.nil?
231
+
232
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeHub::V1::ListMembershipsRequest
233
+
234
+ # Converts hash and nil to an options object
235
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
236
+
237
+ # Customize the options with defaults
238
+ call_metadata = @config.rpcs.list_memberships.metadata.to_h
239
+
240
+ # Set x-goog-api-client and x-goog-user-project headers
241
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
242
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
243
+ gapic_version: ::Google::Cloud::GkeHub::V1::VERSION,
244
+ transports_version_send: [:rest]
245
+
246
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
247
+
248
+ options.apply_defaults timeout: @config.rpcs.list_memberships.timeout,
249
+ metadata: call_metadata,
250
+ retry_policy: @config.rpcs.list_memberships.retry_policy
251
+
252
+ options.apply_defaults timeout: @config.timeout,
253
+ metadata: @config.metadata,
254
+ retry_policy: @config.retry_policy
255
+
256
+ @gke_hub_stub.list_memberships request, options do |result, operation|
257
+ yield result, operation if block_given?
258
+ return result
259
+ end
260
+ rescue ::Gapic::Rest::Error => e
261
+ raise ::Google::Cloud::Error.from_error(e)
262
+ end
263
+
264
+ ##
265
+ # Lists Features in a given project and location.
266
+ #
267
+ # @overload list_features(request, options = nil)
268
+ # Pass arguments to `list_features` via a request object, either of type
269
+ # {::Google::Cloud::GkeHub::V1::ListFeaturesRequest} or an equivalent Hash.
270
+ #
271
+ # @param request [::Google::Cloud::GkeHub::V1::ListFeaturesRequest, ::Hash]
272
+ # A request object representing the call parameters. Required. To specify no
273
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
274
+ # @param options [::Gapic::CallOptions, ::Hash]
275
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
276
+ #
277
+ # @overload list_features(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
278
+ # Pass arguments to `list_features` via keyword arguments. Note that at
279
+ # least one keyword argument is required. To specify no parameters, or to keep all
280
+ # the default parameter values, pass an empty Hash as a request object (see above).
281
+ #
282
+ # @param parent [::String]
283
+ # Required. The parent (project and location) where the Features will be listed.
284
+ # Specified in the format `projects/*/locations/*`.
285
+ # @param page_size [::Integer]
286
+ # When requesting a 'page' of resources, `page_size` specifies number of
287
+ # resources to return. If unspecified or set to 0, all resources will
288
+ # be returned.
289
+ # @param page_token [::String]
290
+ # Token returned by previous call to `ListFeatures` which
291
+ # specifies the position in the list from where to continue listing the
292
+ # resources.
293
+ # @param filter [::String]
294
+ # Lists Features that match the filter expression, following the syntax
295
+ # outlined in https://google.aip.dev/160.
296
+ #
297
+ # Examples:
298
+ #
299
+ # - Feature with the name "servicemesh" in project "foo-proj":
300
+ #
301
+ # name = "projects/foo-proj/locations/global/features/servicemesh"
302
+ #
303
+ # - Features that have a label called `foo`:
304
+ #
305
+ # labels.foo:*
306
+ #
307
+ # - Features that have a label called `foo` whose value is `bar`:
308
+ #
309
+ # labels.foo = bar
310
+ # @param order_by [::String]
311
+ # One or more fields to compare and use to sort the output.
312
+ # See https://google.aip.dev/132#ordering.
313
+ # @yield [result, operation] Access the result along with the TransportOperation object
314
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::GkeHub::V1::Feature>]
315
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
316
+ #
317
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::GkeHub::V1::Feature>]
318
+ #
319
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
320
+ def list_features request, options = nil
321
+ raise ::ArgumentError, "request must be provided" if request.nil?
322
+
323
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeHub::V1::ListFeaturesRequest
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
+ call_metadata = @config.rpcs.list_features.metadata.to_h
330
+
331
+ # Set x-goog-api-client and x-goog-user-project headers
332
+ call_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::GkeHub::V1::VERSION,
335
+ transports_version_send: [:rest]
336
+
337
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
338
+
339
+ options.apply_defaults timeout: @config.rpcs.list_features.timeout,
340
+ metadata: call_metadata,
341
+ retry_policy: @config.rpcs.list_features.retry_policy
342
+
343
+ options.apply_defaults timeout: @config.timeout,
344
+ metadata: @config.metadata,
345
+ retry_policy: @config.retry_policy
346
+
347
+ @gke_hub_stub.list_features request, options do |result, operation|
348
+ result = ::Gapic::Rest::PagedEnumerable.new @gke_hub_stub, :list_features, "resources", request, result, options
349
+ yield result, operation if block_given?
350
+ return result
351
+ end
352
+ rescue ::Gapic::Rest::Error => e
353
+ raise ::Google::Cloud::Error.from_error(e)
354
+ end
355
+
356
+ ##
357
+ # Gets the details of a Membership.
358
+ #
359
+ # @overload get_membership(request, options = nil)
360
+ # Pass arguments to `get_membership` via a request object, either of type
361
+ # {::Google::Cloud::GkeHub::V1::GetMembershipRequest} or an equivalent Hash.
362
+ #
363
+ # @param request [::Google::Cloud::GkeHub::V1::GetMembershipRequest, ::Hash]
364
+ # A request object representing the call parameters. Required. To specify no
365
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
366
+ # @param options [::Gapic::CallOptions, ::Hash]
367
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
368
+ #
369
+ # @overload get_membership(name: nil)
370
+ # Pass arguments to `get_membership` via keyword arguments. Note that at
371
+ # least one keyword argument is required. To specify no parameters, or to keep all
372
+ # the default parameter values, pass an empty Hash as a request object (see above).
373
+ #
374
+ # @param name [::String]
375
+ # Required. The Membership resource name in the format
376
+ # `projects/*/locations/*/memberships/*`.
377
+ # @yield [result, operation] Access the result along with the TransportOperation object
378
+ # @yieldparam result [::Google::Cloud::GkeHub::V1::Membership]
379
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
380
+ #
381
+ # @return [::Google::Cloud::GkeHub::V1::Membership]
382
+ #
383
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
384
+ def get_membership request, options = nil
385
+ raise ::ArgumentError, "request must be provided" if request.nil?
386
+
387
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeHub::V1::GetMembershipRequest
388
+
389
+ # Converts hash and nil to an options object
390
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
391
+
392
+ # Customize the options with defaults
393
+ call_metadata = @config.rpcs.get_membership.metadata.to_h
394
+
395
+ # Set x-goog-api-client and x-goog-user-project headers
396
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
397
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
398
+ gapic_version: ::Google::Cloud::GkeHub::V1::VERSION,
399
+ transports_version_send: [:rest]
400
+
401
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
402
+
403
+ options.apply_defaults timeout: @config.rpcs.get_membership.timeout,
404
+ metadata: call_metadata,
405
+ retry_policy: @config.rpcs.get_membership.retry_policy
406
+
407
+ options.apply_defaults timeout: @config.timeout,
408
+ metadata: @config.metadata,
409
+ retry_policy: @config.retry_policy
410
+
411
+ @gke_hub_stub.get_membership request, options do |result, operation|
412
+ yield result, operation if block_given?
413
+ return result
414
+ end
415
+ rescue ::Gapic::Rest::Error => e
416
+ raise ::Google::Cloud::Error.from_error(e)
417
+ end
418
+
419
+ ##
420
+ # Gets details of a single Feature.
421
+ #
422
+ # @overload get_feature(request, options = nil)
423
+ # Pass arguments to `get_feature` via a request object, either of type
424
+ # {::Google::Cloud::GkeHub::V1::GetFeatureRequest} or an equivalent Hash.
425
+ #
426
+ # @param request [::Google::Cloud::GkeHub::V1::GetFeatureRequest, ::Hash]
427
+ # A request object representing the call parameters. Required. To specify no
428
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
429
+ # @param options [::Gapic::CallOptions, ::Hash]
430
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
431
+ #
432
+ # @overload get_feature(name: nil)
433
+ # Pass arguments to `get_feature` via keyword arguments. Note that at
434
+ # least one keyword argument is required. To specify no parameters, or to keep all
435
+ # the default parameter values, pass an empty Hash as a request object (see above).
436
+ #
437
+ # @param name [::String]
438
+ # Required. The Feature resource name in the format
439
+ # `projects/*/locations/*/features/*`
440
+ # @yield [result, operation] Access the result along with the TransportOperation object
441
+ # @yieldparam result [::Google::Cloud::GkeHub::V1::Feature]
442
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
443
+ #
444
+ # @return [::Google::Cloud::GkeHub::V1::Feature]
445
+ #
446
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
447
+ def get_feature request, options = nil
448
+ raise ::ArgumentError, "request must be provided" if request.nil?
449
+
450
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeHub::V1::GetFeatureRequest
451
+
452
+ # Converts hash and nil to an options object
453
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
454
+
455
+ # Customize the options with defaults
456
+ call_metadata = @config.rpcs.get_feature.metadata.to_h
457
+
458
+ # Set x-goog-api-client and x-goog-user-project headers
459
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
460
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
461
+ gapic_version: ::Google::Cloud::GkeHub::V1::VERSION,
462
+ transports_version_send: [:rest]
463
+
464
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
465
+
466
+ options.apply_defaults timeout: @config.rpcs.get_feature.timeout,
467
+ metadata: call_metadata,
468
+ retry_policy: @config.rpcs.get_feature.retry_policy
469
+
470
+ options.apply_defaults timeout: @config.timeout,
471
+ metadata: @config.metadata,
472
+ retry_policy: @config.retry_policy
473
+
474
+ @gke_hub_stub.get_feature request, options do |result, operation|
475
+ yield result, operation if block_given?
476
+ return result
477
+ end
478
+ rescue ::Gapic::Rest::Error => e
479
+ raise ::Google::Cloud::Error.from_error(e)
480
+ end
481
+
482
+ ##
483
+ # Creates a new Membership.
484
+ #
485
+ # **This is currently only supported for GKE clusters on Google Cloud**.
486
+ # To register other clusters, follow the instructions at
487
+ # https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster.
488
+ #
489
+ # @overload create_membership(request, options = nil)
490
+ # Pass arguments to `create_membership` via a request object, either of type
491
+ # {::Google::Cloud::GkeHub::V1::CreateMembershipRequest} or an equivalent Hash.
492
+ #
493
+ # @param request [::Google::Cloud::GkeHub::V1::CreateMembershipRequest, ::Hash]
494
+ # A request object representing the call parameters. Required. To specify no
495
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
496
+ # @param options [::Gapic::CallOptions, ::Hash]
497
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
498
+ #
499
+ # @overload create_membership(parent: nil, membership_id: nil, resource: nil, request_id: nil)
500
+ # Pass arguments to `create_membership` via keyword arguments. Note that at
501
+ # least one keyword argument is required. To specify no parameters, or to keep all
502
+ # the default parameter values, pass an empty Hash as a request object (see above).
503
+ #
504
+ # @param parent [::String]
505
+ # Required. The parent (project and location) where the Memberships will be created.
506
+ # Specified in the format `projects/*/locations/*`.
507
+ # @param membership_id [::String]
508
+ # Required. Client chosen ID for the membership. `membership_id` must be a valid RFC
509
+ # 1123 compliant DNS label:
510
+ #
511
+ # 1. At most 63 characters in length
512
+ # 2. It must consist of lower case alphanumeric characters or `-`
513
+ # 3. It must start and end with an alphanumeric character
514
+ #
515
+ # Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`,
516
+ # with a maximum length of 63 characters.
517
+ # @param resource [::Google::Cloud::GkeHub::V1::Membership, ::Hash]
518
+ # Required. The membership to create.
519
+ # @param request_id [::String]
520
+ # Optional. A request ID to identify requests. Specify a unique request ID
521
+ # so that if you must retry your request, the server will know to ignore
522
+ # the request if it has already been completed. The server will guarantee
523
+ # that for at least 60 minutes after the first request.
524
+ #
525
+ # For example, consider a situation where you make an initial request and
526
+ # the request times out. If you make the request again with the same request
527
+ # ID, the server can check if original operation with the same request ID
528
+ # was received, and if so, will ignore the second request. This prevents
529
+ # clients from accidentally creating duplicate commitments.
530
+ #
531
+ # The request ID must be a valid UUID with the exception that zero UUID is
532
+ # not supported (00000000-0000-0000-0000-000000000000).
533
+ # @yield [result, operation] Access the result along with the TransportOperation object
534
+ # @yieldparam result [::Gapic::Operation]
535
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
536
+ #
537
+ # @return [::Gapic::Operation]
538
+ #
539
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
540
+ def create_membership request, options = nil
541
+ raise ::ArgumentError, "request must be provided" if request.nil?
542
+
543
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeHub::V1::CreateMembershipRequest
544
+
545
+ # Converts hash and nil to an options object
546
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
547
+
548
+ # Customize the options with defaults
549
+ call_metadata = @config.rpcs.create_membership.metadata.to_h
550
+
551
+ # Set x-goog-api-client and x-goog-user-project headers
552
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
553
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
554
+ gapic_version: ::Google::Cloud::GkeHub::V1::VERSION,
555
+ transports_version_send: [:rest]
556
+
557
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
558
+
559
+ options.apply_defaults timeout: @config.rpcs.create_membership.timeout,
560
+ metadata: call_metadata,
561
+ retry_policy: @config.rpcs.create_membership.retry_policy
562
+
563
+ options.apply_defaults timeout: @config.timeout,
564
+ metadata: @config.metadata,
565
+ retry_policy: @config.retry_policy
566
+
567
+ @gke_hub_stub.create_membership request, options do |result, operation|
568
+ result = ::Gapic::Operation.new result, @operations_client, options: options
569
+ yield result, operation if block_given?
570
+ return result
571
+ end
572
+ rescue ::Gapic::Rest::Error => e
573
+ raise ::Google::Cloud::Error.from_error(e)
574
+ end
575
+
576
+ ##
577
+ # Adds a new Feature.
578
+ #
579
+ # @overload create_feature(request, options = nil)
580
+ # Pass arguments to `create_feature` via a request object, either of type
581
+ # {::Google::Cloud::GkeHub::V1::CreateFeatureRequest} or an equivalent Hash.
582
+ #
583
+ # @param request [::Google::Cloud::GkeHub::V1::CreateFeatureRequest, ::Hash]
584
+ # A request object representing the call parameters. Required. To specify no
585
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
586
+ # @param options [::Gapic::CallOptions, ::Hash]
587
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
588
+ #
589
+ # @overload create_feature(parent: nil, feature_id: nil, resource: nil, request_id: nil)
590
+ # Pass arguments to `create_feature` via keyword arguments. Note that at
591
+ # least one keyword argument is required. To specify no parameters, or to keep all
592
+ # the default parameter values, pass an empty Hash as a request object (see above).
593
+ #
594
+ # @param parent [::String]
595
+ # Required. The parent (project and location) where the Feature will be created.
596
+ # Specified in the format `projects/*/locations/*`.
597
+ # @param feature_id [::String]
598
+ # The ID of the feature to create.
599
+ # @param resource [::Google::Cloud::GkeHub::V1::Feature, ::Hash]
600
+ # The Feature resource to create.
601
+ # @param request_id [::String]
602
+ # Optional. A request ID to identify requests. Specify a unique request ID
603
+ # so that if you must retry your request, the server will know to ignore
604
+ # the request if it has already been completed. The server will guarantee
605
+ # that for at least 60 minutes after the first request.
606
+ #
607
+ # For example, consider a situation where you make an initial request and
608
+ # the request times out. If you make the request again with the same request
609
+ # ID, the server can check if original operation with the same request ID
610
+ # was received, and if so, will ignore the second request. This prevents
611
+ # clients from accidentally creating duplicate commitments.
612
+ #
613
+ # The request ID must be a valid UUID with the exception that zero UUID is
614
+ # not supported (00000000-0000-0000-0000-000000000000).
615
+ # @yield [result, operation] Access the result along with the TransportOperation object
616
+ # @yieldparam result [::Gapic::Operation]
617
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
618
+ #
619
+ # @return [::Gapic::Operation]
620
+ #
621
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
622
+ def create_feature request, options = nil
623
+ raise ::ArgumentError, "request must be provided" if request.nil?
624
+
625
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeHub::V1::CreateFeatureRequest
626
+
627
+ # Converts hash and nil to an options object
628
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
629
+
630
+ # Customize the options with defaults
631
+ call_metadata = @config.rpcs.create_feature.metadata.to_h
632
+
633
+ # Set x-goog-api-client and x-goog-user-project headers
634
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
635
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
636
+ gapic_version: ::Google::Cloud::GkeHub::V1::VERSION,
637
+ transports_version_send: [:rest]
638
+
639
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
640
+
641
+ options.apply_defaults timeout: @config.rpcs.create_feature.timeout,
642
+ metadata: call_metadata,
643
+ retry_policy: @config.rpcs.create_feature.retry_policy
644
+
645
+ options.apply_defaults timeout: @config.timeout,
646
+ metadata: @config.metadata,
647
+ retry_policy: @config.retry_policy
648
+
649
+ @gke_hub_stub.create_feature request, options do |result, operation|
650
+ result = ::Gapic::Operation.new result, @operations_client, options: options
651
+ yield result, operation if block_given?
652
+ return result
653
+ end
654
+ rescue ::Gapic::Rest::Error => e
655
+ raise ::Google::Cloud::Error.from_error(e)
656
+ end
657
+
658
+ ##
659
+ # Removes a Membership.
660
+ #
661
+ # **This is currently only supported for GKE clusters on Google Cloud**.
662
+ # To unregister other clusters, follow the instructions at
663
+ # https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster.
664
+ #
665
+ # @overload delete_membership(request, options = nil)
666
+ # Pass arguments to `delete_membership` via a request object, either of type
667
+ # {::Google::Cloud::GkeHub::V1::DeleteMembershipRequest} or an equivalent Hash.
668
+ #
669
+ # @param request [::Google::Cloud::GkeHub::V1::DeleteMembershipRequest, ::Hash]
670
+ # A request object representing the call parameters. Required. To specify no
671
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
672
+ # @param options [::Gapic::CallOptions, ::Hash]
673
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
674
+ #
675
+ # @overload delete_membership(name: nil, request_id: nil)
676
+ # Pass arguments to `delete_membership` via keyword arguments. Note that at
677
+ # least one keyword argument is required. To specify no parameters, or to keep all
678
+ # the default parameter values, pass an empty Hash as a request object (see above).
679
+ #
680
+ # @param name [::String]
681
+ # Required. The Membership resource name in the format
682
+ # `projects/*/locations/*/memberships/*`.
683
+ # @param request_id [::String]
684
+ # Optional. A request ID to identify requests. Specify a unique request ID
685
+ # so that if you must retry your request, the server will know to ignore
686
+ # the request if it has already been completed. The server will guarantee
687
+ # that for at least 60 minutes after the first request.
688
+ #
689
+ # For example, consider a situation where you make an initial request and
690
+ # the request times out. If you make the request again with the same request
691
+ # ID, the server can check if original operation with the same request ID
692
+ # was received, and if so, will ignore the second request. This prevents
693
+ # clients from accidentally creating duplicate commitments.
694
+ #
695
+ # The request ID must be a valid UUID with the exception that zero UUID is
696
+ # not supported (00000000-0000-0000-0000-000000000000).
697
+ # @yield [result, operation] Access the result along with the TransportOperation object
698
+ # @yieldparam result [::Gapic::Operation]
699
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
700
+ #
701
+ # @return [::Gapic::Operation]
702
+ #
703
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
704
+ def delete_membership request, options = nil
705
+ raise ::ArgumentError, "request must be provided" if request.nil?
706
+
707
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeHub::V1::DeleteMembershipRequest
708
+
709
+ # Converts hash and nil to an options object
710
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
711
+
712
+ # Customize the options with defaults
713
+ call_metadata = @config.rpcs.delete_membership.metadata.to_h
714
+
715
+ # Set x-goog-api-client and x-goog-user-project headers
716
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
717
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
718
+ gapic_version: ::Google::Cloud::GkeHub::V1::VERSION,
719
+ transports_version_send: [:rest]
720
+
721
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
722
+
723
+ options.apply_defaults timeout: @config.rpcs.delete_membership.timeout,
724
+ metadata: call_metadata,
725
+ retry_policy: @config.rpcs.delete_membership.retry_policy
726
+
727
+ options.apply_defaults timeout: @config.timeout,
728
+ metadata: @config.metadata,
729
+ retry_policy: @config.retry_policy
730
+
731
+ @gke_hub_stub.delete_membership request, options do |result, operation|
732
+ result = ::Gapic::Operation.new result, @operations_client, options: options
733
+ yield result, operation if block_given?
734
+ return result
735
+ end
736
+ rescue ::Gapic::Rest::Error => e
737
+ raise ::Google::Cloud::Error.from_error(e)
738
+ end
739
+
740
+ ##
741
+ # Removes a Feature.
742
+ #
743
+ # @overload delete_feature(request, options = nil)
744
+ # Pass arguments to `delete_feature` via a request object, either of type
745
+ # {::Google::Cloud::GkeHub::V1::DeleteFeatureRequest} or an equivalent Hash.
746
+ #
747
+ # @param request [::Google::Cloud::GkeHub::V1::DeleteFeatureRequest, ::Hash]
748
+ # A request object representing the call parameters. Required. To specify no
749
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
750
+ # @param options [::Gapic::CallOptions, ::Hash]
751
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
752
+ #
753
+ # @overload delete_feature(name: nil, force: nil, request_id: nil)
754
+ # Pass arguments to `delete_feature` via keyword arguments. Note that at
755
+ # least one keyword argument is required. To specify no parameters, or to keep all
756
+ # the default parameter values, pass an empty Hash as a request object (see above).
757
+ #
758
+ # @param name [::String]
759
+ # Required. The Feature resource name in the format
760
+ # `projects/*/locations/*/features/*`.
761
+ # @param force [::Boolean]
762
+ # If set to true, the delete will ignore any outstanding resources for
763
+ # this Feature (that is, `FeatureState.has_resources` is set to true). These
764
+ # resources will NOT be cleaned up or modified in any way.
765
+ # @param request_id [::String]
766
+ # Optional. A request ID to identify requests. Specify a unique request ID
767
+ # so that if you must retry your request, the server will know to ignore
768
+ # the request if it has already been completed. The server will guarantee
769
+ # that for at least 60 minutes after the first request.
770
+ #
771
+ # For example, consider a situation where you make an initial request and
772
+ # the request times out. If you make the request again with the same request
773
+ # ID, the server can check if original operation with the same request ID
774
+ # was received, and if so, will ignore the second request. This prevents
775
+ # clients from accidentally creating duplicate commitments.
776
+ #
777
+ # The request ID must be a valid UUID with the exception that zero UUID is
778
+ # not supported (00000000-0000-0000-0000-000000000000).
779
+ # @yield [result, operation] Access the result along with the TransportOperation object
780
+ # @yieldparam result [::Gapic::Operation]
781
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
782
+ #
783
+ # @return [::Gapic::Operation]
784
+ #
785
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
786
+ def delete_feature request, options = nil
787
+ raise ::ArgumentError, "request must be provided" if request.nil?
788
+
789
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeHub::V1::DeleteFeatureRequest
790
+
791
+ # Converts hash and nil to an options object
792
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
793
+
794
+ # Customize the options with defaults
795
+ call_metadata = @config.rpcs.delete_feature.metadata.to_h
796
+
797
+ # Set x-goog-api-client and x-goog-user-project headers
798
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
799
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
800
+ gapic_version: ::Google::Cloud::GkeHub::V1::VERSION,
801
+ transports_version_send: [:rest]
802
+
803
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
804
+
805
+ options.apply_defaults timeout: @config.rpcs.delete_feature.timeout,
806
+ metadata: call_metadata,
807
+ retry_policy: @config.rpcs.delete_feature.retry_policy
808
+
809
+ options.apply_defaults timeout: @config.timeout,
810
+ metadata: @config.metadata,
811
+ retry_policy: @config.retry_policy
812
+
813
+ @gke_hub_stub.delete_feature request, options do |result, operation|
814
+ result = ::Gapic::Operation.new result, @operations_client, options: options
815
+ yield result, operation if block_given?
816
+ return result
817
+ end
818
+ rescue ::Gapic::Rest::Error => e
819
+ raise ::Google::Cloud::Error.from_error(e)
820
+ end
821
+
822
+ ##
823
+ # Updates an existing Membership.
824
+ #
825
+ # @overload update_membership(request, options = nil)
826
+ # Pass arguments to `update_membership` via a request object, either of type
827
+ # {::Google::Cloud::GkeHub::V1::UpdateMembershipRequest} or an equivalent Hash.
828
+ #
829
+ # @param request [::Google::Cloud::GkeHub::V1::UpdateMembershipRequest, ::Hash]
830
+ # A request object representing the call parameters. Required. To specify no
831
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
832
+ # @param options [::Gapic::CallOptions, ::Hash]
833
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
834
+ #
835
+ # @overload update_membership(name: nil, update_mask: nil, resource: nil, request_id: nil)
836
+ # Pass arguments to `update_membership` via keyword arguments. Note that at
837
+ # least one keyword argument is required. To specify no parameters, or to keep all
838
+ # the default parameter values, pass an empty Hash as a request object (see above).
839
+ #
840
+ # @param name [::String]
841
+ # Required. The Membership resource name in the format
842
+ # `projects/*/locations/*/memberships/*`.
843
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
844
+ # Required. Mask of fields to update.
845
+ # @param resource [::Google::Cloud::GkeHub::V1::Membership, ::Hash]
846
+ # Required. Only fields specified in update_mask are updated.
847
+ # If you specify a field in the update_mask but don't specify its value here
848
+ # that field will be deleted.
849
+ # If you are updating a map field, set the value of a key to null or empty
850
+ # string to delete the key from the map. It's not possible to update a key's
851
+ # value to the empty string.
852
+ # If you specify the update_mask to be a special path "*", fully replaces all
853
+ # user-modifiable fields to match `resource`.
854
+ # @param request_id [::String]
855
+ # Optional. A request ID to identify requests. Specify a unique request ID
856
+ # so that if you must retry your request, the server will know to ignore
857
+ # the request if it has already been completed. The server will guarantee
858
+ # that for at least 60 minutes after the first request.
859
+ #
860
+ # For example, consider a situation where you make an initial request and
861
+ # the request times out. If you make the request again with the same request
862
+ # ID, the server can check if original operation with the same request ID
863
+ # was received, and if so, will ignore the second request. This prevents
864
+ # clients from accidentally creating duplicate commitments.
865
+ #
866
+ # The request ID must be a valid UUID with the exception that zero UUID is
867
+ # not supported (00000000-0000-0000-0000-000000000000).
868
+ # @yield [result, operation] Access the result along with the TransportOperation object
869
+ # @yieldparam result [::Gapic::Operation]
870
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
871
+ #
872
+ # @return [::Gapic::Operation]
873
+ #
874
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
875
+ def update_membership request, options = nil
876
+ raise ::ArgumentError, "request must be provided" if request.nil?
877
+
878
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeHub::V1::UpdateMembershipRequest
879
+
880
+ # Converts hash and nil to an options object
881
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
882
+
883
+ # Customize the options with defaults
884
+ call_metadata = @config.rpcs.update_membership.metadata.to_h
885
+
886
+ # Set x-goog-api-client and x-goog-user-project headers
887
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
888
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
889
+ gapic_version: ::Google::Cloud::GkeHub::V1::VERSION,
890
+ transports_version_send: [:rest]
891
+
892
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
893
+
894
+ options.apply_defaults timeout: @config.rpcs.update_membership.timeout,
895
+ metadata: call_metadata,
896
+ retry_policy: @config.rpcs.update_membership.retry_policy
897
+
898
+ options.apply_defaults timeout: @config.timeout,
899
+ metadata: @config.metadata,
900
+ retry_policy: @config.retry_policy
901
+
902
+ @gke_hub_stub.update_membership request, options do |result, operation|
903
+ result = ::Gapic::Operation.new result, @operations_client, options: options
904
+ yield result, operation if block_given?
905
+ return result
906
+ end
907
+ rescue ::Gapic::Rest::Error => e
908
+ raise ::Google::Cloud::Error.from_error(e)
909
+ end
910
+
911
+ ##
912
+ # Updates an existing Feature.
913
+ #
914
+ # @overload update_feature(request, options = nil)
915
+ # Pass arguments to `update_feature` via a request object, either of type
916
+ # {::Google::Cloud::GkeHub::V1::UpdateFeatureRequest} or an equivalent Hash.
917
+ #
918
+ # @param request [::Google::Cloud::GkeHub::V1::UpdateFeatureRequest, ::Hash]
919
+ # A request object representing the call parameters. Required. To specify no
920
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
921
+ # @param options [::Gapic::CallOptions, ::Hash]
922
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
923
+ #
924
+ # @overload update_feature(name: nil, update_mask: nil, resource: nil, request_id: nil)
925
+ # Pass arguments to `update_feature` via keyword arguments. Note that at
926
+ # least one keyword argument is required. To specify no parameters, or to keep all
927
+ # the default parameter values, pass an empty Hash as a request object (see above).
928
+ #
929
+ # @param name [::String]
930
+ # Required. The Feature resource name in the format
931
+ # `projects/*/locations/*/features/*`.
932
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
933
+ # Mask of fields to update.
934
+ # @param resource [::Google::Cloud::GkeHub::V1::Feature, ::Hash]
935
+ # Only fields specified in update_mask are updated.
936
+ # If you specify a field in the update_mask but don't specify its value here
937
+ # that field will be deleted.
938
+ # If you are updating a map field, set the value of a key to null or empty
939
+ # string to delete the key from the map. It's not possible to update a key's
940
+ # value to the empty string.
941
+ # If you specify the update_mask to be a special path "*", fully replaces all
942
+ # user-modifiable fields to match `resource`.
943
+ # @param request_id [::String]
944
+ # Optional. A request ID to identify requests. Specify a unique request ID
945
+ # so that if you must retry your request, the server will know to ignore
946
+ # the request if it has already been completed. The server will guarantee
947
+ # that for at least 60 minutes after the first request.
948
+ #
949
+ # For example, consider a situation where you make an initial request and
950
+ # the request times out. If you make the request again with the same request
951
+ # ID, the server can check if original operation with the same request ID
952
+ # was received, and if so, will ignore the second request. This prevents
953
+ # clients from accidentally creating duplicate commitments.
954
+ #
955
+ # The request ID must be a valid UUID with the exception that zero UUID is
956
+ # not supported (00000000-0000-0000-0000-000000000000).
957
+ # @yield [result, operation] Access the result along with the TransportOperation object
958
+ # @yieldparam result [::Gapic::Operation]
959
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
960
+ #
961
+ # @return [::Gapic::Operation]
962
+ #
963
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
964
+ def update_feature request, options = nil
965
+ raise ::ArgumentError, "request must be provided" if request.nil?
966
+
967
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeHub::V1::UpdateFeatureRequest
968
+
969
+ # Converts hash and nil to an options object
970
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
971
+
972
+ # Customize the options with defaults
973
+ call_metadata = @config.rpcs.update_feature.metadata.to_h
974
+
975
+ # Set x-goog-api-client and x-goog-user-project headers
976
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
977
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
978
+ gapic_version: ::Google::Cloud::GkeHub::V1::VERSION,
979
+ transports_version_send: [:rest]
980
+
981
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
982
+
983
+ options.apply_defaults timeout: @config.rpcs.update_feature.timeout,
984
+ metadata: call_metadata,
985
+ retry_policy: @config.rpcs.update_feature.retry_policy
986
+
987
+ options.apply_defaults timeout: @config.timeout,
988
+ metadata: @config.metadata,
989
+ retry_policy: @config.retry_policy
990
+
991
+ @gke_hub_stub.update_feature request, options do |result, operation|
992
+ result = ::Gapic::Operation.new result, @operations_client, options: options
993
+ yield result, operation if block_given?
994
+ return result
995
+ end
996
+ rescue ::Gapic::Rest::Error => e
997
+ raise ::Google::Cloud::Error.from_error(e)
998
+ end
999
+
1000
+ ##
1001
+ # Generates the manifest for deployment of the GKE connect agent.
1002
+ #
1003
+ # **This method is used internally by Google-provided libraries.**
1004
+ # Most clients should not need to call this method directly.
1005
+ #
1006
+ # @overload generate_connect_manifest(request, options = nil)
1007
+ # Pass arguments to `generate_connect_manifest` via a request object, either of type
1008
+ # {::Google::Cloud::GkeHub::V1::GenerateConnectManifestRequest} or an equivalent Hash.
1009
+ #
1010
+ # @param request [::Google::Cloud::GkeHub::V1::GenerateConnectManifestRequest, ::Hash]
1011
+ # A request object representing the call parameters. Required. To specify no
1012
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1013
+ # @param options [::Gapic::CallOptions, ::Hash]
1014
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1015
+ #
1016
+ # @overload generate_connect_manifest(name: nil, namespace: nil, proxy: nil, version: nil, is_upgrade: nil, registry: nil, image_pull_secret_content: nil)
1017
+ # Pass arguments to `generate_connect_manifest` via keyword arguments. Note that at
1018
+ # least one keyword argument is required. To specify no parameters, or to keep all
1019
+ # the default parameter values, pass an empty Hash as a request object (see above).
1020
+ #
1021
+ # @param name [::String]
1022
+ # Required. The Membership resource name the Agent will associate with, in the format
1023
+ # `projects/*/locations/*/memberships/*`.
1024
+ # @param namespace [::String]
1025
+ # Optional. Namespace for GKE Connect agent resources. Defaults to `gke-connect`.
1026
+ #
1027
+ # The Connect Agent is authorized automatically when run in the default
1028
+ # namespace. Otherwise, explicit authorization must be granted with an
1029
+ # additional IAM binding.
1030
+ # @param proxy [::String]
1031
+ # Optional. URI of a proxy if connectivity from the agent to gkeconnect.googleapis.com
1032
+ # requires the use of a proxy. Format must be in the form
1033
+ # `http(s)://{proxy_address}`, depending on the HTTP/HTTPS protocol
1034
+ # supported by the proxy. This will direct the connect agent's outbound
1035
+ # traffic through a HTTP(S) proxy.
1036
+ # @param version [::String]
1037
+ # Optional. The Connect agent version to use. Defaults to the most current version.
1038
+ # @param is_upgrade [::Boolean]
1039
+ # Optional. If true, generate the resources for upgrade only. Some resources
1040
+ # generated only for installation (e.g. secrets) will be excluded.
1041
+ # @param registry [::String]
1042
+ # Optional. The registry to fetch the connect agent image from. Defaults to
1043
+ # gcr.io/gkeconnect.
1044
+ # @param image_pull_secret_content [::String]
1045
+ # Optional. The image pull secret content for the registry, if not public.
1046
+ # @yield [result, operation] Access the result along with the TransportOperation object
1047
+ # @yieldparam result [::Google::Cloud::GkeHub::V1::GenerateConnectManifestResponse]
1048
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1049
+ #
1050
+ # @return [::Google::Cloud::GkeHub::V1::GenerateConnectManifestResponse]
1051
+ #
1052
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1053
+ def generate_connect_manifest request, options = nil
1054
+ raise ::ArgumentError, "request must be provided" if request.nil?
1055
+
1056
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeHub::V1::GenerateConnectManifestRequest
1057
+
1058
+ # Converts hash and nil to an options object
1059
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1060
+
1061
+ # Customize the options with defaults
1062
+ call_metadata = @config.rpcs.generate_connect_manifest.metadata.to_h
1063
+
1064
+ # Set x-goog-api-client and x-goog-user-project headers
1065
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1066
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1067
+ gapic_version: ::Google::Cloud::GkeHub::V1::VERSION,
1068
+ transports_version_send: [:rest]
1069
+
1070
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1071
+
1072
+ options.apply_defaults timeout: @config.rpcs.generate_connect_manifest.timeout,
1073
+ metadata: call_metadata,
1074
+ retry_policy: @config.rpcs.generate_connect_manifest.retry_policy
1075
+
1076
+ options.apply_defaults timeout: @config.timeout,
1077
+ metadata: @config.metadata,
1078
+ retry_policy: @config.retry_policy
1079
+
1080
+ @gke_hub_stub.generate_connect_manifest request, options do |result, operation|
1081
+ yield result, operation if block_given?
1082
+ return result
1083
+ end
1084
+ rescue ::Gapic::Rest::Error => e
1085
+ raise ::Google::Cloud::Error.from_error(e)
1086
+ end
1087
+
1088
+ ##
1089
+ # Configuration class for the GkeHub REST API.
1090
+ #
1091
+ # This class represents the configuration for GkeHub REST,
1092
+ # providing control over timeouts, retry behavior, logging, transport
1093
+ # parameters, and other low-level controls. Certain parameters can also be
1094
+ # applied individually to specific RPCs. See
1095
+ # {::Google::Cloud::GkeHub::V1::GkeHub::Rest::Client::Configuration::Rpcs}
1096
+ # for a list of RPCs that can be configured independently.
1097
+ #
1098
+ # Configuration can be applied globally to all clients, or to a single client
1099
+ # on construction.
1100
+ #
1101
+ # @example
1102
+ #
1103
+ # # Modify the global config, setting the timeout for
1104
+ # # list_memberships to 20 seconds,
1105
+ # # and all remaining timeouts to 10 seconds.
1106
+ # ::Google::Cloud::GkeHub::V1::GkeHub::Rest::Client.configure do |config|
1107
+ # config.timeout = 10.0
1108
+ # config.rpcs.list_memberships.timeout = 20.0
1109
+ # end
1110
+ #
1111
+ # # Apply the above configuration only to a new client.
1112
+ # client = ::Google::Cloud::GkeHub::V1::GkeHub::Rest::Client.new do |config|
1113
+ # config.timeout = 10.0
1114
+ # config.rpcs.list_memberships.timeout = 20.0
1115
+ # end
1116
+ #
1117
+ # @!attribute [rw] endpoint
1118
+ # The hostname or hostname:port of the service endpoint.
1119
+ # Defaults to `"gkehub.googleapis.com"`.
1120
+ # @return [::String]
1121
+ # @!attribute [rw] credentials
1122
+ # Credentials to send with calls. You may provide any of the following types:
1123
+ # * (`String`) The path to a service account key file in JSON format
1124
+ # * (`Hash`) A service account key as a Hash
1125
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1126
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1127
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1128
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1129
+ # * (`nil`) indicating no credentials
1130
+ # @return [::Object]
1131
+ # @!attribute [rw] scope
1132
+ # The OAuth scopes
1133
+ # @return [::Array<::String>]
1134
+ # @!attribute [rw] lib_name
1135
+ # The library name as recorded in instrumentation and logging
1136
+ # @return [::String]
1137
+ # @!attribute [rw] lib_version
1138
+ # The library version as recorded in instrumentation and logging
1139
+ # @return [::String]
1140
+ # @!attribute [rw] timeout
1141
+ # The call timeout in seconds.
1142
+ # @return [::Numeric]
1143
+ # @!attribute [rw] metadata
1144
+ # Additional headers to be sent with the call.
1145
+ # @return [::Hash{::Symbol=>::String}]
1146
+ # @!attribute [rw] retry_policy
1147
+ # The retry policy. The value is a hash with the following keys:
1148
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1149
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1150
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1151
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1152
+ # trigger a retry.
1153
+ # @return [::Hash]
1154
+ # @!attribute [rw] quota_project
1155
+ # A separate project against which to charge quota.
1156
+ # @return [::String]
1157
+ #
1158
+ class Configuration
1159
+ extend ::Gapic::Config
1160
+
1161
+ config_attr :endpoint, "gkehub.googleapis.com", ::String
1162
+ config_attr :credentials, nil do |value|
1163
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1164
+ allowed.any? { |klass| klass === value }
1165
+ end
1166
+ config_attr :scope, nil, ::String, ::Array, nil
1167
+ config_attr :lib_name, nil, ::String, nil
1168
+ config_attr :lib_version, nil, ::String, nil
1169
+ config_attr :timeout, nil, ::Numeric, nil
1170
+ config_attr :metadata, nil, ::Hash, nil
1171
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1172
+ config_attr :quota_project, nil, ::String, nil
1173
+
1174
+ # @private
1175
+ def initialize parent_config = nil
1176
+ @parent_config = parent_config unless parent_config.nil?
1177
+
1178
+ yield self if block_given?
1179
+ end
1180
+
1181
+ ##
1182
+ # Configurations for individual RPCs
1183
+ # @return [Rpcs]
1184
+ #
1185
+ def rpcs
1186
+ @rpcs ||= begin
1187
+ parent_rpcs = nil
1188
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1189
+ Rpcs.new parent_rpcs
1190
+ end
1191
+ end
1192
+
1193
+ ##
1194
+ # Configuration RPC class for the GkeHub API.
1195
+ #
1196
+ # Includes fields providing the configuration for each RPC in this service.
1197
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1198
+ # the following configuration fields:
1199
+ #
1200
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1201
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1202
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1203
+ # include the following keys:
1204
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1205
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1206
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1207
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1208
+ # trigger a retry.
1209
+ #
1210
+ class Rpcs
1211
+ ##
1212
+ # RPC-specific configuration for `list_memberships`
1213
+ # @return [::Gapic::Config::Method]
1214
+ #
1215
+ attr_reader :list_memberships
1216
+ ##
1217
+ # RPC-specific configuration for `list_features`
1218
+ # @return [::Gapic::Config::Method]
1219
+ #
1220
+ attr_reader :list_features
1221
+ ##
1222
+ # RPC-specific configuration for `get_membership`
1223
+ # @return [::Gapic::Config::Method]
1224
+ #
1225
+ attr_reader :get_membership
1226
+ ##
1227
+ # RPC-specific configuration for `get_feature`
1228
+ # @return [::Gapic::Config::Method]
1229
+ #
1230
+ attr_reader :get_feature
1231
+ ##
1232
+ # RPC-specific configuration for `create_membership`
1233
+ # @return [::Gapic::Config::Method]
1234
+ #
1235
+ attr_reader :create_membership
1236
+ ##
1237
+ # RPC-specific configuration for `create_feature`
1238
+ # @return [::Gapic::Config::Method]
1239
+ #
1240
+ attr_reader :create_feature
1241
+ ##
1242
+ # RPC-specific configuration for `delete_membership`
1243
+ # @return [::Gapic::Config::Method]
1244
+ #
1245
+ attr_reader :delete_membership
1246
+ ##
1247
+ # RPC-specific configuration for `delete_feature`
1248
+ # @return [::Gapic::Config::Method]
1249
+ #
1250
+ attr_reader :delete_feature
1251
+ ##
1252
+ # RPC-specific configuration for `update_membership`
1253
+ # @return [::Gapic::Config::Method]
1254
+ #
1255
+ attr_reader :update_membership
1256
+ ##
1257
+ # RPC-specific configuration for `update_feature`
1258
+ # @return [::Gapic::Config::Method]
1259
+ #
1260
+ attr_reader :update_feature
1261
+ ##
1262
+ # RPC-specific configuration for `generate_connect_manifest`
1263
+ # @return [::Gapic::Config::Method]
1264
+ #
1265
+ attr_reader :generate_connect_manifest
1266
+
1267
+ # @private
1268
+ def initialize parent_rpcs = nil
1269
+ list_memberships_config = parent_rpcs.list_memberships if parent_rpcs.respond_to? :list_memberships
1270
+ @list_memberships = ::Gapic::Config::Method.new list_memberships_config
1271
+ list_features_config = parent_rpcs.list_features if parent_rpcs.respond_to? :list_features
1272
+ @list_features = ::Gapic::Config::Method.new list_features_config
1273
+ get_membership_config = parent_rpcs.get_membership if parent_rpcs.respond_to? :get_membership
1274
+ @get_membership = ::Gapic::Config::Method.new get_membership_config
1275
+ get_feature_config = parent_rpcs.get_feature if parent_rpcs.respond_to? :get_feature
1276
+ @get_feature = ::Gapic::Config::Method.new get_feature_config
1277
+ create_membership_config = parent_rpcs.create_membership if parent_rpcs.respond_to? :create_membership
1278
+ @create_membership = ::Gapic::Config::Method.new create_membership_config
1279
+ create_feature_config = parent_rpcs.create_feature if parent_rpcs.respond_to? :create_feature
1280
+ @create_feature = ::Gapic::Config::Method.new create_feature_config
1281
+ delete_membership_config = parent_rpcs.delete_membership if parent_rpcs.respond_to? :delete_membership
1282
+ @delete_membership = ::Gapic::Config::Method.new delete_membership_config
1283
+ delete_feature_config = parent_rpcs.delete_feature if parent_rpcs.respond_to? :delete_feature
1284
+ @delete_feature = ::Gapic::Config::Method.new delete_feature_config
1285
+ update_membership_config = parent_rpcs.update_membership if parent_rpcs.respond_to? :update_membership
1286
+ @update_membership = ::Gapic::Config::Method.new update_membership_config
1287
+ update_feature_config = parent_rpcs.update_feature if parent_rpcs.respond_to? :update_feature
1288
+ @update_feature = ::Gapic::Config::Method.new update_feature_config
1289
+ generate_connect_manifest_config = parent_rpcs.generate_connect_manifest if parent_rpcs.respond_to? :generate_connect_manifest
1290
+ @generate_connect_manifest = ::Gapic::Config::Method.new generate_connect_manifest_config
1291
+
1292
+ yield self if block_given?
1293
+ end
1294
+ end
1295
+ end
1296
+ end
1297
+ end
1298
+ end
1299
+ end
1300
+ end
1301
+ end
1302
+ end