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