google-cloud-sql-v1 0.2.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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +4 -4
  3. data/README.md +9 -2
  4. data/lib/google/cloud/sql/v1/blue_green_deployments_service/client.rb +899 -0
  5. data/lib/google/cloud/sql/v1/blue_green_deployments_service/credentials.rb +48 -0
  6. data/lib/google/cloud/sql/v1/blue_green_deployments_service/paths.rb +86 -0
  7. data/lib/google/cloud/sql/v1/blue_green_deployments_service/rest/client.rb +821 -0
  8. data/lib/google/cloud/sql/v1/blue_green_deployments_service/rest/service_stub.rb +388 -0
  9. data/lib/google/cloud/sql/v1/blue_green_deployments_service/rest.rb +52 -0
  10. data/lib/google/cloud/sql/v1/blue_green_deployments_service.rb +55 -0
  11. data/lib/google/cloud/sql/v1/cloud_sql_backups_pb.rb +1 -1
  12. data/lib/google/cloud/sql/v1/cloud_sql_blue_green_deployments_pb.rb +45 -0
  13. data/lib/google/cloud/sql/v1/cloud_sql_blue_green_deployments_services_pb.rb +54 -0
  14. data/lib/google/cloud/sql/v1/cloud_sql_databases_pb.rb +2 -1
  15. data/lib/google/cloud/sql/v1/cloud_sql_instances_pb.rb +7 -1
  16. data/lib/google/cloud/sql/v1/cloud_sql_operations_pb.rb +1 -1
  17. data/lib/google/cloud/sql/v1/cloud_sql_resources_pb.rb +5 -1
  18. data/lib/google/cloud/sql/v1/cloud_sql_ssl_certs_pb.rb +2 -1
  19. data/lib/google/cloud/sql/v1/cloud_sql_users_pb.rb +1 -1
  20. data/lib/google/cloud/sql/v1/cloud_sql_workload_captures_pb.rb +35 -0
  21. data/lib/google/cloud/sql/v1/cloud_sql_workload_captures_services_pb.rb +60 -0
  22. data/lib/google/cloud/sql/v1/rest.rb +2 -0
  23. data/lib/google/cloud/sql/v1/sql_backup_runs_service/client.rb +2 -0
  24. data/lib/google/cloud/sql/v1/sql_backup_runs_service/paths.rb +77 -0
  25. data/lib/google/cloud/sql/v1/sql_backup_runs_service/rest/client.rb +2 -0
  26. data/lib/google/cloud/sql/v1/sql_backup_runs_service/rest.rb +1 -0
  27. data/lib/google/cloud/sql/v1/sql_backup_runs_service.rb +1 -0
  28. data/lib/google/cloud/sql/v1/sql_backups_service/paths.rb +63 -0
  29. data/lib/google/cloud/sql/v1/sql_databases_service/client.rb +18 -6
  30. data/lib/google/cloud/sql/v1/sql_databases_service/rest/client.rb +18 -6
  31. data/lib/google/cloud/sql/v1/sql_instances_service/client.rb +131 -44
  32. data/lib/google/cloud/sql/v1/sql_instances_service/paths.rb +108 -0
  33. data/lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb +126 -42
  34. data/lib/google/cloud/sql/v1/sql_operations_service/client.rb +9 -3
  35. data/lib/google/cloud/sql/v1/sql_operations_service/rest/client.rb +9 -3
  36. data/lib/google/cloud/sql/v1/sql_users_service/client.rb +23 -5
  37. data/lib/google/cloud/sql/v1/sql_users_service/rest/client.rb +23 -5
  38. data/lib/google/cloud/sql/v1/sql_workload_captures_service/client.rb +906 -0
  39. data/lib/google/cloud/sql/v1/sql_workload_captures_service/credentials.rb +48 -0
  40. data/lib/google/cloud/sql/v1/sql_workload_captures_service/rest/client.rb +810 -0
  41. data/lib/google/cloud/sql/v1/sql_workload_captures_service/rest/service_stub.rb +396 -0
  42. data/lib/google/cloud/sql/v1/sql_workload_captures_service/rest.rb +51 -0
  43. data/lib/google/cloud/sql/v1/sql_workload_captures_service.rb +54 -0
  44. data/lib/google/cloud/sql/v1/version.rb +1 -1
  45. data/lib/google/cloud/sql/v1.rb +2 -6
  46. data/proto_docs/google/api/routing.rb +463 -0
  47. data/proto_docs/google/cloud/sql/v1/cloud_sql_blue_green_deployments.rb +399 -0
  48. data/proto_docs/google/cloud/sql/v1/cloud_sql_databases.rb +15 -0
  49. data/proto_docs/google/cloud/sql/v1/cloud_sql_instances.rb +248 -2
  50. data/proto_docs/google/cloud/sql/v1/cloud_sql_operations.rb +9 -0
  51. data/proto_docs/google/cloud/sql/v1/cloud_sql_resources.rb +116 -3
  52. data/proto_docs/google/cloud/sql/v1/cloud_sql_users.rb +32 -4
  53. data/proto_docs/google/cloud/sql/v1/cloud_sql_workload_captures.rb +170 -0
  54. data/proto_docs/google/protobuf/timestamp.rb +7 -6
  55. metadata +24 -3
