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,905 @@
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/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Sql
26
+ module V1beta4
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::V1beta4::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::V1beta4::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", "V1beta4"]
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::V1beta4::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::V1beta4::SqlWorkloadCapturesService::Client.new
114
+ #
115
+ # # Create a client using a custom configuration
116
+ # client = ::Google::Cloud::Sql::V1beta4::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/v1beta4/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::V1beta4::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::V1beta4::SqlWorkloadCapturesStartRequest} or an equivalent Hash.
210
+ #
211
+ # @param request [::Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesStartRequest, ::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::V1beta4::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::V1beta4::Operation]
231
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
232
+ #
233
+ # @return [::Google::Cloud::Sql::V1beta4::Operation]
234
+ #
235
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
236
+ #
237
+ # @example Basic example
238
+ # require "google/cloud/sql/v1beta4"
239
+ #
240
+ # # Create a client object. The client can be reused for multiple calls.
241
+ # client = Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesService::Client.new
242
+ #
243
+ # # Create a request. To set request fields, pass in keyword arguments.
244
+ # request = Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesStartRequest.new
245
+ #
246
+ # # Call the start method.
247
+ # result = client.start request
248
+ #
249
+ # # The returned object is of type Google::Cloud::Sql::V1beta4::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::V1beta4::SqlWorkloadCapturesStartRequest
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::V1beta4::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::V1beta4::SqlWorkloadCapturesStopRequest} or an equivalent Hash.
303
+ #
304
+ # @param request [::Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesStopRequest, ::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::V1beta4::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::V1beta4::Operation]
324
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
325
+ #
326
+ # @return [::Google::Cloud::Sql::V1beta4::Operation]
327
+ #
328
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
329
+ #
330
+ # @example Basic example
331
+ # require "google/cloud/sql/v1beta4"
332
+ #
333
+ # # Create a client object. The client can be reused for multiple calls.
334
+ # client = Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesService::Client.new
335
+ #
336
+ # # Create a request. To set request fields, pass in keyword arguments.
337
+ # request = Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesStopRequest.new
338
+ #
339
+ # # Call the stop method.
340
+ # result = client.stop request
341
+ #
342
+ # # The returned object is of type Google::Cloud::Sql::V1beta4::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::V1beta4::SqlWorkloadCapturesStopRequest
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::V1beta4::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::V1beta4::SqlWorkloadCapturesStartReplayRequest} or an equivalent Hash.
397
+ #
398
+ # @param request [::Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesStartReplayRequest, ::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::V1beta4::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::V1beta4::Operation]
420
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
421
+ #
422
+ # @return [::Google::Cloud::Sql::V1beta4::Operation]
423
+ #
424
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
425
+ #
426
+ # @example Basic example
427
+ # require "google/cloud/sql/v1beta4"
428
+ #
429
+ # # Create a client object. The client can be reused for multiple calls.
430
+ # client = Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesService::Client.new
431
+ #
432
+ # # Create a request. To set request fields, pass in keyword arguments.
433
+ # request = Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesStartReplayRequest.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::V1beta4::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::V1beta4::SqlWorkloadCapturesStartReplayRequest
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::V1beta4::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::V1beta4::SqlWorkloadCapturesStopReplayRequest} or an equivalent Hash.
494
+ #
495
+ # @param request [::Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesStopReplayRequest, ::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::V1beta4::StopWorkloadReplayContext, ::Hash]
513
+ # Optional. Contains details about the stop workload replay operation.
514
+ #
515
+ # @yield [response, operation] Access the result along with the RPC operation
516
+ # @yieldparam response [::Google::Cloud::Sql::V1beta4::Operation]
517
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
518
+ #
519
+ # @return [::Google::Cloud::Sql::V1beta4::Operation]
520
+ #
521
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
522
+ #
523
+ # @example Basic example
524
+ # require "google/cloud/sql/v1beta4"
525
+ #
526
+ # # Create a client object. The client can be reused for multiple calls.
527
+ # client = Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesService::Client.new
528
+ #
529
+ # # Create a request. To set request fields, pass in keyword arguments.
530
+ # request = Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesStopReplayRequest.new
531
+ #
532
+ # # Call the stop_replay method.
533
+ # result = client.stop_replay request
534
+ #
535
+ # # The returned object is of type Google::Cloud::Sql::V1beta4::Operation.
536
+ # p result
537
+ #
538
+ def stop_replay request, options = nil
539
+ raise ::ArgumentError, "request must be provided" if request.nil?
540
+
541
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesStopReplayRequest
542
+
543
+ # Converts hash and nil to an options object
544
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
545
+
546
+ # Customize the options with defaults
547
+ metadata = @config.rpcs.stop_replay.metadata.to_h
548
+
549
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
550
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
551
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
552
+ gapic_version: ::Google::Cloud::Sql::V1beta4::VERSION
553
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
554
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
555
+
556
+ header_params = {}
557
+ if request.project
558
+ header_params["project"] = request.project
559
+ end
560
+ if request.instance
561
+ header_params["instance"] = request.instance
562
+ end
563
+
564
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
565
+ metadata[:"x-goog-request-params"] ||= request_params_header
566
+
567
+ options.apply_defaults timeout: @config.rpcs.stop_replay.timeout,
568
+ metadata: metadata,
569
+ retry_policy: @config.rpcs.stop_replay.retry_policy
570
+
571
+ options.apply_defaults timeout: @config.timeout,
572
+ metadata: @config.metadata,
573
+ retry_policy: @config.retry_policy
574
+
575
+ @sql_workload_captures_service_stub.call_rpc :stop_replay, request, options: options do |response, operation|
576
+ yield response, operation if block_given?
577
+ end
578
+ rescue ::GRPC::BadStatus => e
579
+ raise ::Google::Cloud::Error.from_error(e)
580
+ end
581
+
582
+ ##
583
+ # Lists all captured workloads associated with the instance.
584
+ #
585
+ # @overload list(request, options = nil)
586
+ # Pass arguments to `list` via a request object, either of type
587
+ # {::Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesListRequest} or an equivalent Hash.
588
+ #
589
+ # @param request [::Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesListRequest, ::Hash]
590
+ # A request object representing the call parameters. Required. To specify no
591
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
592
+ # @param options [::Gapic::CallOptions, ::Hash]
593
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
594
+ #
595
+ # @overload list(project: nil, instance: nil)
596
+ # Pass arguments to `list` via keyword arguments. Note that at
597
+ # least one keyword argument is required. To specify no parameters, or to keep all
598
+ # the default parameter values, pass an empty Hash as a request object (see above).
599
+ #
600
+ # @param project [::String]
601
+ # Required. Project ID of the project that contains the instance.
602
+ # @param instance [::String]
603
+ # Required. Cloud SQL instance ID. This does not include the project ID.
604
+ #
605
+ # @yield [response, operation] Access the result along with the RPC operation
606
+ # @yieldparam response [::Google::Cloud::Sql::V1beta4::WorkloadCapturesListResponse]
607
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
608
+ #
609
+ # @return [::Google::Cloud::Sql::V1beta4::WorkloadCapturesListResponse]
610
+ #
611
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
612
+ #
613
+ # @example Basic example
614
+ # require "google/cloud/sql/v1beta4"
615
+ #
616
+ # # Create a client object. The client can be reused for multiple calls.
617
+ # client = Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesService::Client.new
618
+ #
619
+ # # Create a request. To set request fields, pass in keyword arguments.
620
+ # request = Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesListRequest.new
621
+ #
622
+ # # Call the list method.
623
+ # result = client.list request
624
+ #
625
+ # # The returned object is of type Google::Cloud::Sql::V1beta4::WorkloadCapturesListResponse.
626
+ # p result
627
+ #
628
+ def list request, options = nil
629
+ raise ::ArgumentError, "request must be provided" if request.nil?
630
+
631
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesListRequest
632
+
633
+ # Converts hash and nil to an options object
634
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
635
+
636
+ # Customize the options with defaults
637
+ metadata = @config.rpcs.list.metadata.to_h
638
+
639
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
640
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
641
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
642
+ gapic_version: ::Google::Cloud::Sql::V1beta4::VERSION
643
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
644
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
645
+
646
+ header_params = {}
647
+ if request.project
648
+ header_params["project"] = request.project
649
+ end
650
+ if request.instance
651
+ header_params["instance"] = request.instance
652
+ end
653
+
654
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
655
+ metadata[:"x-goog-request-params"] ||= request_params_header
656
+
657
+ options.apply_defaults timeout: @config.rpcs.list.timeout,
658
+ metadata: metadata,
659
+ retry_policy: @config.rpcs.list.retry_policy
660
+
661
+ options.apply_defaults timeout: @config.timeout,
662
+ metadata: @config.metadata,
663
+ retry_policy: @config.retry_policy
664
+
665
+ @sql_workload_captures_service_stub.call_rpc :list, request, options: options do |response, operation|
666
+ yield response, operation if block_given?
667
+ end
668
+ rescue ::GRPC::BadStatus => e
669
+ raise ::Google::Cloud::Error.from_error(e)
670
+ end
671
+
672
+ ##
673
+ # Configuration class for the SqlWorkloadCapturesService API.
674
+ #
675
+ # This class represents the configuration for SqlWorkloadCapturesService,
676
+ # providing control over timeouts, retry behavior, logging, transport
677
+ # parameters, and other low-level controls. Certain parameters can also be
678
+ # applied individually to specific RPCs. See
679
+ # {::Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesService::Client::Configuration::Rpcs}
680
+ # for a list of RPCs that can be configured independently.
681
+ #
682
+ # Configuration can be applied globally to all clients, or to a single client
683
+ # on construction.
684
+ #
685
+ # @example
686
+ #
687
+ # # Modify the global config, setting the timeout for
688
+ # # start to 20 seconds,
689
+ # # and all remaining timeouts to 10 seconds.
690
+ # ::Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesService::Client.configure do |config|
691
+ # config.timeout = 10.0
692
+ # config.rpcs.start.timeout = 20.0
693
+ # end
694
+ #
695
+ # # Apply the above configuration only to a new client.
696
+ # client = ::Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesService::Client.new do |config|
697
+ # config.timeout = 10.0
698
+ # config.rpcs.start.timeout = 20.0
699
+ # end
700
+ #
701
+ # @!attribute [rw] endpoint
702
+ # A custom service endpoint, as a hostname or hostname:port. The default is
703
+ # nil, indicating to use the default endpoint in the current universe domain.
704
+ # @return [::String,nil]
705
+ # @!attribute [rw] credentials
706
+ # Credentials to send with calls. You may provide any of the following types:
707
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
708
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
709
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
710
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
711
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
712
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
713
+ # * (`nil`) indicating no credentials
714
+ #
715
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
716
+ # is deprecated. Providing an unvalidated credential configuration to
717
+ # Google APIs can compromise the security of your systems and data.
718
+ #
719
+ # @example
720
+ #
721
+ # # The recommended way to provide credentials is to use the `make_creds` method
722
+ # # on the appropriate credentials class for your environment.
723
+ #
724
+ # require "googleauth"
725
+ #
726
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
727
+ # json_key_io: ::File.open("/path/to/keyfile.json")
728
+ # )
729
+ #
730
+ # client = ::Google::Cloud::Sql::V1beta4::SqlWorkloadCapturesService::Client.new do |config|
731
+ # config.credentials = credentials
732
+ # end
733
+ #
734
+ # @note Warning: If you accept a credential configuration (JSON file or Hash) from an
735
+ # external source for authentication to Google Cloud, you must validate it before
736
+ # providing it to a Google API client library. Providing an unvalidated credential
737
+ # configuration to Google APIs can compromise the security of your systems and data.
738
+ # For more information, refer to [Validate credential configurations from external
739
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
740
+ # @return [::Object]
741
+ # @!attribute [rw] scope
742
+ # The OAuth scopes
743
+ # @return [::Array<::String>]
744
+ # @!attribute [rw] lib_name
745
+ # The library name as recorded in instrumentation and logging
746
+ # @return [::String]
747
+ # @!attribute [rw] lib_version
748
+ # The library version as recorded in instrumentation and logging
749
+ # @return [::String]
750
+ # @!attribute [rw] channel_args
751
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
752
+ # `GRPC::Core::Channel` object is provided as the credential.
753
+ # @return [::Hash]
754
+ # @!attribute [rw] interceptors
755
+ # An array of interceptors that are run before calls are executed.
756
+ # @return [::Array<::GRPC::ClientInterceptor>]
757
+ # @!attribute [rw] timeout
758
+ # The call timeout in seconds.
759
+ # @return [::Numeric]
760
+ # @!attribute [rw] metadata
761
+ # Additional gRPC headers to be sent with the call.
762
+ # @return [::Hash{::Symbol=>::String}]
763
+ # @!attribute [rw] retry_policy
764
+ # The retry policy. The value is a hash with the following keys:
765
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
766
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
767
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
768
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
769
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
770
+ # trigger a retry.
771
+ # @return [::Hash]
772
+ # @!attribute [rw] quota_project
773
+ # A separate project against which to charge quota.
774
+ # @return [::String]
775
+ # @!attribute [rw] universe_domain
776
+ # The universe domain within which to make requests. This determines the
777
+ # default endpoint URL. The default value of nil uses the environment
778
+ # universe (usually the default "googleapis.com" universe).
779
+ # @return [::String,nil]
780
+ # @!attribute [rw] logger
781
+ # A custom logger to use for request/response debug logging, or the value
782
+ # `:default` (the default) to construct a default logger, or `nil` to
783
+ # explicitly disable logging.
784
+ # @return [::Logger,:default,nil]
785
+ #
786
+ class Configuration
787
+ extend ::Gapic::Config
788
+
789
+ # @private
790
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
791
+ DEFAULT_ENDPOINT = "sqladmin.googleapis.com"
792
+
793
+ config_attr :endpoint, nil, ::String, nil
794
+ config_attr :credentials, nil do |value|
795
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
796
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
797
+ allowed.any? { |klass| klass === value }
798
+ end
799
+ config_attr :scope, nil, ::String, ::Array, nil
800
+ config_attr :lib_name, nil, ::String, nil
801
+ config_attr :lib_version, nil, ::String, nil
802
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
803
+ config_attr :interceptors, nil, ::Array, nil
804
+ config_attr :timeout, nil, ::Numeric, nil
805
+ config_attr :metadata, nil, ::Hash, nil
806
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
807
+ config_attr :quota_project, nil, ::String, nil
808
+ config_attr :universe_domain, nil, ::String, nil
809
+ config_attr :logger, :default, ::Logger, nil, :default
810
+
811
+ # @private
812
+ def initialize parent_config = nil
813
+ @parent_config = parent_config unless parent_config.nil?
814
+
815
+ yield self if block_given?
816
+ end
817
+
818
+ ##
819
+ # Configurations for individual RPCs
820
+ # @return [Rpcs]
821
+ #
822
+ def rpcs
823
+ @rpcs ||= begin
824
+ parent_rpcs = nil
825
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
826
+ Rpcs.new parent_rpcs
827
+ end
828
+ end
829
+
830
+ ##
831
+ # Configuration for the channel pool
832
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
833
+ #
834
+ def channel_pool
835
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
836
+ end
837
+
838
+ ##
839
+ # Configuration RPC class for the SqlWorkloadCapturesService API.
840
+ #
841
+ # Includes fields providing the configuration for each RPC in this service.
842
+ # Each configuration object is of type `Gapic::Config::Method` and includes
843
+ # the following configuration fields:
844
+ #
845
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
846
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
847
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
848
+ # include the following keys:
849
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
850
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
851
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
852
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
853
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
854
+ # trigger a retry.
855
+ #
856
+ class Rpcs
857
+ ##
858
+ # RPC-specific configuration for `start`
859
+ # @return [::Gapic::Config::Method]
860
+ #
861
+ attr_reader :start
862
+ ##
863
+ # RPC-specific configuration for `stop`
864
+ # @return [::Gapic::Config::Method]
865
+ #
866
+ attr_reader :stop
867
+ ##
868
+ # RPC-specific configuration for `start_replay`
869
+ # @return [::Gapic::Config::Method]
870
+ #
871
+ attr_reader :start_replay
872
+ ##
873
+ # RPC-specific configuration for `stop_replay`
874
+ # @return [::Gapic::Config::Method]
875
+ #
876
+ attr_reader :stop_replay
877
+ ##
878
+ # RPC-specific configuration for `list`
879
+ # @return [::Gapic::Config::Method]
880
+ #
881
+ attr_reader :list
882
+
883
+ # @private
884
+ def initialize parent_rpcs = nil
885
+ start_config = parent_rpcs.start if parent_rpcs.respond_to? :start
886
+ @start = ::Gapic::Config::Method.new start_config
887
+ stop_config = parent_rpcs.stop if parent_rpcs.respond_to? :stop
888
+ @stop = ::Gapic::Config::Method.new stop_config
889
+ start_replay_config = parent_rpcs.start_replay if parent_rpcs.respond_to? :start_replay
890
+ @start_replay = ::Gapic::Config::Method.new start_replay_config
891
+ stop_replay_config = parent_rpcs.stop_replay if parent_rpcs.respond_to? :stop_replay
892
+ @stop_replay = ::Gapic::Config::Method.new stop_replay_config
893
+ list_config = parent_rpcs.list if parent_rpcs.respond_to? :list
894
+ @list = ::Gapic::Config::Method.new list_config
895
+
896
+ yield self if block_given?
897
+ end
898
+ end
899
+ end
900
+ end
901
+ end
902
+ end
903
+ end
904
+ end
905
+ end