google-cloud-spanner-admin-database-v1 0.12.0 → 0.13.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: 0dd7e7bcd60f178f114d0d9bcc20c5677f09c4b3a0e865ef9a4bee0fed39dc91
4
- data.tar.gz: 7e0f9a2ef395b8c5713213a979914e51db9631c44bca6cdcb94a9b8f3eca8a4b
3
+ metadata.gz: a0ccba22ec473311d535a4a9ec4f1d63be050ca80ae187550ad5419b67ed4186
4
+ data.tar.gz: b9b3b52d6758e734fefb309638b24dec4d0f5d9b778f7ad17fc3ad8d87b5cdde
5
5
  SHA512:
6
- metadata.gz: c28d6a25a2dff217e9f30cc279a959498de5464545a715aceeda38010552d9cc45d87b7cacbd899ed2ad83fc329a399e46f300f180032ba61a4813c8fdefe1d2
7
- data.tar.gz: 88163d15d90874e82b8ce2774fe3d549ff3d87d422e377a3270a8ea44691bcef43235fdcdafdbfed1545474bf28b9ed4dd0d3239b5fd1ede50c5cc04062afa0c
6
+ metadata.gz: 183dcd7dc9b8cf46f6b0e66576a77f755a42f0ba736462eb8cfc6ffc3b7fa07012c2a1982eb205dc1f97d2faecca6478e23cf680fea63545fd05bdd0d4378700
7
+ data.tar.gz: 73f6bd6d455658a016a16ed91e53eab5098dc883eae2b5312e90d6b621025b3a7d69171b20eab7bb248eba60e5903cf1f12e3fcafb26590d829c1de9b8f0699f
data/README.md CHANGED
@@ -47,7 +47,7 @@ for general usage information.
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
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
- or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
50
+ or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/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.
53
53
 
@@ -84,6 +84,11 @@ module Google
84
84
  initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
85
85
  }
86
86
 
87
+ default_config.rpcs.update_database.timeout = 3600.0
88
+ default_config.rpcs.update_database.retry_policy = {
89
+ initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
90
+ }
91
+
87
92
  default_config.rpcs.update_database_ddl.timeout = 3600.0
