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