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