google-cloud-sql-v1 0.a → 0.1.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.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +122 -0
- data/README.md +146 -8
- data/lib/google/cloud/sql/v1/cloud_sql_available_database_versions_pb.rb +25 -0
- data/lib/google/cloud/sql/v1/cloud_sql_available_database_versions_services_pb.rb +29 -0
- data/lib/google/cloud/sql/v1/cloud_sql_backup_runs_pb.rb +35 -0
- data/lib/google/cloud/sql/v1/cloud_sql_backup_runs_services_pb.rb +53 -0
- data/lib/google/cloud/sql/v1/cloud_sql_backups_pb.rb +41 -0
- data/lib/google/cloud/sql/v1/cloud_sql_backups_services_pb.rb +54 -0
- data/lib/google/cloud/sql/v1/cloud_sql_connect_pb.rb +34 -0
- data/lib/google/cloud/sql/v1/cloud_sql_connect_services_pb.rb +50 -0
- data/lib/google/cloud/sql/v1/cloud_sql_databases_pb.rb +30 -0
- data/lib/google/cloud/sql/v1/cloud_sql_databases_services_pb.rb +61 -0
- data/lib/google/cloud/sql/v1/cloud_sql_events_pb.rb +25 -0
- data/lib/google/cloud/sql/v1/cloud_sql_events_services_pb.rb +29 -0
- data/lib/google/cloud/sql/v1/cloud_sql_feature_eligibility_pb.rb +24 -0
- data/lib/google/cloud/sql/v1/cloud_sql_feature_eligibility_services_pb.rb +29 -0
- data/lib/google/cloud/sql/v1/cloud_sql_flags_pb.rb +31 -0
- data/lib/google/cloud/sql/v1/cloud_sql_flags_services_pb.rb +45 -0
- data/lib/google/cloud/sql/v1/cloud_sql_iam_policies_pb.rb +23 -0
- data/lib/google/cloud/sql/v1/cloud_sql_iam_policies_services_pb.rb +29 -0
- data/lib/google/cloud/sql/v1/cloud_sql_instance_names_pb.rb +24 -0
- data/lib/google/cloud/sql/v1/cloud_sql_instance_names_services_pb.rb +29 -0
- data/lib/google/cloud/sql/v1/cloud_sql_instances_pb.rb +146 -0
- data/lib/google/cloud/sql/v1/cloud_sql_instances_services_pb.rb +184 -0
- data/lib/google/cloud/sql/v1/cloud_sql_operations_pb.rb +30 -0
- data/lib/google/cloud/sql/v1/cloud_sql_operations_services_pb.rb +50 -0
- data/lib/google/cloud/sql/v1/cloud_sql_regions_pb.rb +25 -0
- data/lib/google/cloud/sql/v1/cloud_sql_regions_services_pb.rb +29 -0
- data/lib/google/cloud/sql/v1/cloud_sql_resources_pb.rb +119 -0
- data/lib/google/cloud/sql/v1/cloud_sql_ssl_certs_pb.rb +31 -0
- data/lib/google/cloud/sql/v1/cloud_sql_ssl_certs_services_pb.rb +56 -0
- data/lib/google/cloud/sql/v1/cloud_sql_tiers_pb.rb +26 -0
- data/lib/google/cloud/sql/v1/cloud_sql_tiers_services_pb.rb +47 -0
- data/lib/google/cloud/sql/v1/cloud_sql_users_pb.rb +41 -0
- data/lib/google/cloud/sql/v1/cloud_sql_users_services_pb.rb +53 -0
- data/lib/google/cloud/sql/v1/rest.rb +46 -0
- data/lib/google/cloud/sql/v1/sql_backup_runs_service/client.rb +809 -0
- data/lib/google/cloud/sql/v1/sql_backup_runs_service/credentials.rb +48 -0
- data/lib/google/cloud/sql/v1/sql_backup_runs_service/rest/client.rb +720 -0
- data/lib/google/cloud/sql/v1/sql_backup_runs_service/rest/service_stub.rb +332 -0
- data/lib/google/cloud/sql/v1/sql_backup_runs_service/rest.rb +51 -0
- data/lib/google/cloud/sql/v1/sql_backup_runs_service.rb +54 -0
- data/lib/google/cloud/sql/v1/sql_backups_service/client.rb +896 -0
- data/lib/google/cloud/sql/v1/sql_backups_service/credentials.rb +48 -0
- data/lib/google/cloud/sql/v1/sql_backups_service/paths.rb +64 -0
- data/lib/google/cloud/sql/v1/sql_backups_service/rest/client.rb +818 -0
- data/lib/google/cloud/sql/v1/sql_backups_service/rest/service_stub.rb +388 -0
- data/lib/google/cloud/sql/v1/sql_backups_service/rest.rb +50 -0
- data/lib/google/cloud/sql/v1/sql_backups_service.rb +53 -0
- data/lib/google/cloud/sql/v1/sql_connect_service/client.rb +607 -0
- data/lib/google/cloud/sql/v1/sql_connect_service/credentials.rb +48 -0
- data/lib/google/cloud/sql/v1/sql_connect_service/rest/client.rb +544 -0
- data/lib/google/cloud/sql/v1/sql_connect_service/rest/service_stub.rb +206 -0
- data/lib/google/cloud/sql/v1/sql_connect_service/rest.rb +51 -0
- data/lib/google/cloud/sql/v1/sql_connect_service.rb +54 -0
- data/lib/google/cloud/sql/v1/sql_databases_service/client.rb +1011 -0
- data/lib/google/cloud/sql/v1/sql_databases_service/credentials.rb +48 -0
- data/lib/google/cloud/sql/v1/sql_databases_service/rest/client.rb +896 -0
- data/lib/google/cloud/sql/v1/sql_databases_service/rest/service_stub.rb +460 -0
- data/lib/google/cloud/sql/v1/sql_databases_service/rest.rb +51 -0
- data/lib/google/cloud/sql/v1/sql_databases_service.rb +54 -0
- data/lib/google/cloud/sql/v1/sql_flags_service/client.rb +488 -0
- data/lib/google/cloud/sql/v1/sql_flags_service/credentials.rb +48 -0
- data/lib/google/cloud/sql/v1/sql_flags_service/rest/client.rb +446 -0
- data/lib/google/cloud/sql/v1/sql_flags_service/rest/service_stub.rb +140 -0
- data/lib/google/cloud/sql/v1/sql_flags_service/rest.rb +51 -0
- data/lib/google/cloud/sql/v1/sql_flags_service.rb +54 -0
- data/lib/google/cloud/sql/v1/sql_instances_service/client.rb +4738 -0
- data/lib/google/cloud/sql/v1/sql_instances_service/credentials.rb +48 -0
- data/lib/google/cloud/sql/v1/sql_instances_service/paths.rb +95 -0
- data/lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb +4274 -0
- data/lib/google/cloud/sql/v1/sql_instances_service/rest/service_stub.rb +2769 -0
- data/lib/google/cloud/sql/v1/sql_instances_service/rest.rb +50 -0
- data/lib/google/cloud/sql/v1/sql_instances_service.rb +53 -0
- data/lib/google/cloud/sql/v1/sql_operations_service/client.rb +694 -0
- data/lib/google/cloud/sql/v1/sql_operations_service/credentials.rb +48 -0
- data/lib/google/cloud/sql/v1/sql_operations_service/rest/client.rb +624 -0
- data/lib/google/cloud/sql/v1/sql_operations_service/rest/service_stub.rb +266 -0
- data/lib/google/cloud/sql/v1/sql_operations_service/rest.rb +51 -0
- data/lib/google/cloud/sql/v1/sql_operations_service.rb +54 -0
- data/lib/google/cloud/sql/v1/sql_ssl_certs_service/client.rb +804 -0
- data/lib/google/cloud/sql/v1/sql_ssl_certs_service/credentials.rb +48 -0
- data/lib/google/cloud/sql/v1/sql_ssl_certs_service/rest/client.rb +715 -0
- data/lib/google/cloud/sql/v1/sql_ssl_certs_service/rest/service_stub.rb +332 -0
- data/lib/google/cloud/sql/v1/sql_ssl_certs_service/rest.rb +51 -0
- data/lib/google/cloud/sql/v1/sql_ssl_certs_service.rb +54 -0
- data/lib/google/cloud/sql/v1/sql_tiers_service/client.rb +494 -0
- data/lib/google/cloud/sql/v1/sql_tiers_service/credentials.rb +48 -0
- data/lib/google/cloud/sql/v1/sql_tiers_service/rest/client.rb +444 -0
- data/lib/google/cloud/sql/v1/sql_tiers_service/rest/service_stub.rb +142 -0
- data/lib/google/cloud/sql/v1/sql_tiers_service/rest.rb +51 -0
- data/lib/google/cloud/sql/v1/sql_tiers_service.rb +54 -0
- data/lib/google/cloud/sql/v1/sql_users_service/client.rb +909 -0
- data/lib/google/cloud/sql/v1/sql_users_service/credentials.rb +48 -0
- data/lib/google/cloud/sql/v1/sql_users_service/rest/client.rb +813 -0
- data/lib/google/cloud/sql/v1/sql_users_service/rest/service_stub.rb +394 -0
- data/lib/google/cloud/sql/v1/sql_users_service/rest.rb +51 -0
- data/lib/google/cloud/sql/v1/sql_users_service.rb +54 -0
- data/lib/google/cloud/sql/v1/version.rb +8 -3
- data/lib/google/cloud/sql/v1.rb +60 -0
- data/lib/google-cloud-sql-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +593 -0
- data/proto_docs/google/api/field_behavior.rb +85 -0
- data/proto_docs/google/api/field_info.rb +88 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/api/resource.rb +227 -0
- data/proto_docs/google/cloud/sql/v1/cloud_sql_backup_runs.rb +245 -0
- data/proto_docs/google/cloud/sql/v1/cloud_sql_backups.rb +259 -0
- data/proto_docs/google/cloud/sql/v1/cloud_sql_connect.rb +190 -0
- data/proto_docs/google/cloud/sql/v1/cloud_sql_databases.rb +111 -0
- data/proto_docs/google/cloud/sql/v1/cloud_sql_flags.rb +154 -0
- data/proto_docs/google/cloud/sql/v1/cloud_sql_instances.rb +2357 -0
- data/proto_docs/google/cloud/sql/v1/cloud_sql_operations.rb +85 -0
- data/proto_docs/google/cloud/sql/v1/cloud_sql_resources.rb +2522 -0
- data/proto_docs/google/cloud/sql/v1/cloud_sql_ssl_certs.rb +120 -0
- data/proto_docs/google/cloud/sql/v1/cloud_sql_tiers.rb +69 -0
- data/proto_docs/google/cloud/sql/v1/cloud_sql_users.rb +291 -0
- data/proto_docs/google/protobuf/any.rb +145 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +34 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/timestamp.rb +127 -0
- data/proto_docs/google/protobuf/wrappers.rb +148 -0
- data/proto_docs/google/rpc/status.rb +48 -0
- data/proto_docs/google/type/interval.rb +45 -0
- metadata +176 -14
|
@@ -0,0 +1,896 @@
|
|
|
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_backups_pb"
|
|
21
|
+
require "google/cloud/location"
|
|
22
|
+
|
|
23
|
+
module Google
|
|
24
|
+
module Cloud
|
|
25
|
+
module Sql
|
|
26
|
+
module V1
|
|
27
|
+
module SqlBackupsService
|
|
28
|
+
##
|
|
29
|
+
# Client for the SqlBackupsService service.
|
|
30
|
+
#
|
|
31
|
+
class Client
|
|
32
|
+
# @private
|
|
33
|
+
API_VERSION = ""
|
|
34
|
+
|
|
35
|
+
# @private
|
|
36
|
+
DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$"
|
|
37
|
+
|
|
38
|
+
include Paths
|
|
39
|
+
|
|
40
|
+
# @private
|
|
41
|
+
attr_reader :sql_backups_service_stub
|
|
42
|
+
|
|
43
|
+
##
|
|
44
|
+
# Configure the SqlBackupsService Client class.
|
|
45
|
+
#
|
|
46
|
+
# See {::Google::Cloud::Sql::V1::SqlBackupsService::Client::Configuration}
|
|
47
|
+
# for a description of the configuration fields.
|
|
48
|
+
#
|
|
49
|
+
# @example
|
|
50
|
+
#
|
|
51
|
+
# # Modify the configuration for all SqlBackupsService clients
|
|
52
|
+
# ::Google::Cloud::Sql::V1::SqlBackupsService::Client.configure do |config|
|
|
53
|
+
# config.timeout = 10.0
|
|
54
|
+
# end
|
|
55
|
+
#
|
|
56
|
+
# @yield [config] Configure the Client client.
|
|
57
|
+
# @yieldparam config [Client::Configuration]
|
|
58
|
+
#
|
|
59
|
+
# @return [Client::Configuration]
|
|
60
|
+
#
|
|
61
|
+
def self.configure
|
|
62
|
+
@configure ||= begin
|
|
63
|
+
namespace = ["Google", "Cloud", "Sql", "V1"]
|
|
64
|
+
parent_config = while namespace.any?
|
|
65
|
+
parent_name = namespace.join "::"
|
|
66
|
+
parent_const = const_get parent_name
|
|
67
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
|
68
|
+
namespace.pop
|
|
69
|
+
end
|
|
70
|
+
default_config = Client::Configuration.new parent_config
|
|
71
|
+
|
|
72
|
+
default_config.timeout = 60.0
|
|
73
|
+
|
|
74
|
+
default_config
|
|
75
|
+
end
|
|
76
|
+
yield @configure if block_given?
|
|
77
|
+
@configure
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
##
|
|
81
|
+
# Configure the SqlBackupsService Client instance.
|
|
82
|
+
#
|
|
83
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
|
84
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
|
85
|
+
# should be made on {Client.configure}.
|
|
86
|
+
#
|
|
87
|
+
# See {::Google::Cloud::Sql::V1::SqlBackupsService::Client::Configuration}
|
|
88
|
+
# for a description of the configuration fields.
|
|
89
|
+
#
|
|
90
|
+
# @yield [config] Configure the Client client.
|
|
91
|
+
# @yieldparam config [Client::Configuration]
|
|
92
|
+
#
|
|
93
|
+
# @return [Client::Configuration]
|
|
94
|
+
#
|
|
95
|
+
def configure
|
|
96
|
+
yield @config if block_given?
|
|
97
|
+
@config
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
##
|
|
101
|
+
# The effective universe domain
|
|
102
|
+
#
|
|
103
|
+
# @return [String]
|
|
104
|
+
#
|
|
105
|
+
def universe_domain
|
|
106
|
+
@sql_backups_service_stub.universe_domain
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
##
|
|
110
|
+
# Create a new SqlBackupsService client object.
|
|
111
|
+
#
|
|
112
|
+
# @example
|
|
113
|
+
#
|
|
114
|
+
# # Create a client using the default configuration
|
|
115
|
+
# client = ::Google::Cloud::Sql::V1::SqlBackupsService::Client.new
|
|
116
|
+
#
|
|
117
|
+
# # Create a client using a custom configuration
|
|
118
|
+
# client = ::Google::Cloud::Sql::V1::SqlBackupsService::Client.new do |config|
|
|
119
|
+
# config.timeout = 10.0
|
|
120
|
+
# end
|
|
121
|
+
#
|
|
122
|
+
# @yield [config] Configure the SqlBackupsService 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/v1/cloud_sql_backups_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
|
+
@sql_backups_service_stub = ::Gapic::ServiceStub.new(
|
|
154
|
+
::Google::Cloud::Sql::V1::SqlBackupsService::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
|
+
@sql_backups_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 = @sql_backups_service_stub.endpoint
|
|
179
|
+
config.universe_domain = @sql_backups_service_stub.universe_domain
|
|
180
|
+
config.logger = @sql_backups_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
|
+
@sql_backups_service_stub.logger
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Service calls
|
|
201
|
+
|
|
202
|
+
##
|
|
203
|
+
# Creates a backup for a Cloud SQL instance. This API can be used only to
|
|
204
|
+
# create on-demand backups.
|
|
205
|
+
#
|
|
206
|
+
# @overload create_backup(request, options = nil)
|
|
207
|
+
# Pass arguments to `create_backup` via a request object, either of type
|
|
208
|
+
# {::Google::Cloud::Sql::V1::CreateBackupRequest} or an equivalent Hash.
|
|
209
|
+
#
|
|
210
|
+
# @param request [::Google::Cloud::Sql::V1::CreateBackupRequest, ::Hash]
|
|
211
|
+
# A request object representing the call parameters. Required. To specify no
|
|
212
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
213
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
214
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
215
|
+
#
|
|
216
|
+
# @overload create_backup(parent: nil, backup: nil)
|
|
217
|
+
# Pass arguments to `create_backup` via keyword arguments. Note that at
|
|
218
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
219
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
220
|
+
#
|
|
221
|
+
# @param parent [::String]
|
|
222
|
+
# Required. The parent resource where this backup is created.
|
|
223
|
+
# Format: projects/\\{project}
|
|
224
|
+
# @param backup [::Google::Cloud::Sql::V1::Backup, ::Hash]
|
|
225
|
+
# Required. The Backup to create.
|
|
226
|
+
#
|
|
227
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
228
|
+
# @yieldparam response [::Google::Cloud::Sql::V1::Operation]
|
|
229
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
230
|
+
#
|
|
231
|
+
# @return [::Google::Cloud::Sql::V1::Operation]
|
|
232
|
+
#
|
|
233
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
234
|
+
#
|
|
235
|
+
# @example Basic example
|
|
236
|
+
# require "google/cloud/sql/v1"
|
|
237
|
+
#
|
|
238
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
239
|
+
# client = Google::Cloud::Sql::V1::SqlBackupsService::Client.new
|
|
240
|
+
#
|
|
241
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
242
|
+
# request = Google::Cloud::Sql::V1::CreateBackupRequest.new
|
|
243
|
+
#
|
|
244
|
+
# # Call the create_backup method.
|
|
245
|
+
# result = client.create_backup request
|
|
246
|
+
#
|
|
247
|
+
# # The returned object is of type Google::Cloud::Sql::V1::Operation.
|
|
248
|
+
# p result
|
|
249
|
+
#
|
|
250
|
+
def create_backup request, options = nil
|
|
251
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
252
|
+
|
|
253
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::CreateBackupRequest
|
|
254
|
+
|
|
255
|
+
# Converts hash and nil to an options object
|
|
256
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
257
|
+
|
|
258
|
+
# Customize the options with defaults
|
|
259
|
+
metadata = @config.rpcs.create_backup.metadata.to_h
|
|
260
|
+
|
|
261
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
262
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
263
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
264
|
+
gapic_version: ::Google::Cloud::Sql::V1::VERSION
|
|
265
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
266
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
267
|
+
|
|
268
|
+
header_params = {}
|
|
269
|
+
if request.parent
|
|
270
|
+
header_params["parent"] = request.parent
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
274
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
|
275
|
+
|
|
276
|
+
options.apply_defaults timeout: @config.rpcs.create_backup.timeout,
|
|
277
|
+
metadata: metadata,
|
|
278
|
+
retry_policy: @config.rpcs.create_backup.retry_policy
|
|
279
|
+
|
|
280
|
+
options.apply_defaults timeout: @config.timeout,
|
|
281
|
+
metadata: @config.metadata,
|
|
282
|
+
retry_policy: @config.retry_policy
|
|
283
|
+
|
|
284
|
+
@sql_backups_service_stub.call_rpc :create_backup, request, options: options do |response, operation|
|
|
285
|
+
yield response, operation if block_given?
|
|
286
|
+
end
|
|
287
|
+
rescue ::GRPC::BadStatus => e
|
|
288
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
##
|
|
292
|
+
# Retrieves a resource containing information about a backup.
|
|
293
|
+
#
|
|
294
|
+
# @overload get_backup(request, options = nil)
|
|
295
|
+
# Pass arguments to `get_backup` via a request object, either of type
|
|
296
|
+
# {::Google::Cloud::Sql::V1::GetBackupRequest} or an equivalent Hash.
|
|
297
|
+
#
|
|
298
|
+
# @param request [::Google::Cloud::Sql::V1::GetBackupRequest, ::Hash]
|
|
299
|
+
# A request object representing the call parameters. Required. To specify no
|
|
300
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
301
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
302
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
303
|
+
#
|
|
304
|
+
# @overload get_backup(name: nil)
|
|
305
|
+
# Pass arguments to `get_backup` via keyword arguments. Note that at
|
|
306
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
307
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
308
|
+
#
|
|
309
|
+
# @param name [::String]
|
|
310
|
+
# Required. The name of the backup to retrieve.
|
|
311
|
+
# Format: projects/\\{project}/backups/\\{backup}
|
|
312
|
+
#
|
|
313
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
314
|
+
# @yieldparam response [::Google::Cloud::Sql::V1::Backup]
|
|
315
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
316
|
+
#
|
|
317
|
+
# @return [::Google::Cloud::Sql::V1::Backup]
|
|
318
|
+
#
|
|
319
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
320
|
+
#
|
|
321
|
+
# @example Basic example
|
|
322
|
+
# require "google/cloud/sql/v1"
|
|
323
|
+
#
|
|
324
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
325
|
+
# client = Google::Cloud::Sql::V1::SqlBackupsService::Client.new
|
|
326
|
+
#
|
|
327
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
328
|
+
# request = Google::Cloud::Sql::V1::GetBackupRequest.new
|
|
329
|
+
#
|
|
330
|
+
# # Call the get_backup method.
|
|
331
|
+
# result = client.get_backup request
|
|
332
|
+
#
|
|
333
|
+
# # The returned object is of type Google::Cloud::Sql::V1::Backup.
|
|
334
|
+
# p result
|
|
335
|
+
#
|
|
336
|
+
def get_backup request, options = nil
|
|
337
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
338
|
+
|
|
339
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::GetBackupRequest
|
|
340
|
+
|
|
341
|
+
# Converts hash and nil to an options object
|
|
342
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
343
|
+
|
|
344
|
+
# Customize the options with defaults
|
|
345
|
+
metadata = @config.rpcs.get_backup.metadata.to_h
|
|
346
|
+
|
|
347
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
348
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
349
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
350
|
+
gapic_version: ::Google::Cloud::Sql::V1::VERSION
|
|
351
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
352
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
353
|
+
|
|
354
|
+
header_params = {}
|
|
355
|
+
if request.name
|
|
356
|
+
header_params["name"] = request.name
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
360
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
|
361
|
+
|
|
362
|
+
options.apply_defaults timeout: @config.rpcs.get_backup.timeout,
|
|
363
|
+
metadata: metadata,
|
|
364
|
+
retry_policy: @config.rpcs.get_backup.retry_policy
|
|
365
|
+
|
|
366
|
+
options.apply_defaults timeout: @config.timeout,
|
|
367
|
+
metadata: @config.metadata,
|
|
368
|
+
retry_policy: @config.retry_policy
|
|
369
|
+
|
|
370
|
+
@sql_backups_service_stub.call_rpc :get_backup, request, options: options do |response, operation|
|
|
371
|
+
yield response, operation if block_given?
|
|
372
|
+
end
|
|
373
|
+
rescue ::GRPC::BadStatus => e
|
|
374
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
##
|
|
378
|
+
# Lists all backups associated with the project.
|
|
379
|
+
#
|
|
380
|
+
# @overload list_backups(request, options = nil)
|
|
381
|
+
# Pass arguments to `list_backups` via a request object, either of type
|
|
382
|
+
# {::Google::Cloud::Sql::V1::ListBackupsRequest} or an equivalent Hash.
|
|
383
|
+
#
|
|
384
|
+
# @param request [::Google::Cloud::Sql::V1::ListBackupsRequest, ::Hash]
|
|
385
|
+
# A request object representing the call parameters. Required. To specify no
|
|
386
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
387
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
388
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
389
|
+
#
|
|
390
|
+
# @overload list_backups(parent: nil, page_size: nil, page_token: nil, filter: nil)
|
|
391
|
+
# Pass arguments to `list_backups` via keyword arguments. Note that at
|
|
392
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
393
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
394
|
+
#
|
|
395
|
+
# @param parent [::String]
|
|
396
|
+
# Required. The parent that owns this collection of backups.
|
|
397
|
+
# Format: projects/\\{project}
|
|
398
|
+
# @param page_size [::Integer]
|
|
399
|
+
# The maximum number of backups to return per response. The service might
|
|
400
|
+
# return fewer backups than this value. If a value for this parameter isn't
|
|
401
|
+
# specified, then, at most, 500 backups are returned. The maximum value is
|
|
402
|
+
# 2,000. Any values that you set, which are greater than 2,000, are changed
|
|
403
|
+
# to 2,000.
|
|
404
|
+
# @param page_token [::String]
|
|
405
|
+
# A page token, received from a previous `ListBackups` call.
|
|
406
|
+
# Provide this to retrieve the subsequent page.
|
|
407
|
+
#
|
|
408
|
+
# When paginating, all other parameters provided to `ListBackups` must match
|
|
409
|
+
# the call that provided the page token.
|
|
410
|
+
# @param filter [::String]
|
|
411
|
+
# Multiple filter queries are separated by spaces. For example,
|
|
412
|
+
# 'instance:abc AND type:FINAL, 'location:us',
|
|
413
|
+
# 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by
|
|
414
|
+
# type, instance, backupInterval.startTime (creation time), or location.
|
|
415
|
+
#
|
|
416
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
417
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Sql::V1::Backup>]
|
|
418
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
419
|
+
#
|
|
420
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Sql::V1::Backup>]
|
|
421
|
+
#
|
|
422
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
423
|
+
#
|
|
424
|
+
# @example Basic example
|
|
425
|
+
# require "google/cloud/sql/v1"
|
|
426
|
+
#
|
|
427
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
428
|
+
# client = Google::Cloud::Sql::V1::SqlBackupsService::Client.new
|
|
429
|
+
#
|
|
430
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
431
|
+
# request = Google::Cloud::Sql::V1::ListBackupsRequest.new
|
|
432
|
+
#
|
|
433
|
+
# # Call the list_backups method.
|
|
434
|
+
# result = client.list_backups request
|
|
435
|
+
#
|
|
436
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
|
437
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
|
438
|
+
# result.each do |item|
|
|
439
|
+
# # Each element is of type ::Google::Cloud::Sql::V1::Backup.
|
|
440
|
+
# p item
|
|
441
|
+
# end
|
|
442
|
+
#
|
|
443
|
+
def list_backups request, options = nil
|
|
444
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
445
|
+
|
|
446
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::ListBackupsRequest
|
|
447
|
+
|
|
448
|
+
# Converts hash and nil to an options object
|
|
449
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
450
|
+
|
|
451
|
+
# Customize the options with defaults
|
|
452
|
+
metadata = @config.rpcs.list_backups.metadata.to_h
|
|
453
|
+
|
|
454
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
455
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
456
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
457
|
+
gapic_version: ::Google::Cloud::Sql::V1::VERSION
|
|
458
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
459
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
460
|
+
|
|
461
|
+
header_params = {}
|
|
462
|
+
if request.parent
|
|
463
|
+
header_params["parent"] = request.parent
|
|
464
|
+
end
|
|
465
|
+
|
|
466
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
467
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
|
468
|
+
|
|
469
|
+
options.apply_defaults timeout: @config.rpcs.list_backups.timeout,
|
|
470
|
+
metadata: metadata,
|
|
471
|
+
retry_policy: @config.rpcs.list_backups.retry_policy
|
|
472
|
+
|
|
473
|
+
options.apply_defaults timeout: @config.timeout,
|
|
474
|
+
metadata: @config.metadata,
|
|
475
|
+
retry_policy: @config.retry_policy
|
|
476
|
+
|
|
477
|
+
@sql_backups_service_stub.call_rpc :list_backups, request, options: options do |response, operation|
|
|
478
|
+
response = ::Gapic::PagedEnumerable.new @sql_backups_service_stub, :list_backups, request, response, operation, options
|
|
479
|
+
yield response, operation if block_given?
|
|
480
|
+
throw :response, response
|
|
481
|
+
end
|
|
482
|
+
rescue ::GRPC::BadStatus => e
|
|
483
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
484
|
+
end
|
|
485
|
+
|
|
486
|
+
##
|
|
487
|
+
# Updates the retention period and description of the backup. You can use
|
|
488
|
+
# this API to update final backups only.
|
|
489
|
+
#
|
|
490
|
+
# @overload update_backup(request, options = nil)
|
|
491
|
+
# Pass arguments to `update_backup` via a request object, either of type
|
|
492
|
+
# {::Google::Cloud::Sql::V1::UpdateBackupRequest} or an equivalent Hash.
|
|
493
|
+
#
|
|
494
|
+
# @param request [::Google::Cloud::Sql::V1::UpdateBackupRequest, ::Hash]
|
|
495
|
+
# A request object representing the call parameters. Required. To specify no
|
|
496
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
497
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
498
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
499
|
+
#
|
|
500
|
+
# @overload update_backup(backup: nil, update_mask: nil)
|
|
501
|
+
# Pass arguments to `update_backup` via keyword arguments. Note that at
|
|
502
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
503
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
504
|
+
#
|
|
505
|
+
# @param backup [::Google::Cloud::Sql::V1::Backup, ::Hash]
|
|
506
|
+
# Required. The backup to update.
|
|
507
|
+
# The backup’s `name` field is used to identify the backup to update.
|
|
508
|
+
# Format: projects/\\{project}/backups/\\{backup}
|
|
509
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
|
510
|
+
# The list of fields that you can update. You can update only the description
|
|
511
|
+
# and retention period of the final backup.
|
|
512
|
+
#
|
|
513
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
514
|
+
# @yieldparam response [::Google::Cloud::Sql::V1::Operation]
|
|
515
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
516
|
+
#
|
|
517
|
+
# @return [::Google::Cloud::Sql::V1::Operation]
|
|
518
|
+
#
|
|
519
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
520
|
+
#
|
|
521
|
+
# @example Basic example
|
|
522
|
+
# require "google/cloud/sql/v1"
|
|
523
|
+
#
|
|
524
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
525
|
+
# client = Google::Cloud::Sql::V1::SqlBackupsService::Client.new
|
|
526
|
+
#
|
|
527
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
528
|
+
# request = Google::Cloud::Sql::V1::UpdateBackupRequest.new
|
|
529
|
+
#
|
|
530
|
+
# # Call the update_backup method.
|
|
531
|
+
# result = client.update_backup request
|
|
532
|
+
#
|
|
533
|
+
# # The returned object is of type Google::Cloud::Sql::V1::Operation.
|
|
534
|
+
# p result
|
|
535
|
+
#
|
|
536
|
+
def update_backup request, options = nil
|
|
537
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
538
|
+
|
|
539
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::UpdateBackupRequest
|
|
540
|
+
|
|
541
|
+
# Converts hash and nil to an options object
|
|
542
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
543
|
+
|
|
544
|
+
# Customize the options with defaults
|
|
545
|
+
metadata = @config.rpcs.update_backup.metadata.to_h
|
|
546
|
+
|
|
547
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
548
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
549
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
550
|
+
gapic_version: ::Google::Cloud::Sql::V1::VERSION
|
|
551
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
552
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
553
|
+
|
|
554
|
+
header_params = {}
|
|
555
|
+
if request.backup&.name
|
|
556
|
+
header_params["backup.name"] = request.backup.name
|
|
557
|
+
end
|
|
558
|
+
|
|
559
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
560
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
|
561
|
+
|
|
562
|
+
options.apply_defaults timeout: @config.rpcs.update_backup.timeout,
|
|
563
|
+
metadata: metadata,
|
|
564
|
+
retry_policy: @config.rpcs.update_backup.retry_policy
|
|
565
|
+
|
|
566
|
+
options.apply_defaults timeout: @config.timeout,
|
|
567
|
+
metadata: @config.metadata,
|
|
568
|
+
retry_policy: @config.retry_policy
|
|
569
|
+
|
|
570
|
+
@sql_backups_service_stub.call_rpc :update_backup, request, options: options do |response, operation|
|
|
571
|
+
yield response, operation if block_given?
|
|
572
|
+
end
|
|
573
|
+
rescue ::GRPC::BadStatus => e
|
|
574
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
575
|
+
end
|
|
576
|
+
|
|
577
|
+
##
|
|
578
|
+
# Deletes the backup.
|
|
579
|
+
#
|
|
580
|
+
# @overload delete_backup(request, options = nil)
|
|
581
|
+
# Pass arguments to `delete_backup` via a request object, either of type
|
|
582
|
+
# {::Google::Cloud::Sql::V1::DeleteBackupRequest} or an equivalent Hash.
|
|
583
|
+
#
|
|
584
|
+
# @param request [::Google::Cloud::Sql::V1::DeleteBackupRequest, ::Hash]
|
|
585
|
+
# A request object representing the call parameters. Required. To specify no
|
|
586
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
587
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
588
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
589
|
+
#
|
|
590
|
+
# @overload delete_backup(name: nil)
|
|
591
|
+
# Pass arguments to `delete_backup` via keyword arguments. Note that at
|
|
592
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
593
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
594
|
+
#
|
|
595
|
+
# @param name [::String]
|
|
596
|
+
# Required. The name of the backup to delete.
|
|
597
|
+
# Format: projects/\\{project}/backups/\\{backup}
|
|
598
|
+
#
|
|
599
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
600
|
+
# @yieldparam response [::Google::Cloud::Sql::V1::Operation]
|
|
601
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
602
|
+
#
|
|
603
|
+
# @return [::Google::Cloud::Sql::V1::Operation]
|
|
604
|
+
#
|
|
605
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
606
|
+
#
|
|
607
|
+
# @example Basic example
|
|
608
|
+
# require "google/cloud/sql/v1"
|
|
609
|
+
#
|
|
610
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
611
|
+
# client = Google::Cloud::Sql::V1::SqlBackupsService::Client.new
|
|
612
|
+
#
|
|
613
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
614
|
+
# request = Google::Cloud::Sql::V1::DeleteBackupRequest.new
|
|
615
|
+
#
|
|
616
|
+
# # Call the delete_backup method.
|
|
617
|
+
# result = client.delete_backup request
|
|
618
|
+
#
|
|
619
|
+
# # The returned object is of type Google::Cloud::Sql::V1::Operation.
|
|
620
|
+
# p result
|
|
621
|
+
#
|
|
622
|
+
def delete_backup request, options = nil
|
|
623
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
624
|
+
|
|
625
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::DeleteBackupRequest
|
|
626
|
+
|
|
627
|
+
# Converts hash and nil to an options object
|
|
628
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
629
|
+
|
|
630
|
+
# Customize the options with defaults
|
|
631
|
+
metadata = @config.rpcs.delete_backup.metadata.to_h
|
|
632
|
+
|
|
633
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
634
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
635
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
636
|
+
gapic_version: ::Google::Cloud::Sql::V1::VERSION
|
|
637
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
638
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
639
|
+
|
|
640
|
+
header_params = {}
|
|
641
|
+
if request.name
|
|
642
|
+
header_params["name"] = request.name
|
|
643
|
+
end
|
|
644
|
+
|
|
645
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
646
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
|
647
|
+
|
|
648
|
+
options.apply_defaults timeout: @config.rpcs.delete_backup.timeout,
|
|
649
|
+
metadata: metadata,
|
|
650
|
+
retry_policy: @config.rpcs.delete_backup.retry_policy
|
|
651
|
+
|
|
652
|
+
options.apply_defaults timeout: @config.timeout,
|
|
653
|
+
metadata: @config.metadata,
|
|
654
|
+
retry_policy: @config.retry_policy
|
|
655
|
+
|
|
656
|
+
@sql_backups_service_stub.call_rpc :delete_backup, request, options: options do |response, operation|
|
|
657
|
+
yield response, operation if block_given?
|
|
658
|
+
end
|
|
659
|
+
rescue ::GRPC::BadStatus => e
|
|
660
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
661
|
+
end
|
|
662
|
+
|
|
663
|
+
##
|
|
664
|
+
# Configuration class for the SqlBackupsService API.
|
|
665
|
+
#
|
|
666
|
+
# This class represents the configuration for SqlBackupsService,
|
|
667
|
+
# providing control over timeouts, retry behavior, logging, transport
|
|
668
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
|
669
|
+
# applied individually to specific RPCs. See
|
|
670
|
+
# {::Google::Cloud::Sql::V1::SqlBackupsService::Client::Configuration::Rpcs}
|
|
671
|
+
# for a list of RPCs that can be configured independently.
|
|
672
|
+
#
|
|
673
|
+
# Configuration can be applied globally to all clients, or to a single client
|
|
674
|
+
# on construction.
|
|
675
|
+
#
|
|
676
|
+
# @example
|
|
677
|
+
#
|
|
678
|
+
# # Modify the global config, setting the timeout for
|
|
679
|
+
# # create_backup to 20 seconds,
|
|
680
|
+
# # and all remaining timeouts to 10 seconds.
|
|
681
|
+
# ::Google::Cloud::Sql::V1::SqlBackupsService::Client.configure do |config|
|
|
682
|
+
# config.timeout = 10.0
|
|
683
|
+
# config.rpcs.create_backup.timeout = 20.0
|
|
684
|
+
# end
|
|
685
|
+
#
|
|
686
|
+
# # Apply the above configuration only to a new client.
|
|
687
|
+
# client = ::Google::Cloud::Sql::V1::SqlBackupsService::Client.new do |config|
|
|
688
|
+
# config.timeout = 10.0
|
|
689
|
+
# config.rpcs.create_backup.timeout = 20.0
|
|
690
|
+
# end
|
|
691
|
+
#
|
|
692
|
+
# @!attribute [rw] endpoint
|
|
693
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
|
694
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
|
695
|
+
# @return [::String,nil]
|
|
696
|
+
# @!attribute [rw] credentials
|
|
697
|
+
# Credentials to send with calls. You may provide any of the following types:
|
|
698
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
|
699
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
|
700
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
|
701
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
|
702
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
|
703
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
|
704
|
+
# * (`nil`) indicating no credentials
|
|
705
|
+
#
|
|
706
|
+
# @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
|
|
707
|
+
# is deprecated. Providing an unvalidated credential configuration to
|
|
708
|
+
# Google APIs can compromise the security of your systems and data.
|
|
709
|
+
#
|
|
710
|
+
# @example
|
|
711
|
+
#
|
|
712
|
+
# # The recommended way to provide credentials is to use the `make_creds` method
|
|
713
|
+
# # on the appropriate credentials class for your environment.
|
|
714
|
+
#
|
|
715
|
+
# require "googleauth"
|
|
716
|
+
#
|
|
717
|
+
# credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
|
|
718
|
+
# json_key_io: ::File.open("/path/to/keyfile.json")
|
|
719
|
+
# )
|
|
720
|
+
#
|
|
721
|
+
# client = ::Google::Cloud::Sql::V1::SqlBackupsService::Client.new do |config|
|
|
722
|
+
# config.credentials = credentials
|
|
723
|
+
# end
|
|
724
|
+
#
|
|
725
|
+
# @note Warning: If you accept a credential configuration (JSON file or Hash) from an
|
|
726
|
+
# external source for authentication to Google Cloud, you must validate it before
|
|
727
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
|
728
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
|
729
|
+
# For more information, refer to [Validate credential configurations from external
|
|
730
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
|
731
|
+
# @return [::Object]
|
|
732
|
+
# @!attribute [rw] scope
|
|
733
|
+
# The OAuth scopes
|
|
734
|
+
# @return [::Array<::String>]
|
|
735
|
+
# @!attribute [rw] lib_name
|
|
736
|
+
# The library name as recorded in instrumentation and logging
|
|
737
|
+
# @return [::String]
|
|
738
|
+
# @!attribute [rw] lib_version
|
|
739
|
+
# The library version as recorded in instrumentation and logging
|
|
740
|
+
# @return [::String]
|
|
741
|
+
# @!attribute [rw] channel_args
|
|
742
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
|
743
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
|
744
|
+
# @return [::Hash]
|
|
745
|
+
# @!attribute [rw] interceptors
|
|
746
|
+
# An array of interceptors that are run before calls are executed.
|
|
747
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
|
748
|
+
# @!attribute [rw] timeout
|
|
749
|
+
# The call timeout in seconds.
|
|
750
|
+
# @return [::Numeric]
|
|
751
|
+
# @!attribute [rw] metadata
|
|
752
|
+
# Additional gRPC headers to be sent with the call.
|
|
753
|
+
# @return [::Hash{::Symbol=>::String}]
|
|
754
|
+
# @!attribute [rw] retry_policy
|
|
755
|
+
# The retry policy. The value is a hash with the following keys:
|
|
756
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
757
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
758
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
759
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
760
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
761
|
+
# trigger a retry.
|
|
762
|
+
# @return [::Hash]
|
|
763
|
+
# @!attribute [rw] quota_project
|
|
764
|
+
# A separate project against which to charge quota.
|
|
765
|
+
# @return [::String]
|
|
766
|
+
# @!attribute [rw] universe_domain
|
|
767
|
+
# The universe domain within which to make requests. This determines the
|
|
768
|
+
# default endpoint URL. The default value of nil uses the environment
|
|
769
|
+
# universe (usually the default "googleapis.com" universe).
|
|
770
|
+
# @return [::String,nil]
|
|
771
|
+
# @!attribute [rw] logger
|
|
772
|
+
# A custom logger to use for request/response debug logging, or the value
|
|
773
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
|
774
|
+
# explicitly disable logging.
|
|
775
|
+
# @return [::Logger,:default,nil]
|
|
776
|
+
#
|
|
777
|
+
class Configuration
|
|
778
|
+
extend ::Gapic::Config
|
|
779
|
+
|
|
780
|
+
# @private
|
|
781
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
|
782
|
+
DEFAULT_ENDPOINT = "sqladmin.googleapis.com"
|
|
783
|
+
|
|
784
|
+
config_attr :endpoint, nil, ::String, nil
|
|
785
|
+
config_attr :credentials, nil do |value|
|
|
786
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
|
|
787
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
|
|
788
|
+
allowed.any? { |klass| klass === value }
|
|
789
|
+
end
|
|
790
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
|
791
|
+
config_attr :lib_name, nil, ::String, nil
|
|
792
|
+
config_attr :lib_version, nil, ::String, nil
|
|
793
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
|
794
|
+
config_attr :interceptors, nil, ::Array, nil
|
|
795
|
+
config_attr :timeout, nil, ::Numeric, nil
|
|
796
|
+
config_attr :metadata, nil, ::Hash, nil
|
|
797
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
|
798
|
+
config_attr :quota_project, nil, ::String, nil
|
|
799
|
+
config_attr :universe_domain, nil, ::String, nil
|
|
800
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
|
801
|
+
|
|
802
|
+
# @private
|
|
803
|
+
def initialize parent_config = nil
|
|
804
|
+
@parent_config = parent_config unless parent_config.nil?
|
|
805
|
+
|
|
806
|
+
yield self if block_given?
|
|
807
|
+
end
|
|
808
|
+
|
|
809
|
+
##
|
|
810
|
+
# Configurations for individual RPCs
|
|
811
|
+
# @return [Rpcs]
|
|
812
|
+
#
|
|
813
|
+
def rpcs
|
|
814
|
+
@rpcs ||= begin
|
|
815
|
+
parent_rpcs = nil
|
|
816
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
|
817
|
+
Rpcs.new parent_rpcs
|
|
818
|
+
end
|
|
819
|
+
end
|
|
820
|
+
|
|
821
|
+
##
|
|
822
|
+
# Configuration for the channel pool
|
|
823
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
|
824
|
+
#
|
|
825
|
+
def channel_pool
|
|
826
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
|
827
|
+
end
|
|
828
|
+
|
|
829
|
+
##
|
|
830
|
+
# Configuration RPC class for the SqlBackupsService API.
|
|
831
|
+
#
|
|
832
|
+
# Includes fields providing the configuration for each RPC in this service.
|
|
833
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
|
834
|
+
# the following configuration fields:
|
|
835
|
+
#
|
|
836
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
|
837
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
|
838
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
|
839
|
+
# include the following keys:
|
|
840
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
841
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
842
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
843
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
844
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
845
|
+
# trigger a retry.
|
|
846
|
+
#
|
|
847
|
+
class Rpcs
|
|
848
|
+
##
|
|
849
|
+
# RPC-specific configuration for `create_backup`
|
|
850
|
+
# @return [::Gapic::Config::Method]
|
|
851
|
+
#
|
|
852
|
+
attr_reader :create_backup
|
|
853
|
+
##
|
|
854
|
+
# RPC-specific configuration for `get_backup`
|
|
855
|
+
# @return [::Gapic::Config::Method]
|
|
856
|
+
#
|
|
857
|
+
attr_reader :get_backup
|
|
858
|
+
##
|
|
859
|
+
# RPC-specific configuration for `list_backups`
|
|
860
|
+
# @return [::Gapic::Config::Method]
|
|
861
|
+
#
|
|
862
|
+
attr_reader :list_backups
|
|
863
|
+
##
|
|
864
|
+
# RPC-specific configuration for `update_backup`
|
|
865
|
+
# @return [::Gapic::Config::Method]
|
|
866
|
+
#
|
|
867
|
+
attr_reader :update_backup
|
|
868
|
+
##
|
|
869
|
+
# RPC-specific configuration for `delete_backup`
|
|
870
|
+
# @return [::Gapic::Config::Method]
|
|
871
|
+
#
|
|
872
|
+
attr_reader :delete_backup
|
|
873
|
+
|
|
874
|
+
# @private
|
|
875
|
+
def initialize parent_rpcs = nil
|
|
876
|
+
create_backup_config = parent_rpcs.create_backup if parent_rpcs.respond_to? :create_backup
|
|
877
|
+
@create_backup = ::Gapic::Config::Method.new create_backup_config
|
|
878
|
+
get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup
|
|
879
|
+
@get_backup = ::Gapic::Config::Method.new get_backup_config
|
|
880
|
+
list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups
|
|
881
|
+
@list_backups = ::Gapic::Config::Method.new list_backups_config
|
|
882
|
+
update_backup_config = parent_rpcs.update_backup if parent_rpcs.respond_to? :update_backup
|
|
883
|
+
@update_backup = ::Gapic::Config::Method.new update_backup_config
|
|
884
|
+
delete_backup_config = parent_rpcs.delete_backup if parent_rpcs.respond_to? :delete_backup
|
|
885
|
+
@delete_backup = ::Gapic::Config::Method.new delete_backup_config
|
|
886
|
+
|
|
887
|
+
yield self if block_given?
|
|
888
|
+
end
|
|
889
|
+
end
|
|
890
|
+
end
|
|
891
|
+
end
|
|
892
|
+
end
|
|
893
|
+
end
|
|
894
|
+
end
|
|
895
|
+
end
|
|
896
|
+
end
|