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