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