google-cloud-spanner-admin-database-v1 0.10.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1536ce544d325f282526a4e7a4f70d77e1d073372d1bc82d0cae4d12de5d1917
4
- data.tar.gz: 66ee74760e3fff07df238a2c06ad18777f77770d29eba5e3a2f84e71ea76134e
3
+ metadata.gz: 0dd7e7bcd60f178f114d0d9bcc20c5677f09c4b3a0e865ef9a4bee0fed39dc91
4
+ data.tar.gz: 7e0f9a2ef395b8c5713213a979914e51db9631c44bca6cdcb94a9b8f3eca8a4b
5
5
  SHA512:
6
- metadata.gz: 6c632de0881e5b7e06b9e90c3a031ae425771dedbb4bc451dbc380b4cb0eec0ddff0929dd96bd368b7ad3a01cfa8d0cfcce2776cc788bc304eb1bb7919f7d557
7
- data.tar.gz: 07d1c5592f9f7efaa0b3c0495b5cbfd825c900e363c3be9fde0465081bf8bbb70fb7449ae16e5309e1204a2b3d7daf0f438b0a56fefc8c66009864c5296f622c
6
+ metadata.gz: c28d6a25a2dff217e9f30cc279a959498de5464545a715aceeda38010552d9cc45d87b7cacbd899ed2ad83fc329a399e46f300f180032ba61a4813c8fdefe1d2
7
+ data.tar.gz: 88163d15d90874e82b8ce2774fe3d549ff3d87d422e377a3270a8ea44691bcef43235fdcdafdbfed1545474bf28b9ed4dd0d3239b5fd1ede50c5cc04062afa0c
data/AUTHENTICATION.md CHANGED
@@ -114,7 +114,7 @@ credentials are discovered.
114
114
  To configure your system for this, simply:
115
115
 
116
116
  1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