88
93
  default_config.rpcs.update_database_ddl.retry_policy = {
89
94
  initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
@@ -544,6 +549,139 @@ module Google
544
549
  raise ::Google::Cloud::Error.from_error(e)
545
550
  end
546
551
 
552
+ ##
553
+ # Updates a Cloud Spanner database. The returned
554
+ # {::Google::Longrunning::Operation long-running operation} can be used to track
555
+ # the progress of updating the database. If the named database does not
556
+ # exist, returns `NOT_FOUND`.
557
+ #
558
+ # While the operation is pending:
559
+ #
560
+ # * The database's
561
+ # {::Google::Cloud::Spanner::Admin::Database::V1::Database#reconciling reconciling}
562
+ # field is set to true.
563
+ # * Cancelling the operation is best-effort. If the cancellation succeeds,
564
+ # the operation metadata's
565
+ # {::Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseMetadata#cancel_time cancel_time}
566
+ # is set, the updates are reverted, and the operation terminates with a
567
+ # `CANCELLED` status.
568
+ # * New UpdateDatabase requests will return a `FAILED_PRECONDITION` error
569
+ # until the pending operation is done (returns successfully or with
570
+ # error).
571
+ # * Reading the database via the API continues to give the pre-request
572
+ # values.
573
+ #
574
+ # Upon completion of the returned operation:
575
+ #
576
+ # * The new values are in effect and readable via the API.
577
+ # * The database's
578
+ # {::Google::Cloud::Spanner::Admin::Database::V1::Database#reconciling reconciling}
579
+ # field becomes false.
580
+ #
581
+ # The returned {::Google::Longrunning::Operation long-running operation} will
582
+ # have a name of the format
583
+ # `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`
584
+ # and can be used to track the database modification. The
585
+ # {::Google::Longrunning::Operation#metadata metadata} field type is
586
+ # {::Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseMetadata UpdateDatabaseMetadata}.
587
+ # The {::Google::Longrunning::Operation#response response} field type is
588
+ # {::Google::Cloud::Spanner::Admin::Database::V1::Database Database}, if successful.
589
+ #
590
+ # @overload update_database(request, options = nil)
591
+ # Pass arguments to `update_database` via a request object, either of type
592
+ # {::Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseRequest} or an equivalent Hash.
593
+ #
594
+ # @param request [::Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseRequest, ::Hash]
595
+ # A request object representing the call parameters. Required. To specify no
596
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
597
+ # @param options [::Gapic::CallOptions, ::Hash]
598
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
599
+ #
600
+ # @overload update_database(database: nil, update_mask: nil)
601
+ # Pass arguments to `update_database` via keyword arguments. Note that at
602
+ # least one keyword argument is required. To specify no parameters, or to keep all
603
+ # the default parameter values, pass an empty Hash as a request object (see above).
604
+ #
605
+ # @param database [::Google::Cloud::Spanner::Admin::Database::V1::Database, ::Hash]
606
+ # Required. The database to update.
607
+ # The `name` field of the database is of the form
608
+ # `projects/<project>/instances/<instance>/databases/<database>`.
609
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
610
+ # Required. The list of fields to update. Currently, only
611
+ # `enable_drop_protection` field can be updated.
612
+ #
613
+ # @yield [response, operation] Access the result along with the RPC operation
614
+ # @yieldparam response [::Gapic::Operation]
615
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
616
+ #
617
+ # @return [::Gapic::Operation]
618
+ #
619
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
620
+ #
621
+ # @example Basic example
622
+ # require "google/cloud/spanner/admin/database/v1"
623
+ #
624
+ # # Create a client object. The client can be reused for multiple calls.
625
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
626
+ #
627
+ # # Create a request. To set request fields, pass in keyword arguments.
628
+ # request = Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseRequest.new
629
+ #
630
+ # # Call the update_database method.
631
+ # result = client.update_database request
632
+ #
633
+ # # The returned object is of type Gapic::Operation. You can use it to
634
+ # # check the status of an operation, cancel it, or wait for results.
635
+ # # Here is how to wait for a response.
636
+ # result.wait_until_done! timeout: 60
637
+ # if result.response?
638
+ # p result.response
639
+ # else
640
+ # puts "No response received."
641
+ # end
642
+ #
643
+ def update_database request, options = nil
644
+ raise ::ArgumentError, "request must be provided" if request.nil?
645
+
646
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseRequest
647
+
648
+ # Converts hash and nil to an options object
649
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
650
+
651
+ # Customize the options with defaults
652
+ metadata = @config.rpcs.update_database.metadata.to_h
653
+
654
+ # Set x-goog-api-client and x-goog-user-project headers
655
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
656
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
657
+ gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
658
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
659
+
660
+ header_params = {}
661
+ if request.database&.name
662
+ header_params["database.name"] = request.database.name
663
+ end
664
+
665
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
666
+ metadata[:"x-goog-request-params"] ||= request_params_header
667
+
668
+ options.apply_defaults timeout: @config.rpcs.update_database.timeout,
669
+ metadata: metadata,
670
+ retry_policy: @config.rpcs.update_database.retry_policy
671
+
672
+ options.apply_defaults timeout: @config.timeout,
673
+ metadata: @config.metadata,
674
+ retry_policy: @config.retry_policy
675
+
676
+ @database_admin_stub.call_rpc :update_database, request, options: options do |response, operation|
677
+ response = ::Gapic::Operation.new response, @operations_client, options: options
678
+ yield response, operation if block_given?
679
+ return response
680
+ end
681
+ rescue ::GRPC::BadStatus => e
682
+ raise ::Google::Cloud::Error.from_error(e)
683
+ end
684
+
547
685
  ##
548
686
  # Updates the schema of a Cloud Spanner database by
549
687
  # creating/altering/dropping tables, columns, indexes, etc. The returned
@@ -2387,9 +2525,9 @@ module Google
2387
2525
  # * (`String`) The path to a service account key file in JSON format
2388
2526
  # * (`Hash`) A service account key as a Hash
2389
2527
  # * (`Google::Auth::Credentials`) A googleauth credentials object
2390
- # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
2528
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
2391
2529
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
2392
- # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
2530
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
2393
2531
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
2394
2532
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
2395
2533
  # * (`nil`) indicating no credentials
@@ -2500,6 +2638,11 @@ module Google
2500
2638
  #
2501
2639
  attr_reader :get_database
2502
2640
  ##
2641
+ # RPC-specific configuration for `update_database`
2642
+ # @return [::Gapic::Config::Method]
2643
+ #
2644
+ attr_reader :update_database
2645
+ ##
2503
2646
  # RPC-specific configuration for `update_database_ddl`
2504
2647
  # @return [::Gapic::Config::Method]
2505
2648
  #
@@ -2588,6 +2731,8 @@ module Google
2588
2731
  @create_database = ::Gapic::Config::Method.new create_database_config
2589
2732
  get_database_config = parent_rpcs.get_database if parent_rpcs.respond_to? :get_database
2590
2733
  @get_database = ::Gapic::Config::Method.new get_database_config
2734
+ update_database_config = parent_rpcs.update_database if parent_rpcs.respond_to? :update_database
2735
+ @update_database = ::Gapic::Config::Method.new update_database_config
2591
2736
  update_database_ddl_config = parent_rpcs.update_database_ddl if parent_rpcs.respond_to? :update_database_ddl
2592
2737
  @update_database_ddl = ::Gapic::Config::Method.new update_database_ddl_config
2593
2738
  drop_database_config = parent_rpcs.drop_database if parent_rpcs.respond_to? :drop_database
@@ -622,9 +622,9 @@ module Google
622
622
  # * (`String`) The path to a service account key file in JSON format
623
623
  # * (`Hash`) A service account key as a Hash
624
624
  # * (`Google::Auth::Credentials`) A googleauth credentials object
625
- # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
625
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
626
626
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
627
- # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
627
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
628
628
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
629
629
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
630
630
  # * (`nil`) indicating no credentials
@@ -86,6 +86,11 @@ module Google
86
86
  initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
87
87
  }
