google-cloud-sql-v1 0.4.0 → 0.5.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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/sql/v1/blue_green_deployments_service/client.rb +899 -0
  3. data/lib/google/cloud/sql/v1/blue_green_deployments_service/credentials.rb +48 -0
  4. data/lib/google/cloud/sql/v1/blue_green_deployments_service/paths.rb +86 -0
  5. data/lib/google/cloud/sql/v1/blue_green_deployments_service/rest/client.rb +821 -0
  6. data/lib/google/cloud/sql/v1/blue_green_deployments_service/rest/service_stub.rb +388 -0
  7. data/lib/google/cloud/sql/v1/blue_green_deployments_service/rest.rb +52 -0
  8. data/lib/google/cloud/sql/v1/blue_green_deployments_service.rb +55 -0
  9. data/lib/google/cloud/sql/v1/cloud_sql_backups_pb.rb +1 -1
  10. data/lib/google/cloud/sql/v1/cloud_sql_blue_green_deployments_pb.rb +45 -0
  11. data/lib/google/cloud/sql/v1/cloud_sql_blue_green_deployments_services_pb.rb +54 -0
  12. data/lib/google/cloud/sql/v1/cloud_sql_instances_pb.rb +5 -1
  13. data/lib/google/cloud/sql/v1/cloud_sql_resources_pb.rb +5 -1
  14. data/lib/google/cloud/sql/v1/cloud_sql_workload_captures_pb.rb +35 -0
  15. data/lib/google/cloud/sql/v1/cloud_sql_workload_captures_services_pb.rb +60 -0
  16. data/lib/google/cloud/sql/v1/rest.rb +2 -0
  17. data/lib/google/cloud/sql/v1/sql_backup_runs_service/client.rb +2 -0
  18. data/lib/google/cloud/sql/v1/sql_backup_runs_service/paths.rb +77 -0
  19. data/lib/google/cloud/sql/v1/sql_backup_runs_service/rest/client.rb +2 -0
  20. data/lib/google/cloud/sql/v1/sql_backup_runs_service/rest.rb +1 -0
  21. data/lib/google/cloud/sql/v1/sql_backup_runs_service.rb +1 -0
  22. data/lib/google/cloud/sql/v1/sql_backups_service/paths.rb +63 -0
  23. data/lib/google/cloud/sql/v1/sql_instances_service/paths.rb +63 -0
  24. data/lib/google/cloud/sql/v1/sql_workload_captures_service/client.rb +906 -0
  25. data/lib/google/cloud/sql/v1/sql_workload_captures_service/credentials.rb +48 -0
  26. data/lib/google/cloud/sql/v1/sql_workload_captures_service/rest/client.rb +810 -0
  27. data/lib/google/cloud/sql/v1/sql_workload_captures_service/rest/service_stub.rb +396 -0
  28. data/lib/google/cloud/sql/v1/sql_workload_captures_service/rest.rb +51 -0
  29. data/lib/google/cloud/sql/v1/sql_workload_captures_service.rb +54 -0
  30. data/lib/google/cloud/sql/v1/version.rb +1 -1
  31. data/lib/google/cloud/sql/v1.rb +2 -0
  32. data/proto_docs/google/cloud/sql/v1/cloud_sql_blue_green_deployments.rb +399 -0
  33. data/proto_docs/google/cloud/sql/v1/cloud_sql_instances.rb +83 -2
  34. data/proto_docs/google/cloud/sql/v1/cloud_sql_resources.rb +116 -3
  35. data/proto_docs/google/cloud/sql/v1/cloud_sql_users.rb +4 -4
  36. data/proto_docs/google/cloud/sql/v1/cloud_sql_workload_captures.rb +170 -0
  37. metadata +21 -1