@@ -0,0 +1,810 @@
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/sql/v1/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 V1
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::V1::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::V1::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", "V1"]
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::V1::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::V1::SqlWorkloadCapturesService::Rest::Client.new
116
+ #
117
+ # # Create a client using a custom configuration
118
+ # client = ::Google::Cloud::Sql::V1::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::V1::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::V1::WorkloadCapturesStartRequest} or an equivalent Hash.
203
+ #
204
+ # @param request [::Google::Cloud::Sql::V1::WorkloadCapturesStartRequest, ::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::V1::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::V1::Operation]
223
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
224
+ #
225
+ # @return [::Google::Cloud::Sql::V1::Operation]
226
+ #
227
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
228
+ #
229
+ # @example Basic example
230
+ # require "google/cloud/sql/v1"
231
+ #
232
+ # # Create a client object. The client can be reused for multiple calls.
233
+ # client = Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Rest::Client.new
234
+ #
235
+ # # Create a request. To set request fields, pass in keyword arguments.
236
+ # request = Google::Cloud::Sql::V1::WorkloadCapturesStartRequest.new
237
+ #
238
+ # # Call the start method.
239
+ # result = client.start request
240
+ #
241
+ # # The returned object is of type Google::Cloud::Sql::V1::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::V1::WorkloadCapturesStartRequest
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::V1::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::V1::WorkloadCapturesStopRequest} or an equivalent Hash.
286
+ #
287
+ # @param request [::Google::Cloud::Sql::V1::WorkloadCapturesStopRequest, ::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::V1::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::V1::Operation]
306
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
307
+ #
308
+ # @return [::Google::Cloud::Sql::V1::Operation]
309
+ #
310
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
311
+ #
312
+ # @example Basic example
313
+ # require "google/cloud/sql/v1"
314
+ #
315
+ # # Create a client object. The client can be reused for multiple calls.
316
+ # client = Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Rest::Client.new
317
+ #
318
+ # # Create a request. To set request fields, pass in keyword arguments.
319
+ # request = Google::Cloud::Sql::V1::WorkloadCapturesStopRequest.new
320
+ #
321
+ # # Call the stop method.
322
+ # result = client.stop request
323
+ #
324
+ # # The returned object is of type Google::Cloud::Sql::V1::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::V1::WorkloadCapturesStopRequest
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::V1::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::V1::WorkloadCapturesStartReplayRequest} or an equivalent Hash.
370
+ #
371
+ # @param request [::Google::Cloud::Sql::V1::WorkloadCapturesStartReplayRequest, ::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::V1::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::V1::Operation]
392
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
393
+ #
394
+ # @return [::Google::Cloud::Sql::V1::Operation]
395
+ #
396
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
397
+ #
398
+ # @example Basic example
399
+ # require "google/cloud/sql/v1"
400
+ #
401
+ # # Create a client object. The client can be reused for multiple calls.
402
+ # client = Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Rest::Client.new
403
+ #
404
+ # # Create a request. To set request fields, pass in keyword arguments.
405
+ # request = Google::Cloud::Sql::V1::WorkloadCapturesStartReplayRequest.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::V1::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::V1::WorkloadCapturesStartReplayRequest
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::V1::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::V1::WorkloadCapturesStopReplayRequest} or an equivalent Hash.
454
+ #
455
+ # @param request [::Google::Cloud::Sql::V1::WorkloadCapturesStopReplayRequest, ::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::V1::StopWorkloadReplayContext, ::Hash]
473
+ # Optional. Contains details about the stop workload replay operation. If
474
+ # omitted, default values are used.
475
+ # @yield [result, operation] Access the result along with the TransportOperation object
476
+ # @yieldparam result [::Google::Cloud::Sql::V1::Operation]
477
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
478
+ #
479
+ # @return [::Google::Cloud::Sql::V1::Operation]
480
+ #
481
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
482
+ #
483
+ # @example Basic example
484
+ # require "google/cloud/sql/v1"
485
+ #
486
+ # # Create a client object. The client can be reused for multiple calls.
487
+ # client = Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Rest::Client.new
488
+ #
489
+ # # Create a request. To set request fields, pass in keyword arguments.
490
+ # request = Google::Cloud::Sql::V1::WorkloadCapturesStopReplayRequest.new
491
+ #
492
+ # # Call the stop_replay method.
493
+ # result = client.stop_replay request
494
+ #
495
+ # # The returned object is of type Google::Cloud::Sql::V1::Operation.
496
+ # p result
497
+ #
498
+ def stop_replay request, options = nil
499
+ raise ::ArgumentError, "request must be provided" if request.nil?
500
+
501
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::WorkloadCapturesStopReplayRequest
502
+
503
+ # Converts hash and nil to an options object
504
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
505
+
506
+ # Customize the options with defaults
507
+ call_metadata = @config.rpcs.stop_replay.metadata.to_h
508
+
509
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
510
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
511
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
512
+ gapic_version: ::Google::Cloud::Sql::V1::VERSION,
513
+ transports_version_send: [:rest]
514
+
515
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
516
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
517
+
518
+ options.apply_defaults timeout: @config.rpcs.stop_replay.timeout,
519
+ metadata: call_metadata,
520
+ retry_policy: @config.rpcs.stop_replay.retry_policy
521
+
522
+ options.apply_defaults timeout: @config.timeout,
523
+ metadata: @config.metadata,
524
+ retry_policy: @config.retry_policy
525
+
526
+ @sql_workload_captures_service_stub.stop_replay request, options do |result, operation|
527
+ yield result, operation if block_given?
528
+ end
529
+ rescue ::Gapic::Rest::Error => e
530
+ raise ::Google::Cloud::Error.from_error(e)
531
+ end
532
+
533
+ ##
534
+ # Lists all captured workloads associated with the instance.
535
+ #
536
+ # @overload list(request, options = nil)
537
+ # Pass arguments to `list` via a request object, either of type
538
+ # {::Google::Cloud::Sql::V1::SqlWorkloadCapturesListRequest} or an equivalent Hash.
539
+ #
540
+ # @param request [::Google::Cloud::Sql::V1::SqlWorkloadCapturesListRequest, ::Hash]
541
+ # A request object representing the call parameters. Required. To specify no
542
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
543
+ # @param options [::Gapic::CallOptions, ::Hash]
544
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
545
+ #
546
+ # @overload list(project: nil, instance: nil)
547
+ # Pass arguments to `list` via keyword arguments. Note that at
548
+ # least one keyword argument is required. To specify no parameters, or to keep all
549
+ # the default parameter values, pass an empty Hash as a request object (see above).
550
+ #
551
+ # @param project [::String]
552
+ # Required. Project ID of the project that contains the instance.
553
+ # @param instance [::String]
554
+ # Required. Cloud SQL instance ID. This does not include the project ID.
555
+ # @yield [result, operation] Access the result along with the TransportOperation object
556
+ # @yieldparam result [::Google::Cloud::Sql::V1::WorkloadCapturesListResponse]
557
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
558
+ #
559
+ # @return [::Google::Cloud::Sql::V1::WorkloadCapturesListResponse]
560
+ #
561
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
562
+ #
563
+ # @example Basic example
564
+ # require "google/cloud/sql/v1"
565
+ #
566
+ # # Create a client object. The client can be reused for multiple calls.
567
+ # client = Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Rest::Client.new
568
+ #
569
+ # # Create a request. To set request fields, pass in keyword arguments.
570
+ # request = Google::Cloud::Sql::V1::SqlWorkloadCapturesListRequest.new
571
+ #
572
+ # # Call the list method.
573
+ # result = client.list request
574
+ #
575
+ # # The returned object is of type Google::Cloud::Sql::V1::WorkloadCapturesListResponse.
576
+ # p result
577
+ #
578
+ def list request, options = nil
579
+ raise ::ArgumentError, "request must be provided" if request.nil?
580
+
581
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlWorkloadCapturesListRequest
582
+
583
+ # Converts hash and nil to an options object
584
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
585
+
586
+ # Customize the options with defaults
587
+ call_metadata = @config.rpcs.list.metadata.to_h
588
+
589
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
590
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
591
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
592
+ gapic_version: ::Google::Cloud::Sql::V1::VERSION,
593
+ transports_version_send: [:rest]
594
+
595
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
596
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
597
+
598
+ options.apply_defaults timeout: @config.rpcs.list.timeout,
599
+ metadata: call_metadata,
600
+ retry_policy: @config.rpcs.list.retry_policy
601
+
602
+ options.apply_defaults timeout: @config.timeout,
603
+ metadata: @config.metadata,
604
+ retry_policy: @config.retry_policy
605
+
606
+ @sql_workload_captures_service_stub.list request, options do |result, operation|
607
+ yield result, operation if block_given?
608
+ end
609
+ rescue ::Gapic::Rest::Error => e
610
+ raise ::Google::Cloud::Error.from_error(e)
611
+ end
612
+
613
+ ##
614
+ # Configuration class for the SqlWorkloadCapturesService REST API.
615
+ #
616
+ # This class represents the configuration for SqlWorkloadCapturesService REST,
617
+ # providing control over timeouts, retry behavior, logging, transport
618
+ # parameters, and other low-level controls. Certain parameters can also be
619
+ # applied individually to specific RPCs. See
620
+ # {::Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Rest::Client::Configuration::Rpcs}
621
+ # for a list of RPCs that can be configured independently.
622
+ #
623
+ # Configuration can be applied globally to all clients, or to a single client
624
+ # on construction.
625
+ #
626
+ # @example
627
+ #
628
+ # # Modify the global config, setting the timeout for
629
+ # # start to 20 seconds,
630
+ # # and all remaining timeouts to 10 seconds.
631
+ # ::Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Rest::Client.configure do |config|
632
+ # config.timeout = 10.0
633
+ # config.rpcs.start.timeout = 20.0
634
+ # end
635
+ #
636
+ # # Apply the above configuration only to a new client.
637
+ # client = ::Google::Cloud::Sql::V1::SqlWorkloadCapturesService::Rest::Client.new do |config|
638
+ # config.timeout = 10.0
639
+ # config.rpcs.start.timeout = 20.0
640
+ # end
641
+ #
642
+ # @!attribute [rw] endpoint
643
+ # A custom service endpoint, as a hostname or hostname:port. The default is
644
+ # nil, indicating to use the default endpoint in the current universe domain.
645
+ # @return [::String,nil]
646
+ # @!attribute [rw] credentials
647
+ # Credentials to send with calls. You may provide any of the following types:
648
+ # * (`String`) The path to a service account key file in JSON format
649
+ # * (`Hash`) A service account key as a Hash
650
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
651
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
652
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
653
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
654
+ # * (`nil`) indicating no credentials
655
+ #
656
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
657
+ # external source for authentication to Google Cloud, you must validate it before
658
+ # providing it to a Google API client library. Providing an unvalidated credential
659
+ # configuration to Google APIs can compromise the security of your systems and data.
660
+ # For more information, refer to [Validate credential configurations from external
661
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
662
+ # @return [::Object]
663
+ # @!attribute [rw] scope
664
+ # The OAuth scopes
665
+ # @return [::Array<::String>]
666
+ # @!attribute [rw] lib_name
667
+ # The library name as recorded in instrumentation and logging
668
+ # @return [::String]
669
+ # @!attribute [rw] lib_version
670
+ # The library version as recorded in instrumentation and logging
671
+ # @return [::String]
672
+ # @!attribute [rw] timeout
673
+ # The call timeout in seconds.
674
+ # @return [::Numeric]
675
+ # @!attribute [rw] metadata
676
+ # Additional headers to be sent with the call.
677
+ # @return [::Hash{::Symbol=>::String}]
678
+ # @!attribute [rw] retry_policy
679
+ # The retry policy. The value is a hash with the following keys:
680
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
681
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
682
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
683
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
684
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
685
+ # trigger a retry.
686
+ # @return [::Hash]
687
+ # @!attribute [rw] quota_project
688
+ # A separate project against which to charge quota.
689
+ # @return [::String]
690
+ # @!attribute [rw] universe_domain
691
+ # The universe domain within which to make requests. This determines the
692
+ # default endpoint URL. The default value of nil uses the environment
693
+ # universe (usually the default "googleapis.com" universe).
694
+ # @return [::String,nil]
695
+ # @!attribute [rw] logger
696
+ # A custom logger to use for request/response debug logging, or the value
697
+ # `:default` (the default) to construct a default logger, or `nil` to
698
+ # explicitly disable logging.
699
+ # @return [::Logger,:default,nil]
700
+ #
701
+ class Configuration
702
+ extend ::Gapic::Config
703
+
704
+ # @private
705
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
706
+ DEFAULT_ENDPOINT = "sqladmin.googleapis.com"
707
+
708
+ config_attr :endpoint, nil, ::String, nil
709
+ config_attr :credentials, nil do |value|
710
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
711
+ allowed.any? { |klass| klass === value }
712
+ end
713
+ config_attr :scope, nil, ::String, ::Array, nil
714
+ config_attr :lib_name, nil, ::String, nil
715
+ config_attr :lib_version, nil, ::String, nil
716
+ config_attr :timeout, nil, ::Numeric, nil
717
+ config_attr :metadata, nil, ::Hash, nil
718
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
719
+ config_attr :quota_project, nil, ::String, nil
720
+ config_attr :universe_domain, nil, ::String, nil
721
+ config_attr :logger, :default, ::Logger, nil, :default
722
+
723
+ # @private
724
+ def initialize parent_config = nil
725
+ @parent_config = parent_config unless parent_config.nil?
726
+
727
+ yield self if block_given?
728
+ end
729
+
730
+ ##
731
+ # Configurations for individual RPCs
732
+ # @return [Rpcs]
733
+ #
734
+ def rpcs
735
+ @rpcs ||= begin
736
+ parent_rpcs = nil
737
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
738
+ Rpcs.new parent_rpcs
739
+ end
740
+ end
741
+
742
+ ##
743
+ # Configuration RPC class for the SqlWorkloadCapturesService API.
744
+ #
745
+ # Includes fields providing the configuration for each RPC in this service.
746
+ # Each configuration object is of type `Gapic::Config::Method` and includes
747
+ # the following configuration fields:
748
+ #
749
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
750
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
751
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
752
+ # include the following keys:
753
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
754
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
755
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
756
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
757
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
758
+ # trigger a retry.
759
+ #
760
+ class Rpcs
761
+ ##
762
+ # RPC-specific configuration for `start`
763
+ # @return [::Gapic::Config::Method]
764
+ #
765
+ attr_reader :start
766
+ ##
767
+ # RPC-specific configuration for `stop`
768
+ # @return [::Gapic::Config::Method]
769
+ #
770
+ attr_reader :stop
771
+ ##
772
+ # RPC-specific configuration for `start_replay`
773
+ # @return [::Gapic::Config::Method]
774
+ #
775
+ attr_reader :start_replay
776
+ ##
777
+ # RPC-specific configuration for `stop_replay`
778
+ # @return [::Gapic::Config::Method]
779
+ #
780
+ attr_reader :stop_replay
781
+ ##
782
+ # RPC-specific configuration for `list`
783
+ # @return [::Gapic::Config::Method]
784
+ #
785
+ attr_reader :list
786
+
787
+ # @private
788
+ def initialize parent_rpcs = nil
789
+ start_config = parent_rpcs.start if parent_rpcs.respond_to? :start
790
+ @start = ::Gapic::Config::Method.new start_config
791
+ stop_config = parent_rpcs.stop if parent_rpcs.respond_to? :stop
792
+ @stop = ::Gapic::Config::Method.new stop_config
793
+ start_replay_config = parent_rpcs.start_replay if parent_rpcs.respond_to? :start_replay
794
+ @start_replay = ::Gapic::Config::Method.new start_replay_config
795
+ stop_replay_config = parent_rpcs.stop_replay if parent_rpcs.respond_to? :stop_replay
796
+ @stop_replay = ::Gapic::Config::Method.new stop_replay_config
797
+ list_config = parent_rpcs.list if parent_rpcs.respond_to? :list
798
+ @list = ::Gapic::Config::Method.new list_config
799
+
800
+ yield self if block_given?
801
+ end
802
+ end
803
+ end
804
+ end
805
+ end
806
+ end
807
+ end
808
+ end
809
+ end
810
+ end