88
88
 
89
+ default_config.rpcs.update_database.timeout = 3600.0
90
+ default_config.rpcs.update_database.retry_policy = {
91
+ initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
92
+ }
93
+
89
94
  default_config.rpcs.update_database_ddl.timeout = 3600.0
90
95
  default_config.rpcs.update_database_ddl.retry_policy = {
91
96
  initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
@@ -455,6 +460,109 @@ module Google
455
460
  raise ::Google::Cloud::Error.from_error(e)
456
461
  end
457
462
 
463
+ ##
464
+ # Updates a Cloud Spanner database. The returned
465
+ # {::Google::Longrunning::Operation long-running operation} can be used to track
466
+ # the progress of updating the database. If the named database does not
467
+ # exist, returns `NOT_FOUND`.
468
+ #
469
+ # While the operation is pending:
470
+ #
471
+ # * The database's
472
+ # {::Google::Cloud::Spanner::Admin::Database::V1::Database#reconciling reconciling}
473
+ # field is set to true.
474
+ # * Cancelling the operation is best-effort. If the cancellation succeeds,
475
+ # the operation metadata's
476
+ # {::Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseMetadata#cancel_time cancel_time}
477
+ # is set, the updates are reverted, and the operation terminates with a
478
+ # `CANCELLED` status.
479
+ # * New UpdateDatabase requests will return a `FAILED_PRECONDITION` error
480
+ # until the pending operation is done (returns successfully or with
481
+ # error).
482
+ # * Reading the database via the API continues to give the pre-request
483
+ # values.
484
+ #
485
+ # Upon completion of the returned operation:
486
+ #
487
+ # * The new values are in effect and readable via the API.
488
+ # * The database's
489
+ # {::Google::Cloud::Spanner::Admin::Database::V1::Database#reconciling reconciling}
490
+ # field becomes false.
491
+ #
492
+ # The returned {::Google::Longrunning::Operation long-running operation} will
493
+ # have a name of the format
494
+ # `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`
495
+ # and can be used to track the database modification. The
496
+ # {::Google::Longrunning::Operation#metadata metadata} field type is
497
+ # {::Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseMetadata UpdateDatabaseMetadata}.
498
+ # The {::Google::Longrunning::Operation#response response} field type is
499
+ # {::Google::Cloud::Spanner::Admin::Database::V1::Database Database}, if successful.
500
+ #
501
+ # @overload update_database(request, options = nil)
502
+ # Pass arguments to `update_database` via a request object, either of type
503
+ # {::Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseRequest} or an equivalent Hash.
504
+ #
505
+ # @param request [::Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseRequest, ::Hash]
506
+ # A request object representing the call parameters. Required. To specify no
507
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
508
+ # @param options [::Gapic::CallOptions, ::Hash]
509
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
510
+ #
511
+ # @overload update_database(database: nil, update_mask: nil)
512
+ # Pass arguments to `update_database` via keyword arguments. Note that at
513
+ # least one keyword argument is required. To specify no parameters, or to keep all
514
+ # the default parameter values, pass an empty Hash as a request object (see above).
515
+ #
516
+ # @param database [::Google::Cloud::Spanner::Admin::Database::V1::Database, ::Hash]
517
+ # Required. The database to update.
518
+ # The `name` field of the database is of the form
519
+ # `projects/<project>/instances/<instance>/databases/<database>`.
520
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
521
+ # Required. The list of fields to update. Currently, only
522
+ # `enable_drop_protection` field can be updated.
523
+ # @yield [result, operation] Access the result along with the TransportOperation object
524
+ # @yieldparam result [::Gapic::Operation]
525
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
526
+ #
527
+ # @return [::Gapic::Operation]
528
+ #
529
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
530
+ def update_database request, options = nil
531
+ raise ::ArgumentError, "request must be provided" if request.nil?
532
+
533
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseRequest
534
+
535
+ # Converts hash and nil to an options object
536
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
537
+
538
+ # Customize the options with defaults
539
+ call_metadata = @config.rpcs.update_database.metadata.to_h
540
+
541
+ # Set x-goog-api-client and x-goog-user-project headers
542
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
543
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
544
+ gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
545
+ transports_version_send: [:rest]
546
+
547
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
548
+
549
+ options.apply_defaults timeout: @config.rpcs.update_database.timeout,
550
+ metadata: call_metadata,
551
+ retry_policy: @config.rpcs.update_database.retry_policy
552
+
553
+ options.apply_defaults timeout: @config.timeout,
554
+ metadata: @config.metadata,
555
+ retry_policy: @config.retry_policy
556
+
557
+ @database_admin_stub.update_database request, options do |result, operation|
558
+ result = ::Gapic::Operation.new result, @operations_client, options: options
559
+ yield result, operation if block_given?
560
+ return result
561
+ end
562
+ rescue ::Gapic::Rest::Error => e
563
+ raise ::Google::Cloud::Error.from_error(e)
564
+ end
565
+
458
566
  ##
459
567
  # Updates the schema of a Cloud Spanner database by
460
568
  # creating/altering/dropping tables, columns, indexes, etc. The returned
@@ -1884,9 +1992,9 @@ module Google
1884
1992
  # * (`String`) The path to a service account key file in JSON format
1885
1993
  # * (`Hash`) A service account key as a Hash
1886
1994
  # * (`Google::Auth::Credentials`) A googleauth credentials object
1887
- # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1995
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1888
1996
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1889
- # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1997
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1890
1998
  # * (`nil`) indicating no credentials
1891
1999
  # @return [::Object]
1892
2000
  # @!attribute [rw] scope
@@ -1985,6 +2093,11 @@ module Google
1985
2093
  #
1986
2094
  attr_reader :get_database
1987
2095
  ##
2096
+ # RPC-specific configuration for `update_database`
2097
+ # @return [::Gapic::Config::Method]
2098
+ #
2099
+ attr_reader :update_database
2100
+ ##
1988
2101
  # RPC-specific configuration for `update_database_ddl`
1989
2102
  # @return [::Gapic::Config::Method]
1990
2103
  #
@@ -2073,6 +2186,8 @@ module Google
2073
2186
  @create_database = ::Gapic::Config::Method.new create_database_config
2074
2187
  get_database_config = parent_rpcs.get_database if parent_rpcs.respond_to? :get_database
2075
2188
  @get_database = ::Gapic::Config::Method.new get_database_config
2189
+ update_database_config = parent_rpcs.update_database if parent_rpcs.respond_to? :update_database
2190
+ @update_database = ::Gapic::Config::Method.new update_database_config
2076
2191
  update_database_ddl_config = parent_rpcs.update_database_ddl if parent_rpcs.respond_to? :update_database_ddl
2077
2192
  @update_database_ddl = ::Gapic::Config::Method.new update_database_ddl_config
2078
2193
  drop_database_config = parent_rpcs.drop_database if parent_rpcs.respond_to? :drop_database
@@ -413,9 +413,9 @@ module Google
413
413
  # * (`String`) The path to a service account key file in JSON format
414
414
  # * (`Hash`) A service account key as a Hash
415
415
  # * (`Google::Auth::Credentials`) A googleauth credentials object
416
- # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
416
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
417
417
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
418
- # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
418
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
419
419
  # * (`nil`) indicating no credentials
420
420
  # @return [::Object]
421
421
  # @!attribute [rw] scope
@@ -156,6 +156,44 @@ module Google
156
156
  result
157
157
  end
158
158
 
159
+ ##
160
+ # Baseline implementation for the update_database REST call
161
+ #
162
+ # @param request_pb [::Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseRequest]
163
+ # A request object representing the call parameters. Required.
164
+ # @param options [::Gapic::CallOptions]
165
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
166
+ #
167
+ # @yield [result, operation] Access the result along with the TransportOperation object
168
+ # @yieldparam result [::Google::Longrunning::Operation]
169
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
170
+ #
171
+ # @return [::Google::Longrunning::Operation]
172
+ # A result object deserialized from the server's reply
173
+ def update_database request_pb, options = nil
174
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
175
+
176
+ verb, uri, query_string_params, body = ServiceStub.transcode_update_database_request request_pb
177
+ query_string_params = if query_string_params.any?
178
+ query_string_params.to_h { |p| p.split("=", 2) }
179
+ else
180
+ {}
181
+ end
182
+
183
+ response = @client_stub.make_http_request(
184
+ verb,
185
+ uri: uri,
186
+ body: body || "",
187
+ params: query_string_params,
188
+ options: options
189
+ )
190
+ operation = ::Gapic::Rest::TransportOperation.new response
191
+ result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
192
+
193
+ yield result, operation if block_given?
194
+ result
195
+ end
196
+
159
197
  ##
160
198
  # Baseline implementation for the update_database_ddl REST call
161
199
  #
@@ -828,6 +866,28 @@ module Google
828
866
  transcoder.transcode request_pb
829
867
  end
830
868
 
869
+ ##
870
+ # @private
871
+ #
872
+ # GRPC transcoding helper method for the update_database REST call
873
+ #
874
+ # @param request_pb [::Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseRequest]
875
+ # A request object representing the call parameters. Required.
876
+ # @return [Array(String, [String, nil], Hash{String => String})]
877
+ # Uri, Body, Query string parameters
878
+ def self.transcode_update_database_request request_pb
879
+ transcoder = Gapic::Rest::GrpcTranscoder.new
880
+ .with_bindings(
881
+ uri_method: :patch,
882
+ uri_template: "/v1/{database.name}",
883
+ body: "database",
884
+ matches: [
885
+ ["database.name", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/?$}, false]
886
+ ]
887
+ )
888
+ transcoder.transcode request_pb
889
+ end
890
+
831
891
  ##