117
- 2. Authenticate using OAuth 2.0 `$ gcloud auth login`
117
+ 2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login`
118
118
  3. Write code as if already authenticated.
119
119
 
120
120
  **NOTE:** This is _not_ recommended for running in production. The Cloud SDK
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ruby Client for the Cloud Spanner Database Admin V1 API
2
2
 
3
- API Client library for the Cloud Spanner Database Admin V1 API
3
+ Cloud Spanner is a managed, mission-critical, globally consistent and scalable relational database service.
4
4
 
5
5
  Cloud Spanner is a managed, mission-critical, globally consistent and scalable relational database service.
6
6
 
@@ -46,7 +46,7 @@ for general usage information.
46
46
  ## Enabling Logging
47
47
 
48
48
  To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
49
+ The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
50
  or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
51
51
  that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
52
  and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
@@ -144,6 +144,11 @@ module Google
144
144
  initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
145
145
  }
146
146
 
147
+ default_config.rpcs.list_database_roles.timeout = 3600.0
148
+ default_config.rpcs.list_database_roles.retry_policy = {
149
+ initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
150
+ }
151
+
147
152
  default_config
148
153
  end
149
154
  yield @configure if block_given?
@@ -286,13 +291,11 @@ module Google
286
291
  # # Call the list_databases method.
287
292
  # result = client.list_databases request
288
293
  #
289
- # # The returned object is of type Gapic::PagedEnumerable. You can
290
- # # iterate over all elements by calling #each, and the enumerable
291
- # # will lazily make API calls to fetch subsequent pages. Other
292
- # # methods are also available for managing paging directly.
293
- # result.each do |response|
294
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
295
+ # # over elements, and API calls will be issued to fetch pages as needed.
296
+ # result.each do |item|
294
297
  # # Each element is of type ::Google::Cloud::Spanner::Admin::Database::V1::Database.
295
- # p response
298
+ # p item
296
299
  # end
297
300
  #
298
301
  def list_databases request, options = nil
@@ -403,14 +406,14 @@ module Google
403
406
  # # Call the create_database method.
404
407
  # result = client.create_database request
405
408
  #
406
- # # The returned object is of type Gapic::Operation. You can use this
407
- # # object to check the status of an operation, cancel it, or wait
408
- # # for results. Here is how to block until completion:
409
+ # # The returned object is of type Gapic::Operation. You can use it to
410
+ # # check the status of an operation, cancel it, or wait for results.
411
+ # # Here is how to wait for a response.
409
412
  # result.wait_until_done! timeout: 60
410
413
  # if result.response?
411
414
  # p result.response
412
415
  # else
413
- # puts "Error!"
416
+ # puts "No response received."
414
417
  # end
415
418
  #
416
419
  def create_database request, options = nil
@@ -610,14 +613,14 @@ module Google
610
613
  # # Call the update_database_ddl method.
611
614
  # result = client.update_database_ddl request
612
615
  #
613
- # # The returned object is of type Gapic::Operation. You can use this
614
- # # object to check the status of an operation, cancel it, or wait
615
- # # for results. Here is how to block until completion:
616
+ # # The returned object is of type Gapic::Operation. You can use it to
617
+ # # check the status of an operation, cancel it, or wait for results.
618
+ # # Here is how to wait for a response.
616
619
  # result.wait_until_done! timeout: 60
617
620
  # if result.response?
618
621
  # p result.response
619
622
  # else
620
- # puts "Error!"
623
+ # puts "No response received."
621
624
  # end
622
625
  #
623
626
  def update_database_ddl request, options = nil
@@ -1208,14 +1211,14 @@ module Google
1208
1211
  # # Call the create_backup method.
1209
1212
  # result = client.create_backup request
1210
1213
  #
1211
- # # The returned object is of type Gapic::Operation. You can use this
1212
- # # object to check the status of an operation, cancel it, or wait
1213
- # # for results. Here is how to block until completion:
1214
+ # # The returned object is of type Gapic::Operation. You can use it to
1215
+ # # check the status of an operation, cancel it, or wait for results.
1216
+ # # Here is how to wait for a response.
1214
1217
  # result.wait_until_done! timeout: 60
1215
1218
  # if result.response?
1216
1219
  # p result.response
1217
1220
  # else
1218
- # puts "Error!"
1221
+ # puts "No response received."
1219
1222
  # end
1220
1223
  #
1221
1224
  def create_backup request, options = nil
@@ -1336,14 +1339,14 @@ module Google
1336
1339
  # # Call the copy_backup method.
1337
1340
  # result = client.copy_backup request
1338
1341
  #
1339
- # # The returned object is of type Gapic::Operation. You can use this
1340
- # # object to check the status of an operation, cancel it, or wait
1341
- # # for results. Here is how to block until completion:
1342
+ # # The returned object is of type Gapic::Operation. You can use it to
1343
+ # # check the status of an operation, cancel it, or wait for results.
1344
+ # # Here is how to wait for a response.
1342
1345
  # result.wait_until_done! timeout: 60
1343
1346
  # if result.response?
1344
1347
  # p result.response
1345
1348
  # else
1346
- # puts "Error!"
1349
+ # puts "No response received."
1347
1350
  # end
1348
1351
  #
1349
1352
  def copy_backup request, options = nil
@@ -1744,13 +1747,11 @@ module Google
1744
1747
  # # Call the list_backups method.
1745
1748
  # result = client.list_backups request
1746
1749
  #
1747
- # # The returned object is of type Gapic::PagedEnumerable. You can
1748
- # # iterate over all elements by calling #each, and the enumerable
1749
- # # will lazily make API calls to fetch subsequent pages. Other
1750
- # # methods are also available for managing paging directly.
1751
- # result.each do |response|
1750
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1751
+ # # over elements, and API calls will be issued to fetch pages as needed.
1752
+ # result.each do |item|
1752
1753
  # # Each element is of type ::Google::Cloud::Spanner::Admin::Database::V1::Backup.
1753
- # p response
1754
+ # p item
1754
1755
  # end
1755
1756
  #
1756
1757
  def list_backups request, options = nil
@@ -1871,14 +1872,14 @@ module Google
1871
1872
  # # Call the restore_database method.
1872
1873
  # result = client.restore_database request
1873
1874
  #
1874
- # # The returned object is of type Gapic::Operation. You can use this
1875
- # # object to check the status of an operation, cancel it, or wait
1876
- # # for results. Here is how to block until completion:
1875
+ # # The returned object is of type Gapic::Operation. You can use it to
1876
+ # # check the status of an operation, cancel it, or wait for results.
1877
+ # # Here is how to wait for a response.
1877
1878
  # result.wait_until_done! timeout: 60
1878
1879
  # if result.response?
1879
1880
  # p result.response
1880
1881
  # else
1881
- # puts "Error!"
1882
+ # puts "No response received."
1882
1883
  # end
1883
1884
  #
1884
1885
  def restore_database request, options = nil
@@ -2023,13 +2024,11 @@ module Google
2023
2024
  # # Call the list_database_operations method.
2024
2025
  # result = client.list_database_operations request
2025
2026
  #
2026
- # # The returned object is of type Gapic::PagedEnumerable. You can
2027
- # # iterate over all elements by calling #each, and the enumerable
2028
- # # will lazily make API calls to fetch subsequent pages. Other
2029
- # # methods are also available for managing paging directly.
2030
- # result.each do |response|
2027
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
2028
+ # # over elements, and API calls will be issued to fetch pages as needed.
2029
+ # result.each do |item|
2031
2030
  # # Each element is of type ::Google::Longrunning::Operation.
2032
- # p response
2031
+ # p item
2033
2032
  # end
2034
2033
  #
2035
2034
  def list_database_operations request, options = nil
@@ -2201,13 +2200,11 @@ module Google
2201
2200
  # # Call the list_backup_operations method.
2202
2201
  # result = client.list_backup_operations request
2203
2202
  #
2204
- # # The returned object is of type Gapic::PagedEnumerable. You can
2205
- # # iterate over all elements by calling #each, and the enumerable
2206
- # # will lazily make API calls to fetch subsequent pages. Other
2207
- # # methods are also available for managing paging directly.
2208
- # result.each do |response|
2203
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
2204
+ # # over elements, and API calls will be issued to fetch pages as needed.
2205
+ # result.each do |item|
2209
2206
  # # Each element is of type ::Google::Longrunning::Operation.
2210
- # p response
2207
+ # p item
2211
2208
  # end
2212
2209
  #
2213
2210
  def list_backup_operations request, options = nil
@@ -2253,6 +2250,105 @@ module Google
2253
2250
  raise ::Google::Cloud::Error.from_error(e)
2254
2251
  end
2255
2252
 
2253
+ ##
2254
+ # Lists Cloud Spanner database roles.
2255
+ #
2256
+ # @overload list_database_roles(request, options = nil)
2257
+ # Pass arguments to `list_database_roles` via a request object, either of type
2258
+ # {::Google::Cloud::Spanner::Admin::Database::V1::ListDatabaseRolesRequest} or an equivalent Hash.
2259
+ #
2260
+ # @param request [::Google::Cloud::Spanner::Admin::Database::V1::ListDatabaseRolesRequest, ::Hash]
2261
+ # A request object representing the call parameters. Required. To specify no
2262
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2263
+ # @param options [::Gapic::CallOptions, ::Hash]
2264
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2265
+ #
2266
+ # @overload list_database_roles(parent: nil, page_size: nil, page_token: nil)
2267
+ # Pass arguments to `list_database_roles` via keyword arguments. Note that at
2268
+ # least one keyword argument is required. To specify no parameters, or to keep all
2269
+ # the default parameter values, pass an empty Hash as a request object (see above).
2270
+ #
2271
+ # @param parent [::String]
2272
+ # Required. The database whose roles should be listed.
2273
+ # Values are of the form
2274
+ # `projects/<project>/instances/<instance>/databases/<database>/databaseRoles`.
2275
+ # @param page_size [::Integer]
2276
+ # Number of database roles to be returned in the response. If 0 or less,
2277
+ # defaults to the server's maximum allowed page size.
2278
+ # @param page_token [::String]
2279
+ # If non-empty, `page_token` should contain a
2280
+ # {::Google::Cloud::Spanner::Admin::Database::V1::ListDatabaseRolesResponse#next_page_token next_page_token} from a
2281
+ # previous {::Google::Cloud::Spanner::Admin::Database::V1::ListDatabaseRolesResponse ListDatabaseRolesResponse}.
2282
+ #
2283
+ # @yield [response, operation] Access the result along with the RPC operation
2284
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Spanner::Admin::Database::V1::DatabaseRole>]
2285
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2286
+ #
2287
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Spanner::Admin::Database::V1::DatabaseRole>]
2288
+ #
2289
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2290
+ #
2291
+ # @example Basic example
2292
+ # require "google/cloud/spanner/admin/database/v1"
2293
+ #
2294
+ # # Create a client object. The client can be reused for multiple calls.
2295
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
2296
+ #
2297
+ # # Create a request. To set request fields, pass in keyword arguments.
2298
+ # request = Google::Cloud::Spanner::Admin::Database::V1::ListDatabaseRolesRequest.new
2299
+ #
2300
+ # # Call the list_database_roles method.
2301
+ # result = client.list_database_roles request
2302
+ #
2303
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
2304
+ # # over elements, and API calls will be issued to fetch pages as needed.
2305
+ # result.each do |item|
2306
+ # # Each element is of type ::Google::Cloud::Spanner::Admin::Database::V1::DatabaseRole.
2307
+ # p item
2308
+ # end
2309
+ #
2310
+ def list_database_roles request, options = nil
2311
+ raise ::ArgumentError, "request must be provided" if request.nil?
2312
+
2313
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Database::V1::ListDatabaseRolesRequest
2314
+
2315
+ # Converts hash and nil to an options object
2316
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2317
+
2318
+ # Customize the options with defaults
2319
+ metadata = @config.rpcs.list_database_roles.metadata.to_h
2320
+
2321
+ # Set x-goog-api-client and x-goog-user-project headers
2322
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2323
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2324
+ gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
2325
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2326
+
2327
+ header_params = {}
2328
+ if request.parent
2329
+ header_params["parent"] = request.parent
2330
+ end
2331
+
2332
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2333
+ metadata[:"x-goog-request-params"] ||= request_params_header
2334
+
2335
+ options.apply_defaults timeout: @config.rpcs.list_database_roles.timeout,
2336
+ metadata: metadata,
2337
+ retry_policy: @config.rpcs.list_database_roles.retry_policy
2338
+
2339
+ options.apply_defaults timeout: @config.timeout,
2340
+ metadata: @config.metadata,
2341
+ retry_policy: @config.retry_policy
2342
+
2343
+ @database_admin_stub.call_rpc :list_database_roles, request, options: options do |response, operation|
2344
+ response = ::Gapic::PagedEnumerable.new @database_admin_stub, :list_database_roles, request, response, operation, options
2345
+ yield response, operation if block_given?
2346
+ return response
2347
+ end
2348
+ rescue ::GRPC::BadStatus => e
2349
+ raise ::Google::Cloud::Error.from_error(e)
2350
+ end
2351
+
2256
2352
  ##
2257
2353
  # Configuration class for the DatabaseAdmin API.
2258
2354
  #
@@ -2478,6 +2574,11 @@ module Google
2478
2574
  # @return [::Gapic::Config::Method]
2479
2575
  #
2480
2576
  attr_reader :list_backup_operations
2577
+ ##
2578
+ # RPC-specific configuration for `list_database_roles`
2579
+ # @return [::Gapic::Config::Method]
2580
+ #
2581
+ attr_reader :list_database_roles
2481
2582
 
2482
2583
  # @private
2483
2584
  def initialize parent_rpcs = nil
@@ -2517,6 +2618,8 @@ module Google
2517
2618
  @list_database_operations = ::Gapic::Config::Method.new list_database_operations_config
2518
2619
  list_backup_operations_config = parent_rpcs.list_backup_operations if parent_rpcs.respond_to? :list_backup_operations
2519
2620
  @list_backup_operations = ::Gapic::Config::Method.new list_backup_operations_config
2621
+ list_database_roles_config = parent_rpcs.list_database_roles if parent_rpcs.respond_to? :list_database_roles
2622
+ @list_database_roles = ::Gapic::Config::Method.new list_database_roles_config
2520
2623
 
2521
2624
  yield self if block_given?
2522
2625
  end
@@ -160,13 +160,11 @@ module Google
160
160
  # # Call the list_operations method.
161
161
  # result = client.list_operations request
162
162
  #
163
- # # The returned object is of type Gapic::PagedEnumerable. You can
164
- # # iterate over all elements by calling #each, and the enumerable
165
- # # will lazily make API calls to fetch subsequent pages. Other
166
- # # methods are also available for managing paging directly.
167
- # result.each do |response|
163
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
164
+ # # over elements, and API calls will be issued to fetch pages as needed.
165
+ # result.each do |item|
168
166
  # # Each element is of type ::Google::Longrunning::Operation.
169
- # p response
167
+ # p item
170
168
  # end
171
169
  #
172
170
  def list_operations request, options = nil
@@ -255,14 +253,14 @@ module Google
255
253
  # # Call the get_operation method.
256
254
  # result = client.get_operation request
257
255
  #
258
- # # The returned object is of type Gapic::Operation. You can use this
259
- # # object to check the status of an operation, cancel it, or wait
260
- # # for results. Here is how to block until completion:
256
+ # # The returned object is of type Gapic::Operation. You can use it to
257
+ # # check the status of an operation, cancel it, or wait for results.
258
+ # # Here is how to wait for a response.
261
259
  # result.wait_until_done! timeout: 60
262
260
  # if result.response?
263
261
  # p result.response
264
262
  # else
265
- # puts "Error!"
263
+ # puts "No response received."
266
264
  # end
267
265
  #
268
266
  def get_operation request, options = nil
@@ -542,14 +540,14 @@ module Google
542
540
  # # Call the wait_operation method.
543
541
  # result = client.wait_operation request
544
542
  #
545
- # # The returned object is of type Gapic::Operation. You can use this
546
- # # object to check the status of an operation, cancel it, or wait
547
- # # for results. Here is how to block until completion:
543
+ # # The returned object is of type Gapic::Operation. You can use it to
544
+ # # check the status of an operation, cancel it, or wait for results.
545
+ # # Here is how to wait for a response.
548
546
  # result.wait_until_done! timeout: 60
549
547
  # if result.response?
550
548
  # p result.response
551
549
  # else
552
- # puts "Error!"
550
+ # puts "No response received."
553
551
  # end
554
552
  #
555
553
  def wait_operation request, options = nil