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,828 @@
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_blue_green_deployments_pb"
21
+ require "google/cloud/sql/v1beta4/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 V1beta4
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::V1beta4::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::V1beta4::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", "V1beta4"]
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::V1beta4::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::V1beta4::BlueGreenDeploymentsService::Rest::Client.new
118
+ #
119
+ # # Create a client using a custom configuration
120
+ # client = ::Google::Cloud::Sql::V1beta4::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::V1beta4::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. This
197
+ # deployment provisions a synchronized green environment (target instance)
198
+ # from a blue production environment (source instance), facilitating updates
199
+ # like major version upgrades on the green instance without impacting the
200
+ # blue instance.
201
+ #
202
+ # @overload create_blue_green_deployment(request, options = nil)
203
+ # Pass arguments to `create_blue_green_deployment` via a request object, either of type
204
+ # {::Google::Cloud::Sql::V1beta4::CreateBlueGreenDeploymentRequest} or an equivalent Hash.
205
+ #
206
+ # @param request [::Google::Cloud::Sql::V1beta4::CreateBlueGreenDeploymentRequest, ::Hash]
207
+ # A request object representing the call parameters. Required. To specify no
208
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
209
+ # @param options [::Gapic::CallOptions, ::Hash]
210
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
211
+ #
212
+ # @overload create_blue_green_deployment(parent: nil, blue_green_deployment_id: nil, blue_green_deployment: nil)
213
+ # Pass arguments to `create_blue_green_deployment` via keyword arguments. Note that at
214
+ # least one keyword argument is required. To specify no parameters, or to keep all
215
+ # the default parameter values, pass an empty Hash as a request object (see above).
216
+ #
217
+ # @param parent [::String]
218
+ # Required. The parent resource where this blue-green deployment will be
219
+ # created. Format: projects/\\{project}/locations/\\{location}
220
+ # @param blue_green_deployment_id [::String]
221
+ # Required. The ID to use for the blue-green deployment, which will become
222
+ # the final component of the deployment's resource name.
223
+ # @param blue_green_deployment [::Google::Cloud::Sql::V1beta4::BlueGreenDeployment, ::Hash]
224
+ # Required. The `BlueGreenDeployment` resource to create.
225
+ # @yield [result, operation] Access the result along with the TransportOperation object
226
+ # @yieldparam result [::Google::Cloud::Sql::V1beta4::Operation]
227
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
228
+ #
229
+ # @return [::Google::Cloud::Sql::V1beta4::Operation]
230
+ #
231
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
232
+ #
233
+ # @example Basic example
234
+ # require "google/cloud/sql/v1beta4"
235
+ #
236
+ # # Create a client object. The client can be reused for multiple calls.
237
+ # client = Google::Cloud::Sql::V1beta4::BlueGreenDeploymentsService::Rest::Client.new
238
+ #
239
+ # # Create a request. To set request fields, pass in keyword arguments.
240
+ # request = Google::Cloud::Sql::V1beta4::CreateBlueGreenDeploymentRequest.new
241
+ #
242
+ # # Call the create_blue_green_deployment method.
243
+ # result = client.create_blue_green_deployment request
244
+ #
245
+ # # The returned object is of type Google::Cloud::Sql::V1beta4::Operation.
246
+ # p result
247
+ #
248
+ def create_blue_green_deployment request, options = nil
249
+ raise ::ArgumentError, "request must be provided" if request.nil?
250
+
251
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1beta4::CreateBlueGreenDeploymentRequest
252
+
253
+ # Converts hash and nil to an options object
254
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
255
+
256
+ # Customize the options with defaults
257
+ call_metadata = @config.rpcs.create_blue_green_deployment.metadata.to_h
258
+
259
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
260
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
261
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
262
+ gapic_version: ::Google::Cloud::Sql::V1beta4::VERSION,
263
+ transports_version_send: [:rest]
264
+
265
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
266
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
267
+
268
+ options.apply_defaults timeout: @config.rpcs.create_blue_green_deployment.timeout,
269
+ metadata: call_metadata,
270
+ retry_policy: @config.rpcs.create_blue_green_deployment.retry_policy
271
+
272
+ options.apply_defaults timeout: @config.timeout,
273
+ metadata: @config.metadata,
274
+ retry_policy: @config.retry_policy
275
+
276
+ @blue_green_deployments_service_stub.create_blue_green_deployment request, options do |result, operation|
277
+ yield result, operation if block_given?
278
+ end
279
+ rescue ::Gapic::Rest::Error => e
280
+ raise ::Google::Cloud::Error.from_error(e)
281
+ end
282
+
283
+ ##
284
+ # Retrieves a blue-green deployment resource under a given project and
285
+ # location.
286
+ #
287
+ # @overload get_blue_green_deployment(request, options = nil)
288
+ # Pass arguments to `get_blue_green_deployment` via a request object, either of type
289
+ # {::Google::Cloud::Sql::V1beta4::GetBlueGreenDeploymentRequest} or an equivalent Hash.
290
+ #
291
+ # @param request [::Google::Cloud::Sql::V1beta4::GetBlueGreenDeploymentRequest, ::Hash]
292
+ # A request object representing the call parameters. Required. To specify no
293
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
294
+ # @param options [::Gapic::CallOptions, ::Hash]
295
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
296
+ #
297
+ # @overload get_blue_green_deployment(name: nil, view: nil)
298
+ # Pass arguments to `get_blue_green_deployment` via keyword arguments. Note that at
299
+ # least one keyword argument is required. To specify no parameters, or to keep all
300
+ # the default parameter values, pass an empty Hash as a request object (see above).
301
+ #
302
+ # @param name [::String]
303
+ # Required. The name of the blue-green deployment to retrieve.
304
+ # Format:
305
+ # projects/\\{project}/locations/\\{location}/blueGreenDeployments/\\{blue_green_deployment}
306
+ # @param view [::Google::Cloud::Sql::V1beta4::GetBlueGreenDeploymentRequest::BlueGreenDeploymentView]
307
+ # Optional. Specifies whether to return the basic or detailed view of the
308
+ # resource in the response.
309
+ # @yield [result, operation] Access the result along with the TransportOperation object
310
+ # @yieldparam result [::Google::Cloud::Sql::V1beta4::BlueGreenDeployment]
311
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
312
+ #
313
+ # @return [::Google::Cloud::Sql::V1beta4::BlueGreenDeployment]
314
+ #
315
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
316
+ #
317
+ # @example Basic example
318
+ # require "google/cloud/sql/v1beta4"
319
+ #
320
+ # # Create a client object. The client can be reused for multiple calls.
321
+ # client = Google::Cloud::Sql::V1beta4::BlueGreenDeploymentsService::Rest::Client.new
322
+ #
323
+ # # Create a request. To set request fields, pass in keyword arguments.
324
+ # request = Google::Cloud::Sql::V1beta4::GetBlueGreenDeploymentRequest.new
325
+ #
326
+ # # Call the get_blue_green_deployment method.
327
+ # result = client.get_blue_green_deployment request
328
+ #
329
+ # # The returned object is of type Google::Cloud::Sql::V1beta4::BlueGreenDeployment.
330
+ # p result
331
+ #
332
+ def get_blue_green_deployment request, options = nil
333
+ raise ::ArgumentError, "request must be provided" if request.nil?
334
+
335
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1beta4::GetBlueGreenDeploymentRequest
336
+
337
+ # Converts hash and nil to an options object
338
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
339
+
340
+ # Customize the options with defaults
341
+ call_metadata = @config.rpcs.get_blue_green_deployment.metadata.to_h
342
+
343
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
344
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
345
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
346
+ gapic_version: ::Google::Cloud::Sql::V1beta4::VERSION,
347
+ transports_version_send: [:rest]
348
+
349
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
350
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
351
+
352
+ options.apply_defaults timeout: @config.rpcs.get_blue_green_deployment.timeout,
353
+ metadata: call_metadata,
354
+ retry_policy: @config.rpcs.get_blue_green_deployment.retry_policy
355
+
356
+ options.apply_defaults timeout: @config.timeout,
357
+ metadata: @config.metadata,
358
+ retry_policy: @config.retry_policy
359
+
360
+ @blue_green_deployments_service_stub.get_blue_green_deployment request, options do |result, operation|
361
+ yield result, operation if block_given?
362
+ end
363
+ rescue ::Gapic::Rest::Error => e
364
+ raise ::Google::Cloud::Error.from_error(e)
365
+ end
366
+
367
+ ##
368
+ # Lists blue-green deployments under a given project.
369
+ #
370
+ # @overload list_blue_green_deployments(request, options = nil)
371
+ # Pass arguments to `list_blue_green_deployments` via a request object, either of type
372
+ # {::Google::Cloud::Sql::V1beta4::ListBlueGreenDeploymentsRequest} or an equivalent Hash.
373
+ #
374
+ # @param request [::Google::Cloud::Sql::V1beta4::ListBlueGreenDeploymentsRequest, ::Hash]
375
+ # A request object representing the call parameters. Required. To specify no
376
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
377
+ # @param options [::Gapic::CallOptions, ::Hash]
378
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
379
+ #
380
+ # @overload list_blue_green_deployments(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
381
+ # Pass arguments to `list_blue_green_deployments` via keyword arguments. Note that at
382
+ # least one keyword argument is required. To specify no parameters, or to keep all
383
+ # the default parameter values, pass an empty Hash as a request object (see above).
384
+ #
385
+ # @param parent [::String]
386
+ # Required. The parent resource whose blue-green deployments are to be
387
+ # listed. Format: projects/\\{project}/locations/\\{location}
388
+ # @param page_size [::Integer]
389
+ # Optional. The maximum number of deployments to return.
390
+ # @param page_token [::String]
391
+ # Optional. A page token, received from a previous `ListBlueGreenDeployments`
392
+ # call. Provide this to retrieve the subsequent page.
393
+ # @param filter [::String]
394
+ # Optional. A filter expression that filters the results.
395
+ # @param order_by [::String]
396
+ # Optional. A comma-separated list of fields to order the results by.
397
+ # @yield [result, operation] Access the result along with the TransportOperation object
398
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Sql::V1beta4::BlueGreenDeployment>]
399
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
400
+ #
401
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Sql::V1beta4::BlueGreenDeployment>]
402
+ #
403
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
404
+ #
405
+ # @example Basic example
406
+ # require "google/cloud/sql/v1beta4"
407
+ #
408
+ # # Create a client object. The client can be reused for multiple calls.
409
+ # client = Google::Cloud::Sql::V1beta4::BlueGreenDeploymentsService::Rest::Client.new
410
+ #
411
+ # # Create a request. To set request fields, pass in keyword arguments.
412
+ # request = Google::Cloud::Sql::V1beta4::ListBlueGreenDeploymentsRequest.new
413
+ #
414
+ # # Call the list_blue_green_deployments method.
415
+ # result = client.list_blue_green_deployments request
416
+ #
417
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
418
+ # # over elements, and API calls will be issued to fetch pages as needed.
419
+ # result.each do |item|
420
+ # # Each element is of type ::Google::Cloud::Sql::V1beta4::BlueGreenDeployment.
421
+ # p item
422
+ # end
423
+ #
424
+ def list_blue_green_deployments request, options = nil
425
+ raise ::ArgumentError, "request must be provided" if request.nil?
426
+
427
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1beta4::ListBlueGreenDeploymentsRequest
428
+
429
+ # Converts hash and nil to an options object
430
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
431
+
432
+ # Customize the options with defaults
433
+ call_metadata = @config.rpcs.list_blue_green_deployments.metadata.to_h
434
+
435
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
436
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
437
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
438
+ gapic_version: ::Google::Cloud::Sql::V1beta4::VERSION,
439
+ transports_version_send: [:rest]
440
+
441
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
442
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
443
+
444
+ options.apply_defaults timeout: @config.rpcs.list_blue_green_deployments.timeout,
445
+ metadata: call_metadata,
446
+ retry_policy: @config.rpcs.list_blue_green_deployments.retry_policy
447
+
448
+ options.apply_defaults timeout: @config.timeout,
449
+ metadata: @config.metadata,
450
+ retry_policy: @config.retry_policy
451
+
452
+ @blue_green_deployments_service_stub.list_blue_green_deployments request, options do |result, operation|
453
+ result = ::Gapic::Rest::PagedEnumerable.new @blue_green_deployments_service_stub, :list_blue_green_deployments, "blue_green_deployments", request, result, options
454
+ yield result, operation if block_given?
455
+ throw :response, result
456
+ end
457
+ rescue ::Gapic::Rest::Error => e
458
+ raise ::Google::Cloud::Error.from_error(e)
459
+ end
460
+
461
+ ##
462
+ # Switches over to green instance for a blue-green deployment.
463
+ #
464
+ # @overload switchover_blue_green_deployment(request, options = nil)
465
+ # Pass arguments to `switchover_blue_green_deployment` via a request object, either of type
466
+ # {::Google::Cloud::Sql::V1beta4::SwitchoverBlueGreenDeploymentRequest} or an equivalent Hash.
467
+ #
468
+ # @param request [::Google::Cloud::Sql::V1beta4::SwitchoverBlueGreenDeploymentRequest, ::Hash]
469
+ # A request object representing the call parameters. Required. To specify no
470
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
471
+ # @param options [::Gapic::CallOptions, ::Hash]
472
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
473
+ #
474
+ # @overload switchover_blue_green_deployment(name: nil)
475
+ # Pass arguments to `switchover_blue_green_deployment` via keyword arguments. Note that at
476
+ # least one keyword argument is required. To specify no parameters, or to keep all
477
+ # the default parameter values, pass an empty Hash as a request object (see above).
478
+ #
479
+ # @param name [::String]
480
+ # Required. The name of the blue-green deployment to switch over.
481
+ # Format:
482
+ # projects/\\{project}/locations/\\{location}/blueGreenDeployments/\\{blue_green_deployment}
483
+ # @yield [result, operation] Access the result along with the TransportOperation object
484
+ # @yieldparam result [::Google::Cloud::Sql::V1beta4::Operation]
485
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
486
+ #
487
+ # @return [::Google::Cloud::Sql::V1beta4::Operation]
488
+ #
489
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
490
+ #
491
+ # @example Basic example
492
+ # require "google/cloud/sql/v1beta4"
493
+ #
494
+ # # Create a client object. The client can be reused for multiple calls.
495
+ # client = Google::Cloud::Sql::V1beta4::BlueGreenDeploymentsService::Rest::Client.new
496
+ #
497
+ # # Create a request. To set request fields, pass in keyword arguments.
498
+ # request = Google::Cloud::Sql::V1beta4::SwitchoverBlueGreenDeploymentRequest.new
499
+ #
500
+ # # Call the switchover_blue_green_deployment method.
501
+ # result = client.switchover_blue_green_deployment request
502
+ #
503
+ # # The returned object is of type Google::Cloud::Sql::V1beta4::Operation.
504
+ # p result
505
+ #
506
+ def switchover_blue_green_deployment request, options = nil
507
+ raise ::ArgumentError, "request must be provided" if request.nil?
508
+
509
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1beta4::SwitchoverBlueGreenDeploymentRequest
510
+
511
+ # Converts hash and nil to an options object
512
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
513
+
514
+ # Customize the options with defaults
515
+ call_metadata = @config.rpcs.switchover_blue_green_deployment.metadata.to_h
516
+
517
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
518
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
519
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
520
+ gapic_version: ::Google::Cloud::Sql::V1beta4::VERSION,
521
+ transports_version_send: [:rest]
522
+
523
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
524
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
525
+
526
+ options.apply_defaults timeout: @config.rpcs.switchover_blue_green_deployment.timeout,
527
+ metadata: call_metadata,
528
+ retry_policy: @config.rpcs.switchover_blue_green_deployment.retry_policy
529
+
530
+ options.apply_defaults timeout: @config.timeout,
531
+ metadata: @config.metadata,
532
+ retry_policy: @config.retry_policy
533
+
534
+ @blue_green_deployments_service_stub.switchover_blue_green_deployment request, options do |result, operation|
535
+ yield result, operation if block_given?
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, including metadata and underlying
543
+ # resources based on the deployment state. If issued before switchover,
544
+ # this deletes the green instance. If issued after switchover, this deletes
545
+ # the old blue instance (source instance) if the `delete_old_source` field
546
+ # in the request is set to true.
547
+ # All blue-green deployment metadata is permanently deleted.
548
+ # Resources deleted as a result of this operation are no longer accessible
549
+ # and can't be restored.
550
+ #
551
+ # @overload delete_blue_green_deployment(request, options = nil)
552
+ # Pass arguments to `delete_blue_green_deployment` via a request object, either of type
553
+ # {::Google::Cloud::Sql::V1beta4::DeleteBlueGreenDeploymentRequest} or an equivalent Hash.
554
+ #
555
+ # @param request [::Google::Cloud::Sql::V1beta4::DeleteBlueGreenDeploymentRequest, ::Hash]
556
+ # A request object representing the call parameters. Required. To specify no
557
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
558
+ # @param options [::Gapic::CallOptions, ::Hash]
559
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
560
+ #
561
+ # @overload delete_blue_green_deployment(name: nil, delete_old_source: nil)
562
+ # Pass arguments to `delete_blue_green_deployment` via keyword arguments. Note that at
563
+ # least one keyword argument is required. To specify no parameters, or to keep all
564
+ # the default parameter values, pass an empty Hash as a request object (see above).
565
+ #
566
+ # @param name [::String]
567
+ # Required. The name of the blue-green deployment to delete.
568
+ # Format:
569
+ # projects/\\{project}/locations/\\{location}/blueGreenDeployments/\\{blue_green_deployment}
570
+ # @param delete_old_source [::Boolean]
571
+ # Optional. If set to true, and the switchover is complete, this deletes the
572
+ # old source instance along with the deployment.
573
+ # @yield [result, operation] Access the result along with the TransportOperation object
574
+ # @yieldparam result [::Google::Cloud::Sql::V1beta4::Operation]
575
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
576
+ #
577
+ # @return [::Google::Cloud::Sql::V1beta4::Operation]
578
+ #
579
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
580
+ #
581
+ # @example Basic example
582
+ # require "google/cloud/sql/v1beta4"
583
+ #
584
+ # # Create a client object. The client can be reused for multiple calls.
585
+ # client = Google::Cloud::Sql::V1beta4::BlueGreenDeploymentsService::Rest::Client.new
586
+ #
587
+ # # Create a request. To set request fields, pass in keyword arguments.
588
+ # request = Google::Cloud::Sql::V1beta4::DeleteBlueGreenDeploymentRequest.new
589
+ #
590
+ # # Call the delete_blue_green_deployment method.
591
+ # result = client.delete_blue_green_deployment request
592
+ #
593
+ # # The returned object is of type Google::Cloud::Sql::V1beta4::Operation.
594
+ # p result
595
+ #
596
+ def delete_blue_green_deployment request, options = nil
597
+ raise ::ArgumentError, "request must be provided" if request.nil?
598
+
599
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1beta4::DeleteBlueGreenDeploymentRequest
600
+
601
+ # Converts hash and nil to an options object
602
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
603
+
604
+ # Customize the options with defaults
605
+ call_metadata = @config.rpcs.delete_blue_green_deployment.metadata.to_h
606
+
607
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
608
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
609
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
610
+ gapic_version: ::Google::Cloud::Sql::V1beta4::VERSION,
611
+ transports_version_send: [:rest]
612
+
613
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
614
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
615
+
616
+ options.apply_defaults timeout: @config.rpcs.delete_blue_green_deployment.timeout,
617
+ metadata: call_metadata,
618
+ retry_policy: @config.rpcs.delete_blue_green_deployment.retry_policy
619
+
620
+ options.apply_defaults timeout: @config.timeout,
621
+ metadata: @config.metadata,
622
+ retry_policy: @config.retry_policy
623
+
624
+ @blue_green_deployments_service_stub.delete_blue_green_deployment request, options do |result, operation|
625
+ yield result, operation if block_given?
626
+ end
627
+ rescue ::Gapic::Rest::Error => e
628
+ raise ::Google::Cloud::Error.from_error(e)
629
+ end
630
+
631
+ ##
632
+ # Configuration class for the BlueGreenDeploymentsService REST API.
633
+ #
634
+ # This class represents the configuration for BlueGreenDeploymentsService REST,
635
+ # providing control over timeouts, retry behavior, logging, transport
636
+ # parameters, and other low-level controls. Certain parameters can also be
637
+ # applied individually to specific RPCs. See
638
+ # {::Google::Cloud::Sql::V1beta4::BlueGreenDeploymentsService::Rest::Client::Configuration::Rpcs}
639
+ # for a list of RPCs that can be configured independently.
640
+ #
641
+ # Configuration can be applied globally to all clients, or to a single client
642
+ # on construction.
643
+ #
644
+ # @example
645
+ #
646
+ # # Modify the global config, setting the timeout for
647
+ # # create_blue_green_deployment to 20 seconds,
648
+ # # and all remaining timeouts to 10 seconds.
649
+ # ::Google::Cloud::Sql::V1beta4::BlueGreenDeploymentsService::Rest::Client.configure do |config|
650
+ # config.timeout = 10.0
651
+ # config.rpcs.create_blue_green_deployment.timeout = 20.0
652
+ # end
653
+ #
654
+ # # Apply the above configuration only to a new client.
655
+ # client = ::Google::Cloud::Sql::V1beta4::BlueGreenDeploymentsService::Rest::Client.new do |config|
656
+ # config.timeout = 10.0
657
+ # config.rpcs.create_blue_green_deployment.timeout = 20.0
658
+ # end
659
+ #
660
+ # @!attribute [rw] endpoint
661
+ # A custom service endpoint, as a hostname or hostname:port. The default is
662
+ # nil, indicating to use the default endpoint in the current universe domain.
663
+ # @return [::String,nil]
664
+ # @!attribute [rw] credentials
665
+ # Credentials to send with calls. You may provide any of the following types:
666
+ # * (`String`) The path to a service account key file in JSON format
667
+ # * (`Hash`) A service account key as a Hash
668
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
669
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
670
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
671
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
672
+ # * (`nil`) indicating no credentials
673
+ #
674
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
675
+ # external source for authentication to Google Cloud, you must validate it before
676
+ # providing it to a Google API client library. Providing an unvalidated credential
677
+ # configuration to Google APIs can compromise the security of your systems and data.
678
+ # For more information, refer to [Validate credential configurations from external
679
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
680
+ # @return [::Object]
681
+ # @!attribute [rw] scope
682
+ # The OAuth scopes
683
+ # @return [::Array<::String>]
684
+ # @!attribute [rw] lib_name
685
+ # The library name as recorded in instrumentation and logging
686
+ # @return [::String]
687
+ # @!attribute [rw] lib_version
688
+ # The library version as recorded in instrumentation and logging
689
+ # @return [::String]
690
+ # @!attribute [rw] timeout
691
+ # The call timeout in seconds.
692
+ # @return [::Numeric]
693
+ # @!attribute [rw] metadata
694
+ # Additional headers to be sent with the call.
695
+ # @return [::Hash{::Symbol=>::String}]
696
+ # @!attribute [rw] retry_policy
697
+ # The retry policy. The value is a hash with the following keys:
698
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
699
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
700
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
701
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
702
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
703
+ # trigger a retry.
704
+ # @return [::Hash]
705
+ # @!attribute [rw] quota_project
706
+ # A separate project against which to charge quota.
707
+ # @return [::String]
708
+ # @!attribute [rw] universe_domain
709
+ # The universe domain within which to make requests. This determines the
710
+ # default endpoint URL. The default value of nil uses the environment
711
+ # universe (usually the default "googleapis.com" universe).
712
+ # @return [::String,nil]
713
+ # @!attribute [rw] logger
714
+ # A custom logger to use for request/response debug logging, or the value
715
+ # `:default` (the default) to construct a default logger, or `nil` to
716
+ # explicitly disable logging.
717
+ # @return [::Logger,:default,nil]
718
+ #
719
+ class Configuration
720
+ extend ::Gapic::Config
721
+
722
+ # @private
723
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
724
+ DEFAULT_ENDPOINT = "sqladmin.googleapis.com"
725
+
726
+ config_attr :endpoint, nil, ::String, nil
727
+ config_attr :credentials, nil do |value|
728
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
729
+ allowed.any? { |klass| klass === value }
730
+ end
731
+ config_attr :scope, nil, ::String, ::Array, nil
732
+ config_attr :lib_name, nil, ::String, nil
733
+ config_attr :lib_version, nil, ::String, nil
734
+ config_attr :timeout, nil, ::Numeric, nil
735
+ config_attr :metadata, nil, ::Hash, nil
736
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
737
+ config_attr :quota_project, nil, ::String, nil
738
+ config_attr :universe_domain, nil, ::String, nil
739
+ config_attr :logger, :default, ::Logger, nil, :default
740
+
741
+ # @private
742
+ def initialize parent_config = nil
743
+ @parent_config = parent_config unless parent_config.nil?
744
+
745
+ yield self if block_given?
746
+ end
747
+
748
+ ##
749
+ # Configurations for individual RPCs
750
+ # @return [Rpcs]
751
+ #
752
+ def rpcs
753
+ @rpcs ||= begin
754
+ parent_rpcs = nil
755
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
756
+ Rpcs.new parent_rpcs
757
+ end
758
+ end
759
+
760
+ ##
761
+ # Configuration RPC class for the BlueGreenDeploymentsService API.
762
+ #
763
+ # Includes fields providing the configuration for each RPC in this service.
764
+ # Each configuration object is of type `Gapic::Config::Method` and includes
765
+ # the following configuration fields:
766
+ #
767
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
768
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
769
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
770
+ # include the following keys:
771
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
772
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
773
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
774
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
775
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
776
+ # trigger a retry.
777
+ #
778
+ class Rpcs
779
+ ##
780
+ # RPC-specific configuration for `create_blue_green_deployment`
781
+ # @return [::Gapic::Config::Method]
782
+ #
783
+ attr_reader :create_blue_green_deployment
784
+ ##
785
+ # RPC-specific configuration for `get_blue_green_deployment`
786
+ # @return [::Gapic::Config::Method]
787
+ #
788
+ attr_reader :get_blue_green_deployment
789
+ ##
790
+ # RPC-specific configuration for `list_blue_green_deployments`
791
+ # @return [::Gapic::Config::Method]
792
+ #
793
+ attr_reader :list_blue_green_deployments
794
+ ##
795
+ # RPC-specific configuration for `switchover_blue_green_deployment`
796
+ # @return [::Gapic::Config::Method]
797
+ #
798
+ attr_reader :switchover_blue_green_deployment
799
+ ##
800
+ # RPC-specific configuration for `delete_blue_green_deployment`
801
+ # @return [::Gapic::Config::Method]
802
+ #
803
+ attr_reader :delete_blue_green_deployment
804
+
805
+ # @private
806
+ def initialize parent_rpcs = nil
807
+ create_blue_green_deployment_config = parent_rpcs.create_blue_green_deployment if parent_rpcs.respond_to? :create_blue_green_deployment
808
+ @create_blue_green_deployment = ::Gapic::Config::Method.new create_blue_green_deployment_config
809
+ get_blue_green_deployment_config = parent_rpcs.get_blue_green_deployment if parent_rpcs.respond_to? :get_blue_green_deployment
810
+ @get_blue_green_deployment = ::Gapic::Config::Method.new get_blue_green_deployment_config
811
+ list_blue_green_deployments_config = parent_rpcs.list_blue_green_deployments if parent_rpcs.respond_to? :list_blue_green_deployments
812
+ @list_blue_green_deployments = ::Gapic::Config::Method.new list_blue_green_deployments_config
813
+ switchover_blue_green_deployment_config = parent_rpcs.switchover_blue_green_deployment if parent_rpcs.respond_to? :switchover_blue_green_deployment
814
+ @switchover_blue_green_deployment = ::Gapic::Config::Method.new switchover_blue_green_deployment_config
815
+ delete_blue_green_deployment_config = parent_rpcs.delete_blue_green_deployment if parent_rpcs.respond_to? :delete_blue_green_deployment
816
+ @delete_blue_green_deployment = ::Gapic::Config::Method.new delete_blue_green_deployment_config
817
+
818
+ yield self if block_given?
819
+ end
820
+ end
821
+ end
822
+ end
823
+ end
824
+ end
825
+ end
826
+ end
827
+ end
828
+ end