832
892
  # @private
833
893
  #
@@ -23,7 +23,7 @@ module Google
23
23
  module Admin
24
24
  module Database
25
25
  module V1
26
- VERSION = "0.12.0"
26
+ VERSION = "0.13.0"
27
27
  end
28
28
  end
29
29
  end
@@ -11,6 +11,7 @@ require 'google/iam/v1/iam_policy_pb'
11
11
  require 'google/iam/v1/policy_pb'
12
12
  require 'google/longrunning/operations_pb'
13
13
  require 'google/protobuf/empty_pb'
14
+ require 'google/protobuf/field_mask_pb'
14
15
  require 'google/protobuf/timestamp_pb'
15
16
  require 'google/spanner/admin/database/v1/backup_pb'
16
17
  require 'google/spanner/admin/database/v1/common_pb'
@@ -34,6 +35,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
34
35
  optional :earliest_version_time, :message, 7, "google.protobuf.Timestamp"
35
36
  optional :default_leader, :string, 9
36
37
  optional :database_dialect, :enum, 10, "google.spanner.admin.database.v1.DatabaseDialect"
38
+ optional :enable_drop_protection, :bool, 11
39
+ optional :reconciling, :bool, 12
37
40
  end
38
41
  add_enum "google.spanner.admin.database.v1.Database.State" do
