google-cloud-sql-v1beta4 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.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +153 -8
  5. data/lib/google/cloud/sql/v1beta4/cloud_sql_connect_pb.rb +35 -0
  6. data/lib/google/cloud/sql/v1beta4/cloud_sql_connect_services_pb.rb +53 -0
  7. data/lib/google/cloud/sql/v1beta4/cloud_sql_data_pb.rb +35 -0
  8. data/lib/google/cloud/sql/v1beta4/cloud_sql_data_services_pb.rb +80 -0
  9. data/lib/google/cloud/sql/v1beta4/cloud_sql_iam_policies_pb.rb +23 -0
  10. data/lib/google/cloud/sql/v1beta4/cloud_sql_iam_policies_services_pb.rb +29 -0
  11. data/lib/google/cloud/sql/v1beta4/cloud_sql_pb.rb +117 -0
  12. data/lib/google/cloud/sql/v1beta4/cloud_sql_resources_pb.rb +192 -0
  13. data/lib/google/cloud/sql/v1beta4/cloud_sql_services_pb.rb +325 -0
  14. data/lib/google/cloud/sql/v1beta4/cloud_sql_tiers_pb.rb +26 -0
  15. data/lib/google/cloud/sql/v1beta4/cloud_sql_tiers_services_pb.rb +46 -0
  16. data/lib/google/cloud/sql/v1beta4/cloud_sql_users_pb.rb +40 -0
  17. data/lib/google/cloud/sql/v1beta4/cloud_sql_users_services_pb.rb +52 -0
  18. data/lib/google/cloud/sql/v1beta4/rest.rb +46 -0
  19. data/lib/google/cloud/sql/v1beta4/sql_backup_runs_service/client.rb +807 -0
  20. data/lib/google/cloud/sql/v1beta4/sql_backup_runs_service/credentials.rb +48 -0
  21. data/lib/google/cloud/sql/v1beta4/sql_backup_runs_service/rest/client.rb +718 -0
  22. data/lib/google/cloud/sql/v1beta4/sql_backup_runs_service/rest/service_stub.rb +332 -0
  23. data/lib/google/cloud/sql/v1beta4/sql_backup_runs_service/rest.rb +49 -0
  24. data/lib/google/cloud/sql/v1beta4/sql_backup_runs_service.rb +52 -0
  25. data/lib/google/cloud/sql/v1beta4/sql_backups_service/client.rb +896 -0
  26. data/lib/google/cloud/sql/v1beta4/sql_backups_service/credentials.rb +48 -0
  27. data/lib/google/cloud/sql/v1beta4/sql_backups_service/paths.rb +83 -0
  28. data/lib/google/cloud/sql/v1beta4/sql_backups_service/rest/client.rb +818 -0
  29. data/lib/google/cloud/sql/v1beta4/sql_backups_service/rest/service_stub.rb +388 -0
  30. data/lib/google/cloud/sql/v1beta4/sql_backups_service/rest.rb +50 -0
  31. data/lib/google/cloud/sql/v1beta4/sql_backups_service.rb +53 -0
  32. data/lib/google/cloud/sql/v1beta4/sql_connect_service/client.rb +705 -0
  33. data/lib/google/cloud/sql/v1beta4/sql_connect_service/credentials.rb +48 -0
  34. data/lib/google/cloud/sql/v1beta4/sql_connect_service/rest/client.rb +632 -0
  35. data/lib/google/cloud/sql/v1beta4/sql_connect_service/rest/service_stub.rb +268 -0
  36. data/lib/google/cloud/sql/v1beta4/sql_connect_service/rest.rb +51 -0
  37. data/lib/google/cloud/sql/v1beta4/sql_connect_service.rb +54 -0
  38. data/lib/google/cloud/sql/v1beta4/sql_data_service/client.rb +520 -0
  39. data/lib/google/cloud/sql/v1beta4/sql_data_service/credentials.rb +48 -0
  40. data/lib/google/cloud/sql/v1beta4/sql_data_service/paths.rb +50 -0
  41. data/lib/google/cloud/sql/v1beta4/sql_data_service.rb +49 -0
  42. data/lib/google/cloud/sql/v1beta4/sql_databases_service/client.rb +1009 -0
  43. data/lib/google/cloud/sql/v1beta4/sql_databases_service/credentials.rb +48 -0
  44. data/lib/google/cloud/sql/v1beta4/sql_databases_service/rest/client.rb +894 -0
  45. data/lib/google/cloud/sql/v1beta4/sql_databases_service/rest/service_stub.rb +460 -0
  46. data/lib/google/cloud/sql/v1beta4/sql_databases_service/rest.rb +49 -0
  47. data/lib/google/cloud/sql/v1beta4/sql_databases_service.rb +52 -0
  48. data/lib/google/cloud/sql/v1beta4/sql_flags_service/client.rb +486 -0
  49. data/lib/google/cloud/sql/v1beta4/sql_flags_service/credentials.rb +48 -0
  50. data/lib/google/cloud/sql/v1beta4/sql_flags_service/rest/client.rb +444 -0
  51. data/lib/google/cloud/sql/v1beta4/sql_flags_service/rest/service_stub.rb +140 -0
  52. data/lib/google/cloud/sql/v1beta4/sql_flags_service/rest.rb +49 -0
  53. data/lib/google/cloud/sql/v1beta4/sql_flags_service.rb +52 -0
  54. data/lib/google/cloud/sql/v1beta4/sql_instances_service/client.rb +4745 -0
  55. data/lib/google/cloud/sql/v1beta4/sql_instances_service/credentials.rb +48 -0
  56. data/lib/google/cloud/sql/v1beta4/sql_instances_service/paths.rb +159 -0
  57. data/lib/google/cloud/sql/v1beta4/sql_instances_service/rest/client.rb +4281 -0
  58. data/lib/google/cloud/sql/v1beta4/sql_instances_service/rest/service_stub.rb +2769 -0
  59. data/lib/google/cloud/sql/v1beta4/sql_instances_service/rest.rb +50 -0
  60. data/lib/google/cloud/sql/v1beta4/sql_instances_service.rb +53 -0
  61. data/lib/google/cloud/sql/v1beta4/sql_operations_service/client.rb +699 -0
  62. data/lib/google/cloud/sql/v1beta4/sql_operations_service/credentials.rb +48 -0
  63. data/lib/google/cloud/sql/v1beta4/sql_operations_service/rest/client.rb +629 -0
  64. data/lib/google/cloud/sql/v1beta4/sql_operations_service/rest/service_stub.rb +266 -0
  65. data/lib/google/cloud/sql/v1beta4/sql_operations_service/rest.rb +49 -0
  66. data/lib/google/cloud/sql/v1beta4/sql_operations_service.rb +52 -0
  67. data/lib/google/cloud/sql/v1beta4/sql_ssl_certs_service/client.rb +802 -0
  68. data/lib/google/cloud/sql/v1beta4/sql_ssl_certs_service/credentials.rb +48 -0
  69. data/lib/google/cloud/sql/v1beta4/sql_ssl_certs_service/rest/client.rb +713 -0
  70. data/lib/google/cloud/sql/v1beta4/sql_ssl_certs_service/rest/service_stub.rb +332 -0
  71. data/lib/google/cloud/sql/v1beta4/sql_ssl_certs_service/rest.rb +49 -0
  72. data/lib/google/cloud/sql/v1beta4/sql_ssl_certs_service.rb +52 -0
  73. data/lib/google/cloud/sql/v1beta4/sql_tiers_service/client.rb +493 -0
  74. data/lib/google/cloud/sql/v1beta4/sql_tiers_service/credentials.rb +48 -0
  75. data/lib/google/cloud/sql/v1beta4/sql_tiers_service/rest/client.rb +443 -0
  76. data/lib/google/cloud/sql/v1beta4/sql_tiers_service/rest/service_stub.rb +142 -0
  77. data/lib/google/cloud/sql/v1beta4/sql_tiers_service/rest.rb +51 -0
  78. data/lib/google/cloud/sql/v1beta4/sql_tiers_service.rb +54 -0
  79. data/lib/google/cloud/sql/v1beta4/sql_users_service/client.rb +915 -0
  80. data/lib/google/cloud/sql/v1beta4/sql_users_service/credentials.rb +48 -0
  81. data/lib/google/cloud/sql/v1beta4/sql_users_service/rest/client.rb +819 -0
  82. data/lib/google/cloud/sql/v1beta4/sql_users_service/rest/service_stub.rb +394 -0
  83. data/lib/google/cloud/sql/v1beta4/sql_users_service/rest.rb +49 -0
  84. data/lib/google/cloud/sql/v1beta4/sql_users_service.rb +52 -0
  85. data/lib/google/cloud/sql/v1beta4/version.rb +7 -2
  86. data/lib/google/cloud/sql/v1beta4.rb +56 -0
  87. data/lib/google-cloud-sql-v1beta4.rb +21 -0
  88. data/proto_docs/README.md +4 -0
  89. data/proto_docs/google/api/client.rb +593 -0
  90. data/proto_docs/google/api/field_behavior.rb +85 -0
  91. data/proto_docs/google/api/field_info.rb +88 -0
  92. data/proto_docs/google/api/launch_stage.rb +71 -0
  93. data/proto_docs/google/api/resource.rb +227 -0
  94. data/proto_docs/google/cloud/sql/v1beta4/cloud_sql.rb +1329 -0
  95. data/proto_docs/google/cloud/sql/v1beta4/cloud_sql_connect.rb +207 -0
  96. data/proto_docs/google/cloud/sql/v1beta4/cloud_sql_data.rb +189 -0
  97. data/proto_docs/google/cloud/sql/v1beta4/cloud_sql_resources.rb +4489 -0
  98. data/proto_docs/google/cloud/sql/v1beta4/cloud_sql_tiers.rb +68 -0
  99. data/proto_docs/google/cloud/sql/v1beta4/cloud_sql_users.rb +308 -0
  100. data/proto_docs/google/protobuf/any.rb +145 -0
  101. data/proto_docs/google/protobuf/duration.rb +98 -0
  102. data/proto_docs/google/protobuf/empty.rb +34 -0
  103. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  104. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  105. data/proto_docs/google/protobuf/wrappers.rb +148 -0
  106. data/proto_docs/google/rpc/status.rb +48 -0
  107. data/proto_docs/google/type/interval.rb +45 -0
  108. metadata +153 -9
