google-cloud-alloy_db-v1beta 0.15.0 → 0.16.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/lib/google/cloud/alloy_db/v1beta/alloy_db_admin/client.rb +131 -4
- data/lib/google/cloud/alloy_db/v1beta/alloy_db_admin/rest/client.rb +124 -4
- data/lib/google/cloud/alloy_db/v1beta/alloy_db_admin/rest/service_stub.rb +62 -0
- data/lib/google/cloud/alloy_db/v1beta/alloy_db_cloud_sql_admin/client.rb +519 -0
- data/lib/google/cloud/alloy_db/v1beta/alloy_db_cloud_sql_admin/credentials.rb +47 -0
- data/lib/google/cloud/alloy_db/v1beta/alloy_db_cloud_sql_admin/operations.rb +813 -0
- data/lib/google/cloud/alloy_db/v1beta/alloy_db_cloud_sql_admin/paths.rb +128 -0
- data/lib/google/cloud/alloy_db/v1beta/alloy_db_cloud_sql_admin/rest/client.rb +494 -0
- data/lib/google/cloud/alloy_db/v1beta/alloy_db_cloud_sql_admin/rest/operations.rb +913 -0
- data/lib/google/cloud/alloy_db/v1beta/alloy_db_cloud_sql_admin/rest/service_stub.rb +143 -0
- data/lib/google/cloud/alloy_db/v1beta/alloy_db_cloud_sql_admin/rest.rb +54 -0
- data/lib/google/cloud/alloy_db/v1beta/alloy_db_cloud_sql_admin.rb +56 -0
- data/lib/google/cloud/alloy_db/v1beta/rest.rb +1 -0
- data/lib/google/cloud/alloy_db/v1beta/version.rb +1 -1
- data/lib/google/cloud/alloy_db/v1beta.rb +1 -0
- data/lib/google/cloud/alloydb/v1beta/csql_service_pb.rb +53 -0
- data/lib/google/cloud/alloydb/v1beta/csql_service_services_pb.rb +45 -0
- data/lib/google/cloud/alloydb/v1beta/gemini_pb.rb +3 -1
- data/lib/google/cloud/alloydb/v1beta/resources_pb.rb +4 -1
- data/lib/google/cloud/alloydb/v1beta/service_pb.rb +5 -1
- data/lib/google/cloud/alloydb/v1beta/service_services_pb.rb +3 -0
- data/proto_docs/google/cloud/alloydb/v1beta/csql_service.rb +45 -0
- data/proto_docs/google/cloud/alloydb/v1beta/gemini.rb +19 -0
- data/proto_docs/google/cloud/alloydb/v1beta/resources.rb +89 -6
- data/proto_docs/google/cloud/alloydb/v1beta/service.rb +87 -3
- metadata +13 -1
@@ -0,0 +1,128 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2025 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
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module AlloyDB
|
23
|
+
module V1beta
|
24
|
+
module AlloyDBCloudSQLAdmin
|
25
|
+
# Path helper methods for the AlloyDBCloudSQLAdmin API.
|
26
|
+
module Paths
|
27
|
+
##
|
28
|
+
# Create a fully-qualified Backup resource string.
|
29
|
+
#
|
30
|
+
# The resource will be in the following format:
|
31
|
+
#
|
32
|
+
# `projects/{project}/locations/{location}/backups/{backup}`
|
33
|
+
#
|
34
|
+
# @param project [String]
|
35
|
+
# @param location [String]
|
36
|
+
# @param backup [String]
|
37
|
+
#
|
38
|
+
# @return [::String]
|
39
|
+
def backup_path project:, location:, backup:
|
40
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
41
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
42
|
+
|
43
|
+
"projects/#{project}/locations/#{location}/backups/#{backup}"
|
44
|
+
end
|
45
|
+
|
46
|
+
##
|
47
|
+
# Create a fully-qualified Cluster resource string.
|
48
|
+
#
|
49
|
+
# The resource will be in the following format:
|
50
|
+
#
|
51
|
+
# `projects/{project}/locations/{location}/clusters/{cluster}`
|
52
|
+
#
|
53
|
+
# @param project [String]
|
54
|
+
# @param location [String]
|
55
|
+
# @param cluster [String]
|
56
|
+
#
|
57
|
+
# @return [::String]
|
58
|
+
def cluster_path project:, location:, cluster:
|
59
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
60
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
61
|
+
|
62
|
+
"projects/#{project}/locations/#{location}/clusters/#{cluster}"
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# Create a fully-qualified CryptoKeyVersion resource string.
|
67
|
+
#
|
68
|
+
# The resource will be in the following format:
|
69
|
+
#
|
70
|
+
# `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`
|
71
|
+
#
|
72
|
+
# @param project [String]
|
73
|
+
# @param location [String]
|
74
|
+
# @param key_ring [String]
|
75
|
+
# @param crypto_key [String]
|
76
|
+
# @param crypto_key_version [String]
|
77
|
+
#
|
78
|
+
# @return [::String]
|
79
|
+
def crypto_key_version_path project:, location:, key_ring:, crypto_key:, crypto_key_version:
|
80
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
81
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
82
|
+
raise ::ArgumentError, "key_ring cannot contain /" if key_ring.to_s.include? "/"
|
83
|
+
raise ::ArgumentError, "crypto_key cannot contain /" if crypto_key.to_s.include? "/"
|
84
|
+
|
85
|
+
"projects/#{project}/locations/#{location}/keyRings/#{key_ring}/cryptoKeys/#{crypto_key}/cryptoKeyVersions/#{crypto_key_version}"
|
86
|
+
end
|
87
|
+
|
88
|
+
##
|
89
|
+
# Create a fully-qualified Location resource string.
|
90
|
+
#
|
91
|
+
# The resource will be in the following format:
|
92
|
+
#
|
93
|
+
# `projects/{project}/locations/{location}`
|
94
|
+
#
|
95
|
+
# @param project [String]
|
96
|
+
# @param location [String]
|
97
|
+
#
|
98
|
+
# @return [::String]
|
99
|
+
def location_path project:, location:
|
100
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
101
|
+
|
102
|
+
"projects/#{project}/locations/#{location}"
|
103
|
+
end
|
104
|
+
|
105
|
+
##
|
106
|
+
# Create a fully-qualified Network resource string.
|
107
|
+
#
|
108
|
+
# The resource will be in the following format:
|
109
|
+
#
|
110
|
+
# `projects/{project}/global/networks/{network}`
|
111
|
+
#
|
112
|
+
# @param project [String]
|
113
|
+
# @param network [String]
|
114
|
+
#
|
115
|
+
# @return [::String]
|
116
|
+
def network_path project:, network:
|
117
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
118
|
+
|
119
|
+
"projects/#{project}/global/networks/#{network}"
|
120
|
+
end
|
121
|
+
|
122
|
+
extend self
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,494 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2025 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/alloydb/v1beta/csql_service_pb"
|
21
|
+
require "google/cloud/alloy_db/v1beta/alloy_db_cloud_sql_admin/rest/service_stub"
|
22
|
+
require "google/cloud/location/rest"
|
23
|
+
require "google/iam/v1/rest"
|
24
|
+
|
25
|
+
module Google
|
26
|
+
module Cloud
|
27
|
+
module AlloyDB
|
28
|
+
module V1beta
|
29
|
+
module AlloyDBCloudSQLAdmin
|
30
|
+
module Rest
|
31
|
+
##
|
32
|
+
# REST client for the AlloyDBCloudSQLAdmin service.
|
33
|
+
#
|
34
|
+
# Service for interactions with CloudSQL.
|
35
|
+
#
|
36
|
+
class Client
|
37
|
+
# @private
|
38
|
+
API_VERSION = ""
|
39
|
+
|
40
|
+
# @private
|
41
|
+
DEFAULT_ENDPOINT_TEMPLATE = "alloydb.$UNIVERSE_DOMAIN$"
|
42
|
+
|
43
|
+
include Paths
|
44
|
+
|
45
|
+
# @private
|
46
|
+
attr_reader :alloy_db_cloud_sql_admin_stub
|
47
|
+
|
48
|
+
##
|
49
|
+
# Configure the AlloyDBCloudSQLAdmin Client class.
|
50
|
+
#
|
51
|
+
# See {::Google::Cloud::AlloyDB::V1beta::AlloyDBCloudSQLAdmin::Rest::Client::Configuration}
|
52
|
+
# for a description of the configuration fields.
|
53
|
+
#
|
54
|
+
# @example
|
55
|
+
#
|
56
|
+
# # Modify the configuration for all AlloyDBCloudSQLAdmin clients
|
57
|
+
# ::Google::Cloud::AlloyDB::V1beta::AlloyDBCloudSQLAdmin::Rest::Client.configure do |config|
|
58
|
+
# config.timeout = 10.0
|
59
|
+
# end
|
60
|
+
#
|
61
|
+
# @yield [config] Configure the Client client.
|
62
|
+
# @yieldparam config [Client::Configuration]
|
63
|
+
#
|
64
|
+
# @return [Client::Configuration]
|
65
|
+
#
|
66
|
+
def self.configure
|
67
|
+
@configure ||= begin
|
68
|
+
namespace = ["Google", "Cloud", "AlloyDB", "V1beta"]
|
69
|
+
parent_config = while namespace.any?
|
70
|
+
parent_name = namespace.join "::"
|
71
|
+
parent_const = const_get parent_name
|
72
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
73
|
+
namespace.pop
|
74
|
+
end
|
75
|
+
default_config = Client::Configuration.new parent_config
|
76
|
+
|
77
|
+
default_config
|
78
|
+
end
|
79
|
+
yield @configure if block_given?
|
80
|
+
@configure
|
81
|
+
end
|
82
|
+
|
83
|
+
##
|
84
|
+
# Configure the AlloyDBCloudSQLAdmin Client instance.
|
85
|
+
#
|
86
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
87
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
88
|
+
# should be made on {Client.configure}.
|
89
|
+
#
|
90
|
+
# See {::Google::Cloud::AlloyDB::V1beta::AlloyDBCloudSQLAdmin::Rest::Client::Configuration}
|
91
|
+
# for a description of the configuration fields.
|
92
|
+
#
|
93
|
+
# @yield [config] Configure the Client client.
|
94
|
+
# @yieldparam config [Client::Configuration]
|
95
|
+
#
|
96
|
+
# @return [Client::Configuration]
|
97
|
+
#
|
98
|
+
def configure
|
99
|
+
yield @config if block_given?
|
100
|
+
@config
|
101
|
+
end
|
102
|
+
|
103
|
+
##
|
104
|
+
# The effective universe domain
|
105
|
+
#
|
106
|
+
# @return [String]
|
107
|
+
#
|
108
|
+
def universe_domain
|
109
|
+
@alloy_db_cloud_sql_admin_stub.universe_domain
|
110
|
+
end
|
111
|
+
|
112
|
+
##
|
113
|
+
# Create a new AlloyDBCloudSQLAdmin REST client object.
|
114
|
+
#
|
115
|
+
# @example
|
116
|
+
#
|
117
|
+
# # Create a client using the default configuration
|
118
|
+
# client = ::Google::Cloud::AlloyDB::V1beta::AlloyDBCloudSQLAdmin::Rest::Client.new
|
119
|
+
#
|
120
|
+
# # Create a client using a custom configuration
|
121
|
+
# client = ::Google::Cloud::AlloyDB::V1beta::AlloyDBCloudSQLAdmin::Rest::Client.new do |config|
|
122
|
+
# config.timeout = 10.0
|
123
|
+
# end
|
124
|
+
#
|
125
|
+
# @yield [config] Configure the AlloyDBCloudSQLAdmin client.
|
126
|
+
# @yieldparam config [Client::Configuration]
|
127
|
+
#
|
128
|
+
def initialize
|
129
|
+
# Create the configuration object
|
130
|
+
@config = Configuration.new Client.configure
|
131
|
+
|
132
|
+
# Yield the configuration if needed
|
133
|
+
yield @config if block_given?
|
134
|
+
|
135
|
+
# Create credentials
|
136
|
+
credentials = @config.credentials
|
137
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
138
|
+
# but only if the default endpoint does not have a region prefix.
|
139
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
140
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
141
|
+
!@config.endpoint.split(".").first.include?("-"))
|
142
|
+
credentials ||= Credentials.default scope: @config.scope,
|
143
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
144
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
145
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
146
|
+
end
|
147
|
+
|
148
|
+
@quota_project_id = @config.quota_project
|
149
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
150
|
+
|
151
|
+
@operations_client = ::Google::Cloud::AlloyDB::V1beta::AlloyDBCloudSQLAdmin::Rest::Operations.new do |config|
|
152
|
+
config.credentials = credentials
|
153
|
+
config.quota_project = @quota_project_id
|
154
|
+
config.endpoint = @config.endpoint
|
155
|
+
config.universe_domain = @config.universe_domain
|
156
|
+
end
|
157
|
+
|
158
|
+
@alloy_db_cloud_sql_admin_stub = ::Google::Cloud::AlloyDB::V1beta::AlloyDBCloudSQLAdmin::Rest::ServiceStub.new(
|
159
|
+
endpoint: @config.endpoint,
|
160
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
161
|
+
universe_domain: @config.universe_domain,
|
162
|
+
credentials: credentials,
|
163
|
+
logger: @config.logger
|
164
|
+
)
|
165
|
+
|
166
|
+
@alloy_db_cloud_sql_admin_stub.logger(stub: true)&.info do |entry|
|
167
|
+
entry.set_system_name
|
168
|
+
entry.set_service
|
169
|
+
entry.message = "Created client for #{entry.service}"
|
170
|
+
entry.set_credentials_fields credentials
|
171
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
172
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
173
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
174
|
+
end
|
175
|
+
|
176
|
+
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
177
|
+
config.credentials = credentials
|
178
|
+
config.quota_project = @quota_project_id
|
179
|
+
config.endpoint = @alloy_db_cloud_sql_admin_stub.endpoint
|
180
|
+
config.universe_domain = @alloy_db_cloud_sql_admin_stub.universe_domain
|
181
|
+
config.bindings_override = @config.bindings_override
|
182
|
+
config.logger = @alloy_db_cloud_sql_admin_stub.logger if config.respond_to? :logger=
|
183
|
+
end
|
184
|
+
|
185
|
+
@iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
|
186
|
+
config.credentials = credentials
|
187
|
+
config.quota_project = @quota_project_id
|
188
|
+
config.endpoint = @alloy_db_cloud_sql_admin_stub.endpoint
|
189
|
+
config.universe_domain = @alloy_db_cloud_sql_admin_stub.universe_domain
|
190
|
+
config.logger = @alloy_db_cloud_sql_admin_stub.logger if config.respond_to? :logger=
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
##
|
195
|
+
# Get the associated client for long-running operations.
|
196
|
+
#
|
197
|
+
# @return [::Google::Cloud::AlloyDB::V1beta::AlloyDBCloudSQLAdmin::Rest::Operations]
|
198
|
+
#
|
199
|
+
attr_reader :operations_client
|
200
|
+
|
201
|
+
##
|
202
|
+
# Get the associated client for mix-in of the Locations.
|
203
|
+
#
|
204
|
+
# @return [Google::Cloud::Location::Locations::Rest::Client]
|
205
|
+
#
|
206
|
+
attr_reader :location_client
|
207
|
+
|
208
|
+
##
|
209
|
+
# Get the associated client for mix-in of the IAMPolicy.
|
210
|
+
#
|
211
|
+
# @return [Google::Iam::V1::IAMPolicy::Rest::Client]
|
212
|
+
#
|
213
|
+
attr_reader :iam_policy_client
|
214
|
+
|
215
|
+
##
|
216
|
+
# The logger used for request/response debug logging.
|
217
|
+
#
|
218
|
+
# @return [Logger]
|
219
|
+
#
|
220
|
+
def logger
|
221
|
+
@alloy_db_cloud_sql_admin_stub.logger
|
222
|
+
end
|
223
|
+
|
224
|
+
# Service calls
|
225
|
+
|
226
|
+
##
|
227
|
+
# Restores an AlloyDB cluster from a CloudSQL resource.
|
228
|
+
#
|
229
|
+
# @overload restore_from_cloud_sql(request, options = nil)
|
230
|
+
# Pass arguments to `restore_from_cloud_sql` via a request object, either of type
|
231
|
+
# {::Google::Cloud::AlloyDB::V1beta::RestoreFromCloudSQLRequest} or an equivalent Hash.
|
232
|
+
#
|
233
|
+
# @param request [::Google::Cloud::AlloyDB::V1beta::RestoreFromCloudSQLRequest, ::Hash]
|
234
|
+
# A request object representing the call parameters. Required. To specify no
|
235
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
236
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
237
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
238
|
+
#
|
239
|
+
# @overload restore_from_cloud_sql(cloudsql_backup_run_source: nil, parent: nil, cluster_id: nil, cluster: nil)
|
240
|
+
# Pass arguments to `restore_from_cloud_sql` via keyword arguments. Note that at
|
241
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
242
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
243
|
+
#
|
244
|
+
# @param cloudsql_backup_run_source [::Google::Cloud::AlloyDB::V1beta::CloudSQLBackupRunSource, ::Hash]
|
245
|
+
# Cluster created from CloudSQL backup run.
|
246
|
+
# @param parent [::String]
|
247
|
+
# Required. The location of the new cluster. For the required format, see the
|
248
|
+
# comment on Cluster.name field.
|
249
|
+
# @param cluster_id [::String]
|
250
|
+
# Required. ID of the requesting object.
|
251
|
+
# @param cluster [::Google::Cloud::AlloyDB::V1beta::Cluster, ::Hash]
|
252
|
+
# Required. The resource being created
|
253
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
254
|
+
# @yieldparam result [::Gapic::Operation]
|
255
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
256
|
+
#
|
257
|
+
# @return [::Gapic::Operation]
|
258
|
+
#
|
259
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
260
|
+
#
|
261
|
+
# @example Basic example
|
262
|
+
# require "google/cloud/alloy_db/v1beta"
|
263
|
+
#
|
264
|
+
# # Create a client object. The client can be reused for multiple calls.
|
265
|
+
# client = Google::Cloud::AlloyDB::V1beta::AlloyDBCloudSQLAdmin::Rest::Client.new
|
266
|
+
#
|
267
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
268
|
+
# request = Google::Cloud::AlloyDB::V1beta::RestoreFromCloudSQLRequest.new
|
269
|
+
#
|
270
|
+
# # Call the restore_from_cloud_sql method.
|
271
|
+
# result = client.restore_from_cloud_sql request
|
272
|
+
#
|
273
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
274
|
+
# # check the status of an operation, cancel it, or wait for results.
|
275
|
+
# # Here is how to wait for a response.
|
276
|
+
# result.wait_until_done! timeout: 60
|
277
|
+
# if result.response?
|
278
|
+
# p result.response
|
279
|
+
# else
|
280
|
+
# puts "No response received."
|
281
|
+
# end
|
282
|
+
#
|
283
|
+
def restore_from_cloud_sql request, options = nil
|
284
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
285
|
+
|
286
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1beta::RestoreFromCloudSQLRequest
|
287
|
+
|
288
|
+
# Converts hash and nil to an options object
|
289
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
290
|
+
|
291
|
+
# Customize the options with defaults
|
292
|
+
call_metadata = @config.rpcs.restore_from_cloud_sql.metadata.to_h
|
293
|
+
|
294
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
295
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
296
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
297
|
+
gapic_version: ::Google::Cloud::AlloyDB::V1beta::VERSION,
|
298
|
+
transports_version_send: [:rest]
|
299
|
+
|
300
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
301
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
302
|
+
|
303
|
+
options.apply_defaults timeout: @config.rpcs.restore_from_cloud_sql.timeout,
|
304
|
+
metadata: call_metadata,
|
305
|
+
retry_policy: @config.rpcs.restore_from_cloud_sql.retry_policy
|
306
|
+
|
307
|
+
options.apply_defaults timeout: @config.timeout,
|
308
|
+
metadata: @config.metadata,
|
309
|
+
retry_policy: @config.retry_policy
|
310
|
+
|
311
|
+
@alloy_db_cloud_sql_admin_stub.restore_from_cloud_sql request, options do |result, operation|
|
312
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
313
|
+
yield result, operation if block_given?
|
314
|
+
throw :response, result
|
315
|
+
end
|
316
|
+
rescue ::Gapic::Rest::Error => e
|
317
|
+
raise ::Google::Cloud::Error.from_error(e)
|
318
|
+
end
|
319
|
+
|
320
|
+
##
|
321
|
+
# Configuration class for the AlloyDBCloudSQLAdmin REST API.
|
322
|
+
#
|
323
|
+
# This class represents the configuration for AlloyDBCloudSQLAdmin REST,
|
324
|
+
# providing control over timeouts, retry behavior, logging, transport
|
325
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
326
|
+
# applied individually to specific RPCs. See
|
327
|
+
# {::Google::Cloud::AlloyDB::V1beta::AlloyDBCloudSQLAdmin::Rest::Client::Configuration::Rpcs}
|
328
|
+
# for a list of RPCs that can be configured independently.
|
329
|
+
#
|
330
|
+
# Configuration can be applied globally to all clients, or to a single client
|
331
|
+
# on construction.
|
332
|
+
#
|
333
|
+
# @example
|
334
|
+
#
|
335
|
+
# # Modify the global config, setting the timeout for
|
336
|
+
# # restore_from_cloud_sql to 20 seconds,
|
337
|
+
# # and all remaining timeouts to 10 seconds.
|
338
|
+
# ::Google::Cloud::AlloyDB::V1beta::AlloyDBCloudSQLAdmin::Rest::Client.configure do |config|
|
339
|
+
# config.timeout = 10.0
|
340
|
+
# config.rpcs.restore_from_cloud_sql.timeout = 20.0
|
341
|
+
# end
|
342
|
+
#
|
343
|
+
# # Apply the above configuration only to a new client.
|
344
|
+
# client = ::Google::Cloud::AlloyDB::V1beta::AlloyDBCloudSQLAdmin::Rest::Client.new do |config|
|
345
|
+
# config.timeout = 10.0
|
346
|
+
# config.rpcs.restore_from_cloud_sql.timeout = 20.0
|
347
|
+
# end
|
348
|
+
#
|
349
|
+
# @!attribute [rw] endpoint
|
350
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
351
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
352
|
+
# @return [::String,nil]
|
353
|
+
# @!attribute [rw] credentials
|
354
|
+
# Credentials to send with calls. You may provide any of the following types:
|
355
|
+
# * (`String`) The path to a service account key file in JSON format
|
356
|
+
# * (`Hash`) A service account key as a Hash
|
357
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
358
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
359
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
360
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
361
|
+
# * (`nil`) indicating no credentials
|
362
|
+
#
|
363
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
364
|
+
# external source for authentication to Google Cloud, you must validate it before
|
365
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
366
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
367
|
+
# For more information, refer to [Validate credential configurations from external
|
368
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
369
|
+
# @return [::Object]
|
370
|
+
# @!attribute [rw] scope
|
371
|
+
# The OAuth scopes
|
372
|
+
# @return [::Array<::String>]
|
373
|
+
# @!attribute [rw] lib_name
|
374
|
+
# The library name as recorded in instrumentation and logging
|
375
|
+
# @return [::String]
|
376
|
+
# @!attribute [rw] lib_version
|
377
|
+
# The library version as recorded in instrumentation and logging
|
378
|
+
# @return [::String]
|
379
|
+
# @!attribute [rw] timeout
|
380
|
+
# The call timeout in seconds.
|
381
|
+
# @return [::Numeric]
|
382
|
+
# @!attribute [rw] metadata
|
383
|
+
# Additional headers to be sent with the call.
|
384
|
+
# @return [::Hash{::Symbol=>::String}]
|
385
|
+
# @!attribute [rw] retry_policy
|
386
|
+
# The retry policy. The value is a hash with the following keys:
|
387
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
388
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
389
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
390
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
391
|
+
# trigger a retry.
|
392
|
+
# @return [::Hash]
|
393
|
+
# @!attribute [rw] quota_project
|
394
|
+
# A separate project against which to charge quota.
|
395
|
+
# @return [::String]
|
396
|
+
# @!attribute [rw] universe_domain
|
397
|
+
# The universe domain within which to make requests. This determines the
|
398
|
+
# default endpoint URL. The default value of nil uses the environment
|
399
|
+
# universe (usually the default "googleapis.com" universe).
|
400
|
+
# @return [::String,nil]
|
401
|
+
# @!attribute [rw] logger
|
402
|
+
# A custom logger to use for request/response debug logging, or the value
|
403
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
404
|
+
# explicitly disable logging.
|
405
|
+
# @return [::Logger,:default,nil]
|
406
|
+
#
|
407
|
+
class Configuration
|
408
|
+
extend ::Gapic::Config
|
409
|
+
|
410
|
+
# @private
|
411
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
412
|
+
DEFAULT_ENDPOINT = "alloydb.googleapis.com"
|
413
|
+
|
414
|
+
config_attr :endpoint, nil, ::String, nil
|
415
|
+
config_attr :credentials, nil do |value|
|
416
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
|
417
|
+
allowed.any? { |klass| klass === value }
|
418
|
+
end
|
419
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
420
|
+
config_attr :lib_name, nil, ::String, nil
|
421
|
+
config_attr :lib_version, nil, ::String, nil
|
422
|
+
config_attr :timeout, nil, ::Numeric, nil
|
423
|
+
config_attr :metadata, nil, ::Hash, nil
|
424
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
425
|
+
config_attr :quota_project, nil, ::String, nil
|
426
|
+
config_attr :universe_domain, nil, ::String, nil
|
427
|
+
|
428
|
+
# @private
|
429
|
+
# Overrides for http bindings for the RPCs of this service
|
430
|
+
# are only used when this service is used as mixin, and only
|
431
|
+
# by the host service.
|
432
|
+
# @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
|
433
|
+
config_attr :bindings_override, {}, ::Hash, nil
|
434
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
435
|
+
|
436
|
+
# @private
|
437
|
+
def initialize parent_config = nil
|
438
|
+
@parent_config = parent_config unless parent_config.nil?
|
439
|
+
|
440
|
+
yield self if block_given?
|
441
|
+
end
|
442
|
+
|
443
|
+
##
|
444
|
+
# Configurations for individual RPCs
|
445
|
+
# @return [Rpcs]
|
446
|
+
#
|
447
|
+
def rpcs
|
448
|
+
@rpcs ||= begin
|
449
|
+
parent_rpcs = nil
|
450
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
451
|
+
Rpcs.new parent_rpcs
|
452
|
+
end
|
453
|
+
end
|
454
|
+
|
455
|
+
##
|
456
|
+
# Configuration RPC class for the AlloyDBCloudSQLAdmin API.
|
457
|
+
#
|
458
|
+
# Includes fields providing the configuration for each RPC in this service.
|
459
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
460
|
+
# the following configuration fields:
|
461
|
+
#
|
462
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
463
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
464
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
465
|
+
# include the following keys:
|
466
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
467
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
468
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
469
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
470
|
+
# trigger a retry.
|
471
|
+
#
|
472
|
+
class Rpcs
|
473
|
+
##
|
474
|
+
# RPC-specific configuration for `restore_from_cloud_sql`
|
475
|
+
# @return [::Gapic::Config::Method]
|
476
|
+
#
|
477
|
+
attr_reader :restore_from_cloud_sql
|
478
|
+
|
479
|
+
# @private
|
480
|
+
def initialize parent_rpcs = nil
|
481
|
+
restore_from_cloud_sql_config = parent_rpcs.restore_from_cloud_sql if parent_rpcs.respond_to? :restore_from_cloud_sql
|
482
|
+
@restore_from_cloud_sql = ::Gapic::Config::Method.new restore_from_cloud_sql_config
|
483
|
+
|
484
|
+
yield self if block_given?
|
485
|
+
end
|
486
|
+
end
|
487
|
+
end
|
488
|
+
end
|
489
|
+
end
|
490
|
+
end
|
491
|
+
end
|
492
|
+
end
|
493
|
+
end
|
494
|
+
end
|