39
42
  value :STATE_UNSPECIFIED, 0
@@ -63,6 +66,15 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
63
66
  add_message "google.spanner.admin.database.v1.GetDatabaseRequest" do
64
67
  optional :name, :string, 1
65
68
  end
69
+ add_message "google.spanner.admin.database.v1.UpdateDatabaseRequest" do
70
+ optional :database, :message, 1, "google.spanner.admin.database.v1.Database"
71
+ optional :update_mask, :message, 2, "google.protobuf.FieldMask"
72
+ end
73
+ add_message "google.spanner.admin.database.v1.UpdateDatabaseMetadata" do
74
+ optional :request, :message, 1, "google.spanner.admin.database.v1.UpdateDatabaseRequest"
75
+ optional :progress, :message, 2, "google.spanner.admin.database.v1.OperationProgress"
76
+ optional :cancel_time, :message, 3, "google.protobuf.Timestamp"
77
+ end
66
78
  add_message "google.spanner.admin.database.v1.UpdateDatabaseDdlRequest" do
67
79
  optional :database, :string, 1
68
80
  repeated :statements, :string, 2
@@ -159,6 +171,8 @@ module Google
159
171
  CreateDatabaseRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.spanner.admin.database.v1.CreateDatabaseRequest").msgclass
160
172
  CreateDatabaseMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.spanner.admin.database.v1.CreateDatabaseMetadata").msgclass
