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,544 @@
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_connect_pb"
21
+ require "google/cloud/sql/v1/sql_connect_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 SqlConnectService
29
+ module Rest
30
+ ##
31
+ # REST client for the SqlConnectService service.
32
+ #
33
+ # Cloud SQL connect service.
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_connect_service_stub
44
+
45
+ ##
46
+ # Configure the SqlConnectService Client class.
47
+ #
48
+ # See {::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client::Configuration}
49
+ # for a description of the configuration fields.
50
+ #
51
+ # @example
52
+ #
53
+ # # Modify the configuration for all SqlConnectService clients
54
+ # ::Google::Cloud::Sql::V1::SqlConnectService::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
75
+ end
76
+ yield @configure if block_given?
77
+ @configure
78
+ end
79
+
80
+ ##
81
+ # Configure the SqlConnectService 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::SqlConnectService::Rest::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_connect_service_stub.universe_domain
107
+ end
108
+
109
+ ##
110
+ # Create a new SqlConnectService REST client object.
111
+ #
112
+ # @example
113
+ #
114
+ # # Create a client using the default configuration
115
+ # client = ::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client.new
116
+ #
117
+ # # Create a client using a custom configuration
118
+ # client = ::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client.new do |config|
119
+ # config.timeout = 10.0
120
+ # end
121
+ #
122
+ # @yield [config] Configure the SqlConnectService client.
123
+ # @yieldparam config [Client::Configuration]
124
+ #
125
+ def initialize
126
+ # Create the configuration object
127
+ @config = Configuration.new Client.configure
128
+
129
+ # Yield the configuration if needed
130
+ yield @config if block_given?
131
+
132
+ # Create credentials
133
+ credentials = @config.credentials
134
+ # Use self-signed JWT if the endpoint is unchanged from default,
135
+ # but only if the default endpoint does not have a region prefix.
136
+ enable_self_signed_jwt = @config.endpoint.nil? ||
137
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
138
+ !@config.endpoint.split(".").first.include?("-"))
139
+ credentials ||= Credentials.default scope: @config.scope,
140
+ enable_self_signed_jwt: enable_self_signed_jwt
141
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
142
+ credentials = Credentials.new credentials, scope: @config.scope
143
+ end
144
+
145
+ @quota_project_id = @config.quota_project
146
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
147
+
148
+ @sql_connect_service_stub = ::Google::Cloud::Sql::V1::SqlConnectService::Rest::ServiceStub.new(
149
+ endpoint: @config.endpoint,
150
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
151
+ universe_domain: @config.universe_domain,
152
+ credentials: credentials,
153
+ logger: @config.logger
154
+ )
155
+
156
+ @sql_connect_service_stub.logger(stub: true)&.info do |entry|
157
+ entry.set_system_name
158
+ entry.set_service
159
+ entry.message = "Created client for #{entry.service}"
160
+ entry.set_credentials_fields credentials
161
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
162
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
163
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
164
+ end
165
+
166
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
167
+ config.credentials = credentials
168
+ config.quota_project = @quota_project_id
169
+ config.endpoint = @sql_connect_service_stub.endpoint
170
+ config.universe_domain = @sql_connect_service_stub.universe_domain
171
+ config.logger = @sql_connect_service_stub.logger if config.respond_to? :logger=
172
+ end
173
+ end
174
+
175
+ ##
176
+ # Get the associated client for mix-in of the Locations.
177
+ #
178
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
179
+ #
180
+ attr_reader :location_client
181
+
182
+ ##
183
+ # The logger used for request/response debug logging.
184
+ #
185
+ # @return [Logger]
186
+ #
187
+ def logger
188
+ @sql_connect_service_stub.logger
189
+ end
190
+
191
+ # Service calls
192
+
193
+ ##
194
+ # Retrieves connect settings about a Cloud SQL instance.
195
+ #
196
+ # @overload get_connect_settings(request, options = nil)
197
+ # Pass arguments to `get_connect_settings` via a request object, either of type
198
+ # {::Google::Cloud::Sql::V1::GetConnectSettingsRequest} or an equivalent Hash.
199
+ #
200
+ # @param request [::Google::Cloud::Sql::V1::GetConnectSettingsRequest, ::Hash]
201
+ # A request object representing the call parameters. Required. To specify no
202
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
203
+ # @param options [::Gapic::CallOptions, ::Hash]
204
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
205
+ #
206
+ # @overload get_connect_settings(instance: nil, project: nil, read_time: nil)
207
+ # Pass arguments to `get_connect_settings` via keyword arguments. Note that at
208
+ # least one keyword argument is required. To specify no parameters, or to keep all
209
+ # the default parameter values, pass an empty Hash as a request object (see above).
210
+ #
211
+ # @param instance [::String]
212
+ # Cloud SQL instance ID. This does not include the project ID.
213
+ # @param project [::String]
214
+ # Project ID of the project that contains the instance.
215
+ # @param read_time [::Google::Protobuf::Timestamp, ::Hash]
216
+ # Optional. Optional snapshot read timestamp to trade freshness for
217
+ # performance.
218
+ # @yield [result, operation] Access the result along with the TransportOperation object
219
+ # @yieldparam result [::Google::Cloud::Sql::V1::ConnectSettings]
220
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
221
+ #
222
+ # @return [::Google::Cloud::Sql::V1::ConnectSettings]
223
+ #
224
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
225
+ #
226
+ # @example Basic example
227
+ # require "google/cloud/sql/v1"
228
+ #
229
+ # # Create a client object. The client can be reused for multiple calls.
230
+ # client = Google::Cloud::Sql::V1::SqlConnectService::Rest::Client.new
231
+ #
232
+ # # Create a request. To set request fields, pass in keyword arguments.
233
+ # request = Google::Cloud::Sql::V1::GetConnectSettingsRequest.new
234
+ #
235
+ # # Call the get_connect_settings method.
236
+ # result = client.get_connect_settings request
237
+ #
238
+ # # The returned object is of type Google::Cloud::Sql::V1::ConnectSettings.
239
+ # p result
240
+ #
241
+ def get_connect_settings request, options = nil
242
+ raise ::ArgumentError, "request must be provided" if request.nil?
243
+
244
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::GetConnectSettingsRequest
245
+
246
+ # Converts hash and nil to an options object
247
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
248
+
249
+ # Customize the options with defaults
250
+ call_metadata = @config.rpcs.get_connect_settings.metadata.to_h
251
+
252
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
253
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
254
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
255
+ gapic_version: ::Google::Cloud::Sql::V1::VERSION,
256
+ transports_version_send: [:rest]
257
+
258
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
259
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
260
+
261
+ options.apply_defaults timeout: @config.rpcs.get_connect_settings.timeout,
262
+ metadata: call_metadata,
263
+ retry_policy: @config.rpcs.get_connect_settings.retry_policy
264
+
265
+ options.apply_defaults timeout: @config.timeout,
266
+ metadata: @config.metadata,
267
+ retry_policy: @config.retry_policy
268
+
269
+ @sql_connect_service_stub.get_connect_settings request, options do |result, operation|
270
+ yield result, operation if block_given?
271
+ end
272
+ rescue ::Gapic::Rest::Error => e
273
+ raise ::Google::Cloud::Error.from_error(e)
274
+ end
275
+
276
+ ##
277
+ # Generates a short-lived X509 certificate containing the provided public key
278
+ # and signed by a private key specific to the target instance. Users may use
279
+ # the certificate to authenticate as themselves when connecting to the
280
+ # database.
281
+ #
282
+ # @overload generate_ephemeral_cert(request, options = nil)
283
+ # Pass arguments to `generate_ephemeral_cert` via a request object, either of type
284
+ # {::Google::Cloud::Sql::V1::GenerateEphemeralCertRequest} or an equivalent Hash.
285
+ #
286
+ # @param request [::Google::Cloud::Sql::V1::GenerateEphemeralCertRequest, ::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 generate_ephemeral_cert(instance: nil, project: nil, public_key: nil, access_token: nil, read_time: nil, valid_duration: nil)
293
+ # Pass arguments to `generate_ephemeral_cert` 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 instance [::String]
298
+ # Cloud SQL instance ID. This does not include the project ID.
299
+ # @param project [::String]
300
+ # Project ID of the project that contains the instance.
301
+ # @param public_key [::String]
302
+ # PEM encoded public key to include in the signed certificate.
303
+ # @param access_token [::String]
304
+ # Optional. Access token to include in the signed certificate.
305
+ # @param read_time [::Google::Protobuf::Timestamp, ::Hash]
306
+ # Optional. Optional snapshot read timestamp to trade freshness for
307
+ # performance.
308
+ # @param valid_duration [::Google::Protobuf::Duration, ::Hash]
309
+ # Optional. If set, it will contain the cert valid duration.
310
+ # @yield [result, operation] Access the result along with the TransportOperation object
311
+ # @yieldparam result [::Google::Cloud::Sql::V1::GenerateEphemeralCertResponse]
312
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
313
+ #
314
+ # @return [::Google::Cloud::Sql::V1::GenerateEphemeralCertResponse]
315
+ #
316
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
317
+ #
318
+ # @example Basic example
319
+ # require "google/cloud/sql/v1"
320
+ #
321
+ # # Create a client object. The client can be reused for multiple calls.
322
+ # client = Google::Cloud::Sql::V1::SqlConnectService::Rest::Client.new
323
+ #
324
+ # # Create a request. To set request fields, pass in keyword arguments.
325
+ # request = Google::Cloud::Sql::V1::GenerateEphemeralCertRequest.new
326
+ #
327
+ # # Call the generate_ephemeral_cert method.
328
+ # result = client.generate_ephemeral_cert request
329
+ #
330
+ # # The returned object is of type Google::Cloud::Sql::V1::GenerateEphemeralCertResponse.
331
+ # p result
332
+ #
333
+ def generate_ephemeral_cert request, options = nil
334
+ raise ::ArgumentError, "request must be provided" if request.nil?
335
+
336
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::GenerateEphemeralCertRequest
337
+
338
+ # Converts hash and nil to an options object
339
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
340
+
341
+ # Customize the options with defaults
342
+ call_metadata = @config.rpcs.generate_ephemeral_cert.metadata.to_h
343
+
344
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
345
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
346
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
347
+ gapic_version: ::Google::Cloud::Sql::V1::VERSION,
348
+ transports_version_send: [:rest]
349
+
350
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
351
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
352
+
353
+ options.apply_defaults timeout: @config.rpcs.generate_ephemeral_cert.timeout,
354
+ metadata: call_metadata,
355
+ retry_policy: @config.rpcs.generate_ephemeral_cert.retry_policy
356
+
357
+ options.apply_defaults timeout: @config.timeout,
358
+ metadata: @config.metadata,
359
+ retry_policy: @config.retry_policy
360
+
361
+ @sql_connect_service_stub.generate_ephemeral_cert request, options do |result, operation|
362
+ yield result, operation if block_given?
363
+ end
364
+ rescue ::Gapic::Rest::Error => e
365
+ raise ::Google::Cloud::Error.from_error(e)
366
+ end
367
+
368
+ ##
369
+ # Configuration class for the SqlConnectService REST API.
370
+ #
371
+ # This class represents the configuration for SqlConnectService REST,
372
+ # providing control over timeouts, retry behavior, logging, transport
373
+ # parameters, and other low-level controls. Certain parameters can also be
374
+ # applied individually to specific RPCs. See
375
+ # {::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client::Configuration::Rpcs}
376
+ # for a list of RPCs that can be configured independently.
377
+ #
378
+ # Configuration can be applied globally to all clients, or to a single client
379
+ # on construction.
380
+ #
381
+ # @example
382
+ #
383
+ # # Modify the global config, setting the timeout for
384
+ # # get_connect_settings to 20 seconds,
385
+ # # and all remaining timeouts to 10 seconds.
386
+ # ::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client.configure do |config|
387
+ # config.timeout = 10.0
388
+ # config.rpcs.get_connect_settings.timeout = 20.0
389
+ # end
390
+ #
391
+ # # Apply the above configuration only to a new client.
392
+ # client = ::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client.new do |config|
393
+ # config.timeout = 10.0
394
+ # config.rpcs.get_connect_settings.timeout = 20.0
395
+ # end
396
+ #
397
+ # @!attribute [rw] endpoint
398
+ # A custom service endpoint, as a hostname or hostname:port. The default is
399
+ # nil, indicating to use the default endpoint in the current universe domain.
400
+ # @return [::String,nil]
401
+ # @!attribute [rw] credentials
402
+ # Credentials to send with calls. You may provide any of the following types:
403
+ # * (`String`) The path to a service account key file in JSON format
404
+ # * (`Hash`) A service account key as a Hash
405
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
406
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
407
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
408
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
409
+ # * (`nil`) indicating no credentials
410
+ #
411
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
412
+ # external source for authentication to Google Cloud, you must validate it before
413
+ # providing it to a Google API client library. Providing an unvalidated credential
414
+ # configuration to Google APIs can compromise the security of your systems and data.
415
+ # For more information, refer to [Validate credential configurations from external
416
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
417
+ # @return [::Object]
418
+ # @!attribute [rw] scope
419
+ # The OAuth scopes
420
+ # @return [::Array<::String>]
421
+ # @!attribute [rw] lib_name
422
+ # The library name as recorded in instrumentation and logging
423
+ # @return [::String]
424
+ # @!attribute [rw] lib_version
425
+ # The library version as recorded in instrumentation and logging
426
+ # @return [::String]
427
+ # @!attribute [rw] timeout
428
+ # The call timeout in seconds.
429
+ # @return [::Numeric]
430
+ # @!attribute [rw] metadata
431
+ # Additional headers to be sent with the call.
432
+ # @return [::Hash{::Symbol=>::String}]
433
+ # @!attribute [rw] retry_policy
434
+ # The retry policy. The value is a hash with the following keys:
435
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
436
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
437
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
438
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
439
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
440
+ # trigger a retry.
441
+ # @return [::Hash]
442
+ # @!attribute [rw] quota_project
443
+ # A separate project against which to charge quota.
444
+ # @return [::String]
445
+ # @!attribute [rw] universe_domain
446
+ # The universe domain within which to make requests. This determines the
447
+ # default endpoint URL. The default value of nil uses the environment
448
+ # universe (usually the default "googleapis.com" universe).
449
+ # @return [::String,nil]
450
+ # @!attribute [rw] logger
451
+ # A custom logger to use for request/response debug logging, or the value
452
+ # `:default` (the default) to construct a default logger, or `nil` to
453
+ # explicitly disable logging.
454
+ # @return [::Logger,:default,nil]
455
+ #
456
+ class Configuration
457
+ extend ::Gapic::Config
458
+
459
+ # @private
460
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
461
+ DEFAULT_ENDPOINT = "sqladmin.googleapis.com"
462
+
463
+ config_attr :endpoint, nil, ::String, nil
464
+ config_attr :credentials, nil do |value|
465
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
466
+ allowed.any? { |klass| klass === value }
467
+ end
468
+ config_attr :scope, nil, ::String, ::Array, nil
469
+ config_attr :lib_name, nil, ::String, nil
470
+ config_attr :lib_version, nil, ::String, nil
471
+ config_attr :timeout, nil, ::Numeric, nil
472
+ config_attr :metadata, nil, ::Hash, nil
473
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
474
+ config_attr :quota_project, nil, ::String, nil
475
+ config_attr :universe_domain, nil, ::String, nil
476
+ config_attr :logger, :default, ::Logger, nil, :default
477
+
478
+ # @private
479
+ def initialize parent_config = nil
480
+ @parent_config = parent_config unless parent_config.nil?
481
+
482
+ yield self if block_given?
483
+ end
484
+
485
+ ##
486
+ # Configurations for individual RPCs
487
+ # @return [Rpcs]
488
+ #
489
+ def rpcs
490
+ @rpcs ||= begin
491
+ parent_rpcs = nil
492
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
493
+ Rpcs.new parent_rpcs
494
+ end
495
+ end
496
+
497
+ ##
498
+ # Configuration RPC class for the SqlConnectService API.
499
+ #
500
+ # Includes fields providing the configuration for each RPC in this service.
501
+ # Each configuration object is of type `Gapic::Config::Method` and includes
502
+ # the following configuration fields:
503
+ #
504
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
505
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
506
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
507
+ # include the following keys:
508
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
509
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
510
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
511
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
512
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
513
+ # trigger a retry.
514
+ #
515
+ class Rpcs
516
+ ##
517
+ # RPC-specific configuration for `get_connect_settings`
518
+ # @return [::Gapic::Config::Method]
519
+ #
520
+ attr_reader :get_connect_settings
521
+ ##
522
+ # RPC-specific configuration for `generate_ephemeral_cert`
523
+ # @return [::Gapic::Config::Method]
524
+ #
525
+ attr_reader :generate_ephemeral_cert
526
+
527
+ # @private
528
+ def initialize parent_rpcs = nil
529
+ get_connect_settings_config = parent_rpcs.get_connect_settings if parent_rpcs.respond_to? :get_connect_settings
530
+ @get_connect_settings = ::Gapic::Config::Method.new get_connect_settings_config
531
+ generate_ephemeral_cert_config = parent_rpcs.generate_ephemeral_cert if parent_rpcs.respond_to? :generate_ephemeral_cert
532
+ @generate_ephemeral_cert = ::Gapic::Config::Method.new generate_ephemeral_cert_config
533
+
534
+ yield self if block_given?
535
+ end
536
+ end
537
+ end
538
+ end
539
+ end
540
+ end
541
+ end
542
+ end
543
+ end
544
+ end