@@ -0,0 +1,906 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 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/sql/v1/cloud_sql_workload_captures_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Sql
26
+ module V1
27
+ module SqlWorkloadCapturesService
28
+ ##
29
+ # Client for the SqlWorkloadCapturesService service.
30
+ #
31
+ # Cloud SQL Workload Captures service.
32
+ #
33
+ class Client
34
+ # @private
35
+ API_VERSION = ""
36
+
37
+ # @private
38
+ DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$"
39
+
40
+ # @private
41
+ attr_reader :sql_workload_captures_service_stub
42
+
43
+ ##
44
+ # Configure the SqlWorkloadCapturesService Client class.
45
+ #
46
+ # See {::Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Client::Configuration}
47
+ # for a description of the configuration fields.
48
+ #
49
+ # @example
50
+ #
51
+ # # Modify the configuration for all SqlWorkloadCapturesService clients
52
+ # ::Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Client.configure do |config|
53
+ # config.timeout = 10.0
54
+ # end
55
+ #
56
+ # @yield [config] Configure the Client client.
57
+ # @yieldparam config [Client::Configuration]
58
+ #
59
+ # @return [Client::Configuration]
60
+ #
61
+ def self.configure
62
+ @configure ||= begin
63
+ namespace = ["Google", "Cloud", "Sql", "V1"]
64
+ parent_config = while namespace.any?
65
+ parent_name = namespace.join "::"
66
+ parent_const = const_get parent_name
67
+ break parent_const.configure if parent_const.respond_to? :configure
68
+ namespace.pop
69
+ end
70
+ default_config = Client::Configuration.new parent_config
71
+
72
+ default_config
73
+ end
74
+ yield @configure if block_given?
75
+ @configure
76
+ end
77
+
78
+ ##
79
+ # Configure the SqlWorkloadCapturesService Client instance.
80
+ #
81
+ # The configuration is set to the derived mode, meaning that values can be changed,
82
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
83
+ # should be made on {Client.configure}.
84
+ #
85
+ # See {::Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Client::Configuration}
86
+ # for a description of the configuration fields.
87
+ #
88
+ # @yield [config] Configure the Client client.
89
+ # @yieldparam config [Client::Configuration]
90
+ #
91
+ # @return [Client::Configuration]
92
+ #
93
+ def configure
94
+ yield @config if block_given?
95
+ @config
96
+ end
97
+
98
+ ##
99
+ # The effective universe domain
100
+ #
101
+ # @return [String]
102
+ #
103
+ def universe_domain
104
+ @sql_workload_captures_service_stub.universe_domain
105
+ end
106
+
107
+ ##
108
+ # Create a new SqlWorkloadCapturesService client object.
109
+ #
110
+ # @example
111
+ #
112
+ # # Create a client using the default configuration
113
+ # client = ::Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Client.new
114
+ #
115
+ # # Create a client using a custom configuration
116
+ # client = ::Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Client.new do |config|
117
+ # config.timeout = 10.0
118
+ # end
119
+ #
120
+ # @yield [config] Configure the SqlWorkloadCapturesService client.
121
+ # @yieldparam config [Client::Configuration]
122
+ #
123
+ def initialize
124
+ # These require statements are intentionally placed here to initialize
125
+ # the gRPC module only when it's required.
126
+ # See https://github.com/googleapis/toolkit/issues/446
127
+ require "gapic/grpc"
128
+ require "google/cloud/sql/v1/cloud_sql_workload_captures_services_pb"
129
+
130
+ # Create the configuration object
131
+ @config = Configuration.new Client.configure
132
+
133
+ # Yield the configuration if needed
134
+ yield @config if block_given?
135
+
136
+ # Create credentials
137
+ credentials = @config.credentials
138
+ # Use self-signed JWT if the endpoint is unchanged from default,
139
+ # but only if the default endpoint does not have a region prefix.
140
+ enable_self_signed_jwt = @config.endpoint.nil? ||
141
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
142
+ !@config.endpoint.split(".").first.include?("-"))
143
+ credentials ||= Credentials.default scope: @config.scope,
144
+ enable_self_signed_jwt: enable_self_signed_jwt
145
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
146
+ credentials = Credentials.new credentials, scope: @config.scope
147
+ end
148
+ @quota_project_id = @config.quota_project
149
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
150
+
151
+ @sql_workload_captures_service_stub = ::Gapic::ServiceStub.new(
152
+ ::Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Stub,
153
+ credentials: credentials,
154
+ endpoint: @config.endpoint,
155
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
156
+ universe_domain: @config.universe_domain,
157
+ channel_args: @config.channel_args,
158
+ interceptors: @config.interceptors,
159
+ channel_pool_config: @config.channel_pool,
160
+ logger: @config.logger
161
+ )
162
+
163
+ @sql_workload_captures_service_stub.stub_logger&.info do |entry|
164
+ entry.set_system_name
165
+ entry.set_service
166
+ entry.message = "Created client for #{entry.service}"
167
+ entry.set_credentials_fields credentials
168
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
169
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
170
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
171
+ end
172
+
173
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
174
+ config.credentials = credentials
175
+ config.quota_project = @quota_project_id
176
+ config.endpoint = @sql_workload_captures_service_stub.endpoint
177
+ config.universe_domain = @sql_workload_captures_service_stub.universe_domain
178
+ config.logger = @sql_workload_captures_service_stub.logger if config.respond_to? :logger=
179
+ end
180
+ end
181
+
182
+ ##
183
+ # Get the associated client for mix-in of the Locations.
184
+ #
185
+ # @return [Google::Cloud::Location::Locations::Client]
186
+ #
187
+ attr_reader :location_client
188
+
189
+ ##
190
+ # The logger used for request/response debug logging.
191
+ #
192
+ # @return [Logger]
193
+ #
194
+ def logger
195
+ @sql_workload_captures_service_stub.logger
196
+ end
197
+
198
+ # Service calls
199
+
200
+ ##
201
+ # Starts capturing the SQL queries, transactions, and other operations
202
+ # executed on the primary instance. This traffic is securely stored and forms
203
+ # a "captured workload". This workload can be replayed later on a different
204
+ # instance to safely test performance impacts, database upgrades,
205
+ # configuration changes etc. before applying them to production.
206
+ #
207
+ # @overload start(request, options = nil)
208
+ # Pass arguments to `start` via a request object, either of type
209
+ # {::Google::Cloud::Sql::V1::WorkloadCapturesStartRequest} or an equivalent Hash.
210
+ #
211
+ # @param request [::Google::Cloud::Sql::V1::WorkloadCapturesStartRequest, ::Hash]
212
+ # A request object representing the call parameters. Required. To specify no
213
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
214
+ # @param options [::Gapic::CallOptions, ::Hash]
215
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
216
+ #
217
+ # @overload start(project: nil, instance: nil, start_workload_capture_context: nil)
218
+ # Pass arguments to `start` via keyword arguments. Note that at
219
+ # least one keyword argument is required. To specify no parameters, or to keep all
220
+ # the default parameter values, pass an empty Hash as a request object (see above).
221
+ #
222
+ # @param project [::String]
223
+ # Required. Project ID of the project that contains the instance.
224
+ # @param instance [::String]
225
+ # Required. Cloud SQL instance ID. This does not include the project ID.
226
+ # @param start_workload_capture_context [::Google::Cloud::Sql::V1::StartWorkloadCaptureContext, ::Hash]
227
+ # Optional. Contains details about the start workload capture operation.
228
+ #
229
+ # @yield [response, operation] Access the result along with the RPC operation
230
+ # @yieldparam response [::Google::Cloud::Sql::V1::Operation]
231
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
232
+ #
233
+ # @return [::Google::Cloud::Sql::V1::Operation]
234
+ #
235
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
236
+ #
237
+ # @example Basic example
238
+ # require "google/cloud/sql/v1"
239
+ #
240
+ # # Create a client object. The client can be reused for multiple calls.
241
+ # client = Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Client.new
242
+ #
243
+ # # Create a request. To set request fields, pass in keyword arguments.
244
+ # request = Google::Cloud::Sql::V1::WorkloadCapturesStartRequest.new
245
+ #
246
+ # # Call the start method.
247
+ # result = client.start request
248
+ #
249
+ # # The returned object is of type Google::Cloud::Sql::V1::Operation.
250
+ # p result
251
+ #
252
+ def start request, options = nil
253
+ raise ::ArgumentError, "request must be provided" if request.nil?
254
+
255
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::WorkloadCapturesStartRequest
256
+
257
+ # Converts hash and nil to an options object
258
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
259
+
260
+ # Customize the options with defaults
261
+ metadata = @config.rpcs.start.metadata.to_h
262
+
263
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
264
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
265
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
266
+ gapic_version: ::Google::Cloud::Sql::V1::VERSION
267
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
268
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
269
+
270
+ header_params = {}
271
+ if request.project
272
+ header_params["project"] = request.project
273
+ end
274
+ if request.instance
275
+ header_params["instance"] = request.instance
276
+ end
277
+
278
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
279
+ metadata[:"x-goog-request-params"] ||= request_params_header
280
+
281
+ options.apply_defaults timeout: @config.rpcs.start.timeout,
282
+ metadata: metadata,
283
+ retry_policy: @config.rpcs.start.retry_policy
284
+
285
+ options.apply_defaults timeout: @config.timeout,
286
+ metadata: @config.metadata,
287
+ retry_policy: @config.retry_policy
288
+
289
+ @sql_workload_captures_service_stub.call_rpc :start, request, options: options do |response, operation|
290
+ yield response, operation if block_given?
291
+ end
292
+ rescue ::GRPC::BadStatus => e
293
+ raise ::Google::Cloud::Error.from_error(e)
294
+ end
295
+
296
+ ##
297
+ # Stops capturing the query traffic and related operations executed on the
298
+ # primary instance.
299
+ #
300
+ # @overload stop(request, options = nil)
301
+ # Pass arguments to `stop` via a request object, either of type
302
+ # {::Google::Cloud::Sql::V1::WorkloadCapturesStopRequest} or an equivalent Hash.
303
+ #
304
+ # @param request [::Google::Cloud::Sql::V1::WorkloadCapturesStopRequest, ::Hash]
305
+ # A request object representing the call parameters. Required. To specify no
306
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
307
+ # @param options [::Gapic::CallOptions, ::Hash]
308
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
309
+ #
310
+ # @overload stop(project: nil, instance: nil, stop_workload_capture_context: nil)
311
+ # Pass arguments to `stop` via keyword arguments. Note that at
312
+ # least one keyword argument is required. To specify no parameters, or to keep all
313
+ # the default parameter values, pass an empty Hash as a request object (see above).
314
+ #
315
+ # @param project [::String]
316
+ # Required. Project ID of the project that contains the instance.
317
+ # @param instance [::String]
318
+ # Required. Cloud SQL instance ID. This does not include the project ID.
319
+ # @param stop_workload_capture_context [::Google::Cloud::Sql::V1::StopWorkloadCaptureContext, ::Hash]
320
+ # Optional. Contains details about the stop workload capture operation.
321
+ #
322
+ # @yield [response, operation] Access the result along with the RPC operation
323
+ # @yieldparam response [::Google::Cloud::Sql::V1::Operation]
324
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
325
+ #
326
+ # @return [::Google::Cloud::Sql::V1::Operation]
327
+ #
328
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
329
+ #
330
+ # @example Basic example
331
+ # require "google/cloud/sql/v1"
332
+ #
333
+ # # Create a client object. The client can be reused for multiple calls.
334
+ # client = Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Client.new
335
+ #
336
+ # # Create a request. To set request fields, pass in keyword arguments.
337
+ # request = Google::Cloud::Sql::V1::WorkloadCapturesStopRequest.new
338
+ #
339
+ # # Call the stop method.
340
+ # result = client.stop request
341
+ #
342
+ # # The returned object is of type Google::Cloud::Sql::V1::Operation.
343
+ # p result
344
+ #
345
+ def stop request, options = nil
346
+ raise ::ArgumentError, "request must be provided" if request.nil?
347
+
348
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::WorkloadCapturesStopRequest
349
+
350
+ # Converts hash and nil to an options object
351
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
352
+
353
+ # Customize the options with defaults
354
+ metadata = @config.rpcs.stop.metadata.to_h
355
+
356
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
357
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
358
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
359
+ gapic_version: ::Google::Cloud::Sql::V1::VERSION
360
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
361
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
362
+
363
+ header_params = {}
364
+ if request.project
365
+ header_params["project"] = request.project
366
+ end
367
+ if request.instance
368
+ header_params["instance"] = request.instance
369
+ end
370
+
371
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
372
+ metadata[:"x-goog-request-params"] ||= request_params_header
373
+
374
+ options.apply_defaults timeout: @config.rpcs.stop.timeout,
375
+ metadata: metadata,
376
+ retry_policy: @config.rpcs.stop.retry_policy
377
+
378
+ options.apply_defaults timeout: @config.timeout,
379
+ metadata: @config.metadata,
380
+ retry_policy: @config.retry_policy
381
+
382
+ @sql_workload_captures_service_stub.call_rpc :stop, request, options: options do |response, operation|
383
+ yield response, operation if block_given?
384
+ end
385
+ rescue ::GRPC::BadStatus => e
386
+ raise ::Google::Cloud::Error.from_error(e)
387
+ end
388
+
389
+ ##
390
+ # Starts executing a captured workload on a separate Cloud SQL instance
391
+ # provisioned for workload replay. This target instance simulates the
392
+ # production environment without affecting the primary instance.
393
+ #
394
+ # @overload start_replay(request, options = nil)
395
+ # Pass arguments to `start_replay` via a request object, either of type
396
+ # {::Google::Cloud::Sql::V1::WorkloadCapturesStartReplayRequest} or an equivalent Hash.
397
+ #
398
+ # @param request [::Google::Cloud::Sql::V1::WorkloadCapturesStartReplayRequest, ::Hash]
399
+ # A request object representing the call parameters. Required. To specify no
400
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
401
+ # @param options [::Gapic::CallOptions, ::Hash]
402
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
403
+ #
404
+ # @overload start_replay(project: nil, instance: nil, start_workload_replay_context: nil, workload_id: nil)
405
+ # Pass arguments to `start_replay` via keyword arguments. Note that at
406
+ # least one keyword argument is required. To specify no parameters, or to keep all
407
+ # the default parameter values, pass an empty Hash as a request object (see above).
408
+ #
409
+ # @param project [::String]
410
+ # Required. Project ID of the project that contains the instance.
411
+ # @param instance [::String]
412
+ # Required. Cloud SQL instance ID. This does not include the project ID.
413
+ # @param start_workload_replay_context [::Google::Cloud::Sql::V1::StartWorkloadReplayContext, ::Hash]
414
+ # Required. Contains details about the start workload replay operation.
415
+ # @param workload_id [::String]
416
+ # Required. The ID of the workload to replay.
417
+ #
418
+ # @yield [response, operation] Access the result along with the RPC operation
419
+ # @yieldparam response [::Google::Cloud::Sql::V1::Operation]
420
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
421
+ #
422
+ # @return [::Google::Cloud::Sql::V1::Operation]
423
+ #
424
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
425
+ #
426
+ # @example Basic example
427
+ # require "google/cloud/sql/v1"
428
+ #
429
+ # # Create a client object. The client can be reused for multiple calls.
430
+ # client = Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Client.new
431
+ #
432
+ # # Create a request. To set request fields, pass in keyword arguments.
433
+ # request = Google::Cloud::Sql::V1::WorkloadCapturesStartReplayRequest.new
434
+ #
435
+ # # Call the start_replay method.
436
+ # result = client.start_replay request
437
+ #
438
+ # # The returned object is of type Google::Cloud::Sql::V1::Operation.
439
+ # p result
440
+ #
441
+ def start_replay request, options = nil
442
+ raise ::ArgumentError, "request must be provided" if request.nil?
443
+
444
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::WorkloadCapturesStartReplayRequest
445
+
446
+ # Converts hash and nil to an options object
447
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
448
+
449
+ # Customize the options with defaults
450
+ metadata = @config.rpcs.start_replay.metadata.to_h
451
+
452
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
453
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
454
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
455
+ gapic_version: ::Google::Cloud::Sql::V1::VERSION
456
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
457
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
458
+
459
+ header_params = {}
460
+ if request.project
461
+ header_params["project"] = request.project
462
+ end
463
+ if request.instance
464
+ header_params["instance"] = request.instance
465
+ end
466
+ if request.workload_id
467
+ header_params["workload_id"] = request.workload_id
468
+ end
469
+
470
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
471
+ metadata[:"x-goog-request-params"] ||= request_params_header
472
+
473
+ options.apply_defaults timeout: @config.rpcs.start_replay.timeout,
474
+ metadata: metadata,
475
+ retry_policy: @config.rpcs.start_replay.retry_policy
476
+
477
+ options.apply_defaults timeout: @config.timeout,
478
+ metadata: @config.metadata,
479
+ retry_policy: @config.retry_policy
480
+
481
+ @sql_workload_captures_service_stub.call_rpc :start_replay, request, options: options do |response, operation|
482
+ yield response, operation if block_given?
483
+ end
484
+ rescue ::GRPC::BadStatus => e
485
+ raise ::Google::Cloud::Error.from_error(e)
486
+ end
487
+
488
+ ##
489
+ # Stops an active workload replay on the target Cloud SQL replay instance.
490
+ #
491
+ # @overload stop_replay(request, options = nil)
492
+ # Pass arguments to `stop_replay` via a request object, either of type
493
+ # {::Google::Cloud::Sql::V1::WorkloadCapturesStopReplayRequest} or an equivalent Hash.
494
+ #
495
+ # @param request [::Google::Cloud::Sql::V1::WorkloadCapturesStopReplayRequest, ::Hash]
496
+ # A request object representing the call parameters. Required. To specify no
497
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
498
+ # @param options [::Gapic::CallOptions, ::Hash]
499
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
500
+ #
501
+ # @overload stop_replay(project: nil, instance: nil, stop_workload_replay_context: nil)
502
+ # Pass arguments to `stop_replay` via keyword arguments. Note that at
503
+ # least one keyword argument is required. To specify no parameters, or to keep all
504
+ # the default parameter values, pass an empty Hash as a request object (see above).
505
+ #
506
+ # @param project [::String]
507
+ # Required. Project ID of the project that contains the target replay
508
+ # instance.
509
+ # @param instance [::String]
510
+ # Required. Cloud SQL instance ID of the target replay instance. This does
511
+ # not include the project ID.
512
+ # @param stop_workload_replay_context [::Google::Cloud::Sql::V1::StopWorkloadReplayContext, ::Hash]
513
+ # Optional. Contains details about the stop workload replay operation. If
514
+ # omitted, default values are used.
515
+ #
516
+ # @yield [response, operation] Access the result along with the RPC operation
517
+ # @yieldparam response [::Google::Cloud::Sql::V1::Operation]
518
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
519
+ #
520
+ # @return [::Google::Cloud::Sql::V1::Operation]
521
+ #
522
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
523
+ #
524
+ # @example Basic example
525
+ # require "google/cloud/sql/v1"
526
+ #
527
+ # # Create a client object. The client can be reused for multiple calls.
528
+ # client = Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Client.new
529
+ #
530
+ # # Create a request. To set request fields, pass in keyword arguments.
531
+ # request = Google::Cloud::Sql::V1::WorkloadCapturesStopReplayRequest.new
532
+ #
533
+ # # Call the stop_replay method.
534
+ # result = client.stop_replay request
535
+ #
536
+ # # The returned object is of type Google::Cloud::Sql::V1::Operation.
537
+ # p result
538
+ #
539
+ def stop_replay request, options = nil
540
+ raise ::ArgumentError, "request must be provided" if request.nil?
541
+
542
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::WorkloadCapturesStopReplayRequest
543
+
544
+ # Converts hash and nil to an options object
545
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
546
+
547
+ # Customize the options with defaults
548
+ metadata = @config.rpcs.stop_replay.metadata.to_h
549
+
550
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
551
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
552
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
553
+ gapic_version: ::Google::Cloud::Sql::V1::VERSION
554
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
555
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
556
+
557
+ header_params = {}
558
+ if request.project
559
+ header_params["project"] = request.project
560
+ end
561
+ if request.instance
562
+ header_params["instance"] = request.instance
563
+ end
564
+
565
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
566
+ metadata[:"x-goog-request-params"] ||= request_params_header
567
+
568
+ options.apply_defaults timeout: @config.rpcs.stop_replay.timeout,
569
+ metadata: metadata,
570
+ retry_policy: @config.rpcs.stop_replay.retry_policy
571
+
572
+ options.apply_defaults timeout: @config.timeout,
573
+ metadata: @config.metadata,
574
+ retry_policy: @config.retry_policy
575
+
576
+ @sql_workload_captures_service_stub.call_rpc :stop_replay, request, options: options do |response, operation|
577
+ yield response, operation if block_given?
578
+ end
579
+ rescue ::GRPC::BadStatus => e
580
+ raise ::Google::Cloud::Error.from_error(e)
581
+ end
582
+
583
+ ##
584
+ # Lists all captured workloads associated with the instance.
585
+ #
586
+ # @overload list(request, options = nil)
587
+ # Pass arguments to `list` via a request object, either of type
588
+ # {::Google::Cloud::Sql::V1::SqlWorkloadCapturesListRequest} or an equivalent Hash.
589
+ #
590
+ # @param request [::Google::Cloud::Sql::V1::SqlWorkloadCapturesListRequest, ::Hash]
591
+ # A request object representing the call parameters. Required. To specify no
592
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
593
+ # @param options [::Gapic::CallOptions, ::Hash]
594
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
595
+ #
596
+ # @overload list(project: nil, instance: nil)
597
+ # Pass arguments to `list` via keyword arguments. Note that at
598
+ # least one keyword argument is required. To specify no parameters, or to keep all
599
+ # the default parameter values, pass an empty Hash as a request object (see above).
600
+ #
601
+ # @param project [::String]
602
+ # Required. Project ID of the project that contains the instance.
603
+ # @param instance [::String]
604
+ # Required. Cloud SQL instance ID. This does not include the project ID.
605
+ #
606
+ # @yield [response, operation] Access the result along with the RPC operation
607
+ # @yieldparam response [::Google::Cloud::Sql::V1::WorkloadCapturesListResponse]
608
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
609
+ #
610
+ # @return [::Google::Cloud::Sql::V1::WorkloadCapturesListResponse]
611
+ #
612
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
613
+ #
614
+ # @example Basic example
615
+ # require "google/cloud/sql/v1"
616
+ #
617
+ # # Create a client object. The client can be reused for multiple calls.
618
+ # client = Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Client.new
619
+ #
620
+ # # Create a request. To set request fields, pass in keyword arguments.
621
+ # request = Google::Cloud::Sql::V1::SqlWorkloadCapturesListRequest.new
622
+ #
623
+ # # Call the list method.
624
+ # result = client.list request
625
+ #
626
+ # # The returned object is of type Google::Cloud::Sql::V1::WorkloadCapturesListResponse.
627
+ # p result
628
+ #
629
+ def list request, options = nil
630
+ raise ::ArgumentError, "request must be provided" if request.nil?
631
+
632
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlWorkloadCapturesListRequest
633
+
634
+ # Converts hash and nil to an options object
635
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
636
+
637
+ # Customize the options with defaults
638
+ metadata = @config.rpcs.list.metadata.to_h
639
+
640
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
641
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
642
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
643
+ gapic_version: ::Google::Cloud::Sql::V1::VERSION
644
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
645
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
646
+
647
+ header_params = {}
648
+ if request.project
649
+ header_params["project"] = request.project
650
+ end
651
+ if request.instance
652
+ header_params["instance"] = request.instance
653
+ end
654
+
655
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
656
+ metadata[:"x-goog-request-params"] ||= request_params_header
657
+
658
+ options.apply_defaults timeout: @config.rpcs.list.timeout,
659
+ metadata: metadata,
660
+ retry_policy: @config.rpcs.list.retry_policy
661
+
662
+ options.apply_defaults timeout: @config.timeout,
663
+ metadata: @config.metadata,
664
+ retry_policy: @config.retry_policy
665
+
666
+ @sql_workload_captures_service_stub.call_rpc :list, request, options: options do |response, operation|
667
+ yield response, operation if block_given?
668
+ end
669
+ rescue ::GRPC::BadStatus => e
670
+ raise ::Google::Cloud::Error.from_error(e)
671
+ end
672
+
673
+ ##
674
+ # Configuration class for the SqlWorkloadCapturesService API.
675
+ #
676
+ # This class represents the configuration for SqlWorkloadCapturesService,
677
+ # providing control over timeouts, retry behavior, logging, transport
678
+ # parameters, and other low-level controls. Certain parameters can also be
679
+ # applied individually to specific RPCs. See
680
+ # {::Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Client::Configuration::Rpcs}
681
+ # for a list of RPCs that can be configured independently.
682
+ #
683
+ # Configuration can be applied globally to all clients, or to a single client
684
+ # on construction.
685
+ #
686
+ # @example
687
+ #
688
+ # # Modify the global config, setting the timeout for
689
+ # # start to 20 seconds,
690
+ # # and all remaining timeouts to 10 seconds.
691
+ # ::Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Client.configure do |config|
692
+ # config.timeout = 10.0
693
+ # config.rpcs.start.timeout = 20.0
694
+ # end
695
+ #
696
+ # # Apply the above configuration only to a new client.
697
+ # client = ::Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Client.new do |config|
698
+ # config.timeout = 10.0
699
+ # config.rpcs.start.timeout = 20.0
700
+ # end
701
+ #
702
+ # @!attribute [rw] endpoint
703
+ # A custom service endpoint, as a hostname or hostname:port. The default is
704
+ # nil, indicating to use the default endpoint in the current universe domain.
705
+ # @return [::String,nil]
706
+ # @!attribute [rw] credentials
707
+ # Credentials to send with calls. You may provide any of the following types:
708
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
709
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
710
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
711
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
712
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
713
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
714
+ # * (`nil`) indicating no credentials
715
+ #
716
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
717
+ # is deprecated. Providing an unvalidated credential configuration to
718
+ # Google APIs can compromise the security of your systems and data.
719
+ #
720
+ # @example
721
+ #
722
+ # # The recommended way to provide credentials is to use the `make_creds` method
723
+ # # on the appropriate credentials class for your environment.
724
+ #
725
+ # require "googleauth"
726
+ #
727
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
728
+ # json_key_io: ::File.open("/path/to/keyfile.json")
729
+ # )
730
+ #
731
+ # client = ::Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Client.new do |config|
732
+ # config.credentials = credentials
733
+ # end
734
+ #
735
+ # @note Warning: If you accept a credential configuration (JSON file or Hash) from an
736
+ # external source for authentication to Google Cloud, you must validate it before
737
+ # providing it to a Google API client library. Providing an unvalidated credential
738
+ # configuration to Google APIs can compromise the security of your systems and data.
739
+ # For more information, refer to [Validate credential configurations from external
740
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
741
+ # @return [::Object]
742
+ # @!attribute [rw] scope
743
+ # The OAuth scopes
744
+ # @return [::Array<::String>]
745
+ # @!attribute [rw] lib_name
746
+ # The library name as recorded in instrumentation and logging
747
+ # @return [::String]
748
+ # @!attribute [rw] lib_version
749
+ # The library version as recorded in instrumentation and logging
750
+ # @return [::String]
751
+ # @!attribute [rw] channel_args
752
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
753
+ # `GRPC::Core::Channel` object is provided as the credential.
754
+ # @return [::Hash]
755
+ # @!attribute [rw] interceptors
756
+ # An array of interceptors that are run before calls are executed.
757
+ # @return [::Array<::GRPC::ClientInterceptor>]
758
+ # @!attribute [rw] timeout
759
+ # The call timeout in seconds.
760
+ # @return [::Numeric]
761
+ # @!attribute [rw] metadata
762
+ # Additional gRPC headers to be sent with the call.
763
+ # @return [::Hash{::Symbol=>::String}]
764
+ # @!attribute [rw] retry_policy
765
+ # The retry policy. The value is a hash with the following keys:
766
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
767
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
768
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
769
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
770
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
771
+ # trigger a retry.
772
+ # @return [::Hash]
773
+ # @!attribute [rw] quota_project
774
+ # A separate project against which to charge quota.
775
+ # @return [::String]
776
+ # @!attribute [rw] universe_domain
777
+ # The universe domain within which to make requests. This determines the
778
+ # default endpoint URL. The default value of nil uses the environment
779
+ # universe (usually the default "googleapis.com" universe).
780
+ # @return [::String,nil]
781
+ # @!attribute [rw] logger
782
+ # A custom logger to use for request/response debug logging, or the value
783
+ # `:default` (the default) to construct a default logger, or `nil` to
784
+ # explicitly disable logging.
785
+ # @return [::Logger,:default,nil]
786
+ #
787
+ class Configuration
788
+ extend ::Gapic::Config
789
+
790
+ # @private
791
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
792
+ DEFAULT_ENDPOINT = "sqladmin.googleapis.com"
793
+
794
+ config_attr :endpoint, nil, ::String, nil
795
+ config_attr :credentials, nil do |value|
796
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
797
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
798
+ allowed.any? { |klass| klass === value }
799
+ end
800
+ config_attr :scope, nil, ::String, ::Array, nil
801
+ config_attr :lib_name, nil, ::String, nil
802
+ config_attr :lib_version, nil, ::String, nil
803
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
804
+ config_attr :interceptors, nil, ::Array, nil
805
+ config_attr :timeout, nil, ::Numeric, nil
806
+ config_attr :metadata, nil, ::Hash, nil
807
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
808
+ config_attr :quota_project, nil, ::String, nil
809
+ config_attr :universe_domain, nil, ::String, nil
810
+ config_attr :logger, :default, ::Logger, nil, :default
811
+
812
+ # @private
813
+ def initialize parent_config = nil
814
+ @parent_config = parent_config unless parent_config.nil?
815
+
816
+ yield self if block_given?
817
+ end
818
+
819
+ ##
820
+ # Configurations for individual RPCs
821
+ # @return [Rpcs]
822
+ #
823
+ def rpcs
824
+ @rpcs ||= begin
825
+ parent_rpcs = nil
826
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
827
+ Rpcs.new parent_rpcs
828
+ end
829
+ end
830
+
831
+ ##
832
+ # Configuration for the channel pool
833
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
834
+ #
835
+ def channel_pool
836
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
837
+ end
838
+
839
+ ##
840
+ # Configuration RPC class for the SqlWorkloadCapturesService API.
841
+ #
842
+ # Includes fields providing the configuration for each RPC in this service.
843
+ # Each configuration object is of type `Gapic::Config::Method` and includes
844
+ # the following configuration fields:
845
+ #
846
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
847
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
848
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
849
+ # include the following keys:
850
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
851
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
852
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
853
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
854
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
855
+ # trigger a retry.
856
+ #
857
+ class Rpcs
858
+ ##
859
+ # RPC-specific configuration for `start`
860
+ # @return [::Gapic::Config::Method]
861
+ #
862
+ attr_reader :start
863
+ ##
864
+ # RPC-specific configuration for `stop`
865
+ # @return [::Gapic::Config::Method]
866
+ #
867
+ attr_reader :stop
868
+ ##
869
+ # RPC-specific configuration for `start_replay`
870
+ # @return [::Gapic::Config::Method]
871
+ #
872
+ attr_reader :start_replay
873
+ ##
874
+ # RPC-specific configuration for `stop_replay`
875
+ # @return [::Gapic::Config::Method]
876
+ #
877
+ attr_reader :stop_replay
878
+ ##
879
+ # RPC-specific configuration for `list`
880
+ # @return [::Gapic::Config::Method]
881
+ #
882
+ attr_reader :list
883
+
884
+ # @private
885
+ def initialize parent_rpcs = nil
886
+ start_config = parent_rpcs.start if parent_rpcs.respond_to? :start
887
+ @start = ::Gapic::Config::Method.new start_config
888
+ stop_config = parent_rpcs.stop if parent_rpcs.respond_to? :stop
889
+ @stop = ::Gapic::Config::Method.new stop_config
890
+ start_replay_config = parent_rpcs.start_replay if parent_rpcs.respond_to? :start_replay
891
+ @start_replay = ::Gapic::Config::Method.new start_replay_config
892
+ stop_replay_config = parent_rpcs.stop_replay if parent_rpcs.respond_to? :stop_replay
893
+ @stop_replay = ::Gapic::Config::Method.new stop_replay_config
894
+ list_config = parent_rpcs.list if parent_rpcs.respond_to? :list
895
+ @list = ::Gapic::Config::Method.new list_config
896
+
897
+ yield self if block_given?
898
+ end
899
+ end
900
+ end
901
+ end
902
+ end
903
+ end
904
+ end
905
+ end
906
+ end