google-cloud-managed_kafka-v1 1.0.1 → 1.1.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,1771 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 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/managedkafka/v1/managed_kafka_connect_pb"
21
+ require "google/cloud/managed_kafka/v1/managed_kafka_connect/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module ManagedKafka
27
+ module V1
28
+ module ManagedKafkaConnect
29
+ module Rest
30
+ ##
31
+ # REST client for the ManagedKafkaConnect service.
32
+ #
33
+ # The service that a client application uses to manage Apache Kafka Connect
34
+ # clusters and connectors.
35
+ #
36
+ class Client
37
+ # @private
38
+ API_VERSION = ""
39
+
40
+ # @private
41
+ DEFAULT_ENDPOINT_TEMPLATE = "managedkafka.$UNIVERSE_DOMAIN$"
42
+
43
+ include Paths
44
+
45
+ # @private
46
+ attr_reader :managed_kafka_connect_stub
47
+
48
+ ##
49
+ # Configure the ManagedKafkaConnect Client class.
50
+ #
51
+ # See {::Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client::Configuration}
52
+ # for a description of the configuration fields.
53
+ #
54
+ # @example
55
+ #
56
+ # # Modify the configuration for all ManagedKafkaConnect clients
57
+ # ::Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client.configure do |config|
58
+ # config.timeout = 10.0
59
+ # end
60
+ #
61
+ # @yield [config] Configure the Client client.
62
+ # @yieldparam config [Client::Configuration]
63
+ #
64
+ # @return [Client::Configuration]
65
+ #
66
+ def self.configure
67
+ @configure ||= begin
68
+ namespace = ["Google", "Cloud", "ManagedKafka", "V1"]
69
+ parent_config = while namespace.any?
70
+ parent_name = namespace.join "::"
71
+ parent_const = const_get parent_name
72
+ break parent_const.configure if parent_const.respond_to? :configure
73
+ namespace.pop
74
+ end
75
+ default_config = Client::Configuration.new parent_config
76
+
77
+ default_config.rpcs.list_connect_clusters.timeout = 60.0
78
+ default_config.rpcs.list_connect_clusters.retry_policy = {
79
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
80
+ }
81
+
82
+ default_config.rpcs.get_connect_cluster.timeout = 60.0
83
+ default_config.rpcs.get_connect_cluster.retry_policy = {
84
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
85
+ }
86
+
87
+ default_config.rpcs.create_connect_cluster.timeout = 60.0
88
+
89
+ default_config.rpcs.update_connect_cluster.timeout = 60.0
90
+
91
+ default_config.rpcs.delete_connect_cluster.timeout = 60.0
92
+
93
+ default_config.rpcs.list_connectors.timeout = 60.0
94
+ default_config.rpcs.list_connectors.retry_policy = {
95
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
96
+ }
97
+
98
+ default_config.rpcs.get_connector.timeout = 60.0
99
+ default_config.rpcs.get_connector.retry_policy = {
100
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
101
+ }
102
+
103
+ default_config.rpcs.create_connector.timeout = 60.0
104
+
105
+ default_config.rpcs.update_connector.timeout = 60.0
106
+
107
+ default_config.rpcs.delete_connector.timeout = 60.0
108
+
109
+ default_config.rpcs.pause_connector.timeout = 60.0
110
+
111
+ default_config.rpcs.resume_connector.timeout = 60.0
112
+
113
+ default_config.rpcs.restart_connector.timeout = 60.0
114
+
115
+ default_config.rpcs.stop_connector.timeout = 60.0
116
+
117
+ default_config
118
+ end
119
+ yield @configure if block_given?
120
+ @configure
121
+ end
122
+
123
+ ##
124
+ # Configure the ManagedKafkaConnect Client instance.
125
+ #
126
+ # The configuration is set to the derived mode, meaning that values can be changed,
127
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
128
+ # should be made on {Client.configure}.
129
+ #
130
+ # See {::Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client::Configuration}
131
+ # for a description of the configuration fields.
132
+ #
133
+ # @yield [config] Configure the Client client.
134
+ # @yieldparam config [Client::Configuration]
135
+ #
136
+ # @return [Client::Configuration]
137
+ #
138
+ def configure
139
+ yield @config if block_given?
140
+ @config
141
+ end
142
+
143
+ ##
144
+ # The effective universe domain
145
+ #
146
+ # @return [String]
147
+ #
148
+ def universe_domain
149
+ @managed_kafka_connect_stub.universe_domain
150
+ end
151
+
152
+ ##
153
+ # Create a new ManagedKafkaConnect REST client object.
154
+ #
155
+ # @example
156
+ #
157
+ # # Create a client using the default configuration
158
+ # client = ::Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client.new
159
+ #
160
+ # # Create a client using a custom configuration
161
+ # client = ::Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client.new do |config|
162
+ # config.timeout = 10.0
163
+ # end
164
+ #
165
+ # @yield [config] Configure the ManagedKafkaConnect client.
166
+ # @yieldparam config [Client::Configuration]
167
+ #
168
+ def initialize
169
+ # Create the configuration object
170
+ @config = Configuration.new Client.configure
171
+
172
+ # Yield the configuration if needed
173
+ yield @config if block_given?
174
+
175
+ # Create credentials
176
+ credentials = @config.credentials
177
+ # Use self-signed JWT if the endpoint is unchanged from default,
178
+ # but only if the default endpoint does not have a region prefix.
179
+ enable_self_signed_jwt = @config.endpoint.nil? ||
180
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
181
+ !@config.endpoint.split(".").first.include?("-"))
182
+ credentials ||= Credentials.default scope: @config.scope,
183
+ enable_self_signed_jwt: enable_self_signed_jwt
184
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
185
+ credentials = Credentials.new credentials, scope: @config.scope
186
+ end
187
+
188
+ @quota_project_id = @config.quota_project
189
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
190
+
191
+ @operations_client = ::Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Operations.new do |config|
192
+ config.credentials = credentials
193
+ config.quota_project = @quota_project_id
194
+ config.endpoint = @config.endpoint
195
+ config.universe_domain = @config.universe_domain
196
+ end
197
+
198
+ @managed_kafka_connect_stub = ::Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::ServiceStub.new(
199
+ endpoint: @config.endpoint,
200
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
201
+ universe_domain: @config.universe_domain,
202
+ credentials: credentials,
203
+ logger: @config.logger
204
+ )
205
+
206
+ @managed_kafka_connect_stub.logger(stub: true)&.info do |entry|
207
+ entry.set_system_name
208
+ entry.set_service
209
+ entry.message = "Created client for #{entry.service}"
210
+ entry.set_credentials_fields credentials
211
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
212
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
213
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
214
+ end
215
+
216
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
217
+ config.credentials = credentials
218
+ config.quota_project = @quota_project_id
219
+ config.endpoint = @managed_kafka_connect_stub.endpoint
220
+ config.universe_domain = @managed_kafka_connect_stub.universe_domain
221
+ config.bindings_override = @config.bindings_override
222
+ config.logger = @managed_kafka_connect_stub.logger if config.respond_to? :logger=
223
+ end
224
+ end
225
+
226
+ ##
227
+ # Get the associated client for long-running operations.
228
+ #
229
+ # @return [::Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Operations]
230
+ #
231
+ attr_reader :operations_client
232
+
233
+ ##
234
+ # Get the associated client for mix-in of the Locations.
235
+ #
236
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
237
+ #
238
+ attr_reader :location_client
239
+
240
+ ##
241
+ # The logger used for request/response debug logging.
242
+ #
243
+ # @return [Logger]
244
+ #
245
+ def logger
246
+ @managed_kafka_connect_stub.logger
247
+ end
248
+
249
+ # Service calls
250
+
251
+ ##
252
+ # Lists the Kafka Connect clusters in a given project and location.
253
+ #
254
+ # @overload list_connect_clusters(request, options = nil)
255
+ # Pass arguments to `list_connect_clusters` via a request object, either of type
256
+ # {::Google::Cloud::ManagedKafka::V1::ListConnectClustersRequest} or an equivalent Hash.
257
+ #
258
+ # @param request [::Google::Cloud::ManagedKafka::V1::ListConnectClustersRequest, ::Hash]
259
+ # A request object representing the call parameters. Required. To specify no
260
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
261
+ # @param options [::Gapic::CallOptions, ::Hash]
262
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
263
+ #
264
+ # @overload list_connect_clusters(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
265
+ # Pass arguments to `list_connect_clusters` via keyword arguments. Note that at
266
+ # least one keyword argument is required. To specify no parameters, or to keep all
267
+ # the default parameter values, pass an empty Hash as a request object (see above).
268
+ #
269
+ # @param parent [::String]
270
+ # Required. The parent project/location whose Connect clusters are to be
271
+ # listed. Structured like `projects/{project}/locations/{location}`.
272
+ # @param page_size [::Integer]
273
+ # Optional. The maximum number of Connect clusters to return. The service may
274
+ # return fewer than this value. If unspecified, server will pick an
275
+ # appropriate default.
276
+ # @param page_token [::String]
277
+ # Optional. A page token, received from a previous `ListConnectClusters`
278
+ # call. Provide this to retrieve the subsequent page.
279
+ #
280
+ # When paginating, all other parameters provided to `ListConnectClusters`
281
+ # must match the call that provided the page token.
282
+ # @param filter [::String]
283
+ # Optional. Filter expression for the result.
284
+ # @param order_by [::String]
285
+ # Optional. Order by fields for the result.
286
+ # @yield [result, operation] Access the result along with the TransportOperation object
287
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ManagedKafka::V1::ConnectCluster>]
288
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
289
+ #
290
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ManagedKafka::V1::ConnectCluster>]
291
+ #
292
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
293
+ #
294
+ # @example Basic example
295
+ # require "google/cloud/managed_kafka/v1"
296
+ #
297
+ # # Create a client object. The client can be reused for multiple calls.
298
+ # client = Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client.new
299
+ #
300
+ # # Create a request. To set request fields, pass in keyword arguments.
301
+ # request = Google::Cloud::ManagedKafka::V1::ListConnectClustersRequest.new
302
+ #
303
+ # # Call the list_connect_clusters method.
304
+ # result = client.list_connect_clusters request
305
+ #
306
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
307
+ # # over elements, and API calls will be issued to fetch pages as needed.
308
+ # result.each do |item|
309
+ # # Each element is of type ::Google::Cloud::ManagedKafka::V1::ConnectCluster.
310
+ # p item
311
+ # end
312
+ #
313
+ def list_connect_clusters request, options = nil
314
+ raise ::ArgumentError, "request must be provided" if request.nil?
315
+
316
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ManagedKafka::V1::ListConnectClustersRequest
317
+
318
+ # Converts hash and nil to an options object
319
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
320
+
321
+ # Customize the options with defaults
322
+ call_metadata = @config.rpcs.list_connect_clusters.metadata.to_h
323
+
324
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
325
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
326
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
327
+ gapic_version: ::Google::Cloud::ManagedKafka::V1::VERSION,
328
+ transports_version_send: [:rest]
329
+
330
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
331
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
332
+
333
+ options.apply_defaults timeout: @config.rpcs.list_connect_clusters.timeout,
334
+ metadata: call_metadata,
335
+ retry_policy: @config.rpcs.list_connect_clusters.retry_policy
336
+
337
+ options.apply_defaults timeout: @config.timeout,
338
+ metadata: @config.metadata,
339
+ retry_policy: @config.retry_policy
340
+
341
+ @managed_kafka_connect_stub.list_connect_clusters request, options do |result, operation|
342
+ result = ::Gapic::Rest::PagedEnumerable.new @managed_kafka_connect_stub, :list_connect_clusters, "connect_clusters", request, result, options
343
+ yield result, operation if block_given?
344
+ throw :response, result
345
+ end
346
+ rescue ::Gapic::Rest::Error => e
347
+ raise ::Google::Cloud::Error.from_error(e)
348
+ end
349
+
350
+ ##
351
+ # Returns the properties of a single Kafka Connect cluster.
352
+ #
353
+ # @overload get_connect_cluster(request, options = nil)
354
+ # Pass arguments to `get_connect_cluster` via a request object, either of type
355
+ # {::Google::Cloud::ManagedKafka::V1::GetConnectClusterRequest} or an equivalent Hash.
356
+ #
357
+ # @param request [::Google::Cloud::ManagedKafka::V1::GetConnectClusterRequest, ::Hash]
358
+ # A request object representing the call parameters. Required. To specify no
359
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
360
+ # @param options [::Gapic::CallOptions, ::Hash]
361
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
362
+ #
363
+ # @overload get_connect_cluster(name: nil)
364
+ # Pass arguments to `get_connect_cluster` via keyword arguments. Note that at
365
+ # least one keyword argument is required. To specify no parameters, or to keep all
366
+ # the default parameter values, pass an empty Hash as a request object (see above).
367
+ #
368
+ # @param name [::String]
369
+ # Required. The name of the Kafka Connect cluster whose configuration to
370
+ # return. Structured like
371
+ # `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`.
372
+ # @yield [result, operation] Access the result along with the TransportOperation object
373
+ # @yieldparam result [::Google::Cloud::ManagedKafka::V1::ConnectCluster]
374
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
375
+ #
376
+ # @return [::Google::Cloud::ManagedKafka::V1::ConnectCluster]
377
+ #
378
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
379
+ #
380
+ # @example Basic example
381
+ # require "google/cloud/managed_kafka/v1"
382
+ #
383
+ # # Create a client object. The client can be reused for multiple calls.
384
+ # client = Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client.new
385
+ #
386
+ # # Create a request. To set request fields, pass in keyword arguments.
387
+ # request = Google::Cloud::ManagedKafka::V1::GetConnectClusterRequest.new
388
+ #
389
+ # # Call the get_connect_cluster method.
390
+ # result = client.get_connect_cluster request
391
+ #
392
+ # # The returned object is of type Google::Cloud::ManagedKafka::V1::ConnectCluster.
393
+ # p result
394
+ #
395
+ def get_connect_cluster request, options = nil
396
+ raise ::ArgumentError, "request must be provided" if request.nil?
397
+
398
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ManagedKafka::V1::GetConnectClusterRequest
399
+
400
+ # Converts hash and nil to an options object
401
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
402
+
403
+ # Customize the options with defaults
404
+ call_metadata = @config.rpcs.get_connect_cluster.metadata.to_h
405
+
406
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
407
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
408
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
409
+ gapic_version: ::Google::Cloud::ManagedKafka::V1::VERSION,
410
+ transports_version_send: [:rest]
411
+
412
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
413
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
414
+
415
+ options.apply_defaults timeout: @config.rpcs.get_connect_cluster.timeout,
416
+ metadata: call_metadata,
417
+ retry_policy: @config.rpcs.get_connect_cluster.retry_policy
418
+
419
+ options.apply_defaults timeout: @config.timeout,
420
+ metadata: @config.metadata,
421
+ retry_policy: @config.retry_policy
422
+
423
+ @managed_kafka_connect_stub.get_connect_cluster request, options do |result, operation|
424
+ yield result, operation if block_given?
425
+ end
426
+ rescue ::Gapic::Rest::Error => e
427
+ raise ::Google::Cloud::Error.from_error(e)
428
+ end
429
+
430
+ ##
431
+ # Creates a new Kafka Connect cluster in a given project and location.
432
+ #
433
+ # @overload create_connect_cluster(request, options = nil)
434
+ # Pass arguments to `create_connect_cluster` via a request object, either of type
435
+ # {::Google::Cloud::ManagedKafka::V1::CreateConnectClusterRequest} or an equivalent Hash.
436
+ #
437
+ # @param request [::Google::Cloud::ManagedKafka::V1::CreateConnectClusterRequest, ::Hash]
438
+ # A request object representing the call parameters. Required. To specify no
439
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
440
+ # @param options [::Gapic::CallOptions, ::Hash]
441
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
442
+ #
443
+ # @overload create_connect_cluster(parent: nil, connect_cluster_id: nil, connect_cluster: nil, request_id: nil)
444
+ # Pass arguments to `create_connect_cluster` via keyword arguments. Note that at
445
+ # least one keyword argument is required. To specify no parameters, or to keep all
446
+ # the default parameter values, pass an empty Hash as a request object (see above).
447
+ #
448
+ # @param parent [::String]
449
+ # Required. The parent project/location in which to create the Kafka Connect
450
+ # cluster. Structured like
451
+ # `projects/{project}/locations/{location}/`.
452
+ # @param connect_cluster_id [::String]
453
+ # Required. The ID to use for the Connect cluster, which will become the
454
+ # final component of the cluster's name. The ID must be 1-63 characters long,
455
+ # and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` to comply
456
+ # with RFC 1035.
457
+ #
458
+ # This value is structured like: `my-cluster-id`.
459
+ # @param connect_cluster [::Google::Cloud::ManagedKafka::V1::ConnectCluster, ::Hash]
460
+ # Required. Configuration of the Kafka Connect cluster to create. Its `name`
461
+ # field is ignored.
462
+ # @param request_id [::String]
463
+ # Optional. An optional request ID to identify requests. Specify a unique
464
+ # request ID to avoid duplication of requests. If a request times out or
465
+ # fails, retrying with the same ID allows the server to recognize the
466
+ # previous attempt. For at least 60 minutes, the server ignores duplicate
467
+ # requests bearing the same ID.
468
+ #
469
+ # For example, consider a situation where you make an initial request and the
470
+ # request times out. If you make the request again with the same request ID
471
+ # within 60 minutes of the last request, the server checks if an original
472
+ # operation with the same request ID was received. If so, the server ignores
473
+ # the second request.
474
+ #
475
+ # The request ID must be a valid UUID. A zero UUID is not supported
476
+ # (00000000-0000-0000-0000-000000000000).
477
+ # @yield [result, operation] Access the result along with the TransportOperation object
478
+ # @yieldparam result [::Gapic::Operation]
479
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
480
+ #
481
+ # @return [::Gapic::Operation]
482
+ #
483
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
484
+ #
485
+ # @example Basic example
486
+ # require "google/cloud/managed_kafka/v1"
487
+ #
488
+ # # Create a client object. The client can be reused for multiple calls.
489
+ # client = Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client.new
490
+ #
491
+ # # Create a request. To set request fields, pass in keyword arguments.
492
+ # request = Google::Cloud::ManagedKafka::V1::CreateConnectClusterRequest.new
493
+ #
494
+ # # Call the create_connect_cluster method.
495
+ # result = client.create_connect_cluster request
496
+ #
497
+ # # The returned object is of type Gapic::Operation. You can use it to
498
+ # # check the status of an operation, cancel it, or wait for results.
499
+ # # Here is how to wait for a response.
500
+ # result.wait_until_done! timeout: 60
501
+ # if result.response?
502
+ # p result.response
503
+ # else
504
+ # puts "No response received."
505
+ # end
506
+ #
507
+ def create_connect_cluster request, options = nil
508
+ raise ::ArgumentError, "request must be provided" if request.nil?
509
+
510
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ManagedKafka::V1::CreateConnectClusterRequest
511
+
512
+ # Converts hash and nil to an options object
513
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
514
+
515
+ # Customize the options with defaults
516
+ call_metadata = @config.rpcs.create_connect_cluster.metadata.to_h
517
+
518
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
519
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
520
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
521
+ gapic_version: ::Google::Cloud::ManagedKafka::V1::VERSION,
522
+ transports_version_send: [:rest]
523
+
524
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
525
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
526
+
527
+ options.apply_defaults timeout: @config.rpcs.create_connect_cluster.timeout,
528
+ metadata: call_metadata,
529
+ retry_policy: @config.rpcs.create_connect_cluster.retry_policy
530
+
531
+ options.apply_defaults timeout: @config.timeout,
532
+ metadata: @config.metadata,
533
+ retry_policy: @config.retry_policy
534
+
535
+ @managed_kafka_connect_stub.create_connect_cluster request, options do |result, operation|
536
+ result = ::Gapic::Operation.new result, @operations_client, options: options
537
+ yield result, operation if block_given?
538
+ throw :response, result
539
+ end
540
+ rescue ::Gapic::Rest::Error => e
541
+ raise ::Google::Cloud::Error.from_error(e)
542
+ end
543
+
544
+ ##
545
+ # Updates the properties of a single Kafka Connect cluster.
546
+ #
547
+ # @overload update_connect_cluster(request, options = nil)
548
+ # Pass arguments to `update_connect_cluster` via a request object, either of type
549
+ # {::Google::Cloud::ManagedKafka::V1::UpdateConnectClusterRequest} or an equivalent Hash.
550
+ #
551
+ # @param request [::Google::Cloud::ManagedKafka::V1::UpdateConnectClusterRequest, ::Hash]
552
+ # A request object representing the call parameters. Required. To specify no
553
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
554
+ # @param options [::Gapic::CallOptions, ::Hash]
555
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
556
+ #
557
+ # @overload update_connect_cluster(update_mask: nil, connect_cluster: nil, request_id: nil)
558
+ # Pass arguments to `update_connect_cluster` via keyword arguments. Note that at
559
+ # least one keyword argument is required. To specify no parameters, or to keep all
560
+ # the default parameter values, pass an empty Hash as a request object (see above).
561
+ #
562
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
563
+ # Required. Field mask is used to specify the fields to be overwritten in the
564
+ # cluster resource by the update. The fields specified in the update_mask are
565
+ # relative to the resource, not the full request. A field will be overwritten
566
+ # if it is in the mask. The mask is required and a value of * will update all
567
+ # fields.
568
+ # @param connect_cluster [::Google::Cloud::ManagedKafka::V1::ConnectCluster, ::Hash]
569
+ # Required. The Kafka Connect cluster to update. Its `name` field must be
570
+ # populated.
571
+ # @param request_id [::String]
572
+ # Optional. An optional request ID to identify requests. Specify a unique
573
+ # request ID to avoid duplication of requests. If a request times out or
574
+ # fails, retrying with the same ID allows the server to recognize the
575
+ # previous attempt. For at least 60 minutes, the server ignores duplicate
576
+ # requests bearing the same ID.
577
+ #
578
+ # For example, consider a situation where you make an initial request and the
579
+ # request times out. If you make the request again with the same request ID
580
+ # within 60 minutes of the last request, the server checks if an original
581
+ # operation with the same request ID was received. If so, the server ignores
582
+ # the second request.
583
+ #
584
+ # The request ID must be a valid UUID. A zero UUID is not supported
585
+ # (00000000-0000-0000-0000-000000000000).
586
+ # @yield [result, operation] Access the result along with the TransportOperation object
587
+ # @yieldparam result [::Gapic::Operation]
588
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
589
+ #
590
+ # @return [::Gapic::Operation]
591
+ #
592
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
593
+ #
594
+ # @example Basic example
595
+ # require "google/cloud/managed_kafka/v1"
596
+ #
597
+ # # Create a client object. The client can be reused for multiple calls.
598
+ # client = Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client.new
599
+ #
600
+ # # Create a request. To set request fields, pass in keyword arguments.
601
+ # request = Google::Cloud::ManagedKafka::V1::UpdateConnectClusterRequest.new
602
+ #
603
+ # # Call the update_connect_cluster method.
604
+ # result = client.update_connect_cluster request
605
+ #
606
+ # # The returned object is of type Gapic::Operation. You can use it to
607
+ # # check the status of an operation, cancel it, or wait for results.
608
+ # # Here is how to wait for a response.
609
+ # result.wait_until_done! timeout: 60
610
+ # if result.response?
611
+ # p result.response
612
+ # else
613
+ # puts "No response received."
614
+ # end
615
+ #
616
+ def update_connect_cluster request, options = nil
617
+ raise ::ArgumentError, "request must be provided" if request.nil?
618
+
619
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ManagedKafka::V1::UpdateConnectClusterRequest
620
+
621
+ # Converts hash and nil to an options object
622
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
623
+
624
+ # Customize the options with defaults
625
+ call_metadata = @config.rpcs.update_connect_cluster.metadata.to_h
626
+
627
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
628
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
629
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
630
+ gapic_version: ::Google::Cloud::ManagedKafka::V1::VERSION,
631
+ transports_version_send: [:rest]
632
+
633
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
634
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
635
+
636
+ options.apply_defaults timeout: @config.rpcs.update_connect_cluster.timeout,
637
+ metadata: call_metadata,
638
+ retry_policy: @config.rpcs.update_connect_cluster.retry_policy
639
+
640
+ options.apply_defaults timeout: @config.timeout,
641
+ metadata: @config.metadata,
642
+ retry_policy: @config.retry_policy
643
+
644
+ @managed_kafka_connect_stub.update_connect_cluster request, options do |result, operation|
645
+ result = ::Gapic::Operation.new result, @operations_client, options: options
646
+ yield result, operation if block_given?
647
+ throw :response, result
648
+ end
649
+ rescue ::Gapic::Rest::Error => e
650
+ raise ::Google::Cloud::Error.from_error(e)
651
+ end
652
+
653
+ ##
654
+ # Deletes a single Connect cluster.
655
+ #
656
+ # @overload delete_connect_cluster(request, options = nil)
657
+ # Pass arguments to `delete_connect_cluster` via a request object, either of type
658
+ # {::Google::Cloud::ManagedKafka::V1::DeleteConnectClusterRequest} or an equivalent Hash.
659
+ #
660
+ # @param request [::Google::Cloud::ManagedKafka::V1::DeleteConnectClusterRequest, ::Hash]
661
+ # A request object representing the call parameters. Required. To specify no
662
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
663
+ # @param options [::Gapic::CallOptions, ::Hash]
664
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
665
+ #
666
+ # @overload delete_connect_cluster(name: nil, request_id: nil)
667
+ # Pass arguments to `delete_connect_cluster` via keyword arguments. Note that at
668
+ # least one keyword argument is required. To specify no parameters, or to keep all
669
+ # the default parameter values, pass an empty Hash as a request object (see above).
670
+ #
671
+ # @param name [::String]
672
+ # Required. The name of the Kafka Connect cluster to delete.
673
+ # Structured like
674
+ # `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`.
675
+ # @param request_id [::String]
676
+ # Optional. An optional request ID to identify requests. Specify a unique
677
+ # request ID to avoid duplication of requests. If a request times out or
678
+ # fails, retrying with the same ID allows the server to recognize the
679
+ # previous attempt. For at least 60 minutes, the server ignores duplicate
680
+ # requests bearing the same ID.
681
+ #
682
+ # For example, consider a situation where you make an initial request and the
683
+ # request times out. If you make the request again with the same request ID
684
+ # within 60 minutes of the last request, the server checks if an original
685
+ # operation with the same request ID was received. If so, the server ignores
686
+ # the second request.
687
+ #
688
+ # The request ID must be a valid UUID. A zero UUID is not supported
689
+ # (00000000-0000-0000-0000-000000000000).
690
+ # @yield [result, operation] Access the result along with the TransportOperation object
691
+ # @yieldparam result [::Gapic::Operation]
692
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
693
+ #
694
+ # @return [::Gapic::Operation]
695
+ #
696
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
697
+ #
698
+ # @example Basic example
699
+ # require "google/cloud/managed_kafka/v1"
700
+ #
701
+ # # Create a client object. The client can be reused for multiple calls.
702
+ # client = Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client.new
703
+ #
704
+ # # Create a request. To set request fields, pass in keyword arguments.
705
+ # request = Google::Cloud::ManagedKafka::V1::DeleteConnectClusterRequest.new
706
+ #
707
+ # # Call the delete_connect_cluster method.
708
+ # result = client.delete_connect_cluster request
709
+ #
710
+ # # The returned object is of type Gapic::Operation. You can use it to
711
+ # # check the status of an operation, cancel it, or wait for results.
712
+ # # Here is how to wait for a response.
713
+ # result.wait_until_done! timeout: 60
714
+ # if result.response?
715
+ # p result.response
716
+ # else
717
+ # puts "No response received."
718
+ # end
719
+ #
720
+ def delete_connect_cluster request, options = nil
721
+ raise ::ArgumentError, "request must be provided" if request.nil?
722
+
723
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ManagedKafka::V1::DeleteConnectClusterRequest
724
+
725
+ # Converts hash and nil to an options object
726
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
727
+
728
+ # Customize the options with defaults
729
+ call_metadata = @config.rpcs.delete_connect_cluster.metadata.to_h
730
+
731
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
732
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
733
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
734
+ gapic_version: ::Google::Cloud::ManagedKafka::V1::VERSION,
735
+ transports_version_send: [:rest]
736
+
737
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
738
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
739
+
740
+ options.apply_defaults timeout: @config.rpcs.delete_connect_cluster.timeout,
741
+ metadata: call_metadata,
742
+ retry_policy: @config.rpcs.delete_connect_cluster.retry_policy
743
+
744
+ options.apply_defaults timeout: @config.timeout,
745
+ metadata: @config.metadata,
746
+ retry_policy: @config.retry_policy
747
+
748
+ @managed_kafka_connect_stub.delete_connect_cluster request, options do |result, operation|
749
+ result = ::Gapic::Operation.new result, @operations_client, options: options
750
+ yield result, operation if block_given?
751
+ throw :response, result
752
+ end
753
+ rescue ::Gapic::Rest::Error => e
754
+ raise ::Google::Cloud::Error.from_error(e)
755
+ end
756
+
757
+ ##
758
+ # Lists the connectors in a given Connect cluster.
759
+ #
760
+ # @overload list_connectors(request, options = nil)
761
+ # Pass arguments to `list_connectors` via a request object, either of type
762
+ # {::Google::Cloud::ManagedKafka::V1::ListConnectorsRequest} or an equivalent Hash.
763
+ #
764
+ # @param request [::Google::Cloud::ManagedKafka::V1::ListConnectorsRequest, ::Hash]
765
+ # A request object representing the call parameters. Required. To specify no
766
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
767
+ # @param options [::Gapic::CallOptions, ::Hash]
768
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
769
+ #
770
+ # @overload list_connectors(parent: nil, page_size: nil, page_token: nil)
771
+ # Pass arguments to `list_connectors` via keyword arguments. Note that at
772
+ # least one keyword argument is required. To specify no parameters, or to keep all
773
+ # the default parameter values, pass an empty Hash as a request object (see above).
774
+ #
775
+ # @param parent [::String]
776
+ # Required. The parent Connect cluster whose connectors are to be listed.
777
+ # Structured like
778
+ # `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`.
779
+ # @param page_size [::Integer]
780
+ # Optional. The maximum number of connectors to return. The service may
781
+ # return fewer than this value. If unspecified, server will pick an
782
+ # appropriate default.
783
+ # @param page_token [::String]
784
+ # Optional. A page token, received from a previous `ListConnectors` call.
785
+ # Provide this to retrieve the subsequent page.
786
+ #
787
+ # When paginating, all other parameters provided to `ListConnectors`
788
+ # must match the call that provided the page token.
789
+ # @yield [result, operation] Access the result along with the TransportOperation object
790
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ManagedKafka::V1::Connector>]
791
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
792
+ #
793
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ManagedKafka::V1::Connector>]
794
+ #
795
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
796
+ #
797
+ # @example Basic example
798
+ # require "google/cloud/managed_kafka/v1"
799
+ #
800
+ # # Create a client object. The client can be reused for multiple calls.
801
+ # client = Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client.new
802
+ #
803
+ # # Create a request. To set request fields, pass in keyword arguments.
804
+ # request = Google::Cloud::ManagedKafka::V1::ListConnectorsRequest.new
805
+ #
806
+ # # Call the list_connectors method.
807
+ # result = client.list_connectors request
808
+ #
809
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
810
+ # # over elements, and API calls will be issued to fetch pages as needed.
811
+ # result.each do |item|
812
+ # # Each element is of type ::Google::Cloud::ManagedKafka::V1::Connector.
813
+ # p item
814
+ # end
815
+ #
816
+ def list_connectors request, options = nil
817
+ raise ::ArgumentError, "request must be provided" if request.nil?
818
+
819
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ManagedKafka::V1::ListConnectorsRequest
820
+
821
+ # Converts hash and nil to an options object
822
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
823
+
824
+ # Customize the options with defaults
825
+ call_metadata = @config.rpcs.list_connectors.metadata.to_h
826
+
827
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
828
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
829
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
830
+ gapic_version: ::Google::Cloud::ManagedKafka::V1::VERSION,
831
+ transports_version_send: [:rest]
832
+
833
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
834
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
835
+
836
+ options.apply_defaults timeout: @config.rpcs.list_connectors.timeout,
837
+ metadata: call_metadata,
838
+ retry_policy: @config.rpcs.list_connectors.retry_policy
839
+
840
+ options.apply_defaults timeout: @config.timeout,
841
+ metadata: @config.metadata,
842
+ retry_policy: @config.retry_policy
843
+
844
+ @managed_kafka_connect_stub.list_connectors request, options do |result, operation|
845
+ result = ::Gapic::Rest::PagedEnumerable.new @managed_kafka_connect_stub, :list_connectors, "connectors", request, result, options
846
+ yield result, operation if block_given?
847
+ throw :response, result
848
+ end
849
+ rescue ::Gapic::Rest::Error => e
850
+ raise ::Google::Cloud::Error.from_error(e)
851
+ end
852
+
853
+ ##
854
+ # Returns the properties of a single connector.
855
+ #
856
+ # @overload get_connector(request, options = nil)
857
+ # Pass arguments to `get_connector` via a request object, either of type
858
+ # {::Google::Cloud::ManagedKafka::V1::GetConnectorRequest} or an equivalent Hash.
859
+ #
860
+ # @param request [::Google::Cloud::ManagedKafka::V1::GetConnectorRequest, ::Hash]
861
+ # A request object representing the call parameters. Required. To specify no
862
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
863
+ # @param options [::Gapic::CallOptions, ::Hash]
864
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
865
+ #
866
+ # @overload get_connector(name: nil)
867
+ # Pass arguments to `get_connector` via keyword arguments. Note that at
868
+ # least one keyword argument is required. To specify no parameters, or to keep all
869
+ # the default parameter values, pass an empty Hash as a request object (see above).
870
+ #
871
+ # @param name [::String]
872
+ # Required. The name of the connector whose configuration to return.
873
+ # Structured like:
874
+ # projects/\\{project}/locations/\\{location}/connectClusters/\\{connectCluster}/connectors/\\{connector}
875
+ # @yield [result, operation] Access the result along with the TransportOperation object
876
+ # @yieldparam result [::Google::Cloud::ManagedKafka::V1::Connector]
877
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
878
+ #
879
+ # @return [::Google::Cloud::ManagedKafka::V1::Connector]
880
+ #
881
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
882
+ #
883
+ # @example Basic example
884
+ # require "google/cloud/managed_kafka/v1"
885
+ #
886
+ # # Create a client object. The client can be reused for multiple calls.
887
+ # client = Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client.new
888
+ #
889
+ # # Create a request. To set request fields, pass in keyword arguments.
890
+ # request = Google::Cloud::ManagedKafka::V1::GetConnectorRequest.new
891
+ #
892
+ # # Call the get_connector method.
893
+ # result = client.get_connector request
894
+ #
895
+ # # The returned object is of type Google::Cloud::ManagedKafka::V1::Connector.
896
+ # p result
897
+ #
898
+ def get_connector request, options = nil
899
+ raise ::ArgumentError, "request must be provided" if request.nil?
900
+
901
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ManagedKafka::V1::GetConnectorRequest
902
+
903
+ # Converts hash and nil to an options object
904
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
905
+
906
+ # Customize the options with defaults
907
+ call_metadata = @config.rpcs.get_connector.metadata.to_h
908
+
909
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
910
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
911
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
912
+ gapic_version: ::Google::Cloud::ManagedKafka::V1::VERSION,
913
+ transports_version_send: [:rest]
914
+
915
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
916
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
917
+
918
+ options.apply_defaults timeout: @config.rpcs.get_connector.timeout,
919
+ metadata: call_metadata,
920
+ retry_policy: @config.rpcs.get_connector.retry_policy
921
+
922
+ options.apply_defaults timeout: @config.timeout,
923
+ metadata: @config.metadata,
924
+ retry_policy: @config.retry_policy
925
+
926
+ @managed_kafka_connect_stub.get_connector request, options do |result, operation|
927
+ yield result, operation if block_given?
928
+ end
929
+ rescue ::Gapic::Rest::Error => e
930
+ raise ::Google::Cloud::Error.from_error(e)
931
+ end
932
+
933
+ ##
934
+ # Creates a new connector in a given Connect cluster.
935
+ #
936
+ # @overload create_connector(request, options = nil)
937
+ # Pass arguments to `create_connector` via a request object, either of type
938
+ # {::Google::Cloud::ManagedKafka::V1::CreateConnectorRequest} or an equivalent Hash.
939
+ #
940
+ # @param request [::Google::Cloud::ManagedKafka::V1::CreateConnectorRequest, ::Hash]
941
+ # A request object representing the call parameters. Required. To specify no
942
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
943
+ # @param options [::Gapic::CallOptions, ::Hash]
944
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
945
+ #
946
+ # @overload create_connector(parent: nil, connector_id: nil, connector: nil)
947
+ # Pass arguments to `create_connector` via keyword arguments. Note that at
948
+ # least one keyword argument is required. To specify no parameters, or to keep all
949
+ # the default parameter values, pass an empty Hash as a request object (see above).
950
+ #
951
+ # @param parent [::String]
952
+ # Required. The parent Connect cluster in which to create the connector.
953
+ # Structured like
954
+ # `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`.
955
+ # @param connector_id [::String]
956
+ # Required. The ID to use for the connector, which will become the final
957
+ # component of the connector's name. The ID must be 1-63 characters long, and
958
+ # match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` to comply with
959
+ # RFC 1035.
960
+ #
961
+ # This value is structured like: `my-connector-id`.
962
+ # @param connector [::Google::Cloud::ManagedKafka::V1::Connector, ::Hash]
963
+ # Required. The connector to create.
964
+ # @yield [result, operation] Access the result along with the TransportOperation object
965
+ # @yieldparam result [::Google::Cloud::ManagedKafka::V1::Connector]
966
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
967
+ #
968
+ # @return [::Google::Cloud::ManagedKafka::V1::Connector]
969
+ #
970
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
971
+ #
972
+ # @example Basic example
973
+ # require "google/cloud/managed_kafka/v1"
974
+ #
975
+ # # Create a client object. The client can be reused for multiple calls.
976
+ # client = Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client.new
977
+ #
978
+ # # Create a request. To set request fields, pass in keyword arguments.
979
+ # request = Google::Cloud::ManagedKafka::V1::CreateConnectorRequest.new
980
+ #
981
+ # # Call the create_connector method.
982
+ # result = client.create_connector request
983
+ #
984
+ # # The returned object is of type Google::Cloud::ManagedKafka::V1::Connector.
985
+ # p result
986
+ #
987
+ def create_connector request, options = nil
988
+ raise ::ArgumentError, "request must be provided" if request.nil?
989
+
990
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ManagedKafka::V1::CreateConnectorRequest
991
+
992
+ # Converts hash and nil to an options object
993
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
994
+
995
+ # Customize the options with defaults
996
+ call_metadata = @config.rpcs.create_connector.metadata.to_h
997
+
998
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
999
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1000
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1001
+ gapic_version: ::Google::Cloud::ManagedKafka::V1::VERSION,
1002
+ transports_version_send: [:rest]
1003
+
1004
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1005
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1006
+
1007
+ options.apply_defaults timeout: @config.rpcs.create_connector.timeout,
1008
+ metadata: call_metadata,
1009
+ retry_policy: @config.rpcs.create_connector.retry_policy
1010
+
1011
+ options.apply_defaults timeout: @config.timeout,
1012
+ metadata: @config.metadata,
1013
+ retry_policy: @config.retry_policy
1014
+
1015
+ @managed_kafka_connect_stub.create_connector request, options do |result, operation|
1016
+ yield result, operation if block_given?
1017
+ end
1018
+ rescue ::Gapic::Rest::Error => e
1019
+ raise ::Google::Cloud::Error.from_error(e)
1020
+ end
1021
+
1022
+ ##
1023
+ # Updates the properties of a connector.
1024
+ #
1025
+ # @overload update_connector(request, options = nil)
1026
+ # Pass arguments to `update_connector` via a request object, either of type
1027
+ # {::Google::Cloud::ManagedKafka::V1::UpdateConnectorRequest} or an equivalent Hash.
1028
+ #
1029
+ # @param request [::Google::Cloud::ManagedKafka::V1::UpdateConnectorRequest, ::Hash]
1030
+ # A request object representing the call parameters. Required. To specify no
1031
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1032
+ # @param options [::Gapic::CallOptions, ::Hash]
1033
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1034
+ #
1035
+ # @overload update_connector(update_mask: nil, connector: nil)
1036
+ # Pass arguments to `update_connector` via keyword arguments. Note that at
1037
+ # least one keyword argument is required. To specify no parameters, or to keep all
1038
+ # the default parameter values, pass an empty Hash as a request object (see above).
1039
+ #
1040
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1041
+ # Required. Field mask is used to specify the fields to be overwritten in the
1042
+ # cluster resource by the update. The fields specified in the update_mask are
1043
+ # relative to the resource, not the full request. A field will be overwritten
1044
+ # if it is in the mask. The mask is required and a value of * will update all
1045
+ # fields.
1046
+ # @param connector [::Google::Cloud::ManagedKafka::V1::Connector, ::Hash]
1047
+ # Required. The connector to update. Its `name` field must be populated.
1048
+ # @yield [result, operation] Access the result along with the TransportOperation object
1049
+ # @yieldparam result [::Google::Cloud::ManagedKafka::V1::Connector]
1050
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1051
+ #
1052
+ # @return [::Google::Cloud::ManagedKafka::V1::Connector]
1053
+ #
1054
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1055
+ #
1056
+ # @example Basic example
1057
+ # require "google/cloud/managed_kafka/v1"
1058
+ #
1059
+ # # Create a client object. The client can be reused for multiple calls.
1060
+ # client = Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client.new
1061
+ #
1062
+ # # Create a request. To set request fields, pass in keyword arguments.
1063
+ # request = Google::Cloud::ManagedKafka::V1::UpdateConnectorRequest.new
1064
+ #
1065
+ # # Call the update_connector method.
1066
+ # result = client.update_connector request
1067
+ #
1068
+ # # The returned object is of type Google::Cloud::ManagedKafka::V1::Connector.
1069
+ # p result
1070
+ #
1071
+ def update_connector request, options = nil
1072
+ raise ::ArgumentError, "request must be provided" if request.nil?
1073
+
1074
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ManagedKafka::V1::UpdateConnectorRequest
1075
+
1076
+ # Converts hash and nil to an options object
1077
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1078
+
1079
+ # Customize the options with defaults
1080
+ call_metadata = @config.rpcs.update_connector.metadata.to_h
1081
+
1082
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1083
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1084
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1085
+ gapic_version: ::Google::Cloud::ManagedKafka::V1::VERSION,
1086
+ transports_version_send: [:rest]
1087
+
1088
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1089
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1090
+
1091
+ options.apply_defaults timeout: @config.rpcs.update_connector.timeout,
1092
+ metadata: call_metadata,
1093
+ retry_policy: @config.rpcs.update_connector.retry_policy
1094
+
1095
+ options.apply_defaults timeout: @config.timeout,
1096
+ metadata: @config.metadata,
1097
+ retry_policy: @config.retry_policy
1098
+
1099
+ @managed_kafka_connect_stub.update_connector request, options do |result, operation|
1100
+ yield result, operation if block_given?
1101
+ end
1102
+ rescue ::Gapic::Rest::Error => e
1103
+ raise ::Google::Cloud::Error.from_error(e)
1104
+ end
1105
+
1106
+ ##
1107
+ # Deletes a connector.
1108
+ #
1109
+ # @overload delete_connector(request, options = nil)
1110
+ # Pass arguments to `delete_connector` via a request object, either of type
1111
+ # {::Google::Cloud::ManagedKafka::V1::DeleteConnectorRequest} or an equivalent Hash.
1112
+ #
1113
+ # @param request [::Google::Cloud::ManagedKafka::V1::DeleteConnectorRequest, ::Hash]
1114
+ # A request object representing the call parameters. Required. To specify no
1115
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1116
+ # @param options [::Gapic::CallOptions, ::Hash]
1117
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1118
+ #
1119
+ # @overload delete_connector(name: nil)
1120
+ # Pass arguments to `delete_connector` via keyword arguments. Note that at
1121
+ # least one keyword argument is required. To specify no parameters, or to keep all
1122
+ # the default parameter values, pass an empty Hash as a request object (see above).
1123
+ #
1124
+ # @param name [::String]
1125
+ # Required. The name of the connector to delete.
1126
+ # Structured like:
1127
+ # projects/\\{project}/locations/\\{location}/connectClusters/\\{connectCluster}/connectors/\\{connector}
1128
+ # @yield [result, operation] Access the result along with the TransportOperation object
1129
+ # @yieldparam result [::Google::Protobuf::Empty]
1130
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1131
+ #
1132
+ # @return [::Google::Protobuf::Empty]
1133
+ #
1134
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1135
+ #
1136
+ # @example Basic example
1137
+ # require "google/cloud/managed_kafka/v1"
1138
+ #
1139
+ # # Create a client object. The client can be reused for multiple calls.
1140
+ # client = Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client.new
1141
+ #
1142
+ # # Create a request. To set request fields, pass in keyword arguments.
1143
+ # request = Google::Cloud::ManagedKafka::V1::DeleteConnectorRequest.new
1144
+ #
1145
+ # # Call the delete_connector method.
1146
+ # result = client.delete_connector request
1147
+ #
1148
+ # # The returned object is of type Google::Protobuf::Empty.
1149
+ # p result
1150
+ #
1151
+ def delete_connector request, options = nil
1152
+ raise ::ArgumentError, "request must be provided" if request.nil?
1153
+
1154
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ManagedKafka::V1::DeleteConnectorRequest
1155
+
1156
+ # Converts hash and nil to an options object
1157
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1158
+
1159
+ # Customize the options with defaults
1160
+ call_metadata = @config.rpcs.delete_connector.metadata.to_h
1161
+
1162
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1163
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1164
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1165
+ gapic_version: ::Google::Cloud::ManagedKafka::V1::VERSION,
1166
+ transports_version_send: [:rest]
1167
+
1168
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1169
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1170
+
1171
+ options.apply_defaults timeout: @config.rpcs.delete_connector.timeout,
1172
+ metadata: call_metadata,
1173
+ retry_policy: @config.rpcs.delete_connector.retry_policy
1174
+
1175
+ options.apply_defaults timeout: @config.timeout,
1176
+ metadata: @config.metadata,
1177
+ retry_policy: @config.retry_policy
1178
+
1179
+ @managed_kafka_connect_stub.delete_connector request, options do |result, operation|
1180
+ yield result, operation if block_given?
1181
+ end
1182
+ rescue ::Gapic::Rest::Error => e
1183
+ raise ::Google::Cloud::Error.from_error(e)
1184
+ end
1185
+
1186
+ ##
1187
+ # Pauses the connector and its tasks.
1188
+ #
1189
+ # @overload pause_connector(request, options = nil)
1190
+ # Pass arguments to `pause_connector` via a request object, either of type
1191
+ # {::Google::Cloud::ManagedKafka::V1::PauseConnectorRequest} or an equivalent Hash.
1192
+ #
1193
+ # @param request [::Google::Cloud::ManagedKafka::V1::PauseConnectorRequest, ::Hash]
1194
+ # A request object representing the call parameters. Required. To specify no
1195
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1196
+ # @param options [::Gapic::CallOptions, ::Hash]
1197
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1198
+ #
1199
+ # @overload pause_connector(name: nil)
1200
+ # Pass arguments to `pause_connector` via keyword arguments. Note that at
1201
+ # least one keyword argument is required. To specify no parameters, or to keep all
1202
+ # the default parameter values, pass an empty Hash as a request object (see above).
1203
+ #
1204
+ # @param name [::String]
1205
+ # Required. The name of the connector to pause.
1206
+ # Structured like:
1207
+ # projects/\\{project}/locations/\\{location}/connectClusters/\\{connectCluster}/connectors/\\{connector}
1208
+ # @yield [result, operation] Access the result along with the TransportOperation object
1209
+ # @yieldparam result [::Google::Cloud::ManagedKafka::V1::PauseConnectorResponse]
1210
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1211
+ #
1212
+ # @return [::Google::Cloud::ManagedKafka::V1::PauseConnectorResponse]
1213
+ #
1214
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1215
+ #
1216
+ # @example Basic example
1217
+ # require "google/cloud/managed_kafka/v1"
1218
+ #
1219
+ # # Create a client object. The client can be reused for multiple calls.
1220
+ # client = Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client.new
1221
+ #
1222
+ # # Create a request. To set request fields, pass in keyword arguments.
1223
+ # request = Google::Cloud::ManagedKafka::V1::PauseConnectorRequest.new
1224
+ #
1225
+ # # Call the pause_connector method.
1226
+ # result = client.pause_connector request
1227
+ #
1228
+ # # The returned object is of type Google::Cloud::ManagedKafka::V1::PauseConnectorResponse.
1229
+ # p result
1230
+ #
1231
+ def pause_connector request, options = nil
1232
+ raise ::ArgumentError, "request must be provided" if request.nil?
1233
+
1234
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ManagedKafka::V1::PauseConnectorRequest
1235
+
1236
+ # Converts hash and nil to an options object
1237
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1238
+
1239
+ # Customize the options with defaults
1240
+ call_metadata = @config.rpcs.pause_connector.metadata.to_h
1241
+
1242
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1243
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1244
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1245
+ gapic_version: ::Google::Cloud::ManagedKafka::V1::VERSION,
1246
+ transports_version_send: [:rest]
1247
+
1248
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1249
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1250
+
1251
+ options.apply_defaults timeout: @config.rpcs.pause_connector.timeout,
1252
+ metadata: call_metadata,
1253
+ retry_policy: @config.rpcs.pause_connector.retry_policy
1254
+
1255
+ options.apply_defaults timeout: @config.timeout,
1256
+ metadata: @config.metadata,
1257
+ retry_policy: @config.retry_policy
1258
+
1259
+ @managed_kafka_connect_stub.pause_connector request, options do |result, operation|
1260
+ yield result, operation if block_given?
1261
+ end
1262
+ rescue ::Gapic::Rest::Error => e
1263
+ raise ::Google::Cloud::Error.from_error(e)
1264
+ end
1265
+
1266
+ ##
1267
+ # Resumes the connector and its tasks.
1268
+ #
1269
+ # @overload resume_connector(request, options = nil)
1270
+ # Pass arguments to `resume_connector` via a request object, either of type
1271
+ # {::Google::Cloud::ManagedKafka::V1::ResumeConnectorRequest} or an equivalent Hash.
1272
+ #
1273
+ # @param request [::Google::Cloud::ManagedKafka::V1::ResumeConnectorRequest, ::Hash]
1274
+ # A request object representing the call parameters. Required. To specify no
1275
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1276
+ # @param options [::Gapic::CallOptions, ::Hash]
1277
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1278
+ #
1279
+ # @overload resume_connector(name: nil)
1280
+ # Pass arguments to `resume_connector` via keyword arguments. Note that at
1281
+ # least one keyword argument is required. To specify no parameters, or to keep all
1282
+ # the default parameter values, pass an empty Hash as a request object (see above).
1283
+ #
1284
+ # @param name [::String]
1285
+ # Required. The name of the connector to pause.
1286
+ # Structured like:
1287
+ # projects/\\{project}/locations/\\{location}/connectClusters/\\{connectCluster}/connectors/\\{connector}
1288
+ # @yield [result, operation] Access the result along with the TransportOperation object
1289
+ # @yieldparam result [::Google::Cloud::ManagedKafka::V1::ResumeConnectorResponse]
1290
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1291
+ #
1292
+ # @return [::Google::Cloud::ManagedKafka::V1::ResumeConnectorResponse]
1293
+ #
1294
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1295
+ #
1296
+ # @example Basic example
1297
+ # require "google/cloud/managed_kafka/v1"
1298
+ #
1299
+ # # Create a client object. The client can be reused for multiple calls.
1300
+ # client = Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client.new
1301
+ #
1302
+ # # Create a request. To set request fields, pass in keyword arguments.
1303
+ # request = Google::Cloud::ManagedKafka::V1::ResumeConnectorRequest.new
1304
+ #
1305
+ # # Call the resume_connector method.
1306
+ # result = client.resume_connector request
1307
+ #
1308
+ # # The returned object is of type Google::Cloud::ManagedKafka::V1::ResumeConnectorResponse.
1309
+ # p result
1310
+ #
1311
+ def resume_connector request, options = nil
1312
+ raise ::ArgumentError, "request must be provided" if request.nil?
1313
+
1314
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ManagedKafka::V1::ResumeConnectorRequest
1315
+
1316
+ # Converts hash and nil to an options object
1317
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1318
+
1319
+ # Customize the options with defaults
1320
+ call_metadata = @config.rpcs.resume_connector.metadata.to_h
1321
+
1322
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1323
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1324
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1325
+ gapic_version: ::Google::Cloud::ManagedKafka::V1::VERSION,
1326
+ transports_version_send: [:rest]
1327
+
1328
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1329
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1330
+
1331
+ options.apply_defaults timeout: @config.rpcs.resume_connector.timeout,
1332
+ metadata: call_metadata,
1333
+ retry_policy: @config.rpcs.resume_connector.retry_policy
1334
+
1335
+ options.apply_defaults timeout: @config.timeout,
1336
+ metadata: @config.metadata,
1337
+ retry_policy: @config.retry_policy
1338
+
1339
+ @managed_kafka_connect_stub.resume_connector request, options do |result, operation|
1340
+ yield result, operation if block_given?
1341
+ end
1342
+ rescue ::Gapic::Rest::Error => e
1343
+ raise ::Google::Cloud::Error.from_error(e)
1344
+ end
1345
+
1346
+ ##
1347
+ # Restarts the connector.
1348
+ #
1349
+ # @overload restart_connector(request, options = nil)
1350
+ # Pass arguments to `restart_connector` via a request object, either of type
1351
+ # {::Google::Cloud::ManagedKafka::V1::RestartConnectorRequest} or an equivalent Hash.
1352
+ #
1353
+ # @param request [::Google::Cloud::ManagedKafka::V1::RestartConnectorRequest, ::Hash]
1354
+ # A request object representing the call parameters. Required. To specify no
1355
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1356
+ # @param options [::Gapic::CallOptions, ::Hash]
1357
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1358
+ #
1359
+ # @overload restart_connector(name: nil)
1360
+ # Pass arguments to `restart_connector` via keyword arguments. Note that at
1361
+ # least one keyword argument is required. To specify no parameters, or to keep all
1362
+ # the default parameter values, pass an empty Hash as a request object (see above).
1363
+ #
1364
+ # @param name [::String]
1365
+ # Required. The name of the connector to restart.
1366
+ # Structured like:
1367
+ # projects/\\{project}/locations/\\{location}/connectClusters/\\{connectCluster}/connectors/\\{connector}
1368
+ # @yield [result, operation] Access the result along with the TransportOperation object
1369
+ # @yieldparam result [::Google::Cloud::ManagedKafka::V1::RestartConnectorResponse]
1370
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1371
+ #
1372
+ # @return [::Google::Cloud::ManagedKafka::V1::RestartConnectorResponse]
1373
+ #
1374
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1375
+ #
1376
+ # @example Basic example
1377
+ # require "google/cloud/managed_kafka/v1"
1378
+ #
1379
+ # # Create a client object. The client can be reused for multiple calls.
1380
+ # client = Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client.new
1381
+ #
1382
+ # # Create a request. To set request fields, pass in keyword arguments.
1383
+ # request = Google::Cloud::ManagedKafka::V1::RestartConnectorRequest.new
1384
+ #
1385
+ # # Call the restart_connector method.
1386
+ # result = client.restart_connector request
1387
+ #
1388
+ # # The returned object is of type Google::Cloud::ManagedKafka::V1::RestartConnectorResponse.
1389
+ # p result
1390
+ #
1391
+ def restart_connector request, options = nil
1392
+ raise ::ArgumentError, "request must be provided" if request.nil?
1393
+
1394
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ManagedKafka::V1::RestartConnectorRequest
1395
+
1396
+ # Converts hash and nil to an options object
1397
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1398
+
1399
+ # Customize the options with defaults
1400
+ call_metadata = @config.rpcs.restart_connector.metadata.to_h
1401
+
1402
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1403
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1404
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1405
+ gapic_version: ::Google::Cloud::ManagedKafka::V1::VERSION,
1406
+ transports_version_send: [:rest]
1407
+
1408
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1409
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1410
+
1411
+ options.apply_defaults timeout: @config.rpcs.restart_connector.timeout,
1412
+ metadata: call_metadata,
1413
+ retry_policy: @config.rpcs.restart_connector.retry_policy
1414
+
1415
+ options.apply_defaults timeout: @config.timeout,
1416
+ metadata: @config.metadata,
1417
+ retry_policy: @config.retry_policy
1418
+
1419
+ @managed_kafka_connect_stub.restart_connector request, options do |result, operation|
1420
+ yield result, operation if block_given?
1421
+ end
1422
+ rescue ::Gapic::Rest::Error => e
1423
+ raise ::Google::Cloud::Error.from_error(e)
1424
+ end
1425
+
1426
+ ##
1427
+ # Stops the connector.
1428
+ #
1429
+ # @overload stop_connector(request, options = nil)
1430
+ # Pass arguments to `stop_connector` via a request object, either of type
1431
+ # {::Google::Cloud::ManagedKafka::V1::StopConnectorRequest} or an equivalent Hash.
1432
+ #
1433
+ # @param request [::Google::Cloud::ManagedKafka::V1::StopConnectorRequest, ::Hash]
1434
+ # A request object representing the call parameters. Required. To specify no
1435
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1436
+ # @param options [::Gapic::CallOptions, ::Hash]
1437
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1438
+ #
1439
+ # @overload stop_connector(name: nil)
1440
+ # Pass arguments to `stop_connector` via keyword arguments. Note that at
1441
+ # least one keyword argument is required. To specify no parameters, or to keep all
1442
+ # the default parameter values, pass an empty Hash as a request object (see above).
1443
+ #
1444
+ # @param name [::String]
1445
+ # Required. The name of the connector to stop.
1446
+ # Structured like:
1447
+ # projects/\\{project}/locations/\\{location}/connectClusters/\\{connectCluster}/connectors/\\{connector}
1448
+ # @yield [result, operation] Access the result along with the TransportOperation object
1449
+ # @yieldparam result [::Google::Cloud::ManagedKafka::V1::StopConnectorResponse]
1450
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1451
+ #
1452
+ # @return [::Google::Cloud::ManagedKafka::V1::StopConnectorResponse]
1453
+ #
1454
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1455
+ #
1456
+ # @example Basic example
1457
+ # require "google/cloud/managed_kafka/v1"
1458
+ #
1459
+ # # Create a client object. The client can be reused for multiple calls.
1460
+ # client = Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client.new
1461
+ #
1462
+ # # Create a request. To set request fields, pass in keyword arguments.
1463
+ # request = Google::Cloud::ManagedKafka::V1::StopConnectorRequest.new
1464
+ #
1465
+ # # Call the stop_connector method.
1466
+ # result = client.stop_connector request
1467
+ #
1468
+ # # The returned object is of type Google::Cloud::ManagedKafka::V1::StopConnectorResponse.
1469
+ # p result
1470
+ #
1471
+ def stop_connector request, options = nil
1472
+ raise ::ArgumentError, "request must be provided" if request.nil?
1473
+
1474
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ManagedKafka::V1::StopConnectorRequest
1475
+
1476
+ # Converts hash and nil to an options object
1477
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1478
+
1479
+ # Customize the options with defaults
1480
+ call_metadata = @config.rpcs.stop_connector.metadata.to_h
1481
+
1482
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1483
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1484
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1485
+ gapic_version: ::Google::Cloud::ManagedKafka::V1::VERSION,
1486
+ transports_version_send: [:rest]
1487
+
1488
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1489
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1490
+
1491
+ options.apply_defaults timeout: @config.rpcs.stop_connector.timeout,
1492
+ metadata: call_metadata,
1493
+ retry_policy: @config.rpcs.stop_connector.retry_policy
1494
+
1495
+ options.apply_defaults timeout: @config.timeout,
1496
+ metadata: @config.metadata,
1497
+ retry_policy: @config.retry_policy
1498
+
1499
+ @managed_kafka_connect_stub.stop_connector request, options do |result, operation|
1500
+ yield result, operation if block_given?
1501
+ end
1502
+ rescue ::Gapic::Rest::Error => e
1503
+ raise ::Google::Cloud::Error.from_error(e)
1504
+ end
1505
+
1506
+ ##
1507
+ # Configuration class for the ManagedKafkaConnect REST API.
1508
+ #
1509
+ # This class represents the configuration for ManagedKafkaConnect REST,
1510
+ # providing control over timeouts, retry behavior, logging, transport
1511
+ # parameters, and other low-level controls. Certain parameters can also be
1512
+ # applied individually to specific RPCs. See
1513
+ # {::Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client::Configuration::Rpcs}
1514
+ # for a list of RPCs that can be configured independently.
1515
+ #
1516
+ # Configuration can be applied globally to all clients, or to a single client
1517
+ # on construction.
1518
+ #
1519
+ # @example
1520
+ #
1521
+ # # Modify the global config, setting the timeout for
1522
+ # # list_connect_clusters to 20 seconds,
1523
+ # # and all remaining timeouts to 10 seconds.
1524
+ # ::Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client.configure do |config|
1525
+ # config.timeout = 10.0
1526
+ # config.rpcs.list_connect_clusters.timeout = 20.0
1527
+ # end
1528
+ #
1529
+ # # Apply the above configuration only to a new client.
1530
+ # client = ::Google::Cloud::ManagedKafka::V1::ManagedKafkaConnect::Rest::Client.new do |config|
1531
+ # config.timeout = 10.0
1532
+ # config.rpcs.list_connect_clusters.timeout = 20.0
1533
+ # end
1534
+ #
1535
+ # @!attribute [rw] endpoint
1536
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1537
+ # nil, indicating to use the default endpoint in the current universe domain.
1538
+ # @return [::String,nil]
1539
+ # @!attribute [rw] credentials
1540
+ # Credentials to send with calls. You may provide any of the following types:
1541
+ # * (`String`) The path to a service account key file in JSON format
1542
+ # * (`Hash`) A service account key as a Hash
1543
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1544
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1545
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1546
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1547
+ # * (`nil`) indicating no credentials
1548
+ #
1549
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
1550
+ # external source for authentication to Google Cloud, you must validate it before
1551
+ # providing it to a Google API client library. Providing an unvalidated credential
1552
+ # configuration to Google APIs can compromise the security of your systems and data.
1553
+ # For more information, refer to [Validate credential configurations from external
1554
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1555
+ # @return [::Object]
1556
+ # @!attribute [rw] scope
1557
+ # The OAuth scopes
1558
+ # @return [::Array<::String>]
1559
+ # @!attribute [rw] lib_name
1560
+ # The library name as recorded in instrumentation and logging
1561
+ # @return [::String]
1562
+ # @!attribute [rw] lib_version
1563
+ # The library version as recorded in instrumentation and logging
1564
+ # @return [::String]
1565
+ # @!attribute [rw] timeout
1566
+ # The call timeout in seconds.
1567
+ # @return [::Numeric]
1568
+ # @!attribute [rw] metadata
1569
+ # Additional headers to be sent with the call.
1570
+ # @return [::Hash{::Symbol=>::String}]
1571
+ # @!attribute [rw] retry_policy
1572
+ # The retry policy. The value is a hash with the following keys:
1573
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1574
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1575
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1576
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1577
+ # trigger a retry.
1578
+ # @return [::Hash]
1579
+ # @!attribute [rw] quota_project
1580
+ # A separate project against which to charge quota.
1581
+ # @return [::String]
1582
+ # @!attribute [rw] universe_domain
1583
+ # The universe domain within which to make requests. This determines the
1584
+ # default endpoint URL. The default value of nil uses the environment
1585
+ # universe (usually the default "googleapis.com" universe).
1586
+ # @return [::String,nil]
1587
+ # @!attribute [rw] logger
1588
+ # A custom logger to use for request/response debug logging, or the value
1589
+ # `:default` (the default) to construct a default logger, or `nil` to
1590
+ # explicitly disable logging.
1591
+ # @return [::Logger,:default,nil]
1592
+ #
1593
+ class Configuration
1594
+ extend ::Gapic::Config
1595
+
1596
+ # @private
1597
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1598
+ DEFAULT_ENDPOINT = "managedkafka.googleapis.com"
1599
+
1600
+ config_attr :endpoint, nil, ::String, nil
1601
+ config_attr :credentials, nil do |value|
1602
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1603
+ allowed.any? { |klass| klass === value }
1604
+ end
1605
+ config_attr :scope, nil, ::String, ::Array, nil
1606
+ config_attr :lib_name, nil, ::String, nil
1607
+ config_attr :lib_version, nil, ::String, nil
1608
+ config_attr :timeout, nil, ::Numeric, nil
1609
+ config_attr :metadata, nil, ::Hash, nil
1610
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1611
+ config_attr :quota_project, nil, ::String, nil
1612
+ config_attr :universe_domain, nil, ::String, nil
1613
+
1614
+ # @private
1615
+ # Overrides for http bindings for the RPCs of this service
1616
+ # are only used when this service is used as mixin, and only
1617
+ # by the host service.
1618
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1619
+ config_attr :bindings_override, {}, ::Hash, nil
1620
+ config_attr :logger, :default, ::Logger, nil, :default
1621
+
1622
+ # @private
1623
+ def initialize parent_config = nil
1624
+ @parent_config = parent_config unless parent_config.nil?
1625
+
1626
+ yield self if block_given?
1627
+ end
1628
+
1629
+ ##
1630
+ # Configurations for individual RPCs
1631
+ # @return [Rpcs]
1632
+ #
1633
+ def rpcs
1634
+ @rpcs ||= begin
1635
+ parent_rpcs = nil
1636
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1637
+ Rpcs.new parent_rpcs
1638
+ end
1639
+ end
1640
+
1641
+ ##
1642
+ # Configuration RPC class for the ManagedKafkaConnect API.
1643
+ #
1644
+ # Includes fields providing the configuration for each RPC in this service.
1645
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1646
+ # the following configuration fields:
1647
+ #
1648
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1649
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1650
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1651
+ # include the following keys:
1652
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1653
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1654
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1655
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1656
+ # trigger a retry.
1657
+ #
1658
+ class Rpcs
1659
+ ##
1660
+ # RPC-specific configuration for `list_connect_clusters`
1661
+ # @return [::Gapic::Config::Method]
1662
+ #
1663
+ attr_reader :list_connect_clusters
1664
+ ##
1665
+ # RPC-specific configuration for `get_connect_cluster`
1666
+ # @return [::Gapic::Config::Method]
1667
+ #
1668
+ attr_reader :get_connect_cluster
1669
+ ##
1670
+ # RPC-specific configuration for `create_connect_cluster`
1671
+ # @return [::Gapic::Config::Method]
1672
+ #
1673
+ attr_reader :create_connect_cluster
1674
+ ##
1675
+ # RPC-specific configuration for `update_connect_cluster`
1676
+ # @return [::Gapic::Config::Method]
1677
+ #
1678
+ attr_reader :update_connect_cluster
1679
+ ##
1680
+ # RPC-specific configuration for `delete_connect_cluster`
1681
+ # @return [::Gapic::Config::Method]
1682
+ #
1683
+ attr_reader :delete_connect_cluster
1684
+ ##
1685
+ # RPC-specific configuration for `list_connectors`
1686
+ # @return [::Gapic::Config::Method]
1687
+ #
1688
+ attr_reader :list_connectors
1689
+ ##
1690
+ # RPC-specific configuration for `get_connector`
1691
+ # @return [::Gapic::Config::Method]
1692
+ #
1693
+ attr_reader :get_connector
1694
+ ##
1695
+ # RPC-specific configuration for `create_connector`
1696
+ # @return [::Gapic::Config::Method]
1697
+ #
1698
+ attr_reader :create_connector
1699
+ ##
1700
+ # RPC-specific configuration for `update_connector`
1701
+ # @return [::Gapic::Config::Method]
1702
+ #
1703
+ attr_reader :update_connector
1704
+ ##
1705
+ # RPC-specific configuration for `delete_connector`
1706
+ # @return [::Gapic::Config::Method]
1707
+ #
1708
+ attr_reader :delete_connector
1709
+ ##
1710
+ # RPC-specific configuration for `pause_connector`
1711
+ # @return [::Gapic::Config::Method]
1712
+ #
1713
+ attr_reader :pause_connector
1714
+ ##
1715
+ # RPC-specific configuration for `resume_connector`
1716
+ # @return [::Gapic::Config::Method]
1717
+ #
1718
+ attr_reader :resume_connector
1719
+ ##
1720
+ # RPC-specific configuration for `restart_connector`
1721
+ # @return [::Gapic::Config::Method]
1722
+ #
1723
+ attr_reader :restart_connector
1724
+ ##
1725
+ # RPC-specific configuration for `stop_connector`
1726
+ # @return [::Gapic::Config::Method]
1727
+ #
1728
+ attr_reader :stop_connector
1729
+
1730
+ # @private
1731
+ def initialize parent_rpcs = nil
1732
+ list_connect_clusters_config = parent_rpcs.list_connect_clusters if parent_rpcs.respond_to? :list_connect_clusters
1733
+ @list_connect_clusters = ::Gapic::Config::Method.new list_connect_clusters_config
1734
+ get_connect_cluster_config = parent_rpcs.get_connect_cluster if parent_rpcs.respond_to? :get_connect_cluster
1735
+ @get_connect_cluster = ::Gapic::Config::Method.new get_connect_cluster_config
1736
+ create_connect_cluster_config = parent_rpcs.create_connect_cluster if parent_rpcs.respond_to? :create_connect_cluster
1737
+ @create_connect_cluster = ::Gapic::Config::Method.new create_connect_cluster_config
1738
+ update_connect_cluster_config = parent_rpcs.update_connect_cluster if parent_rpcs.respond_to? :update_connect_cluster
1739
+ @update_connect_cluster = ::Gapic::Config::Method.new update_connect_cluster_config
1740
+ delete_connect_cluster_config = parent_rpcs.delete_connect_cluster if parent_rpcs.respond_to? :delete_connect_cluster
1741
+ @delete_connect_cluster = ::Gapic::Config::Method.new delete_connect_cluster_config
1742
+ list_connectors_config = parent_rpcs.list_connectors if parent_rpcs.respond_to? :list_connectors
1743
+ @list_connectors = ::Gapic::Config::Method.new list_connectors_config
1744
+ get_connector_config = parent_rpcs.get_connector if parent_rpcs.respond_to? :get_connector
1745
+ @get_connector = ::Gapic::Config::Method.new get_connector_config
1746
+ create_connector_config = parent_rpcs.create_connector if parent_rpcs.respond_to? :create_connector
1747
+ @create_connector = ::Gapic::Config::Method.new create_connector_config
1748
+ update_connector_config = parent_rpcs.update_connector if parent_rpcs.respond_to? :update_connector
1749
+ @update_connector = ::Gapic::Config::Method.new update_connector_config
1750
+ delete_connector_config = parent_rpcs.delete_connector if parent_rpcs.respond_to? :delete_connector
1751
+ @delete_connector = ::Gapic::Config::Method.new delete_connector_config
1752
+ pause_connector_config = parent_rpcs.pause_connector if parent_rpcs.respond_to? :pause_connector
1753
+ @pause_connector = ::Gapic::Config::Method.new pause_connector_config
1754
+ resume_connector_config = parent_rpcs.resume_connector if parent_rpcs.respond_to? :resume_connector
1755
+ @resume_connector = ::Gapic::Config::Method.new resume_connector_config
1756
+ restart_connector_config = parent_rpcs.restart_connector if parent_rpcs.respond_to? :restart_connector
1757
+ @restart_connector = ::Gapic::Config::Method.new restart_connector_config
1758
+ stop_connector_config = parent_rpcs.stop_connector if parent_rpcs.respond_to? :stop_connector
1759
+ @stop_connector = ::Gapic::Config::Method.new stop_connector_config
1760
+
1761
+ yield self if block_given?
1762
+ end
1763
+ end
1764
+ end
1765
+ end
1766
+ end
1767
+ end
1768
+ end
1769
+ end
1770
+ end
1771
+ end