161
173
  GetDatabaseRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.spanner.admin.database.v1.GetDatabaseRequest").msgclass
174
+ UpdateDatabaseRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.spanner.admin.database.v1.UpdateDatabaseRequest").msgclass
175
+ UpdateDatabaseMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.spanner.admin.database.v1.UpdateDatabaseMetadata").msgclass
162
176
  UpdateDatabaseDdlRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.spanner.admin.database.v1.UpdateDatabaseDdlRequest").msgclass
163
177
  UpdateDatabaseDdlMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata").msgclass
164
178
  DropDatabaseRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.spanner.admin.database.v1.DropDatabaseRequest").msgclass
@@ -54,6 +54,43 @@ module Google
54
54
  rpc :CreateDatabase, ::Google::Cloud::Spanner::Admin::Database::V1::CreateDatabaseRequest, ::Google::Longrunning::Operation
55
55
  # Gets the state of a Cloud Spanner database.
56
56
  rpc :GetDatabase, ::Google::Cloud::Spanner::Admin::Database::V1::GetDatabaseRequest, ::Google::Cloud::Spanner::Admin::Database::V1::Database
57
+ # Updates a Cloud Spanner database. The returned
58
+ # [long-running operation][google.longrunning.Operation] can be used to track
59
+ # the progress of updating the database. If the named database does not
60
+ # exist, returns `NOT_FOUND`.
61
+ #
62
+ # While the operation is pending:
63
+ #
64
+ # * The database's
65
+ # [reconciling][google.spanner.admin.database.v1.Database.reconciling]
66
+ # field is set to true.
67
+ # * Cancelling the operation is best-effort. If the cancellation succeeds,
68
+ # the operation metadata's
69
+ # [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time]
70
+ # is set, the updates are reverted, and the operation terminates with a
71
+ # `CANCELLED` status.
72
+ # * New UpdateDatabase requests will return a `FAILED_PRECONDITION` error
73
+ # until the pending operation is done (returns successfully or with
74
+ # error).
75
+ # * Reading the database via the API continues to give the pre-request
76
+ # values.
77
+ #
78
+ # Upon completion of the returned operation:
79
+ #
80
+ # * The new values are in effect and readable via the API.
81
+ # * The database's
82
+ # [reconciling][google.spanner.admin.database.v1.Database.reconciling]
83
+ # field becomes false.
84
+ #
85
+ # The returned [long-running operation][google.longrunning.Operation] will
86
+ # have a name of the format
87
+ # `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`
88
+ # and can be used to track the database modification. The
89
+ # [metadata][google.longrunning.Operation.metadata] field type is
90
+ # [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata].
91
+ # The [response][google.longrunning.Operation.response] field type is
92
+ # [Database][google.spanner.admin.database.v1.Database], if successful.
93
+ rpc :UpdateDatabase, ::Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseRequest, ::Google::Longrunning::Operation
57
94
  # Updates the schema of a Cloud Spanner database by
58
95
  # creating/altering/dropping tables, columns, indexes, etc. The returned
59
96
  # [long-running operation][google.longrunning.Operation] will have a name of
@@ -35,7 +35,9 @@ module Google
35
35
  # Details about how and where to publish client libraries.
36
36
  # @!attribute [rw] version
37
37
  # @return [::String]
38
- # Version of the API to apply these settings to.
38
+ # Version of the API to apply these settings to. This is the full protobuf
39
+ # package for the API, ending in the version element.
40
+ # Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1".
39
41
  # @!attribute [rw] launch_stage
40
42
  # @return [::Google::Api::LaunchStage]
41
43
  # Launch stage of this version of the API.
@@ -81,7 +83,7 @@ module Google
81
83
  # long-running operation pattern.
82
84
  # @!attribute [rw] new_issue_uri
83
85
  # @return [::String]
84
- # Link to a place that API users can report issues. Example:
86
+ # Link to a *public* URI where users can report issues. Example:
85
87
  # https://issuetracker.google.com/issues/new?component=190865&template=1161103
86
88
  # @!attribute [rw] documentation_uri
