google-cloud-gke_hub-v1 0.3.0 → 0.5.0

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