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,705 @@
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_connect_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Sql
26
+ module V1beta4
27
+ module SqlConnectService
28
+ ##
29
+ # Client for the SqlConnectService service.
30
+ #
31
+ # Cloud SQL connect service.
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_connect_service_stub
42
+
43
+ ##
44
+ # Configure the SqlConnectService Client class.
45
+ #
46
+ # See {::Google::Cloud::Sql::V1beta4::SqlConnectService::Client::Configuration}
47
+ # for a description of the configuration fields.
48
+ #
49
+ # @example
50
+ #
51
+ # # Modify the configuration for all SqlConnectService clients
52
+ # ::Google::Cloud::Sql::V1beta4::SqlConnectService::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", "V1beta4"]
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
73
+ end
74
+ yield @configure if block_given?
75
+ @configure
76
+ end
77
+
78
+ ##
79
+ # Configure the SqlConnectService 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::SqlConnectService::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_connect_service_stub.universe_domain
105
+ end
106
+
107
+ ##
108
+ # Create a new SqlConnectService client object.
109
+ #
110
+ # @example
111
+ #
112
+ # # Create a client using the default configuration
113
+ # client = ::Google::Cloud::Sql::V1beta4::SqlConnectService::Client.new
114
+ #
115
+ # # Create a client using a custom configuration
116
+ # client = ::Google::Cloud::Sql::V1beta4::SqlConnectService::Client.new do |config|
117
+ # config.timeout = 10.0
118
+ # end
119
+ #
120
+ # @yield [config] Configure the SqlConnectService 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_connect_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_connect_service_stub = ::Gapic::ServiceStub.new(
152
+ ::Google::Cloud::Sql::V1beta4::SqlConnectService::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_connect_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_connect_service_stub.endpoint
177
+ config.universe_domain = @sql_connect_service_stub.universe_domain
178
+ config.logger = @sql_connect_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_connect_service_stub.logger
196
+ end
197
+
198
+ # Service calls
199
+
200
+ ##
201
+ # Retrieves connect settings about a Cloud SQL instance.
202
+ #
203
+ # @overload get_connect_settings(request, options = nil)
204
+ # Pass arguments to `get_connect_settings` via a request object, either of type
205
+ # {::Google::Cloud::Sql::V1beta4::GetConnectSettingsRequest} or an equivalent Hash.
206
+ #
207
+ # @param request [::Google::Cloud::Sql::V1beta4::GetConnectSettingsRequest, ::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 get_connect_settings(instance: nil, project: nil, read_time: nil)
214
+ # Pass arguments to `get_connect_settings` 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 instance [::String]
219
+ # Cloud SQL instance ID. This does not include the project ID.
220
+ # @param project [::String]
221
+ # Project ID of the project that contains the instance.
222
+ # @param read_time [::Google::Protobuf::Timestamp, ::Hash]
223
+ # Optional. Optional snapshot read timestamp to trade freshness for
224
+ # performance.
225
+ #
226
+ # @yield [response, operation] Access the result along with the RPC operation
227
+ # @yieldparam response [::Google::Cloud::Sql::V1beta4::ConnectSettings]
228
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
229
+ #
230
+ # @return [::Google::Cloud::Sql::V1beta4::ConnectSettings]
231
+ #
232
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
233
+ #
234
+ # @example Basic example
235
+ # require "google/cloud/sql/v1beta4"
236
+ #
237
+ # # Create a client object. The client can be reused for multiple calls.
238
+ # client = Google::Cloud::Sql::V1beta4::SqlConnectService::Client.new
239
+ #
240
+ # # Create a request. To set request fields, pass in keyword arguments.
241
+ # request = Google::Cloud::Sql::V1beta4::GetConnectSettingsRequest.new
242
+ #
243
+ # # Call the get_connect_settings method.
244
+ # result = client.get_connect_settings request
245
+ #
246
+ # # The returned object is of type Google::Cloud::Sql::V1beta4::ConnectSettings.
247
+ # p result
248
+ #
249
+ def get_connect_settings request, options = nil
250
+ raise ::ArgumentError, "request must be provided" if request.nil?
251
+
252
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1beta4::GetConnectSettingsRequest
253
+
254
+ # Converts hash and nil to an options object
255
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
256
+
257
+ # Customize the options with defaults
258
+ metadata = @config.rpcs.get_connect_settings.metadata.to_h
259
+
260
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
261
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
262
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
263
+ gapic_version: ::Google::Cloud::Sql::V1beta4::VERSION
264
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
265
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
266
+
267
+ header_params = {}
268
+ if request.project
269
+ header_params["project"] = request.project
270
+ end
271
+ if request.instance
272
+ header_params["instance"] = request.instance
273
+ end
274
+
275
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
276
+ metadata[:"x-goog-request-params"] ||= request_params_header
277
+
278
+ options.apply_defaults timeout: @config.rpcs.get_connect_settings.timeout,
279
+ metadata: metadata,
280
+ retry_policy: @config.rpcs.get_connect_settings.retry_policy
281
+
282
+ options.apply_defaults timeout: @config.timeout,
283
+ metadata: @config.metadata,
284
+ retry_policy: @config.retry_policy
285
+
286
+ @sql_connect_service_stub.call_rpc :get_connect_settings, request, options: options do |response, operation|
287
+ yield response, operation if block_given?
288
+ end
289
+ rescue ::GRPC::BadStatus => e
290
+ raise ::Google::Cloud::Error.from_error(e)
291
+ end
292
+
293
+ ##
294
+ # Retrieves connect settings about a Cloud SQL instance using the instance
295
+ # DNS name.
296
+ #
297
+ # @overload resolve_connect_settings(request, options = nil)
298
+ # Pass arguments to `resolve_connect_settings` via a request object, either of type
299
+ # {::Google::Cloud::Sql::V1beta4::ResolveConnectSettingsRequest} or an equivalent Hash.
300
+ #
301
+ # @param request [::Google::Cloud::Sql::V1beta4::ResolveConnectSettingsRequest, ::Hash]
302
+ # A request object representing the call parameters. Required. To specify no
303
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
304
+ # @param options [::Gapic::CallOptions, ::Hash]
305
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
306
+ #
307
+ # @overload resolve_connect_settings(dns_name: nil, location: nil)
308
+ # Pass arguments to `resolve_connect_settings` via keyword arguments. Note that at
309
+ # least one keyword argument is required. To specify no parameters, or to keep all
310
+ # the default parameter values, pass an empty Hash as a request object (see above).
311
+ #
312
+ # @param dns_name [::String]
313
+ # Required. Cloud SQL instance ID. This does not include the project ID.
314
+ # @param location [::String]
315
+ # Required. The region of the instance.
316
+ #
317
+ # @yield [response, operation] Access the result along with the RPC operation
318
+ # @yieldparam response [::Google::Cloud::Sql::V1beta4::ConnectSettings]
319
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
320
+ #
321
+ # @return [::Google::Cloud::Sql::V1beta4::ConnectSettings]
322
+ #
323
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
324
+ #
325
+ # @example Basic example
326
+ # require "google/cloud/sql/v1beta4"
327
+ #
328
+ # # Create a client object. The client can be reused for multiple calls.
329
+ # client = Google::Cloud::Sql::V1beta4::SqlConnectService::Client.new
330
+ #
331
+ # # Create a request. To set request fields, pass in keyword arguments.
332
+ # request = Google::Cloud::Sql::V1beta4::ResolveConnectSettingsRequest.new
333
+ #
334
+ # # Call the resolve_connect_settings method.
335
+ # result = client.resolve_connect_settings request
336
+ #
337
+ # # The returned object is of type Google::Cloud::Sql::V1beta4::ConnectSettings.
338
+ # p result
339
+ #
340
+ def resolve_connect_settings request, options = nil
341
+ raise ::ArgumentError, "request must be provided" if request.nil?
342
+
343
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1beta4::ResolveConnectSettingsRequest
344
+
345
+ # Converts hash and nil to an options object
346
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
347
+
348
+ # Customize the options with defaults
349
+ metadata = @config.rpcs.resolve_connect_settings.metadata.to_h
350
+
351
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
352
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
353
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
354
+ gapic_version: ::Google::Cloud::Sql::V1beta4::VERSION
355
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
356
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
357
+
358
+ header_params = {}
359
+ if request.location
360
+ header_params["location"] = request.location
361
+ end
362
+ if request.dns_name
363
+ header_params["dns_name"] = request.dns_name
364
+ end
365
+
366
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
367
+ metadata[:"x-goog-request-params"] ||= request_params_header
368
+
369
+ options.apply_defaults timeout: @config.rpcs.resolve_connect_settings.timeout,
370
+ metadata: metadata,
371
+ retry_policy: @config.rpcs.resolve_connect_settings.retry_policy
372
+
373
+ options.apply_defaults timeout: @config.timeout,
374
+ metadata: @config.metadata,
375
+ retry_policy: @config.retry_policy
376
+
377
+ @sql_connect_service_stub.call_rpc :resolve_connect_settings, request, options: options do |response, operation|
378
+ yield response, operation if block_given?
379
+ end
380
+ rescue ::GRPC::BadStatus => e
381
+ raise ::Google::Cloud::Error.from_error(e)
382
+ end
383
+
384
+ ##
385
+ # Generates a short-lived X509 certificate containing the provided public key
386
+ # and signed by a private key specific to the target instance. Users may use
387
+ # the certificate to authenticate as themselves when connecting to the
388
+ # database.
389
+ #
390
+ # @overload generate_ephemeral_cert(request, options = nil)
391
+ # Pass arguments to `generate_ephemeral_cert` via a request object, either of type
392
+ # {::Google::Cloud::Sql::V1beta4::GenerateEphemeralCertRequest} or an equivalent Hash.
393
+ #
394
+ # @param request [::Google::Cloud::Sql::V1beta4::GenerateEphemeralCertRequest, ::Hash]
395
+ # A request object representing the call parameters. Required. To specify no
396
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
397
+ # @param options [::Gapic::CallOptions, ::Hash]
398
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
399
+ #
400
+ # @overload generate_ephemeral_cert(instance: nil, project: nil, public_key: nil, access_token: nil, read_time: nil, valid_duration: nil)
401
+ # Pass arguments to `generate_ephemeral_cert` via keyword arguments. Note that at
402
+ # least one keyword argument is required. To specify no parameters, or to keep all
403
+ # the default parameter values, pass an empty Hash as a request object (see above).
404
+ #
405
+ # @param instance [::String]
406
+ # Cloud SQL instance ID. This does not include the project ID.
407
+ # @param project [::String]
408
+ # Project ID of the project that contains the instance.
409
+ # @param public_key [::String]
410
+ # PEM encoded public key to include in the signed certificate.
411
+ # @param access_token [::String]
412
+ # Optional. Access token to include in the signed certificate.
413
+ # @param read_time [::Google::Protobuf::Timestamp, ::Hash]
414
+ # Optional. Optional snapshot read timestamp to trade freshness for
415
+ # performance.
416
+ # @param valid_duration [::Google::Protobuf::Duration, ::Hash]
417
+ # Optional. If set, it will contain the cert valid duration.
418
+ #
419
+ # @yield [response, operation] Access the result along with the RPC operation
420
+ # @yieldparam response [::Google::Cloud::Sql::V1beta4::GenerateEphemeralCertResponse]
421
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
422
+ #
423
+ # @return [::Google::Cloud::Sql::V1beta4::GenerateEphemeralCertResponse]
424
+ #
425
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
426
+ #
427
+ # @example Basic example
428
+ # require "google/cloud/sql/v1beta4"
429
+ #
430
+ # # Create a client object. The client can be reused for multiple calls.
431
+ # client = Google::Cloud::Sql::V1beta4::SqlConnectService::Client.new
432
+ #
433
+ # # Create a request. To set request fields, pass in keyword arguments.
434
+ # request = Google::Cloud::Sql::V1beta4::GenerateEphemeralCertRequest.new
435
+ #
436
+ # # Call the generate_ephemeral_cert method.
437
+ # result = client.generate_ephemeral_cert request
438
+ #
439
+ # # The returned object is of type Google::Cloud::Sql::V1beta4::GenerateEphemeralCertResponse.
440
+ # p result
441
+ #
442
+ def generate_ephemeral_cert request, options = nil
443
+ raise ::ArgumentError, "request must be provided" if request.nil?
444
+
445
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1beta4::GenerateEphemeralCertRequest
446
+
447
+ # Converts hash and nil to an options object
448
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
449
+
450
+ # Customize the options with defaults
451
+ metadata = @config.rpcs.generate_ephemeral_cert.metadata.to_h
452
+
453
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
454
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
455
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
456
+ gapic_version: ::Google::Cloud::Sql::V1beta4::VERSION
457
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
458
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
459
+
460
+ header_params = {}
461
+ if request.project
462
+ header_params["project"] = request.project
463
+ end
464
+ if request.instance
465
+ header_params["instance"] = request.instance
466
+ end
467
+
468
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
469
+ metadata[:"x-goog-request-params"] ||= request_params_header
470
+
471
+ options.apply_defaults timeout: @config.rpcs.generate_ephemeral_cert.timeout,
472
+ metadata: metadata,
473
+ retry_policy: @config.rpcs.generate_ephemeral_cert.retry_policy
474
+
475
+ options.apply_defaults timeout: @config.timeout,
476
+ metadata: @config.metadata,
477
+ retry_policy: @config.retry_policy
478
+
479
+ @sql_connect_service_stub.call_rpc :generate_ephemeral_cert, request, options: options do |response, operation|
480
+ yield response, operation if block_given?
481
+ end
482
+ rescue ::GRPC::BadStatus => e
483
+ raise ::Google::Cloud::Error.from_error(e)
484
+ end
485
+
486
+ ##
487
+ # Configuration class for the SqlConnectService API.
488
+ #
489
+ # This class represents the configuration for SqlConnectService,
490
+ # providing control over timeouts, retry behavior, logging, transport
491
+ # parameters, and other low-level controls. Certain parameters can also be
492
+ # applied individually to specific RPCs. See
493
+ # {::Google::Cloud::Sql::V1beta4::SqlConnectService::Client::Configuration::Rpcs}
494
+ # for a list of RPCs that can be configured independently.
495
+ #
496
+ # Configuration can be applied globally to all clients, or to a single client
497
+ # on construction.
498
+ #
499
+ # @example
500
+ #
501
+ # # Modify the global config, setting the timeout for
502
+ # # get_connect_settings to 20 seconds,
503
+ # # and all remaining timeouts to 10 seconds.
504
+ # ::Google::Cloud::Sql::V1beta4::SqlConnectService::Client.configure do |config|
505
+ # config.timeout = 10.0
506
+ # config.rpcs.get_connect_settings.timeout = 20.0
507
+ # end
508
+ #
509
+ # # Apply the above configuration only to a new client.
510
+ # client = ::Google::Cloud::Sql::V1beta4::SqlConnectService::Client.new do |config|
511
+ # config.timeout = 10.0
512
+ # config.rpcs.get_connect_settings.timeout = 20.0
513
+ # end
514
+ #
515
+ # @!attribute [rw] endpoint
516
+ # A custom service endpoint, as a hostname or hostname:port. The default is
517
+ # nil, indicating to use the default endpoint in the current universe domain.
518
+ # @return [::String,nil]
519
+ # @!attribute [rw] credentials
520
+ # Credentials to send with calls. You may provide any of the following types:
521
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
522
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
523
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
524
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
525
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
526
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
527
+ # * (`nil`) indicating no credentials
528
+ #
529
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
530
+ # is deprecated. Providing an unvalidated credential configuration to
531
+ # Google APIs can compromise the security of your systems and data.
532
+ #
533
+ # @example
534
+ #
535
+ # # The recommended way to provide credentials is to use the `make_creds` method
536
+ # # on the appropriate credentials class for your environment.
537
+ #
538
+ # require "googleauth"
539
+ #
540
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
541
+ # json_key_io: ::File.open("/path/to/keyfile.json")
542
+ # )
543
+ #
544
+ # client = ::Google::Cloud::Sql::V1beta4::SqlConnectService::Client.new do |config|
545
+ # config.credentials = credentials
546
+ # end
547
+ #
548
+ # @note Warning: If you accept a credential configuration (JSON file or Hash) from an
549
+ # external source for authentication to Google Cloud, you must validate it before
550
+ # providing it to a Google API client library. Providing an unvalidated credential
551
+ # configuration to Google APIs can compromise the security of your systems and data.
552
+ # For more information, refer to [Validate credential configurations from external
553
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
554
+ # @return [::Object]
555
+ # @!attribute [rw] scope
556
+ # The OAuth scopes
557
+ # @return [::Array<::String>]
558
+ # @!attribute [rw] lib_name
559
+ # The library name as recorded in instrumentation and logging
560
+ # @return [::String]
561
+ # @!attribute [rw] lib_version
562
+ # The library version as recorded in instrumentation and logging
563
+ # @return [::String]
564
+ # @!attribute [rw] channel_args
565
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
566
+ # `GRPC::Core::Channel` object is provided as the credential.
567
+ # @return [::Hash]
568
+ # @!attribute [rw] interceptors
569
+ # An array of interceptors that are run before calls are executed.
570
+ # @return [::Array<::GRPC::ClientInterceptor>]
571
+ # @!attribute [rw] timeout
572
+ # The call timeout in seconds.
573
+ # @return [::Numeric]
574
+ # @!attribute [rw] metadata
575
+ # Additional gRPC headers to be sent with the call.
576
+ # @return [::Hash{::Symbol=>::String}]
577
+ # @!attribute [rw] retry_policy
578
+ # The retry policy. The value is a hash with the following keys:
579
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
580
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
581
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
582
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
583
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
584
+ # trigger a retry.
585
+ # @return [::Hash]
586
+ # @!attribute [rw] quota_project
587
+ # A separate project against which to charge quota.
588
+ # @return [::String]
589
+ # @!attribute [rw] universe_domain
590
+ # The universe domain within which to make requests. This determines the
591
+ # default endpoint URL. The default value of nil uses the environment
592
+ # universe (usually the default "googleapis.com" universe).
593
+ # @return [::String,nil]
594
+ # @!attribute [rw] logger
595
+ # A custom logger to use for request/response debug logging, or the value
596
+ # `:default` (the default) to construct a default logger, or `nil` to
597
+ # explicitly disable logging.
598
+ # @return [::Logger,:default,nil]
599
+ #
600
+ class Configuration
601
+ extend ::Gapic::Config
602
+
603
+ # @private
604
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
605
+ DEFAULT_ENDPOINT = "sqladmin.googleapis.com"
606
+
607
+ config_attr :endpoint, nil, ::String, nil
608
+ config_attr :credentials, nil do |value|
609
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
610
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
611
+ allowed.any? { |klass| klass === value }
612
+ end
613
+ config_attr :scope, nil, ::String, ::Array, nil
614
+ config_attr :lib_name, nil, ::String, nil
615
+ config_attr :lib_version, nil, ::String, nil
616
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
617
+ config_attr :interceptors, nil, ::Array, nil
618
+ config_attr :timeout, nil, ::Numeric, nil
619
+ config_attr :metadata, nil, ::Hash, nil
620
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
621
+ config_attr :quota_project, nil, ::String, nil
622
+ config_attr :universe_domain, nil, ::String, nil
623
+ config_attr :logger, :default, ::Logger, nil, :default
624
+
625
+ # @private
626
+ def initialize parent_config = nil
627
+ @parent_config = parent_config unless parent_config.nil?
628
+
629
+ yield self if block_given?
630
+ end
631
+
632
+ ##
633
+ # Configurations for individual RPCs
634
+ # @return [Rpcs]
635
+ #
636
+ def rpcs
637
+ @rpcs ||= begin
638
+ parent_rpcs = nil
639
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
640
+ Rpcs.new parent_rpcs
641
+ end
642
+ end
643
+
644
+ ##
645
+ # Configuration for the channel pool
646
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
647
+ #
648
+ def channel_pool
649
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
650
+ end
651
+
652
+ ##
653
+ # Configuration RPC class for the SqlConnectService API.
654
+ #
655
+ # Includes fields providing the configuration for each RPC in this service.
656
+ # Each configuration object is of type `Gapic::Config::Method` and includes
657
+ # the following configuration fields:
658
+ #
659
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
660
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
661
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
662
+ # include the following keys:
663
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
664
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
665
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
666
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
667
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
668
+ # trigger a retry.
669
+ #
670
+ class Rpcs
671
+ ##
672
+ # RPC-specific configuration for `get_connect_settings`
673
+ # @return [::Gapic::Config::Method]
674
+ #
675
+ attr_reader :get_connect_settings
676
+ ##
677
+ # RPC-specific configuration for `resolve_connect_settings`
678
+ # @return [::Gapic::Config::Method]
679
+ #
680
+ attr_reader :resolve_connect_settings
681
+ ##
682
+ # RPC-specific configuration for `generate_ephemeral_cert`
683
+ # @return [::Gapic::Config::Method]
684
+ #
685
+ attr_reader :generate_ephemeral_cert
686
+
687
+ # @private
688
+ def initialize parent_rpcs = nil
689
+ get_connect_settings_config = parent_rpcs.get_connect_settings if parent_rpcs.respond_to? :get_connect_settings
690
+ @get_connect_settings = ::Gapic::Config::Method.new get_connect_settings_config
691
+ resolve_connect_settings_config = parent_rpcs.resolve_connect_settings if parent_rpcs.respond_to? :resolve_connect_settings
692
+ @resolve_connect_settings = ::Gapic::Config::Method.new resolve_connect_settings_config
693
+ generate_ephemeral_cert_config = parent_rpcs.generate_ephemeral_cert if parent_rpcs.respond_to? :generate_ephemeral_cert
694
+ @generate_ephemeral_cert = ::Gapic::Config::Method.new generate_ephemeral_cert_config
695
+
696
+ yield self if block_given?
697
+ end
698
+ end
699
+ end
700
+ end
701
+ end
702
+ end
703
+ end
704
+ end
705
+ end