87
89
  # @return [::String]
@@ -111,6 +113,10 @@ module Google
111
113
  # Client library settings. If the same version string appears multiple
112
114
  # times in this list, then the last one wins. Settings from earlier
113
115
  # settings with the same version string are discarded.
116
+ # @!attribute [rw] proto_reference_documentation_uri
117
+ # @return [::String]
118
+ # Optional link to proto reference documentation. Example:
119
+ # https://cloud.google.com/pubsub/lite/docs/reference/rpc
114
120
  class Publishing
115
121
  include ::Google::Protobuf::MessageExts
116
122
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -203,9 +209,57 @@ module Google
203
209
  # @!attribute [rw] common
204
210
  # @return [::Google::Api::CommonLanguageSettings]
205
211
  # Some settings.
212
+ # @!attribute [rw] renamed_services
213
+ # @return [::Google::Protobuf::Map{::String => ::String}]
214
+ # Map from original service names to renamed versions.
215
+ # This is used when the default generated types
216
+ # would cause a naming conflict. (Neither name is
217
+ # fully-qualified.)
218
+ # Example: Subscriber to SubscriberServiceApi.
219
+ # @!attribute [rw] renamed_resources
220
+ # @return [::Google::Protobuf::Map{::String => ::String}]
221
+ # Map from full resource types to the effective short name
222
+ # for the resource. This is used when otherwise resource
223
+ # named from different services would cause naming collisions.
224
+ # Example entry:
225
+ # "datalabeling.googleapis.com/Dataset": "DataLabelingDataset"
226
+ # @!attribute [rw] ignored_resources
227
+ # @return [::Array<::String>]
228
+ # List of full resource types to ignore during generation.
229
+ # This is typically used for API-specific Location resources,
230
+ # which should be handled by the generator as if they were actually
231
+ # the common Location resources.
232
+ # Example entry: "documentai.googleapis.com/Location"
233
+ # @!attribute [rw] forced_namespace_aliases
234
+ # @return [::Array<::String>]
235
+ # Namespaces which must be aliased in snippets due to
236
+ # a known (but non-generator-predictable) naming collision
237
+ # @!attribute [rw] handwritten_signatures
238
+ # @return [::Array<::String>]
239
+ # Method signatures (in the form "service.method(signature)")
240
+ # which are provided separately, so shouldn't be generated.
241
+ # Snippets *calling* these methods are still generated, however.
206
242
  class DotnetSettings
207
243
  include ::Google::Protobuf::MessageExts
208
244
  extend ::Google::Protobuf::MessageExts::ClassMethods
245
+
246
+ # @!attribute [rw] key
247
+ # @return [::String]
248
+ # @!attribute [rw] value
249
+ # @return [::String]
250
+ class RenamedServicesEntry
251
+ include ::Google::Protobuf::MessageExts
252
+ extend ::Google::Protobuf::MessageExts::ClassMethods
253
+ end
254
+
255
+ # @!attribute [rw] key
256
+ # @return [::String]
257
+ # @!attribute [rw] value
258
+ # @return [::String]
259
+ class RenamedResourcesEntry
260
+ include ::Google::Protobuf::MessageExts
261
+ extend ::Google::Protobuf::MessageExts::ClassMethods
262
+ end
209
263
  end
210
264
 
211
265
  # Settings for Ruby client libraries.
@@ -240,8 +294,8 @@ module Google
240
294
  # Example of a YAML configuration::
241
295
  #
242
296
  # publishing:
243
- # method_behavior:
244
- # - selector: CreateAdDomain
297
+ # method_settings:
298
+ # - selector: google.cloud.speech.v2.Speech.BatchRecognize
245
299
  # long_running:
246
300
  # initial_poll_delay:
247
301
  # seconds: 60 # 1 minute
@@ -299,6 +353,15 @@ module Google
299
353
 
300
354
  # Street View Org.
301
355
  STREET_VIEW = 4
356
+
357
+ # Shopping Org.
358
+ SHOPPING = 5
359
+
360
+ # Geo Org.
361
+ GEO = 6
362
+
363
+ # Generative AI - https://developers.generativeai.google
364
+ GENERATIVE_AI = 7
302
365
  end
303
366
 
304
367
  # To where should client libraries be published?
@@ -35,7 +35,8 @@ module Google
35
35
  # only if the expression evaluates to `true`. A condition can add constraints
36
36
  # based on attributes of the request, the resource, or both. To learn which