@@ -0,0 +1,807 @@
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_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Sql
26
+ module V1beta4
27
+ module SqlBackupRunsService
28
+ ##
29
+ # Client for the SqlBackupRunsService service.
30
+ #
31
+ class Client
32
+ # @private
33
+ API_VERSION = ""
34
+
35
+ # @private
36
+ DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$"
37
+
38
+ # @private
39
+ attr_reader :sql_backup_runs_service_stub
40
+
41
+ ##
42
+ # Configure the SqlBackupRunsService Client class.
43
+ #
44
+ # See {::Google::Cloud::Sql::V1beta4::SqlBackupRunsService::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # @example
48
+ #
49
+ # # Modify the configuration for all SqlBackupRunsService clients
50
+ # ::Google::Cloud::Sql::V1beta4::SqlBackupRunsService::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "Sql", "V1beta4"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config.timeout = 60.0
71
+
72
+ default_config
73
+ end
74
+ yield @configure if block_given?
75
+ @configure
76
+ end
77
+
78
+ ##
79
+ # Configure the SqlBackupRunsService Client instance.
80
+ #
81
+ # The configuration is set to the derived mode, meaning that values can be changed,
82
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
83
+ # should be made on {Client.configure}.
84
+ #
85
+ # See {::Google::Cloud::Sql::V1beta4::SqlBackupRunsService::Client::Configuration}
86
+ # for a description of the configuration fields.
87
+ #
88
+ # @yield [config] Configure the Client client.
89
+ # @yieldparam config [Client::Configuration]
90
+ #
91
+ # @return [Client::Configuration]
92
+ #
93
+ def configure
94
+ yield @config if block_given?
95
+ @config
96
+ end
97
+
98
+ ##
99
+ # The effective universe domain
100
+ #
101
+ # @return [String]
102
+ #
103
+ def universe_domain
104
+ @sql_backup_runs_service_stub.universe_domain
105
+ end
106
+
107
+ ##
108
+ # Create a new SqlBackupRunsService client object.
109
+ #
110
+ # @example
111
+ #
112
+ # # Create a client using the default configuration
113
+ # client = ::Google::Cloud::Sql::V1beta4::SqlBackupRunsService::Client.new
114
+ #
115
+ # # Create a client using a custom configuration
116
+ # client = ::Google::Cloud::Sql::V1beta4::SqlBackupRunsService::Client.new do |config|
117
+ # config.timeout = 10.0
118
+ # end
119
+ #
120
+ # @yield [config] Configure the SqlBackupRunsService client.
121
+ # @yieldparam config [Client::Configuration]
122
+ #
123
+ def initialize
124
+ # These require statements are intentionally placed here to initialize
125
+ # the gRPC module only when it's required.
126
+ # See https://github.com/googleapis/toolkit/issues/446
127
+ require "gapic/grpc"
128
+ require "google/cloud/sql/v1beta4/cloud_sql_services_pb"
129
+
130
+ # Create the configuration object
131
+ @config = Configuration.new Client.configure
132
+
133
+ # Yield the configuration if needed
134
+ yield @config if block_given?
135
+
136
+ # Create credentials
137
+ credentials = @config.credentials
138
+ # Use self-signed JWT if the endpoint is unchanged from default,
139
+ # but only if the default endpoint does not have a region prefix.
140
+ enable_self_signed_jwt = @config.endpoint.nil? ||
141
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
142
+ !@config.endpoint.split(".").first.include?("-"))
143
+ credentials ||= Credentials.default scope: @config.scope,
144
+ enable_self_signed_jwt: enable_self_signed_jwt
145
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
146
+ credentials = Credentials.new credentials, scope: @config.scope
147
+ end
148
+ @quota_project_id = @config.quota_project
149
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
150
+
151
+ @sql_backup_runs_service_stub = ::Gapic::ServiceStub.new(
152
+ ::Google::Cloud::Sql::V1beta4::SqlBackupRunsService::Stub,
153
+ credentials: credentials,
154
+ endpoint: @config.endpoint,
155
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
156
+ universe_domain: @config.universe_domain,
157
+ channel_args: @config.channel_args,
158
+ interceptors: @config.interceptors,
159
+ channel_pool_config: @config.channel_pool,
160
+ logger: @config.logger
161
+ )
162
+
163
+ @sql_backup_runs_service_stub.stub_logger&.info do |entry|
164
+ entry.set_system_name
165
+ entry.set_service
166
+ entry.message = "Created client for #{entry.service}"
167
+ entry.set_credentials_fields credentials
168
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
169
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
170
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
171
+ end
172
+
173
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
174
+ config.credentials = credentials
175
+ config.quota_project = @quota_project_id
176
+ config.endpoint = @sql_backup_runs_service_stub.endpoint
177
+ config.universe_domain = @sql_backup_runs_service_stub.universe_domain
178
+ config.logger = @sql_backup_runs_service_stub.logger if config.respond_to? :logger=
179
+ end
180
+ end
181
+
182
+ ##
183
+ # Get the associated client for mix-in of the Locations.
184
+ #
185
+ # @return [Google::Cloud::Location::Locations::Client]
186
+ #
187
+ attr_reader :location_client
188
+
189
+ ##
190
+ # The logger used for request/response debug logging.
191
+ #
192
+ # @return [Logger]
193
+ #
194
+ def logger
195
+ @sql_backup_runs_service_stub.logger
196
+ end
197
+
198
+ # Service calls
199
+
200
+ ##
201
+ # Deletes the backup taken by a backup run.
202
+ #
203
+ # @overload delete(request, options = nil)
204
+ # Pass arguments to `delete` via a request object, either of type
205
+ # {::Google::Cloud::Sql::V1beta4::SqlBackupRunsDeleteRequest} or an equivalent Hash.
206
+ #
207
+ # @param request [::Google::Cloud::Sql::V1beta4::SqlBackupRunsDeleteRequest, ::Hash]
208
+ # A request object representing the call parameters. Required. To specify no
209
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
210
+ # @param options [::Gapic::CallOptions, ::Hash]
211
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
212
+ #
213
+ # @overload delete(id: nil, instance: nil, project: nil)
214
+ # Pass arguments to `delete` via keyword arguments. Note that at
215
+ # least one keyword argument is required. To specify no parameters, or to keep all
216
+ # the default parameter values, pass an empty Hash as a request object (see above).
217
+ #
218
+ # @param id [::Integer]
219
+ # The ID of the backup run to delete. To find a backup run ID, use the
220
+ # [list](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/backupRuns/list)
221
+ # method.
222
+ # @param instance [::String]
223
+ # Cloud SQL instance ID. This does not include the project ID.
224
+ # @param project [::String]
225
+ # Project ID of the project that contains the instance.
226
+ #
227
+ # @yield [response, operation] Access the result along with the RPC operation
228
+ # @yieldparam response [::Google::Cloud::Sql::V1beta4::Operation]
229
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
230
+ #
231
+ # @return [::Google::Cloud::Sql::V1beta4::Operation]
232
+ #
233
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
234
+ #
235
+ # @example Basic example
236
+ # require "google/cloud/sql/v1beta4"
237
+ #
238
+ # # Create a client object. The client can be reused for multiple calls.
239
+ # client = Google::Cloud::Sql::V1beta4::SqlBackupRunsService::Client.new
240
+ #
241
+ # # Create a request. To set request fields, pass in keyword arguments.
242
+ # request = Google::Cloud::Sql::V1beta4::SqlBackupRunsDeleteRequest.new
243
+ #
244
+ # # Call the delete method.
245
+ # result = client.delete request
246
+ #
247
+ # # The returned object is of type Google::Cloud::Sql::V1beta4::Operation.
248
+ # p result
249
+ #
250
+ def delete request, options = nil
251
+ raise ::ArgumentError, "request must be provided" if request.nil?
252
+
253
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1beta4::SqlBackupRunsDeleteRequest
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.delete.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::V1beta4::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.project
270
+ header_params["project"] = request.project
271
+ end
272
+ if request.instance
273
+ header_params["instance"] = request.instance
274
+ end
275
+ if request.id
276
+ header_params["id"] = request.id
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.delete.timeout,
283
+ metadata: metadata,
284
+ retry_policy: @config.rpcs.delete.retry_policy
285
+
286
+ options.apply_defaults timeout: @config.timeout,
287
+ metadata: @config.metadata,
288
+ retry_policy: @config.retry_policy
289
+
290
+ @sql_backup_runs_service_stub.call_rpc :delete, 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 resource containing information about a backup run.
299
+ #
300
+ # @overload get(request, options = nil)
301
+ # Pass arguments to `get` via a request object, either of type
302
+ # {::Google::Cloud::Sql::V1beta4::SqlBackupRunsGetRequest} or an equivalent Hash.
303
+ #
304
+ # @param request [::Google::Cloud::Sql::V1beta4::SqlBackupRunsGetRequest, ::Hash]
305
+ # A request object representing the call parameters. Required. To specify no
306
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
307
+ # @param options [::Gapic::CallOptions, ::Hash]
308
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
309
+ #
310
+ # @overload get(id: nil, instance: nil, project: nil)
311
+ # Pass arguments to `get` via keyword arguments. Note that at
312
+ # least one keyword argument is required. To specify no parameters, or to keep all
313
+ # the default parameter values, pass an empty Hash as a request object (see above).
314
+ #
315
+ # @param id [::Integer]
316
+ # The ID of this backup run.
317
+ # @param instance [::String]
318
+ # Cloud SQL instance ID. This does not include the project ID.
319
+ # @param project [::String]
320
+ # Project ID of the project that contains the instance.
321
+ #
322
+ # @yield [response, operation] Access the result along with the RPC operation
323
+ # @yieldparam response [::Google::Cloud::Sql::V1beta4::BackupRun]
324
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
325
+ #
326
+ # @return [::Google::Cloud::Sql::V1beta4::BackupRun]
327
+ #
328
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
329
+ #
330
+ # @example Basic example
331
+ # require "google/cloud/sql/v1beta4"
332
+ #
333
+ # # Create a client object. The client can be reused for multiple calls.
334
+ # client = Google::Cloud::Sql::V1beta4::SqlBackupRunsService::Client.new
335
+ #
336
+ # # Create a request. To set request fields, pass in keyword arguments.
337
+ # request = Google::Cloud::Sql::V1beta4::SqlBackupRunsGetRequest.new
338
+ #
339
+ # # Call the get method.
340
+ # result = client.get request
341
+ #
342
+ # # The returned object is of type Google::Cloud::Sql::V1beta4::BackupRun.
343
+ # p result
344
+ #
345
+ def get request, options = nil
346
+ raise ::ArgumentError, "request must be provided" if request.nil?
347
+
348
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1beta4::SqlBackupRunsGetRequest
349
+
350
+ # Converts hash and nil to an options object
351
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
352
+
353
+ # Customize the options with defaults
354
+ metadata = @config.rpcs.get.metadata.to_h
355
+
356
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
357
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
358
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
359
+ gapic_version: ::Google::Cloud::Sql::V1beta4::VERSION
360
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
361
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
362
+
363
+ header_params = {}
364
+ if request.project
365
+ header_params["project"] = request.project
366
+ end
367
+ if request.instance
368
+ header_params["instance"] = request.instance
369
+ end
370
+ if request.id
371
+ header_params["id"] = request.id
372
+ end
373
+
374
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
375
+ metadata[:"x-goog-request-params"] ||= request_params_header
376
+
377
+ options.apply_defaults timeout: @config.rpcs.get.timeout,
378
+ metadata: metadata,
379
+ retry_policy: @config.rpcs.get.retry_policy
380
+
381
+ options.apply_defaults timeout: @config.timeout,
382
+ metadata: @config.metadata,
383
+ retry_policy: @config.retry_policy
384
+
385
+ @sql_backup_runs_service_stub.call_rpc :get, request, options: options do |response, operation|
386
+ yield response, operation if block_given?
387
+ end
388
+ rescue ::GRPC::BadStatus => e
389
+ raise ::Google::Cloud::Error.from_error(e)
390
+ end
391
+
392
+ ##
393
+ # Creates a new backup run on demand.
394
+ #
395
+ # @overload insert(request, options = nil)
396
+ # Pass arguments to `insert` via a request object, either of type
397
+ # {::Google::Cloud::Sql::V1beta4::SqlBackupRunsInsertRequest} or an equivalent Hash.
398
+ #
399
+ # @param request [::Google::Cloud::Sql::V1beta4::SqlBackupRunsInsertRequest, ::Hash]
400
+ # A request object representing the call parameters. Required. To specify no
401
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
402
+ # @param options [::Gapic::CallOptions, ::Hash]
403
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
404
+ #
405
+ # @overload insert(instance: nil, project: nil, body: nil)
406
+ # Pass arguments to `insert` via keyword arguments. Note that at
407
+ # least one keyword argument is required. To specify no parameters, or to keep all
408
+ # the default parameter values, pass an empty Hash as a request object (see above).
409
+ #
410
+ # @param instance [::String]
411
+ # Cloud SQL instance ID. This does not include the project ID.
412
+ # @param project [::String]
413
+ # Project ID of the project that contains the instance.
414
+ # @param body [::Google::Cloud::Sql::V1beta4::BackupRun, ::Hash]
415
+ #
416
+ # @yield [response, operation] Access the result along with the RPC operation
417
+ # @yieldparam response [::Google::Cloud::Sql::V1beta4::Operation]
418
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
419
+ #
420
+ # @return [::Google::Cloud::Sql::V1beta4::Operation]
421
+ #
422
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
423
+ #
424
+ # @example Basic example
425
+ # require "google/cloud/sql/v1beta4"
426
+ #
427
+ # # Create a client object. The client can be reused for multiple calls.
428
+ # client = Google::Cloud::Sql::V1beta4::SqlBackupRunsService::Client.new
429
+ #
430
+ # # Create a request. To set request fields, pass in keyword arguments.
431
+ # request = Google::Cloud::Sql::V1beta4::SqlBackupRunsInsertRequest.new
432
+ #
433
+ # # Call the insert method.
434
+ # result = client.insert request
435
+ #
436
+ # # The returned object is of type Google::Cloud::Sql::V1beta4::Operation.
437
+ # p result
438
+ #
439
+ def insert request, options = nil
440
+ raise ::ArgumentError, "request must be provided" if request.nil?
441
+
442
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1beta4::SqlBackupRunsInsertRequest
443
+
444
+ # Converts hash and nil to an options object
445
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
446
+
447
+ # Customize the options with defaults
448
+ metadata = @config.rpcs.insert.metadata.to_h
449
+
450
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
451
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
452
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
453
+ gapic_version: ::Google::Cloud::Sql::V1beta4::VERSION
454
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
455
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
456
+
457
+ header_params = {}
458
+ if request.project
459
+ header_params["project"] = request.project
460
+ end
461
+ if request.instance
462
+ header_params["instance"] = request.instance
463
+ end
464
+
465
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
466
+ metadata[:"x-goog-request-params"] ||= request_params_header
467
+
468
+ options.apply_defaults timeout: @config.rpcs.insert.timeout,
469
+ metadata: metadata,
470
+ retry_policy: @config.rpcs.insert.retry_policy
471
+
472
+ options.apply_defaults timeout: @config.timeout,
473
+ metadata: @config.metadata,
474
+ retry_policy: @config.retry_policy
475
+
476
+ @sql_backup_runs_service_stub.call_rpc :insert, request, options: options do |response, operation|
477
+ yield response, operation if block_given?
478
+ end
479
+ rescue ::GRPC::BadStatus => e
480
+ raise ::Google::Cloud::Error.from_error(e)
481
+ end
482
+
483
+ ##
484
+ # Lists all backup runs associated with the project or a given instance and
485
+ # configuration in the reverse chronological order of the backup initiation
486
+ # time.
487
+ #
488
+ # @overload list(request, options = nil)
489
+ # Pass arguments to `list` via a request object, either of type
490
+ # {::Google::Cloud::Sql::V1beta4::SqlBackupRunsListRequest} or an equivalent Hash.
491
+ #
492
+ # @param request [::Google::Cloud::Sql::V1beta4::SqlBackupRunsListRequest, ::Hash]
493
+ # A request object representing the call parameters. Required. To specify no
494
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
495
+ # @param options [::Gapic::CallOptions, ::Hash]
496
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
497
+ #
498
+ # @overload list(instance: nil, max_results: nil, page_token: nil, project: nil)
499
+ # Pass arguments to `list` via keyword arguments. Note that at
500
+ # least one keyword argument is required. To specify no parameters, or to keep all
501
+ # the default parameter values, pass an empty Hash as a request object (see above).
502
+ #
503
+ # @param instance [::String]
504
+ # Cloud SQL instance ID, or "-" for all instances. This does not include
505
+ # the project ID.
506
+ # @param max_results [::Integer]
507
+ # Maximum number of backup runs per response.
508
+ # @param page_token [::String]
509
+ # A previously-returned page token representing part of the larger set of
510
+ # results to view.
511
+ # @param project [::String]
512
+ # Project ID of the project that contains the instance.
513
+ #
514
+ # @yield [response, operation] Access the result along with the RPC operation
515
+ # @yieldparam response [::Google::Cloud::Sql::V1beta4::BackupRunsListResponse]
516
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
517
+ #
518
+ # @return [::Google::Cloud::Sql::V1beta4::BackupRunsListResponse]
519
+ #
520
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
521
+ #
522
+ # @example Basic example
523
+ # require "google/cloud/sql/v1beta4"
524
+ #
525
+ # # Create a client object. The client can be reused for multiple calls.
526
+ # client = Google::Cloud::Sql::V1beta4::SqlBackupRunsService::Client.new
527
+ #
528
+ # # Create a request. To set request fields, pass in keyword arguments.
529
+ # request = Google::Cloud::Sql::V1beta4::SqlBackupRunsListRequest.new
530
+ #
531
+ # # Call the list method.
532
+ # result = client.list request
533
+ #
534
+ # # The returned object is of type Google::Cloud::Sql::V1beta4::BackupRunsListResponse.
535
+ # p result
536
+ #
537
+ def list request, options = nil
538
+ raise ::ArgumentError, "request must be provided" if request.nil?
539
+
540
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1beta4::SqlBackupRunsListRequest
541
+
542
+ # Converts hash and nil to an options object
543
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
544
+
545
+ # Customize the options with defaults
546
+ metadata = @config.rpcs.list.metadata.to_h
547
+
548
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
549
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
550
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
551
+ gapic_version: ::Google::Cloud::Sql::V1beta4::VERSION
552
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
553
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
554
+
555
+ header_params = {}
556
+ if request.project
557
+ header_params["project"] = request.project
558
+ end
559
+ if request.instance
560
+ header_params["instance"] = request.instance
561
+ end
562
+
563
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
564
+ metadata[:"x-goog-request-params"] ||= request_params_header
565
+
566
+ options.apply_defaults timeout: @config.rpcs.list.timeout,
567
+ metadata: metadata,
568
+ retry_policy: @config.rpcs.list.retry_policy
569
+
570
+ options.apply_defaults timeout: @config.timeout,
571
+ metadata: @config.metadata,
572
+ retry_policy: @config.retry_policy
573
+
574
+ @sql_backup_runs_service_stub.call_rpc :list, request, options: options do |response, operation|
575
+ yield response, operation if block_given?
576
+ end
577
+ rescue ::GRPC::BadStatus => e
578
+ raise ::Google::Cloud::Error.from_error(e)
579
+ end
580
+
581
+ ##
582
+ # Configuration class for the SqlBackupRunsService API.
583
+ #
584
+ # This class represents the configuration for SqlBackupRunsService,
585
+ # providing control over timeouts, retry behavior, logging, transport
586
+ # parameters, and other low-level controls. Certain parameters can also be
587
+ # applied individually to specific RPCs. See
588
+ # {::Google::Cloud::Sql::V1beta4::SqlBackupRunsService::Client::Configuration::Rpcs}
589
+ # for a list of RPCs that can be configured independently.
590
+ #
591
+ # Configuration can be applied globally to all clients, or to a single client
592
+ # on construction.
593
+ #
594
+ # @example
595
+ #
596
+ # # Modify the global config, setting the timeout for
597
+ # # delete to 20 seconds,
598
+ # # and all remaining timeouts to 10 seconds.
599
+ # ::Google::Cloud::Sql::V1beta4::SqlBackupRunsService::Client.configure do |config|
600
+ # config.timeout = 10.0
601
+ # config.rpcs.delete.timeout = 20.0
602
+ # end
603
+ #
604
+ # # Apply the above configuration only to a new client.
605
+ # client = ::Google::Cloud::Sql::V1beta4::SqlBackupRunsService::Client.new do |config|
606
+ # config.timeout = 10.0
607
+ # config.rpcs.delete.timeout = 20.0
608
+ # end
609
+ #
610
+ # @!attribute [rw] endpoint
611
+ # A custom service endpoint, as a hostname or hostname:port. The default is
612
+ # nil, indicating to use the default endpoint in the current universe domain.
613
+ # @return [::String,nil]
614
+ # @!attribute [rw] credentials
615
+ # Credentials to send with calls. You may provide any of the following types:
616
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
617
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
618
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
619
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
620
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
621
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
622
+ # * (`nil`) indicating no credentials
623
+ #
624
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
625
+ # is deprecated. Providing an unvalidated credential configuration to
626
+ # Google APIs can compromise the security of your systems and data.
627
+ #
628
+ # @example
629
+ #
630
+ # # The recommended way to provide credentials is to use the `make_creds` method
631
+ # # on the appropriate credentials class for your environment.
632
+ #
633
+ # require "googleauth"
634
+ #
635
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
636
+ # json_key_io: ::File.open("/path/to/keyfile.json")
637
+ # )
638
+ #
639
+ # client = ::Google::Cloud::Sql::V1beta4::SqlBackupRunsService::Client.new do |config|
640
+ # config.credentials = credentials
641
+ # end
642
+ #
643
+ # @note Warning: If you accept a credential configuration (JSON file or Hash) from an
644
+ # external source for authentication to Google Cloud, you must validate it before
645
+ # providing it to a Google API client library. Providing an unvalidated credential
646
+ # configuration to Google APIs can compromise the security of your systems and data.
647
+ # For more information, refer to [Validate credential configurations from external
648
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
649
+ # @return [::Object]
650
+ # @!attribute [rw] scope
651
+ # The OAuth scopes
652
+ # @return [::Array<::String>]
653
+ # @!attribute [rw] lib_name
654
+ # The library name as recorded in instrumentation and logging
655
+ # @return [::String]
656
+ # @!attribute [rw] lib_version
657
+ # The library version as recorded in instrumentation and logging
658
+ # @return [::String]
659
+ # @!attribute [rw] channel_args
660
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
661
+ # `GRPC::Core::Channel` object is provided as the credential.
662
+ # @return [::Hash]
663
+ # @!attribute [rw] interceptors
664
+ # An array of interceptors that are run before calls are executed.
665
+ # @return [::Array<::GRPC::ClientInterceptor>]
666
+ # @!attribute [rw] timeout
667
+ # The call timeout in seconds.
668
+ # @return [::Numeric]
669
+ # @!attribute [rw] metadata
670
+ # Additional gRPC headers to be sent with the call.
671
+ # @return [::Hash{::Symbol=>::String}]
672
+ # @!attribute [rw] retry_policy
673
+ # The retry policy. The value is a hash with the following keys:
674
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
675
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
676
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
677
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
678
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
679
+ # trigger a retry.
680
+ # @return [::Hash]
681
+ # @!attribute [rw] quota_project
682
+ # A separate project against which to charge quota.
683
+ # @return [::String]
684
+ # @!attribute [rw] universe_domain
685
+ # The universe domain within which to make requests. This determines the
686
+ # default endpoint URL. The default value of nil uses the environment
687
+ # universe (usually the default "googleapis.com" universe).
688
+ # @return [::String,nil]
689
+ # @!attribute [rw] logger
690
+ # A custom logger to use for request/response debug logging, or the value
691
+ # `:default` (the default) to construct a default logger, or `nil` to
692
+ # explicitly disable logging.
693
+ # @return [::Logger,:default,nil]
694
+ #
695
+ class Configuration
696
+ extend ::Gapic::Config
697
+
698
+ # @private
699
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
700
+ DEFAULT_ENDPOINT = "sqladmin.googleapis.com"
701
+
702
+ config_attr :endpoint, nil, ::String, nil
703
+ config_attr :credentials, nil do |value|
704
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
705
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
706
+ allowed.any? { |klass| klass === value }
707
+ end
708
+ config_attr :scope, nil, ::String, ::Array, nil
709
+ config_attr :lib_name, nil, ::String, nil
710
+ config_attr :lib_version, nil, ::String, nil
711
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
712
+ config_attr :interceptors, nil, ::Array, nil
713
+ config_attr :timeout, nil, ::Numeric, nil
714
+ config_attr :metadata, nil, ::Hash, nil
715
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
716
+ config_attr :quota_project, nil, ::String, nil
717
+ config_attr :universe_domain, nil, ::String, nil
718
+ config_attr :logger, :default, ::Logger, nil, :default
719
+
720
+ # @private
721
+ def initialize parent_config = nil
722
+ @parent_config = parent_config unless parent_config.nil?
723
+
724
+ yield self if block_given?
725
+ end
726
+
727
+ ##
728
+ # Configurations for individual RPCs
729
+ # @return [Rpcs]
730
+ #
731
+ def rpcs
732
+ @rpcs ||= begin
733
+ parent_rpcs = nil
734
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
735
+ Rpcs.new parent_rpcs
736
+ end
737
+ end
738
+
739
+ ##
740
+ # Configuration for the channel pool
741
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
742
+ #
743
+ def channel_pool
744
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
745
+ end
746
+
747
+ ##
748
+ # Configuration RPC class for the SqlBackupRunsService API.
749
+ #
750
+ # Includes fields providing the configuration for each RPC in this service.
751
+ # Each configuration object is of type `Gapic::Config::Method` and includes
752
+ # the following configuration fields:
753
+ #
754
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
755
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
756
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
757
+ # include the following keys:
758
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
759
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
760
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
761
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
762
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
763
+ # trigger a retry.
764
+ #
765
+ class Rpcs
766
+ ##
767
+ # RPC-specific configuration for `delete`
768
+ # @return [::Gapic::Config::Method]
769
+ #
770
+ attr_reader :delete
771
+ ##
772
+ # RPC-specific configuration for `get`
773
+ # @return [::Gapic::Config::Method]
774
+ #
775
+ attr_reader :get
776
+ ##
777
+ # RPC-specific configuration for `insert`
778
+ # @return [::Gapic::Config::Method]
779
+ #
780
+ attr_reader :insert
781
+ ##
782
+ # RPC-specific configuration for `list`
783
+ # @return [::Gapic::Config::Method]
784
+ #
785
+ attr_reader :list
786
+
787
+ # @private
788
+ def initialize parent_rpcs = nil
789
+ delete_config = parent_rpcs.delete if parent_rpcs.respond_to? :delete
790
+ @delete = ::Gapic::Config::Method.new delete_config
791
+ get_config = parent_rpcs.get if parent_rpcs.respond_to? :get
792
+ @get = ::Gapic::Config::Method.new get_config
793
+ insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert
794
+ @insert = ::Gapic::Config::Method.new insert_config
795
+ list_config = parent_rpcs.list if parent_rpcs.respond_to? :list
796
+ @list = ::Gapic::Config::Method.new list_config
797
+
798
+ yield self if block_given?
799
+ end
800
+ end
801
+ end
802
+ end
803
+ end
804
+ end
805
+ end
806
+ end
807
+ end