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