37
37
  # resources support conditions in their IAM policies, see the
38
- # [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
38
+ # [IAM
39
+ # documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
39
40
  #
40
41
  # **JSON example:**
41
42
  #
@@ -58,7 +59,8 @@ module Google
58
59
  # "condition": {
59
60
  # "title": "expirable access",
60
61
  # "description": "Does not grant access after Sep 2020",
61
- # "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')",
62
+ # "expression": "request.time <
63
+ # timestamp('2020-10-01T00:00:00.000Z')",
62
64
  # }
63
65
  # }
64
66
  # ],
@@ -112,7 +114,8 @@ module Google
112
114
  # specify any valid version or leave the field unset.
113
115
  #
114
116
  # To learn which resources support conditions in their IAM policies, see the
115
- # [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
117
+ # [IAM
118
+ # documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
116
119
  # @!attribute [rw] bindings
117
120
  # @return [::Array<::Google::Iam::V1::Binding>]
118
121
  # Associates a list of `members`, or principals, with a `role`. Optionally,
@@ -305,7 +308,8 @@ module Google
305
308
  # @return [::Array<::String>]
306
309
  # Specifies the identities that do not cause logging for this type of
307
310
  # permission.
308
- # Follows the same format of {::Google::Iam::V1::Binding#members Binding.members}.
311
+ # Follows the same format of
312
+ # {::Google::Iam::V1::Binding#members Binding.members}.
309
313
  class AuditLogConfig
310
314
  include ::Google::Protobuf::MessageExts
311
315
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -96,6 +96,14 @@ module Google
96
96
  # @!attribute [r] database_dialect
97
97
  # @return [::Google::Cloud::Spanner::Admin::Database::V1::DatabaseDialect]
98
98
  # Output only. The dialect of the Cloud Spanner Database.
99
+ # @!attribute [rw] enable_drop_protection
100
+ # @return [::Boolean]
101
+ # Whether drop protection is enabled for this database. Defaults to false,
102
+ # if not set.
103
+ # @!attribute [r] reconciling
104
+ # @return [::Boolean]
105
+ # Output only. If true, the database is being updated. If false, there are no
106
+ # ongoing update operations for the database.
99
107
  class Database
100
108
  include ::Google::Protobuf::MessageExts
101
109
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -208,6 +216,42 @@ module Google
208
216
  extend ::Google::Protobuf::MessageExts::ClassMethods
209
217
  end
210
218
 
219
+ # The request for
220
+ # {::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client#update_database UpdateDatabase}.
221
+ # @!attribute [rw] database
222
+ # @return [::Google::Cloud::Spanner::Admin::Database::V1::Database]
223
+ # Required. The database to update.
224
+ # The `name` field of the database is of the form
225
+ # `projects/<project>/instances/<instance>/databases/<database>`.
226
+ # @!attribute [rw] update_mask
227
+ # @return [::Google::Protobuf::FieldMask]
228
+ # Required. The list of fields to update. Currently, only
229
+ # `enable_drop_protection` field can be updated.
230
+ class UpdateDatabaseRequest
231
+ include ::Google::Protobuf::MessageExts
232
+ extend ::Google::Protobuf::MessageExts::ClassMethods
233
+ end
234
+
235
+ # Metadata type for the operation returned by
236
+ # {::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client#update_database UpdateDatabase}.
237
+ # @!attribute [rw] request
238
+ # @return [::Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseRequest]
239
+ # The request for
240
+ # {::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client#update_database UpdateDatabase}.
241
+ # @!attribute [rw] progress
242
+ # @return [::Google::Cloud::Spanner::Admin::Database::V1::OperationProgress]
243
+ # The progress of the
244
+ # {::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client#update_database UpdateDatabase}
245
+ # operation.
246
+ # @!attribute [rw] cancel_time
247
+ # @return [::Google::Protobuf::Timestamp]
248
+ # The time at which this operation was cancelled. If set, this operation is
249
+ # in the process of undoing itself (which is best-effort).
250
+ class UpdateDatabaseMetadata
251
+ include ::Google::Protobuf::MessageExts
252
+ extend ::Google::Protobuf::MessageExts::ClassMethods
253
+ end
254
+
211
255
  # Enqueues the given DDL statements to be applied, in order but not
212
256
  # necessarily all at once, to the database schema at some point (or
213
257
  # points) in the future. The server checks that the statements
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-spanner-admin-database-v1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-08 00:00:00.000000000 Z
11
+ date: 2023-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gapic-common