google-cloud-backupdr-v1 0.2.1 → 0.4.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 (28) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -20
  3. data/lib/google/cloud/backupdr/v1/backupdr/client.rb +2850 -156
  4. data/lib/google/cloud/backupdr/v1/backupdr/operations.rb +12 -15
  5. data/lib/google/cloud/backupdr/v1/backupdr/paths.rb +101 -0
  6. data/lib/google/cloud/backupdr/v1/backupdr/rest/client.rb +2676 -156
  7. data/lib/google/cloud/backupdr/v1/backupdr/rest/operations.rb +43 -38
  8. data/lib/google/cloud/backupdr/v1/backupdr/rest/service_stub.rb +1514 -83
  9. data/lib/google/cloud/backupdr/v1/backupdr_pb.rb +5 -1
  10. data/lib/google/cloud/backupdr/v1/backupdr_services_pb.rb +48 -0
  11. data/lib/google/cloud/backupdr/v1/backupplan_pb.rb +62 -0
  12. data/lib/google/cloud/backupdr/v1/backupplanassociation_pb.rb +59 -0
  13. data/lib/google/cloud/backupdr/v1/backupvault_ba_pb.rb +46 -0
  14. data/lib/google/cloud/backupdr/v1/backupvault_gce_pb.rb +87 -0
  15. data/lib/google/cloud/backupdr/v1/backupvault_pb.rb +99 -0
  16. data/lib/google/cloud/backupdr/v1/version.rb +1 -1
  17. data/proto_docs/google/api/client.rb +39 -0
  18. data/proto_docs/google/api/field_info.rb +88 -0
  19. data/proto_docs/google/cloud/backupdr/v1/backupdr.rb +11 -10
  20. data/proto_docs/google/cloud/backupdr/v1/backupplan.rb +414 -0
  21. data/proto_docs/google/cloud/backupdr/v1/backupplanassociation.rb +272 -0
  22. data/proto_docs/google/cloud/backupdr/v1/backupvault.rb +1103 -0
  23. data/proto_docs/google/cloud/backupdr/v1/backupvault_ba.rb +47 -0
  24. data/proto_docs/google/cloud/backupdr/v1/backupvault_gce.rb +993 -0
  25. data/proto_docs/google/longrunning/operations.rb +19 -14
  26. data/proto_docs/google/type/dayofweek.rb +49 -0
  27. data/proto_docs/google/type/month.rb +64 -0
  28. metadata +18 -5
@@ -86,6 +86,59 @@ module Google
86
86
 
87
87
  default_config.rpcs.delete_management_server.timeout = 60.0
88
88
 
89
+ default_config.rpcs.create_backup_vault.timeout = 60.0
90
+ default_config.rpcs.create_backup_vault.retry_policy = {
91
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
92
+ }
93
+
94
+ default_config.rpcs.list_backup_vaults.timeout = 60.0
95
+ default_config.rpcs.list_backup_vaults.retry_policy = {
96
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
97
+ }
98
+
99
+ default_config.rpcs.fetch_usable_backup_vaults.timeout = 60.0
100
+ default_config.rpcs.fetch_usable_backup_vaults.retry_policy = {
101
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
102
+ }
103
+
104
+ default_config.rpcs.get_backup_vault.timeout = 60.0
105
+ default_config.rpcs.get_backup_vault.retry_policy = {
106
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
107
+ }
108
+
109
+ default_config.rpcs.update_backup_vault.timeout = 60.0
110
+
111
+ default_config.rpcs.delete_backup_vault.timeout = 60.0
112
+ default_config.rpcs.delete_backup_vault.retry_policy = {
113
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
114
+ }
115
+
116
+ default_config.rpcs.list_data_sources.timeout = 60.0
117
+ default_config.rpcs.list_data_sources.retry_policy = {
118
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
119
+ }
120
+
121
+ default_config.rpcs.get_data_source.timeout = 60.0
122
+ default_config.rpcs.get_data_source.retry_policy = {
123
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
124
+ }
125
+
126
+ default_config.rpcs.update_data_source.timeout = 60.0
127
+
128
+ default_config.rpcs.list_backups.timeout = 60.0
129
+ default_config.rpcs.list_backups.retry_policy = {
130
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
131
+ }
132
+
133
+ default_config.rpcs.get_backup.timeout = 60.0
134
+ default_config.rpcs.get_backup.retry_policy = {
135
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
136
+ }
137
+
138
+ default_config.rpcs.update_backup.timeout = 60.0
139
+
140
+ default_config.rpcs.restore_backup.timeout = 60.0
141
+
89
142
  default_config
90
143
  end
91
144
  yield @configure if block_given?
@@ -180,14 +233,26 @@ module Google
180
233
  universe_domain: @config.universe_domain,
181
234
  channel_args: @config.channel_args,
182
235
  interceptors: @config.interceptors,
183
- channel_pool_config: @config.channel_pool
236
+ channel_pool_config: @config.channel_pool,
237
+ logger: @config.logger
184
238
  )
185
239
 
240
+ @backup_dr_stub.stub_logger&.info do |entry|
241
+ entry.set_system_name
242
+ entry.set_service
243
+ entry.message = "Created client for #{entry.service}"
244
+ entry.set_credentials_fields credentials
245
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
246
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
247
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
248
+ end
249
+
186
250
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
187
251
  config.credentials = credentials
188
252
  config.quota_project = @quota_project_id
189
253
  config.endpoint = @backup_dr_stub.endpoint
190
254
  config.universe_domain = @backup_dr_stub.universe_domain
255
+ config.logger = @backup_dr_stub.logger if config.respond_to? :logger=
191
256
  end
192
257
 
193
258
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
@@ -195,6 +260,7 @@ module Google
195
260
  config.quota_project = @quota_project_id
196
261
  config.endpoint = @backup_dr_stub.endpoint
197
262
  config.universe_domain = @backup_dr_stub.universe_domain
263
+ config.logger = @backup_dr_stub.logger if config.respond_to? :logger=
198
264
  end
199
265
  end
200
266
 
@@ -219,6 +285,15 @@ module Google
219
285
  #
220
286
  attr_reader :iam_policy_client
221
287
 
288
+ ##
289
+ # The logger used for request/response debug logging.
290
+ #
291
+ # @return [Logger]
292
+ #
293
+ def logger
294
+ @backup_dr_stub.logger
295
+ end
296
+
222
297
  # Service calls
223
298
 
224
299
  ##
@@ -241,10 +316,11 @@ module Google
241
316
  #
242
317
  # @param parent [::String]
243
318
  # Required. The project and location for which to retrieve management servers
244
- # information, in the format `projects/{project_id}/locations/{location}`. In
245
- # Cloud BackupDR, locations map to GCP regions, for example **us-central1**.
246
- # To retrieve management servers for all locations, use "-" for the
247
- # `{location}` value.
319
+ # information, in the format 'projects/\\{project_id}/locations/\\{location}'. In
320
+ # Cloud BackupDR, locations map to Google Cloud regions, for example
321
+ # **us-central1**. To retrieve management servers for all locations, use "-"
322
+ # for the
323
+ # '\\{location}' value.
248
324
  # @param page_size [::Integer]
249
325
  # Optional. Requested page size. Server may return fewer items than
250
326
  # requested. If unspecified, server will pick an appropriate default.
@@ -319,7 +395,7 @@ module Google
319
395
  @backup_dr_stub.call_rpc :list_management_servers, request, options: options do |response, operation|
320
396
  response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :list_management_servers, request, response, operation, options
321
397
  yield response, operation if block_given?
322
- return response
398
+ throw :response, response
323
399
  end
324
400
  rescue ::GRPC::BadStatus => e
325
401
  raise ::Google::Cloud::Error.from_error(e)
@@ -345,7 +421,7 @@ module Google
345
421
  #
346
422
  # @param name [::String]
347
423
  # Required. Name of the management server resource name, in the format
348
- # `projects/{project_id}/locations/{location}/managementServers/{resource_name}`
424
+ # 'projects/\\{project_id}/locations/\\{location}/managementServers/\\{resource_name}'
349
425
  #
350
426
  # @yield [response, operation] Access the result along with the RPC operation
351
427
  # @yieldparam response [::Google::Cloud::BackupDR::V1::ManagementServer]
@@ -406,7 +482,6 @@ module Google
406
482
 
407
483
  @backup_dr_stub.call_rpc :get_management_server, request, options: options do |response, operation|
408
484
  yield response, operation if block_given?
409
- return response
410
485
  end
411
486
  rescue ::GRPC::BadStatus => e
412
487
  raise ::Google::Cloud::Error.from_error(e)
@@ -432,8 +507,8 @@ module Google
432
507
  #
433
508
  # @param parent [::String]
434
509
  # Required. The management server project and location in the format
435
- # `projects/{project_id}/locations/{location}`. In Cloud Backup and DR
436
- # locations map to GCP regions, for example **us-central1**.
510
+ # 'projects/\\{project_id}/locations/\\{location}'. In Cloud Backup and DR
511
+ # locations map to Google Cloud regions, for example **us-central1**.
437
512
  # @param management_server_id [::String]
438
513
  # Required. The name of the management server to create. The name must be
439
514
  # unique for the specified project and location.
@@ -522,7 +597,7 @@ module Google
522
597
  @backup_dr_stub.call_rpc :create_management_server, request, options: options do |response, operation|
523
598
  response = ::Gapic::Operation.new response, @operations_client, options: options
524
599
  yield response, operation if block_given?
525
- return response
600
+ throw :response, response
526
601
  end
527
602
  rescue ::GRPC::BadStatus => e
528
603
  raise ::Google::Cloud::Error.from_error(e)
@@ -630,173 +705,2631 @@ module Google
630
705
  @backup_dr_stub.call_rpc :delete_management_server, request, options: options do |response, operation|
631
706
  response = ::Gapic::Operation.new response, @operations_client, options: options
632
707
  yield response, operation if block_given?
633
- return response
708
+ throw :response, response
634
709
  end
635
710
  rescue ::GRPC::BadStatus => e
636
711
  raise ::Google::Cloud::Error.from_error(e)
637
712
  end
638
713
 
639
714
  ##
640
- # Configuration class for the BackupDR API.
715
+ # Creates a new BackupVault in a given project and location.
641
716
  #
642
- # This class represents the configuration for BackupDR,
643
- # providing control over timeouts, retry behavior, logging, transport
644
- # parameters, and other low-level controls. Certain parameters can also be
645
- # applied individually to specific RPCs. See
646
- # {::Google::Cloud::BackupDR::V1::BackupDR::Client::Configuration::Rpcs}
647
- # for a list of RPCs that can be configured independently.
717
+ # @overload create_backup_vault(request, options = nil)
718
+ # Pass arguments to `create_backup_vault` via a request object, either of type
719
+ # {::Google::Cloud::BackupDR::V1::CreateBackupVaultRequest} or an equivalent Hash.
648
720
  #
649
- # Configuration can be applied globally to all clients, or to a single client
650
- # on construction.
721
+ # @param request [::Google::Cloud::BackupDR::V1::CreateBackupVaultRequest, ::Hash]
722
+ # A request object representing the call parameters. Required. To specify no
723
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
724
+ # @param options [::Gapic::CallOptions, ::Hash]
725
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
651
726
  #
652
- # @example
727
+ # @overload create_backup_vault(parent: nil, backup_vault_id: nil, backup_vault: nil, request_id: nil, validate_only: nil)
728
+ # Pass arguments to `create_backup_vault` via keyword arguments. Note that at
729
+ # least one keyword argument is required. To specify no parameters, or to keep all
730
+ # the default parameter values, pass an empty Hash as a request object (see above).
653
731
  #
654
- # # Modify the global config, setting the timeout for
655
- # # list_management_servers to 20 seconds,
656
- # # and all remaining timeouts to 10 seconds.
657
- # ::Google::Cloud::BackupDR::V1::BackupDR::Client.configure do |config|
658
- # config.timeout = 10.0
659
- # config.rpcs.list_management_servers.timeout = 20.0
660
- # end
732
+ # @param parent [::String]
733
+ # Required. Value for parent.
734
+ # @param backup_vault_id [::String]
735
+ # Required. ID of the requesting object
736
+ # If auto-generating ID server-side, remove this field and
737
+ # backup_vault_id from the method_signature of Create RPC
738
+ # @param backup_vault [::Google::Cloud::BackupDR::V1::BackupVault, ::Hash]
739
+ # Required. The resource being created
740
+ # @param request_id [::String]
741
+ # Optional. An optional request ID to identify requests. Specify a unique
742
+ # request ID so that if you must retry your request, the server will know to
743
+ # ignore the request if it has already been completed. The server will
744
+ # guarantee that for at least 60 minutes since the first request.
661
745
  #
662
- # # Apply the above configuration only to a new client.
663
- # client = ::Google::Cloud::BackupDR::V1::BackupDR::Client.new do |config|
664
- # config.timeout = 10.0
665
- # config.rpcs.list_management_servers.timeout = 20.0
666
- # end
746
+ # For example, consider a situation where you make an initial request and
747
+ # the request times out. If you make the request again with the same request
748
+ # ID, the server can check if original operation with the same request ID
749
+ # was received, and if so, will ignore the second request. This prevents
750
+ # clients from accidentally creating duplicate commitments.
667
751
  #
668
- # @!attribute [rw] endpoint
669
- # A custom service endpoint, as a hostname or hostname:port. The default is
670
- # nil, indicating to use the default endpoint in the current universe domain.
671
- # @return [::String,nil]
672
- # @!attribute [rw] credentials
673
- # Credentials to send with calls. You may provide any of the following types:
674
- # * (`String`) The path to a service account key file in JSON format
675
- # * (`Hash`) A service account key as a Hash
676
- # * (`Google::Auth::Credentials`) A googleauth credentials object
677
- # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
678
- # * (`Signet::OAuth2::Client`) A signet oauth2 client object
679
- # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
680
- # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
681
- # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
682
- # * (`nil`) indicating no credentials
683
- # @return [::Object]
684
- # @!attribute [rw] scope
685
- # The OAuth scopes
686
- # @return [::Array<::String>]
687
- # @!attribute [rw] lib_name
688
- # The library name as recorded in instrumentation and logging
689
- # @return [::String]
690
- # @!attribute [rw] lib_version
691
- # The library version as recorded in instrumentation and logging
692
- # @return [::String]
693
- # @!attribute [rw] channel_args
694
- # Extra parameters passed to the gRPC channel. Note: this is ignored if a
695
- # `GRPC::Core::Channel` object is provided as the credential.
696
- # @return [::Hash]
697
- # @!attribute [rw] interceptors
698
- # An array of interceptors that are run before calls are executed.
699
- # @return [::Array<::GRPC::ClientInterceptor>]
700
- # @!attribute [rw] timeout
701
- # The call timeout in seconds.
702
- # @return [::Numeric]
703
- # @!attribute [rw] metadata
704
- # Additional gRPC headers to be sent with the call.
705
- # @return [::Hash{::Symbol=>::String}]
706
- # @!attribute [rw] retry_policy
707
- # The retry policy. The value is a hash with the following keys:
708
- # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
709
- # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
710
- # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
711
- # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
712
- # trigger a retry.
713
- # @return [::Hash]
714
- # @!attribute [rw] quota_project
715
- # A separate project against which to charge quota.
716
- # @return [::String]
717
- # @!attribute [rw] universe_domain
718
- # The universe domain within which to make requests. This determines the
719
- # default endpoint URL. The default value of nil uses the environment
720
- # universe (usually the default "googleapis.com" universe).
721
- # @return [::String,nil]
752
+ # The request ID must be a valid UUID with the exception that zero UUID is
753
+ # not supported (00000000-0000-0000-0000-000000000000).
754
+ # @param validate_only [::Boolean]
755
+ # Optional. Only validate the request, but do not perform mutations.
756
+ # The default is 'false'.
722
757
  #
723
- class Configuration
724
- extend ::Gapic::Config
758
+ # @yield [response, operation] Access the result along with the RPC operation
759
+ # @yieldparam response [::Gapic::Operation]
760
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
761
+ #
762
+ # @return [::Gapic::Operation]
763
+ #
764
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
765
+ #
766
+ # @example Basic example
767
+ # require "google/cloud/backupdr/v1"
768
+ #
769
+ # # Create a client object. The client can be reused for multiple calls.
770
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
771
+ #
772
+ # # Create a request. To set request fields, pass in keyword arguments.
773
+ # request = Google::Cloud::BackupDR::V1::CreateBackupVaultRequest.new
774
+ #
775
+ # # Call the create_backup_vault method.
776
+ # result = client.create_backup_vault request
777
+ #
778
+ # # The returned object is of type Gapic::Operation. You can use it to
779
+ # # check the status of an operation, cancel it, or wait for results.
780
+ # # Here is how to wait for a response.
781
+ # result.wait_until_done! timeout: 60
782
+ # if result.response?
783
+ # p result.response
784
+ # else
785
+ # puts "No response received."
786
+ # end
787
+ #
788
+ def create_backup_vault request, options = nil
789
+ raise ::ArgumentError, "request must be provided" if request.nil?
725
790
 
726
- # @private
727
- # The endpoint specific to the default "googleapis.com" universe. Deprecated.
728
- DEFAULT_ENDPOINT = "backupdr.googleapis.com"
791
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::CreateBackupVaultRequest
729
792
 
730
- config_attr :endpoint, nil, ::String, nil
731
- config_attr :credentials, nil do |value|
732
- allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
733
- allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
734
- allowed.any? { |klass| klass === value }
735
- end
736
- config_attr :scope, nil, ::String, ::Array, nil
737
- config_attr :lib_name, nil, ::String, nil
738
- config_attr :lib_version, nil, ::String, nil
739
- config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
740
- config_attr :interceptors, nil, ::Array, nil
741
- config_attr :timeout, nil, ::Numeric, nil
742
- config_attr :metadata, nil, ::Hash, nil
743
- config_attr :retry_policy, nil, ::Hash, ::Proc, nil
744
- config_attr :quota_project, nil, ::String, nil
745
- config_attr :universe_domain, nil, ::String, nil
793
+ # Converts hash and nil to an options object
794
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
746
795
 
747
- # @private
748
- def initialize parent_config = nil
749
- @parent_config = parent_config unless parent_config.nil?
796
+ # Customize the options with defaults
797
+ metadata = @config.rpcs.create_backup_vault.metadata.to_h
750
798
 
751
- yield self if block_given?
752
- end
799
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
800
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
801
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
802
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
803
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
804
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
753
805
 
754
- ##
755
- # Configurations for individual RPCs
756
- # @return [Rpcs]
757
- #
758
- def rpcs
759
- @rpcs ||= begin
760
- parent_rpcs = nil
761
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
762
- Rpcs.new parent_rpcs
763
- end
806
+ header_params = {}
807
+ if request.parent
808
+ header_params["parent"] = request.parent
764
809
  end
765
810
 
766
- ##
767
- # Configuration for the channel pool
768
- # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
769
- #
770
- def channel_pool
771
- @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
811
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
812
+ metadata[:"x-goog-request-params"] ||= request_params_header
813
+
814
+ options.apply_defaults timeout: @config.rpcs.create_backup_vault.timeout,
815
+ metadata: metadata,
816
+ retry_policy: @config.rpcs.create_backup_vault.retry_policy
817
+
818
+ options.apply_defaults timeout: @config.timeout,
819
+ metadata: @config.metadata,
820
+ retry_policy: @config.retry_policy
821
+
822
+ @backup_dr_stub.call_rpc :create_backup_vault, request, options: options do |response, operation|
823
+ response = ::Gapic::Operation.new response, @operations_client, options: options
824
+ yield response, operation if block_given?
825
+ throw :response, response
772
826
  end
827
+ rescue ::GRPC::BadStatus => e
828
+ raise ::Google::Cloud::Error.from_error(e)
829
+ end
773
830
 
774
- ##
775
- # Configuration RPC class for the BackupDR API.
776
- #
777
- # Includes fields providing the configuration for each RPC in this service.
778
- # Each configuration object is of type `Gapic::Config::Method` and includes
779
- # the following configuration fields:
780
- #
781
- # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
782
- # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
783
- # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
784
- # include the following keys:
785
- # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
786
- # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
787
- # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
788
- # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
789
- # trigger a retry.
790
- #
791
- class Rpcs
792
- ##
793
- # RPC-specific configuration for `list_management_servers`
794
- # @return [::Gapic::Config::Method]
795
- #
796
- attr_reader :list_management_servers
797
- ##
798
- # RPC-specific configuration for `get_management_server`
799
- # @return [::Gapic::Config::Method]
831
+ ##
832
+ # Lists BackupVaults in a given project and location.
833
+ #
834
+ # @overload list_backup_vaults(request, options = nil)
835
+ # Pass arguments to `list_backup_vaults` via a request object, either of type
836
+ # {::Google::Cloud::BackupDR::V1::ListBackupVaultsRequest} or an equivalent Hash.
837
+ #
838
+ # @param request [::Google::Cloud::BackupDR::V1::ListBackupVaultsRequest, ::Hash]
839
+ # A request object representing the call parameters. Required. To specify no
840
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
841
+ # @param options [::Gapic::CallOptions, ::Hash]
842
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
843
+ #
844
+ # @overload list_backup_vaults(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil, view: nil)
845
+ # Pass arguments to `list_backup_vaults` via keyword arguments. Note that at
846
+ # least one keyword argument is required. To specify no parameters, or to keep all
847
+ # the default parameter values, pass an empty Hash as a request object (see above).
848
+ #
849
+ # @param parent [::String]
850
+ # Required. The project and location for which to retrieve backupvault stores
851
+ # information, in the format 'projects/\\{project_id}/locations/\\{location}'. In
852
+ # Cloud Backup and DR, locations map to Google Cloud regions, for example
853
+ # **us-central1**.
854
+ # To retrieve backupvault stores for all locations, use "-" for the
855
+ # '\\{location}' value.
856
+ # @param page_size [::Integer]
857
+ # Optional. Requested page size. Server may return fewer items than
858
+ # requested. If unspecified, server will pick an appropriate default.
859
+ # @param page_token [::String]
860
+ # Optional. A token identifying a page of results the server should return.
861
+ # @param filter [::String]
862
+ # Optional. Filtering results.
863
+ # @param order_by [::String]
864
+ # Optional. Hint for how to order the results.
865
+ # @param view [::Google::Cloud::BackupDR::V1::BackupVaultView]
866
+ # Optional. Reserved for future use to provide a BASIC & FULL view of Backup
867
+ # Vault.
868
+ #
869
+ # @yield [response, operation] Access the result along with the RPC operation
870
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::BackupDR::V1::BackupVault>]
871
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
872
+ #
873
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::BackupDR::V1::BackupVault>]
874
+ #
875
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
876
+ #
877
+ # @example Basic example
878
+ # require "google/cloud/backupdr/v1"
879
+ #
880
+ # # Create a client object. The client can be reused for multiple calls.
881
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
882
+ #
883
+ # # Create a request. To set request fields, pass in keyword arguments.
884
+ # request = Google::Cloud::BackupDR::V1::ListBackupVaultsRequest.new
885
+ #
886
+ # # Call the list_backup_vaults method.
887
+ # result = client.list_backup_vaults request
888
+ #
889
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
890
+ # # over elements, and API calls will be issued to fetch pages as needed.
891
+ # result.each do |item|
892
+ # # Each element is of type ::Google::Cloud::BackupDR::V1::BackupVault.
893
+ # p item
894
+ # end
895
+ #
896
+ def list_backup_vaults request, options = nil
897
+ raise ::ArgumentError, "request must be provided" if request.nil?
898
+
899
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::ListBackupVaultsRequest
900
+
901
+ # Converts hash and nil to an options object
902
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
903
+
904
+ # Customize the options with defaults
905
+ metadata = @config.rpcs.list_backup_vaults.metadata.to_h
906
+
907
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
908
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
909
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
910
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
911
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
912
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
913
+
914
+ header_params = {}
915
+ if request.parent
916
+ header_params["parent"] = request.parent
917
+ end
918
+
919
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
920
+ metadata[:"x-goog-request-params"] ||= request_params_header
921
+
922
+ options.apply_defaults timeout: @config.rpcs.list_backup_vaults.timeout,
923
+ metadata: metadata,
924
+ retry_policy: @config.rpcs.list_backup_vaults.retry_policy
925
+
926
+ options.apply_defaults timeout: @config.timeout,
927
+ metadata: @config.metadata,
928
+ retry_policy: @config.retry_policy
929
+
930
+ @backup_dr_stub.call_rpc :list_backup_vaults, request, options: options do |response, operation|
931
+ response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :list_backup_vaults, request, response, operation, options
932
+ yield response, operation if block_given?
933
+ throw :response, response
934
+ end
935
+ rescue ::GRPC::BadStatus => e
936
+ raise ::Google::Cloud::Error.from_error(e)
937
+ end
938
+
939
+ ##
940
+ # FetchUsableBackupVaults lists usable BackupVaults in a given project and
941
+ # location. Usable BackupVault are the ones that user has
942
+ # backupdr.backupVaults.get permission.
943
+ #
944
+ # @overload fetch_usable_backup_vaults(request, options = nil)
945
+ # Pass arguments to `fetch_usable_backup_vaults` via a request object, either of type
946
+ # {::Google::Cloud::BackupDR::V1::FetchUsableBackupVaultsRequest} or an equivalent Hash.
947
+ #
948
+ # @param request [::Google::Cloud::BackupDR::V1::FetchUsableBackupVaultsRequest, ::Hash]
949
+ # A request object representing the call parameters. Required. To specify no
950
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
951
+ # @param options [::Gapic::CallOptions, ::Hash]
952
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
953
+ #
954
+ # @overload fetch_usable_backup_vaults(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
955
+ # Pass arguments to `fetch_usable_backup_vaults` via keyword arguments. Note that at
956
+ # least one keyword argument is required. To specify no parameters, or to keep all
957
+ # the default parameter values, pass an empty Hash as a request object (see above).
958
+ #
959
+ # @param parent [::String]
960
+ # Required. The project and location for which to retrieve backupvault stores
961
+ # information, in the format 'projects/\\{project_id}/locations/\\{location}'. In
962
+ # Cloud Backup and DR, locations map to Google Cloud regions, for example
963
+ # **us-central1**.
964
+ # To retrieve backupvault stores for all locations, use "-" for the
965
+ # '\\{location}' value.
966
+ # @param page_size [::Integer]
967
+ # Optional. Requested page size. Server may return fewer items than
968
+ # requested. If unspecified, server will pick an appropriate default.
969
+ # @param page_token [::String]
970
+ # Optional. A token identifying a page of results the server should return.
971
+ # @param filter [::String]
972
+ # Optional. Filtering results.
973
+ # @param order_by [::String]
974
+ # Optional. Hint for how to order the results.
975
+ #
976
+ # @yield [response, operation] Access the result along with the RPC operation
977
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::BackupDR::V1::BackupVault>]
978
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
979
+ #
980
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::BackupDR::V1::BackupVault>]
981
+ #
982
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
983
+ #
984
+ # @example Basic example
985
+ # require "google/cloud/backupdr/v1"
986
+ #
987
+ # # Create a client object. The client can be reused for multiple calls.
988
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
989
+ #
990
+ # # Create a request. To set request fields, pass in keyword arguments.
991
+ # request = Google::Cloud::BackupDR::V1::FetchUsableBackupVaultsRequest.new
992
+ #
993
+ # # Call the fetch_usable_backup_vaults method.
994
+ # result = client.fetch_usable_backup_vaults request
995
+ #
996
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
997
+ # # over elements, and API calls will be issued to fetch pages as needed.
998
+ # result.each do |item|
999
+ # # Each element is of type ::Google::Cloud::BackupDR::V1::BackupVault.
1000
+ # p item
1001
+ # end
1002
+ #
1003
+ def fetch_usable_backup_vaults request, options = nil
1004
+ raise ::ArgumentError, "request must be provided" if request.nil?
1005
+
1006
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::FetchUsableBackupVaultsRequest
1007
+
1008
+ # Converts hash and nil to an options object
1009
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1010
+
1011
+ # Customize the options with defaults
1012
+ metadata = @config.rpcs.fetch_usable_backup_vaults.metadata.to_h
1013
+
1014
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1015
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1016
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1017
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
1018
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1019
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1020
+
1021
+ header_params = {}
1022
+ if request.parent
1023
+ header_params["parent"] = request.parent
1024
+ end
1025
+
1026
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1027
+ metadata[:"x-goog-request-params"] ||= request_params_header
1028
+
1029
+ options.apply_defaults timeout: @config.rpcs.fetch_usable_backup_vaults.timeout,
1030
+ metadata: metadata,
1031
+ retry_policy: @config.rpcs.fetch_usable_backup_vaults.retry_policy
1032
+
1033
+ options.apply_defaults timeout: @config.timeout,
1034
+ metadata: @config.metadata,
1035
+ retry_policy: @config.retry_policy
1036
+
1037
+ @backup_dr_stub.call_rpc :fetch_usable_backup_vaults, request, options: options do |response, operation|
1038
+ response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :fetch_usable_backup_vaults, request, response, operation, options
1039
+ yield response, operation if block_given?
1040
+ throw :response, response
1041
+ end
1042
+ rescue ::GRPC::BadStatus => e
1043
+ raise ::Google::Cloud::Error.from_error(e)
1044
+ end
1045
+
1046
+ ##
1047
+ # Gets details of a BackupVault.
1048
+ #
1049
+ # @overload get_backup_vault(request, options = nil)
1050
+ # Pass arguments to `get_backup_vault` via a request object, either of type
1051
+ # {::Google::Cloud::BackupDR::V1::GetBackupVaultRequest} or an equivalent Hash.
1052
+ #
1053
+ # @param request [::Google::Cloud::BackupDR::V1::GetBackupVaultRequest, ::Hash]
1054
+ # A request object representing the call parameters. Required. To specify no
1055
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1056
+ # @param options [::Gapic::CallOptions, ::Hash]
1057
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1058
+ #
1059
+ # @overload get_backup_vault(name: nil, view: nil)
1060
+ # Pass arguments to `get_backup_vault` via keyword arguments. Note that at
1061
+ # least one keyword argument is required. To specify no parameters, or to keep all
1062
+ # the default parameter values, pass an empty Hash as a request object (see above).
1063
+ #
1064
+ # @param name [::String]
1065
+ # Required. Name of the backupvault store resource name, in the format
1066
+ # 'projects/\\{project_id}/locations/\\{location}/backupVaults/\\{resource_name}'
1067
+ # @param view [::Google::Cloud::BackupDR::V1::BackupVaultView]
1068
+ # Optional. Reserved for future use to provide a BASIC & FULL view of Backup
1069
+ # Vault
1070
+ #
1071
+ # @yield [response, operation] Access the result along with the RPC operation
1072
+ # @yieldparam response [::Google::Cloud::BackupDR::V1::BackupVault]
1073
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1074
+ #
1075
+ # @return [::Google::Cloud::BackupDR::V1::BackupVault]
1076
+ #
1077
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1078
+ #
1079
+ # @example Basic example
1080
+ # require "google/cloud/backupdr/v1"
1081
+ #
1082
+ # # Create a client object. The client can be reused for multiple calls.
1083
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
1084
+ #
1085
+ # # Create a request. To set request fields, pass in keyword arguments.
1086
+ # request = Google::Cloud::BackupDR::V1::GetBackupVaultRequest.new
1087
+ #
1088
+ # # Call the get_backup_vault method.
1089
+ # result = client.get_backup_vault request
1090
+ #
1091
+ # # The returned object is of type Google::Cloud::BackupDR::V1::BackupVault.
1092
+ # p result
1093
+ #
1094
+ def get_backup_vault request, options = nil
1095
+ raise ::ArgumentError, "request must be provided" if request.nil?
1096
+
1097
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::GetBackupVaultRequest
1098
+
1099
+ # Converts hash and nil to an options object
1100
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1101
+
1102
+ # Customize the options with defaults
1103
+ metadata = @config.rpcs.get_backup_vault.metadata.to_h
1104
+
1105
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1106
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1107
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1108
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
1109
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1110
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1111
+
1112
+ header_params = {}
1113
+ if request.name
1114
+ header_params["name"] = request.name
1115
+ end
1116
+
1117
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1118
+ metadata[:"x-goog-request-params"] ||= request_params_header
1119
+
1120
+ options.apply_defaults timeout: @config.rpcs.get_backup_vault.timeout,
1121
+ metadata: metadata,
1122
+ retry_policy: @config.rpcs.get_backup_vault.retry_policy
1123
+
1124
+ options.apply_defaults timeout: @config.timeout,
1125
+ metadata: @config.metadata,
1126
+ retry_policy: @config.retry_policy
1127
+
1128
+ @backup_dr_stub.call_rpc :get_backup_vault, request, options: options do |response, operation|
1129
+ yield response, operation if block_given?
1130
+ end
1131
+ rescue ::GRPC::BadStatus => e
1132
+ raise ::Google::Cloud::Error.from_error(e)
1133
+ end
1134
+
1135
+ ##
1136
+ # Updates the settings of a BackupVault.
1137
+ #
1138
+ # @overload update_backup_vault(request, options = nil)
1139
+ # Pass arguments to `update_backup_vault` via a request object, either of type
1140
+ # {::Google::Cloud::BackupDR::V1::UpdateBackupVaultRequest} or an equivalent Hash.
1141
+ #
1142
+ # @param request [::Google::Cloud::BackupDR::V1::UpdateBackupVaultRequest, ::Hash]
1143
+ # A request object representing the call parameters. Required. To specify no
1144
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1145
+ # @param options [::Gapic::CallOptions, ::Hash]
1146
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1147
+ #
1148
+ # @overload update_backup_vault(update_mask: nil, backup_vault: nil, request_id: nil, validate_only: nil, force: nil)
1149
+ # Pass arguments to `update_backup_vault` via keyword arguments. Note that at
1150
+ # least one keyword argument is required. To specify no parameters, or to keep all
1151
+ # the default parameter values, pass an empty Hash as a request object (see above).
1152
+ #
1153
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1154
+ # Required. Field mask is used to specify the fields to be overwritten in the
1155
+ # BackupVault resource by the update.
1156
+ # The fields specified in the update_mask are relative to the resource, not
1157
+ # the full request. A field will be overwritten if it is in the mask. If the
1158
+ # user does not provide a mask then the request will fail.
1159
+ # @param backup_vault [::Google::Cloud::BackupDR::V1::BackupVault, ::Hash]
1160
+ # Required. The resource being updated
1161
+ # @param request_id [::String]
1162
+ # Optional. An optional request ID to identify requests. Specify a unique
1163
+ # request ID so that if you must retry your request, the server will know to
1164
+ # ignore the request if it has already been completed. The server will
1165
+ # guarantee that for at least 60 minutes since the first request.
1166
+ #
1167
+ # For example, consider a situation where you make an initial request and
1168
+ # the request times out. If you make the request again with the same request
1169
+ # ID, the server can check if original operation with the same request ID
1170
+ # was received, and if so, will ignore the second request. This prevents
1171
+ # clients from accidentally creating duplicate commitments.
1172
+ #
1173
+ # The request ID must be a valid UUID with the exception that zero UUID is
1174
+ # not supported (00000000-0000-0000-0000-000000000000).
1175
+ # @param validate_only [::Boolean]
1176
+ # Optional. Only validate the request, but do not perform mutations.
1177
+ # The default is 'false'.
1178
+ # @param force [::Boolean]
1179
+ # Optional. If set to true, will not check plan duration against backup vault
1180
+ # enforcement duration.
1181
+ #
1182
+ # @yield [response, operation] Access the result along with the RPC operation
1183
+ # @yieldparam response [::Gapic::Operation]
1184
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1185
+ #
1186
+ # @return [::Gapic::Operation]
1187
+ #
1188
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1189
+ #
1190
+ # @example Basic example
1191
+ # require "google/cloud/backupdr/v1"
1192
+ #
1193
+ # # Create a client object. The client can be reused for multiple calls.
1194
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
1195
+ #
1196
+ # # Create a request. To set request fields, pass in keyword arguments.
1197
+ # request = Google::Cloud::BackupDR::V1::UpdateBackupVaultRequest.new
1198
+ #
1199
+ # # Call the update_backup_vault method.
1200
+ # result = client.update_backup_vault request
1201
+ #
1202
+ # # The returned object is of type Gapic::Operation. You can use it to
1203
+ # # check the status of an operation, cancel it, or wait for results.
1204
+ # # Here is how to wait for a response.
1205
+ # result.wait_until_done! timeout: 60
1206
+ # if result.response?
1207
+ # p result.response
1208
+ # else
1209
+ # puts "No response received."
1210
+ # end
1211
+ #
1212
+ def update_backup_vault request, options = nil
1213
+ raise ::ArgumentError, "request must be provided" if request.nil?
1214
+
1215
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::UpdateBackupVaultRequest
1216
+
1217
+ # Converts hash and nil to an options object
1218
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1219
+
1220
+ # Customize the options with defaults
1221
+ metadata = @config.rpcs.update_backup_vault.metadata.to_h
1222
+
1223
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1224
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1225
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1226
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
1227
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1228
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1229
+
1230
+ header_params = {}
1231
+ if request.backup_vault&.name
1232
+ header_params["backup_vault.name"] = request.backup_vault.name
1233
+ end
1234
+
1235
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1236
+ metadata[:"x-goog-request-params"] ||= request_params_header
1237
+
1238
+ options.apply_defaults timeout: @config.rpcs.update_backup_vault.timeout,
1239
+ metadata: metadata,
1240
+ retry_policy: @config.rpcs.update_backup_vault.retry_policy
1241
+
1242
+ options.apply_defaults timeout: @config.timeout,
1243
+ metadata: @config.metadata,
1244
+ retry_policy: @config.retry_policy
1245
+
1246
+ @backup_dr_stub.call_rpc :update_backup_vault, request, options: options do |response, operation|
1247
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1248
+ yield response, operation if block_given?
1249
+ throw :response, response
1250
+ end
1251
+ rescue ::GRPC::BadStatus => e
1252
+ raise ::Google::Cloud::Error.from_error(e)
1253
+ end
1254
+
1255
+ ##
1256
+ # Deletes a BackupVault.
1257
+ #
1258
+ # @overload delete_backup_vault(request, options = nil)
1259
+ # Pass arguments to `delete_backup_vault` via a request object, either of type
1260
+ # {::Google::Cloud::BackupDR::V1::DeleteBackupVaultRequest} or an equivalent Hash.
1261
+ #
1262
+ # @param request [::Google::Cloud::BackupDR::V1::DeleteBackupVaultRequest, ::Hash]
1263
+ # A request object representing the call parameters. Required. To specify no
1264
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1265
+ # @param options [::Gapic::CallOptions, ::Hash]
1266
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1267
+ #
1268
+ # @overload delete_backup_vault(name: nil, request_id: nil, force: nil, etag: nil, validate_only: nil, allow_missing: nil)
1269
+ # Pass arguments to `delete_backup_vault` via keyword arguments. Note that at
1270
+ # least one keyword argument is required. To specify no parameters, or to keep all
1271
+ # the default parameter values, pass an empty Hash as a request object (see above).
1272
+ #
1273
+ # @param name [::String]
1274
+ # Required. Name of the resource.
1275
+ # @param request_id [::String]
1276
+ # Optional. An optional request ID to identify requests. Specify a unique
1277
+ # request ID so that if you must retry your request, the server will know to
1278
+ # ignore the request if it has already been completed. The server will
1279
+ # guarantee that for at least 60 minutes after the first request.
1280
+ #
1281
+ # For example, consider a situation where you make an initial request and
1282
+ # the request times out. If you make the request again with the same request
1283
+ # ID, the server can check if original operation with the same request ID
1284
+ # was received, and if so, will ignore the second request. This prevents
1285
+ # clients from accidentally creating duplicate commitments.
1286
+ #
1287
+ # The request ID must be a valid UUID with the exception that zero UUID is
1288
+ # not supported (00000000-0000-0000-0000-000000000000).
1289
+ # @param force [::Boolean]
1290
+ # Optional. If set to true, any data source from this backup vault will also
1291
+ # be deleted.
1292
+ # @param etag [::String]
1293
+ # The current etag of the backup vault.
1294
+ # If an etag is provided and does not match the current etag of the
1295
+ # connection, deletion will be blocked.
1296
+ # @param validate_only [::Boolean]
1297
+ # Optional. Only validate the request, but do not perform mutations.
1298
+ # The default is 'false'.
1299
+ # @param allow_missing [::Boolean]
1300
+ # Optional. If true and the BackupVault is not found, the request will
1301
+ # succeed but no action will be taken.
1302
+ #
1303
+ # @yield [response, operation] Access the result along with the RPC operation
1304
+ # @yieldparam response [::Gapic::Operation]
1305
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1306
+ #
1307
+ # @return [::Gapic::Operation]
1308
+ #
1309
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1310
+ #
1311
+ # @example Basic example
1312
+ # require "google/cloud/backupdr/v1"
1313
+ #
1314
+ # # Create a client object. The client can be reused for multiple calls.
1315
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
1316
+ #
1317
+ # # Create a request. To set request fields, pass in keyword arguments.
1318
+ # request = Google::Cloud::BackupDR::V1::DeleteBackupVaultRequest.new
1319
+ #
1320
+ # # Call the delete_backup_vault method.
1321
+ # result = client.delete_backup_vault request
1322
+ #
1323
+ # # The returned object is of type Gapic::Operation. You can use it to
1324
+ # # check the status of an operation, cancel it, or wait for results.
1325
+ # # Here is how to wait for a response.
1326
+ # result.wait_until_done! timeout: 60
1327
+ # if result.response?
1328
+ # p result.response
1329
+ # else
1330
+ # puts "No response received."
1331
+ # end
1332
+ #
1333
+ def delete_backup_vault request, options = nil
1334
+ raise ::ArgumentError, "request must be provided" if request.nil?
1335
+
1336
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::DeleteBackupVaultRequest
1337
+
1338
+ # Converts hash and nil to an options object
1339
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1340
+
1341
+ # Customize the options with defaults
1342
+ metadata = @config.rpcs.delete_backup_vault.metadata.to_h
1343
+
1344
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1345
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1346
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1347
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
1348
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1349
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1350
+
1351
+ header_params = {}
1352
+ if request.name
1353
+ header_params["name"] = request.name
1354
+ end
1355
+
1356
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1357
+ metadata[:"x-goog-request-params"] ||= request_params_header
1358
+
1359
+ options.apply_defaults timeout: @config.rpcs.delete_backup_vault.timeout,
1360
+ metadata: metadata,
1361
+ retry_policy: @config.rpcs.delete_backup_vault.retry_policy
1362
+
1363
+ options.apply_defaults timeout: @config.timeout,
1364
+ metadata: @config.metadata,
1365
+ retry_policy: @config.retry_policy
1366
+
1367
+ @backup_dr_stub.call_rpc :delete_backup_vault, request, options: options do |response, operation|
1368
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1369
+ yield response, operation if block_given?
1370
+ throw :response, response
1371
+ end
1372
+ rescue ::GRPC::BadStatus => e
1373
+ raise ::Google::Cloud::Error.from_error(e)
1374
+ end
1375
+
1376
+ ##
1377
+ # Lists DataSources in a given project and location.
1378
+ #
1379
+ # @overload list_data_sources(request, options = nil)
1380
+ # Pass arguments to `list_data_sources` via a request object, either of type
1381
+ # {::Google::Cloud::BackupDR::V1::ListDataSourcesRequest} or an equivalent Hash.
1382
+ #
1383
+ # @param request [::Google::Cloud::BackupDR::V1::ListDataSourcesRequest, ::Hash]
1384
+ # A request object representing the call parameters. Required. To specify no
1385
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1386
+ # @param options [::Gapic::CallOptions, ::Hash]
1387
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1388
+ #
1389
+ # @overload list_data_sources(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
1390
+ # Pass arguments to `list_data_sources` via keyword arguments. Note that at
1391
+ # least one keyword argument is required. To specify no parameters, or to keep all
1392
+ # the default parameter values, pass an empty Hash as a request object (see above).
1393
+ #
1394
+ # @param parent [::String]
1395
+ # Required. The project and location for which to retrieve data
1396
+ # sources information, in the format
1397
+ # 'projects/\\{project_id}/locations/\\{location}'. In Cloud Backup and DR,
1398
+ # locations map to Google Cloud regions, for example **us-central1**.
1399
+ # To retrieve data sources for all locations, use "-" for the
1400
+ # '\\{location}' value.
1401
+ # @param page_size [::Integer]
1402
+ # Optional. Requested page size. Server may return fewer items than
1403
+ # requested. If unspecified, server will pick an appropriate default.
1404
+ # @param page_token [::String]
1405
+ # Optional. A token identifying a page of results the server should return.
1406
+ # @param filter [::String]
1407
+ # Optional. Filtering results.
1408
+ # @param order_by [::String]
1409
+ # Optional. Hint for how to order the results.
1410
+ #
1411
+ # @yield [response, operation] Access the result along with the RPC operation
1412
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::BackupDR::V1::DataSource>]
1413
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1414
+ #
1415
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::BackupDR::V1::DataSource>]
1416
+ #
1417
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1418
+ #
1419
+ # @example Basic example
1420
+ # require "google/cloud/backupdr/v1"
1421
+ #
1422
+ # # Create a client object. The client can be reused for multiple calls.
1423
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
1424
+ #
1425
+ # # Create a request. To set request fields, pass in keyword arguments.
1426
+ # request = Google::Cloud::BackupDR::V1::ListDataSourcesRequest.new
1427
+ #
1428
+ # # Call the list_data_sources method.
1429
+ # result = client.list_data_sources request
1430
+ #
1431
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1432
+ # # over elements, and API calls will be issued to fetch pages as needed.
1433
+ # result.each do |item|
1434
+ # # Each element is of type ::Google::Cloud::BackupDR::V1::DataSource.
1435
+ # p item
1436
+ # end
1437
+ #
1438
+ def list_data_sources request, options = nil
1439
+ raise ::ArgumentError, "request must be provided" if request.nil?
1440
+
1441
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::ListDataSourcesRequest
1442
+
1443
+ # Converts hash and nil to an options object
1444
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1445
+
1446
+ # Customize the options with defaults
1447
+ metadata = @config.rpcs.list_data_sources.metadata.to_h
1448
+
1449
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1450
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1451
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1452
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
1453
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1454
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1455
+
1456
+ header_params = {}
1457
+ if request.parent
1458
+ header_params["parent"] = request.parent
1459
+ end
1460
+
1461
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1462
+ metadata[:"x-goog-request-params"] ||= request_params_header
1463
+
1464
+ options.apply_defaults timeout: @config.rpcs.list_data_sources.timeout,
1465
+ metadata: metadata,
1466
+ retry_policy: @config.rpcs.list_data_sources.retry_policy
1467
+
1468
+ options.apply_defaults timeout: @config.timeout,
1469
+ metadata: @config.metadata,
1470
+ retry_policy: @config.retry_policy
1471
+
1472
+ @backup_dr_stub.call_rpc :list_data_sources, request, options: options do |response, operation|
1473
+ response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :list_data_sources, request, response, operation, options
1474
+ yield response, operation if block_given?
1475
+ throw :response, response
1476
+ end
1477
+ rescue ::GRPC::BadStatus => e
1478
+ raise ::Google::Cloud::Error.from_error(e)
1479
+ end
1480
+
1481
+ ##
1482
+ # Gets details of a DataSource.
1483
+ #
1484
+ # @overload get_data_source(request, options = nil)
1485
+ # Pass arguments to `get_data_source` via a request object, either of type
1486
+ # {::Google::Cloud::BackupDR::V1::GetDataSourceRequest} or an equivalent Hash.
1487
+ #
1488
+ # @param request [::Google::Cloud::BackupDR::V1::GetDataSourceRequest, ::Hash]
1489
+ # A request object representing the call parameters. Required. To specify no
1490
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1491
+ # @param options [::Gapic::CallOptions, ::Hash]
1492
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1493
+ #
1494
+ # @overload get_data_source(name: nil)
1495
+ # Pass arguments to `get_data_source` via keyword arguments. Note that at
1496
+ # least one keyword argument is required. To specify no parameters, or to keep all
1497
+ # the default parameter values, pass an empty Hash as a request object (see above).
1498
+ #
1499
+ # @param name [::String]
1500
+ # Required. Name of the data source resource name, in the format
1501
+ # 'projects/\\{project_id}/locations/\\{location}/backupVaults/\\{resource_name}/dataSource/\\{resource_name}'
1502
+ #
1503
+ # @yield [response, operation] Access the result along with the RPC operation
1504
+ # @yieldparam response [::Google::Cloud::BackupDR::V1::DataSource]
1505
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1506
+ #
1507
+ # @return [::Google::Cloud::BackupDR::V1::DataSource]
1508
+ #
1509
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1510
+ #
1511
+ # @example Basic example
1512
+ # require "google/cloud/backupdr/v1"
1513
+ #
1514
+ # # Create a client object. The client can be reused for multiple calls.
1515
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
1516
+ #
1517
+ # # Create a request. To set request fields, pass in keyword arguments.
1518
+ # request = Google::Cloud::BackupDR::V1::GetDataSourceRequest.new
1519
+ #
1520
+ # # Call the get_data_source method.
1521
+ # result = client.get_data_source request
1522
+ #
1523
+ # # The returned object is of type Google::Cloud::BackupDR::V1::DataSource.
1524
+ # p result
1525
+ #
1526
+ def get_data_source request, options = nil
1527
+ raise ::ArgumentError, "request must be provided" if request.nil?
1528
+
1529
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::GetDataSourceRequest
1530
+
1531
+ # Converts hash and nil to an options object
1532
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1533
+
1534
+ # Customize the options with defaults
1535
+ metadata = @config.rpcs.get_data_source.metadata.to_h
1536
+
1537
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1538
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1539
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1540
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
1541
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1542
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1543
+
1544
+ header_params = {}
1545
+ if request.name
1546
+ header_params["name"] = request.name
1547
+ end
1548
+
1549
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1550
+ metadata[:"x-goog-request-params"] ||= request_params_header
1551
+
1552
+ options.apply_defaults timeout: @config.rpcs.get_data_source.timeout,
1553
+ metadata: metadata,
1554
+ retry_policy: @config.rpcs.get_data_source.retry_policy
1555
+
1556
+ options.apply_defaults timeout: @config.timeout,
1557
+ metadata: @config.metadata,
1558
+ retry_policy: @config.retry_policy
1559
+
1560
+ @backup_dr_stub.call_rpc :get_data_source, request, options: options do |response, operation|
1561
+ yield response, operation if block_given?
1562
+ end
1563
+ rescue ::GRPC::BadStatus => e
1564
+ raise ::Google::Cloud::Error.from_error(e)
1565
+ end
1566
+
1567
+ ##
1568
+ # Updates the settings of a DataSource.
1569
+ #
1570
+ # @overload update_data_source(request, options = nil)
1571
+ # Pass arguments to `update_data_source` via a request object, either of type
1572
+ # {::Google::Cloud::BackupDR::V1::UpdateDataSourceRequest} or an equivalent Hash.
1573
+ #
1574
+ # @param request [::Google::Cloud::BackupDR::V1::UpdateDataSourceRequest, ::Hash]
1575
+ # A request object representing the call parameters. Required. To specify no
1576
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1577
+ # @param options [::Gapic::CallOptions, ::Hash]
1578
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1579
+ #
1580
+ # @overload update_data_source(update_mask: nil, data_source: nil, request_id: nil, allow_missing: nil)
1581
+ # Pass arguments to `update_data_source` via keyword arguments. Note that at
1582
+ # least one keyword argument is required. To specify no parameters, or to keep all
1583
+ # the default parameter values, pass an empty Hash as a request object (see above).
1584
+ #
1585
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1586
+ # Required. Field mask is used to specify the fields to be overwritten in the
1587
+ # DataSource resource by the update.
1588
+ # The fields specified in the update_mask are relative to the resource, not
1589
+ # the full request. A field will be overwritten if it is in the mask. If the
1590
+ # user does not provide a mask then the request will fail.
1591
+ # @param data_source [::Google::Cloud::BackupDR::V1::DataSource, ::Hash]
1592
+ # Required. The resource being updated
1593
+ # @param request_id [::String]
1594
+ # Optional. An optional request ID to identify requests. Specify a unique
1595
+ # request ID so that if you must retry your request, the server will know to
1596
+ # ignore the request if it has already been completed. The server will
1597
+ # guarantee that for at least 60 minutes since the first request.
1598
+ #
1599
+ # For example, consider a situation where you make an initial request and
1600
+ # the request times out. If you make the request again with the same request
1601
+ # ID, the server can check if original operation with the same request ID
1602
+ # was received, and if so, will ignore the second request. This prevents
1603
+ # clients from accidentally creating duplicate commitments.
1604
+ #
1605
+ # The request ID must be a valid UUID with the exception that zero UUID is
1606
+ # not supported (00000000-0000-0000-0000-000000000000).
1607
+ # @param allow_missing [::Boolean]
1608
+ # Optional. Enable upsert.
1609
+ #
1610
+ # @yield [response, operation] Access the result along with the RPC operation
1611
+ # @yieldparam response [::Gapic::Operation]
1612
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1613
+ #
1614
+ # @return [::Gapic::Operation]
1615
+ #
1616
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1617
+ #
1618
+ # @example Basic example
1619
+ # require "google/cloud/backupdr/v1"
1620
+ #
1621
+ # # Create a client object. The client can be reused for multiple calls.
1622
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
1623
+ #
1624
+ # # Create a request. To set request fields, pass in keyword arguments.
1625
+ # request = Google::Cloud::BackupDR::V1::UpdateDataSourceRequest.new
1626
+ #
1627
+ # # Call the update_data_source method.
1628
+ # result = client.update_data_source request
1629
+ #
1630
+ # # The returned object is of type Gapic::Operation. You can use it to
1631
+ # # check the status of an operation, cancel it, or wait for results.
1632
+ # # Here is how to wait for a response.
1633
+ # result.wait_until_done! timeout: 60
1634
+ # if result.response?
1635
+ # p result.response
1636
+ # else
1637
+ # puts "No response received."
1638
+ # end
1639
+ #
1640
+ def update_data_source request, options = nil
1641
+ raise ::ArgumentError, "request must be provided" if request.nil?
1642
+
1643
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::UpdateDataSourceRequest
1644
+
1645
+ # Converts hash and nil to an options object
1646
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1647
+
1648
+ # Customize the options with defaults
1649
+ metadata = @config.rpcs.update_data_source.metadata.to_h
1650
+
1651
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1652
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1653
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1654
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
1655
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1656
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1657
+
1658
+ header_params = {}
1659
+ if request.data_source&.name
1660
+ header_params["data_source.name"] = request.data_source.name
1661
+ end
1662
+
1663
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1664
+ metadata[:"x-goog-request-params"] ||= request_params_header
1665
+
1666
+ options.apply_defaults timeout: @config.rpcs.update_data_source.timeout,
1667
+ metadata: metadata,
1668
+ retry_policy: @config.rpcs.update_data_source.retry_policy
1669
+
1670
+ options.apply_defaults timeout: @config.timeout,
1671
+ metadata: @config.metadata,
1672
+ retry_policy: @config.retry_policy
1673
+
1674
+ @backup_dr_stub.call_rpc :update_data_source, request, options: options do |response, operation|
1675
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1676
+ yield response, operation if block_given?
1677
+ throw :response, response
1678
+ end
1679
+ rescue ::GRPC::BadStatus => e
1680
+ raise ::Google::Cloud::Error.from_error(e)
1681
+ end
1682
+
1683
+ ##
1684
+ # Lists Backups in a given project and location.
1685
+ #
1686
+ # @overload list_backups(request, options = nil)
1687
+ # Pass arguments to `list_backups` via a request object, either of type
1688
+ # {::Google::Cloud::BackupDR::V1::ListBackupsRequest} or an equivalent Hash.
1689
+ #
1690
+ # @param request [::Google::Cloud::BackupDR::V1::ListBackupsRequest, ::Hash]
1691
+ # A request object representing the call parameters. Required. To specify no
1692
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1693
+ # @param options [::Gapic::CallOptions, ::Hash]
1694
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1695
+ #
1696
+ # @overload list_backups(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil, view: nil)
1697
+ # Pass arguments to `list_backups` via keyword arguments. Note that at
1698
+ # least one keyword argument is required. To specify no parameters, or to keep all
1699
+ # the default parameter values, pass an empty Hash as a request object (see above).
1700
+ #
1701
+ # @param parent [::String]
1702
+ # Required. The project and location for which to retrieve backup
1703
+ # information, in the format
1704
+ # 'projects/\\{project_id}/locations/\\{location}'. In Cloud Backup and DR,
1705
+ # locations map to Google Cloud regions, for example **us-central1**.
1706
+ # To retrieve data sources for all locations, use "-" for the
1707
+ # '\\{location}' value.
1708
+ # @param page_size [::Integer]
1709
+ # Optional. Requested page size. Server may return fewer items than
1710
+ # requested. If unspecified, server will pick an appropriate default.
1711
+ # @param page_token [::String]
1712
+ # Optional. A token identifying a page of results the server should return.
1713
+ # @param filter [::String]
1714
+ # Optional. Filtering results.
1715
+ # @param order_by [::String]
1716
+ # Optional. Hint for how to order the results.
1717
+ # @param view [::Google::Cloud::BackupDR::V1::BackupView]
1718
+ # Optional. Reserved for future use to provide a BASIC & FULL view of Backup
1719
+ # resource.
1720
+ #
1721
+ # @yield [response, operation] Access the result along with the RPC operation
1722
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::BackupDR::V1::Backup>]
1723
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1724
+ #
1725
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::BackupDR::V1::Backup>]
1726
+ #
1727
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1728
+ #
1729
+ # @example Basic example
1730
+ # require "google/cloud/backupdr/v1"
1731
+ #
1732
+ # # Create a client object. The client can be reused for multiple calls.
1733
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
1734
+ #
1735
+ # # Create a request. To set request fields, pass in keyword arguments.
1736
+ # request = Google::Cloud::BackupDR::V1::ListBackupsRequest.new
1737
+ #
1738
+ # # Call the list_backups method.
1739
+ # result = client.list_backups request
1740
+ #
1741
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1742
+ # # over elements, and API calls will be issued to fetch pages as needed.
1743
+ # result.each do |item|
1744
+ # # Each element is of type ::Google::Cloud::BackupDR::V1::Backup.
1745
+ # p item
1746
+ # end
1747
+ #
1748
+ def list_backups request, options = nil
1749
+ raise ::ArgumentError, "request must be provided" if request.nil?
1750
+
1751
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::ListBackupsRequest
1752
+
1753
+ # Converts hash and nil to an options object
1754
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1755
+
1756
+ # Customize the options with defaults
1757
+ metadata = @config.rpcs.list_backups.metadata.to_h
1758
+
1759
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1760
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1761
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1762
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
1763
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1764
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1765
+
1766
+ header_params = {}
1767
+ if request.parent
1768
+ header_params["parent"] = request.parent
1769
+ end
1770
+
1771
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1772
+ metadata[:"x-goog-request-params"] ||= request_params_header
1773
+
1774
+ options.apply_defaults timeout: @config.rpcs.list_backups.timeout,
1775
+ metadata: metadata,
1776
+ retry_policy: @config.rpcs.list_backups.retry_policy
1777
+
1778
+ options.apply_defaults timeout: @config.timeout,
1779
+ metadata: @config.metadata,
1780
+ retry_policy: @config.retry_policy
1781
+
1782
+ @backup_dr_stub.call_rpc :list_backups, request, options: options do |response, operation|
1783
+ response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :list_backups, request, response, operation, options
1784
+ yield response, operation if block_given?
1785
+ throw :response, response
1786
+ end
1787
+ rescue ::GRPC::BadStatus => e
1788
+ raise ::Google::Cloud::Error.from_error(e)
1789
+ end
1790
+
1791
+ ##
1792
+ # Gets details of a Backup.
1793
+ #
1794
+ # @overload get_backup(request, options = nil)
1795
+ # Pass arguments to `get_backup` via a request object, either of type
1796
+ # {::Google::Cloud::BackupDR::V1::GetBackupRequest} or an equivalent Hash.
1797
+ #
1798
+ # @param request [::Google::Cloud::BackupDR::V1::GetBackupRequest, ::Hash]
1799
+ # A request object representing the call parameters. Required. To specify no
1800
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1801
+ # @param options [::Gapic::CallOptions, ::Hash]
1802
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1803
+ #
1804
+ # @overload get_backup(name: nil, view: nil)
1805
+ # Pass arguments to `get_backup` via keyword arguments. Note that at
1806
+ # least one keyword argument is required. To specify no parameters, or to keep all
1807
+ # the default parameter values, pass an empty Hash as a request object (see above).
1808
+ #
1809
+ # @param name [::String]
1810
+ # Required. Name of the data source resource name, in the format
1811
+ # 'projects/\\{project_id}/locations/\\{location}/backupVaults/\\{backupVault}/dataSources/\\{datasource}/backups/\\{backup}'
1812
+ # @param view [::Google::Cloud::BackupDR::V1::BackupView]
1813
+ # Optional. Reserved for future use to provide a BASIC & FULL view of Backup
1814
+ # resource.
1815
+ #
1816
+ # @yield [response, operation] Access the result along with the RPC operation
1817
+ # @yieldparam response [::Google::Cloud::BackupDR::V1::Backup]
1818
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1819
+ #
1820
+ # @return [::Google::Cloud::BackupDR::V1::Backup]
1821
+ #
1822
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1823
+ #
1824
+ # @example Basic example
1825
+ # require "google/cloud/backupdr/v1"
1826
+ #
1827
+ # # Create a client object. The client can be reused for multiple calls.
1828
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
1829
+ #
1830
+ # # Create a request. To set request fields, pass in keyword arguments.
1831
+ # request = Google::Cloud::BackupDR::V1::GetBackupRequest.new
1832
+ #
1833
+ # # Call the get_backup method.
1834
+ # result = client.get_backup request
1835
+ #
1836
+ # # The returned object is of type Google::Cloud::BackupDR::V1::Backup.
1837
+ # p result
1838
+ #
1839
+ def get_backup request, options = nil
1840
+ raise ::ArgumentError, "request must be provided" if request.nil?
1841
+
1842
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::GetBackupRequest
1843
+
1844
+ # Converts hash and nil to an options object
1845
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1846
+
1847
+ # Customize the options with defaults
1848
+ metadata = @config.rpcs.get_backup.metadata.to_h
1849
+
1850
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1851
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1852
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1853
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
1854
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1855
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1856
+
1857
+ header_params = {}
1858
+ if request.name
1859
+ header_params["name"] = request.name
1860
+ end
1861
+
1862
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1863
+ metadata[:"x-goog-request-params"] ||= request_params_header
1864
+
1865
+ options.apply_defaults timeout: @config.rpcs.get_backup.timeout,
1866
+ metadata: metadata,
1867
+ retry_policy: @config.rpcs.get_backup.retry_policy
1868
+
1869
+ options.apply_defaults timeout: @config.timeout,
1870
+ metadata: @config.metadata,
1871
+ retry_policy: @config.retry_policy
1872
+
1873
+ @backup_dr_stub.call_rpc :get_backup, request, options: options do |response, operation|
1874
+ yield response, operation if block_given?
1875
+ end
1876
+ rescue ::GRPC::BadStatus => e
1877
+ raise ::Google::Cloud::Error.from_error(e)
1878
+ end
1879
+
1880
+ ##
1881
+ # Updates the settings of a Backup.
1882
+ #
1883
+ # @overload update_backup(request, options = nil)
1884
+ # Pass arguments to `update_backup` via a request object, either of type
1885
+ # {::Google::Cloud::BackupDR::V1::UpdateBackupRequest} or an equivalent Hash.
1886
+ #
1887
+ # @param request [::Google::Cloud::BackupDR::V1::UpdateBackupRequest, ::Hash]
1888
+ # A request object representing the call parameters. Required. To specify no
1889
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1890
+ # @param options [::Gapic::CallOptions, ::Hash]
1891
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1892
+ #
1893
+ # @overload update_backup(update_mask: nil, backup: nil, request_id: nil)
1894
+ # Pass arguments to `update_backup` via keyword arguments. Note that at
1895
+ # least one keyword argument is required. To specify no parameters, or to keep all
1896
+ # the default parameter values, pass an empty Hash as a request object (see above).
1897
+ #
1898
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1899
+ # Required. Field mask is used to specify the fields to be overwritten in the
1900
+ # Backup resource by the update.
1901
+ # The fields specified in the update_mask are relative to the resource, not
1902
+ # the full request. A field will be overwritten if it is in the mask. If the
1903
+ # user does not provide a mask then the request will fail.
1904
+ # @param backup [::Google::Cloud::BackupDR::V1::Backup, ::Hash]
1905
+ # Required. The resource being updated
1906
+ # @param request_id [::String]
1907
+ # Optional. An optional request ID to identify requests. Specify a unique
1908
+ # request ID so that if you must retry your request, the server will know to
1909
+ # ignore the request if it has already been completed. The server will
1910
+ # guarantee that for at least 60 minutes since the first request.
1911
+ #
1912
+ # For example, consider a situation where you make an initial request and
1913
+ # the request times out. If you make the request again with the same request
1914
+ # ID, the server can check if original operation with the same request ID
1915
+ # was received, and if so, will ignore the second request. This prevents
1916
+ # clients from accidentally creating duplicate commitments.
1917
+ #
1918
+ # The request ID must be a valid UUID with the exception that zero UUID is
1919
+ # not supported (00000000-0000-0000-0000-000000000000).
1920
+ #
1921
+ # @yield [response, operation] Access the result along with the RPC operation
1922
+ # @yieldparam response [::Gapic::Operation]
1923
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1924
+ #
1925
+ # @return [::Gapic::Operation]
1926
+ #
1927
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1928
+ #
1929
+ # @example Basic example
1930
+ # require "google/cloud/backupdr/v1"
1931
+ #
1932
+ # # Create a client object. The client can be reused for multiple calls.
1933
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
1934
+ #
1935
+ # # Create a request. To set request fields, pass in keyword arguments.
1936
+ # request = Google::Cloud::BackupDR::V1::UpdateBackupRequest.new
1937
+ #
1938
+ # # Call the update_backup method.
1939
+ # result = client.update_backup request
1940
+ #
1941
+ # # The returned object is of type Gapic::Operation. You can use it to
1942
+ # # check the status of an operation, cancel it, or wait for results.
1943
+ # # Here is how to wait for a response.
1944
+ # result.wait_until_done! timeout: 60
1945
+ # if result.response?
1946
+ # p result.response
1947
+ # else
1948
+ # puts "No response received."
1949
+ # end
1950
+ #
1951
+ def update_backup request, options = nil
1952
+ raise ::ArgumentError, "request must be provided" if request.nil?
1953
+
1954
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::UpdateBackupRequest
1955
+
1956
+ # Converts hash and nil to an options object
1957
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1958
+
1959
+ # Customize the options with defaults
1960
+ metadata = @config.rpcs.update_backup.metadata.to_h
1961
+
1962
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1963
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1964
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1965
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
1966
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1967
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1968
+
1969
+ header_params = {}
1970
+ if request.backup&.name
1971
+ header_params["backup.name"] = request.backup.name
1972
+ end
1973
+
1974
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1975
+ metadata[:"x-goog-request-params"] ||= request_params_header
1976
+
1977
+ options.apply_defaults timeout: @config.rpcs.update_backup.timeout,
1978
+ metadata: metadata,
1979
+ retry_policy: @config.rpcs.update_backup.retry_policy
1980
+
1981
+ options.apply_defaults timeout: @config.timeout,
1982
+ metadata: @config.metadata,
1983
+ retry_policy: @config.retry_policy
1984
+
1985
+ @backup_dr_stub.call_rpc :update_backup, request, options: options do |response, operation|
1986
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1987
+ yield response, operation if block_given?
1988
+ throw :response, response
1989
+ end
1990
+ rescue ::GRPC::BadStatus => e
1991
+ raise ::Google::Cloud::Error.from_error(e)
1992
+ end
1993
+
1994
+ ##
1995
+ # Deletes a Backup.
1996
+ #
1997
+ # @overload delete_backup(request, options = nil)
1998
+ # Pass arguments to `delete_backup` via a request object, either of type
1999
+ # {::Google::Cloud::BackupDR::V1::DeleteBackupRequest} or an equivalent Hash.
2000
+ #
2001
+ # @param request [::Google::Cloud::BackupDR::V1::DeleteBackupRequest, ::Hash]
2002
+ # A request object representing the call parameters. Required. To specify no
2003
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2004
+ # @param options [::Gapic::CallOptions, ::Hash]
2005
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2006
+ #
2007
+ # @overload delete_backup(name: nil, request_id: nil)
2008
+ # Pass arguments to `delete_backup` via keyword arguments. Note that at
2009
+ # least one keyword argument is required. To specify no parameters, or to keep all
2010
+ # the default parameter values, pass an empty Hash as a request object (see above).
2011
+ #
2012
+ # @param name [::String]
2013
+ # Required. Name of the resource.
2014
+ # @param request_id [::String]
2015
+ # Optional. An optional request ID to identify requests. Specify a unique
2016
+ # request ID so that if you must retry your request, the server will know to
2017
+ # ignore the request if it has already been completed. The server will
2018
+ # guarantee that for at least 60 minutes after the first request.
2019
+ #
2020
+ # For example, consider a situation where you make an initial request and
2021
+ # the request times out. If you make the request again with the same request
2022
+ # ID, the server can check if original operation with the same request ID
2023
+ # was received, and if so, will ignore the second request. This prevents
2024
+ # clients from accidentally creating duplicate commitments.
2025
+ #
2026
+ # The request ID must be a valid UUID with the exception that zero UUID is
2027
+ # not supported (00000000-0000-0000-0000-000000000000).
2028
+ #
2029
+ # @yield [response, operation] Access the result along with the RPC operation
2030
+ # @yieldparam response [::Gapic::Operation]
2031
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2032
+ #
2033
+ # @return [::Gapic::Operation]
2034
+ #
2035
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2036
+ #
2037
+ # @example Basic example
2038
+ # require "google/cloud/backupdr/v1"
2039
+ #
2040
+ # # Create a client object. The client can be reused for multiple calls.
2041
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
2042
+ #
2043
+ # # Create a request. To set request fields, pass in keyword arguments.
2044
+ # request = Google::Cloud::BackupDR::V1::DeleteBackupRequest.new
2045
+ #
2046
+ # # Call the delete_backup method.
2047
+ # result = client.delete_backup request
2048
+ #
2049
+ # # The returned object is of type Gapic::Operation. You can use it to
2050
+ # # check the status of an operation, cancel it, or wait for results.
2051
+ # # Here is how to wait for a response.
2052
+ # result.wait_until_done! timeout: 60
2053
+ # if result.response?
2054
+ # p result.response
2055
+ # else
2056
+ # puts "No response received."
2057
+ # end
2058
+ #
2059
+ def delete_backup request, options = nil
2060
+ raise ::ArgumentError, "request must be provided" if request.nil?
2061
+
2062
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::DeleteBackupRequest
2063
+
2064
+ # Converts hash and nil to an options object
2065
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2066
+
2067
+ # Customize the options with defaults
2068
+ metadata = @config.rpcs.delete_backup.metadata.to_h
2069
+
2070
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2071
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2072
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2073
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
2074
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2075
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2076
+
2077
+ header_params = {}
2078
+ if request.name
2079
+ header_params["name"] = request.name
2080
+ end
2081
+
2082
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2083
+ metadata[:"x-goog-request-params"] ||= request_params_header
2084
+
2085
+ options.apply_defaults timeout: @config.rpcs.delete_backup.timeout,
2086
+ metadata: metadata,
2087
+ retry_policy: @config.rpcs.delete_backup.retry_policy
2088
+
2089
+ options.apply_defaults timeout: @config.timeout,
2090
+ metadata: @config.metadata,
2091
+ retry_policy: @config.retry_policy
2092
+
2093
+ @backup_dr_stub.call_rpc :delete_backup, request, options: options do |response, operation|
2094
+ response = ::Gapic::Operation.new response, @operations_client, options: options
2095
+ yield response, operation if block_given?
2096
+ throw :response, response
2097
+ end
2098
+ rescue ::GRPC::BadStatus => e
2099
+ raise ::Google::Cloud::Error.from_error(e)
2100
+ end
2101
+
2102
+ ##
2103
+ # Restore from a Backup
2104
+ #
2105
+ # @overload restore_backup(request, options = nil)
2106
+ # Pass arguments to `restore_backup` via a request object, either of type
2107
+ # {::Google::Cloud::BackupDR::V1::RestoreBackupRequest} or an equivalent Hash.
2108
+ #
2109
+ # @param request [::Google::Cloud::BackupDR::V1::RestoreBackupRequest, ::Hash]
2110
+ # A request object representing the call parameters. Required. To specify no
2111
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2112
+ # @param options [::Gapic::CallOptions, ::Hash]
2113
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2114
+ #
2115
+ # @overload restore_backup(name: nil, request_id: nil, compute_instance_target_environment: nil, compute_instance_restore_properties: nil)
2116
+ # Pass arguments to `restore_backup` via keyword arguments. Note that at
2117
+ # least one keyword argument is required. To specify no parameters, or to keep all
2118
+ # the default parameter values, pass an empty Hash as a request object (see above).
2119
+ #
2120
+ # @param name [::String]
2121
+ # Required. The resource name of the Backup instance, in the format
2122
+ # 'projects/*/locations/*/backupVaults/*/dataSources/*/backups/'.
2123
+ # @param request_id [::String]
2124
+ # Optional. An optional request ID to identify requests. Specify a unique
2125
+ # request ID so that if you must retry your request, the server will know to
2126
+ # ignore the request if it has already been completed. The server will
2127
+ # guarantee that for at least 60 minutes after the first request.
2128
+ #
2129
+ # For example, consider a situation where you make an initial request and
2130
+ # the request times out. If you make the request again with the same request
2131
+ # ID, the server can check if original operation with the same request ID
2132
+ # was received, and if so, will ignore the second request. This prevents
2133
+ # clients from accidentally creating duplicate commitments.
2134
+ #
2135
+ # The request ID must be a valid UUID with the exception that zero UUID is
2136
+ # not supported (00000000-0000-0000-0000-000000000000).
2137
+ # @param compute_instance_target_environment [::Google::Cloud::BackupDR::V1::ComputeInstanceTargetEnvironment, ::Hash]
2138
+ # Compute Engine target environment to be used during restore.
2139
+ # @param compute_instance_restore_properties [::Google::Cloud::BackupDR::V1::ComputeInstanceRestoreProperties, ::Hash]
2140
+ # Compute Engine instance properties to be overridden during restore.
2141
+ #
2142
+ # @yield [response, operation] Access the result along with the RPC operation
2143
+ # @yieldparam response [::Gapic::Operation]
2144
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2145
+ #
2146
+ # @return [::Gapic::Operation]
2147
+ #
2148
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2149
+ #
2150
+ # @example Basic example
2151
+ # require "google/cloud/backupdr/v1"
2152
+ #
2153
+ # # Create a client object. The client can be reused for multiple calls.
2154
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
2155
+ #
2156
+ # # Create a request. To set request fields, pass in keyword arguments.
2157
+ # request = Google::Cloud::BackupDR::V1::RestoreBackupRequest.new
2158
+ #
2159
+ # # Call the restore_backup method.
2160
+ # result = client.restore_backup request
2161
+ #
2162
+ # # The returned object is of type Gapic::Operation. You can use it to
2163
+ # # check the status of an operation, cancel it, or wait for results.
2164
+ # # Here is how to wait for a response.
2165
+ # result.wait_until_done! timeout: 60
2166
+ # if result.response?
2167
+ # p result.response
2168
+ # else
2169
+ # puts "No response received."
2170
+ # end
2171
+ #
2172
+ def restore_backup request, options = nil
2173
+ raise ::ArgumentError, "request must be provided" if request.nil?
2174
+
2175
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::RestoreBackupRequest
2176
+
2177
+ # Converts hash and nil to an options object
2178
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2179
+
2180
+ # Customize the options with defaults
2181
+ metadata = @config.rpcs.restore_backup.metadata.to_h
2182
+
2183
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2184
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2185
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2186
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
2187
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2188
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2189
+
2190
+ header_params = {}
2191
+ if request.name
2192
+ header_params["name"] = request.name
2193
+ end
2194
+
2195
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2196
+ metadata[:"x-goog-request-params"] ||= request_params_header
2197
+
2198
+ options.apply_defaults timeout: @config.rpcs.restore_backup.timeout,
2199
+ metadata: metadata,
2200
+ retry_policy: @config.rpcs.restore_backup.retry_policy
2201
+
2202
+ options.apply_defaults timeout: @config.timeout,
2203
+ metadata: @config.metadata,
2204
+ retry_policy: @config.retry_policy
2205
+
2206
+ @backup_dr_stub.call_rpc :restore_backup, request, options: options do |response, operation|
2207
+ response = ::Gapic::Operation.new response, @operations_client, options: options
2208
+ yield response, operation if block_given?
2209
+ throw :response, response
2210
+ end
2211
+ rescue ::GRPC::BadStatus => e
2212
+ raise ::Google::Cloud::Error.from_error(e)
2213
+ end
2214
+
2215
+ ##
2216
+ # Create a BackupPlan
2217
+ #
2218
+ # @overload create_backup_plan(request, options = nil)
2219
+ # Pass arguments to `create_backup_plan` via a request object, either of type
2220
+ # {::Google::Cloud::BackupDR::V1::CreateBackupPlanRequest} or an equivalent Hash.
2221
+ #
2222
+ # @param request [::Google::Cloud::BackupDR::V1::CreateBackupPlanRequest, ::Hash]
2223
+ # A request object representing the call parameters. Required. To specify no
2224
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2225
+ # @param options [::Gapic::CallOptions, ::Hash]
2226
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2227
+ #
2228
+ # @overload create_backup_plan(parent: nil, backup_plan_id: nil, backup_plan: nil, request_id: nil)
2229
+ # Pass arguments to `create_backup_plan` via keyword arguments. Note that at
2230
+ # least one keyword argument is required. To specify no parameters, or to keep all
2231
+ # the default parameter values, pass an empty Hash as a request object (see above).
2232
+ #
2233
+ # @param parent [::String]
2234
+ # Required. The `BackupPlan` project and location in the format
2235
+ # `projects/{project}/locations/{location}`. In Cloud BackupDR locations
2236
+ # map to GCP regions, for example **us-central1**.
2237
+ # @param backup_plan_id [::String]
2238
+ # Required. The name of the `BackupPlan` to create. The name must be unique
2239
+ # for the specified project and location.The name must start with a lowercase
2240
+ # letter followed by up to 62 lowercase letters, numbers, or hyphens.
2241
+ # Pattern, /[a-z][a-z0-9-]\\{,62}/.
2242
+ # @param backup_plan [::Google::Cloud::BackupDR::V1::BackupPlan, ::Hash]
2243
+ # Required. The `BackupPlan` resource object to create.
2244
+ # @param request_id [::String]
2245
+ # Optional. An optional request ID to identify requests. Specify a unique
2246
+ # request ID so that if you must retry your request, the server will know to
2247
+ # ignore the request if it has already been completed. The server will
2248
+ # guarantee that for at least 60 minutes since the first request.
2249
+ #
2250
+ # For example, consider a situation where you make an initial request and t
2251
+ # he request times out. If you make the request again with the same request
2252
+ # ID, the server can check if original operation with the same request ID
2253
+ # was received, and if so, will ignore the second request. This prevents
2254
+ # clients from accidentally creating duplicate commitments.
2255
+ #
2256
+ # The request ID must be a valid UUID with the exception that zero UUID is
2257
+ # not supported (00000000-0000-0000-0000-000000000000).
2258
+ #
2259
+ # @yield [response, operation] Access the result along with the RPC operation
2260
+ # @yieldparam response [::Gapic::Operation]
2261
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2262
+ #
2263
+ # @return [::Gapic::Operation]
2264
+ #
2265
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2266
+ #
2267
+ # @example Basic example
2268
+ # require "google/cloud/backupdr/v1"
2269
+ #
2270
+ # # Create a client object. The client can be reused for multiple calls.
2271
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
2272
+ #
2273
+ # # Create a request. To set request fields, pass in keyword arguments.
2274
+ # request = Google::Cloud::BackupDR::V1::CreateBackupPlanRequest.new
2275
+ #
2276
+ # # Call the create_backup_plan method.
2277
+ # result = client.create_backup_plan request
2278
+ #
2279
+ # # The returned object is of type Gapic::Operation. You can use it to
2280
+ # # check the status of an operation, cancel it, or wait for results.
2281
+ # # Here is how to wait for a response.
2282
+ # result.wait_until_done! timeout: 60
2283
+ # if result.response?
2284
+ # p result.response
2285
+ # else
2286
+ # puts "No response received."
2287
+ # end
2288
+ #
2289
+ def create_backup_plan request, options = nil
2290
+ raise ::ArgumentError, "request must be provided" if request.nil?
2291
+
2292
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::CreateBackupPlanRequest
2293
+
2294
+ # Converts hash and nil to an options object
2295
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2296
+
2297
+ # Customize the options with defaults
2298
+ metadata = @config.rpcs.create_backup_plan.metadata.to_h
2299
+
2300
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2301
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2302
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2303
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
2304
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2305
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2306
+
2307
+ header_params = {}
2308
+ if request.parent
2309
+ header_params["parent"] = request.parent
2310
+ end
2311
+
2312
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2313
+ metadata[:"x-goog-request-params"] ||= request_params_header
2314
+
2315
+ options.apply_defaults timeout: @config.rpcs.create_backup_plan.timeout,
2316
+ metadata: metadata,
2317
+ retry_policy: @config.rpcs.create_backup_plan.retry_policy
2318
+
2319
+ options.apply_defaults timeout: @config.timeout,
2320
+ metadata: @config.metadata,
2321
+ retry_policy: @config.retry_policy
2322
+
2323
+ @backup_dr_stub.call_rpc :create_backup_plan, request, options: options do |response, operation|
2324
+ response = ::Gapic::Operation.new response, @operations_client, options: options
2325
+ yield response, operation if block_given?
2326
+ throw :response, response
2327
+ end
2328
+ rescue ::GRPC::BadStatus => e
2329
+ raise ::Google::Cloud::Error.from_error(e)
2330
+ end
2331
+
2332
+ ##
2333
+ # Gets details of a single BackupPlan.
2334
+ #
2335
+ # @overload get_backup_plan(request, options = nil)
2336
+ # Pass arguments to `get_backup_plan` via a request object, either of type
2337
+ # {::Google::Cloud::BackupDR::V1::GetBackupPlanRequest} or an equivalent Hash.
2338
+ #
2339
+ # @param request [::Google::Cloud::BackupDR::V1::GetBackupPlanRequest, ::Hash]
2340
+ # A request object representing the call parameters. Required. To specify no
2341
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2342
+ # @param options [::Gapic::CallOptions, ::Hash]
2343
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2344
+ #
2345
+ # @overload get_backup_plan(name: nil)
2346
+ # Pass arguments to `get_backup_plan` via keyword arguments. Note that at
2347
+ # least one keyword argument is required. To specify no parameters, or to keep all
2348
+ # the default parameter values, pass an empty Hash as a request object (see above).
2349
+ #
2350
+ # @param name [::String]
2351
+ # Required. The resource name of the `BackupPlan` to retrieve.
2352
+ #
2353
+ # Format: `projects/{project}/locations/{location}/backupPlans/{backup_plan}`
2354
+ #
2355
+ # @yield [response, operation] Access the result along with the RPC operation
2356
+ # @yieldparam response [::Google::Cloud::BackupDR::V1::BackupPlan]
2357
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2358
+ #
2359
+ # @return [::Google::Cloud::BackupDR::V1::BackupPlan]
2360
+ #
2361
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2362
+ #
2363
+ # @example Basic example
2364
+ # require "google/cloud/backupdr/v1"
2365
+ #
2366
+ # # Create a client object. The client can be reused for multiple calls.
2367
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
2368
+ #
2369
+ # # Create a request. To set request fields, pass in keyword arguments.
2370
+ # request = Google::Cloud::BackupDR::V1::GetBackupPlanRequest.new
2371
+ #
2372
+ # # Call the get_backup_plan method.
2373
+ # result = client.get_backup_plan request
2374
+ #
2375
+ # # The returned object is of type Google::Cloud::BackupDR::V1::BackupPlan.
2376
+ # p result
2377
+ #
2378
+ def get_backup_plan request, options = nil
2379
+ raise ::ArgumentError, "request must be provided" if request.nil?
2380
+
2381
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::GetBackupPlanRequest
2382
+
2383
+ # Converts hash and nil to an options object
2384
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2385
+
2386
+ # Customize the options with defaults
2387
+ metadata = @config.rpcs.get_backup_plan.metadata.to_h
2388
+
2389
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2390
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2391
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2392
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
2393
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2394
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2395
+
2396
+ header_params = {}
2397
+ if request.name
2398
+ header_params["name"] = request.name
2399
+ end
2400
+
2401
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2402
+ metadata[:"x-goog-request-params"] ||= request_params_header
2403
+
2404
+ options.apply_defaults timeout: @config.rpcs.get_backup_plan.timeout,
2405
+ metadata: metadata,
2406
+ retry_policy: @config.rpcs.get_backup_plan.retry_policy
2407
+
2408
+ options.apply_defaults timeout: @config.timeout,
2409
+ metadata: @config.metadata,
2410
+ retry_policy: @config.retry_policy
2411
+
2412
+ @backup_dr_stub.call_rpc :get_backup_plan, request, options: options do |response, operation|
2413
+ yield response, operation if block_given?
2414
+ end
2415
+ rescue ::GRPC::BadStatus => e
2416
+ raise ::Google::Cloud::Error.from_error(e)
2417
+ end
2418
+
2419
+ ##
2420
+ # Lists BackupPlans in a given project and location.
2421
+ #
2422
+ # @overload list_backup_plans(request, options = nil)
2423
+ # Pass arguments to `list_backup_plans` via a request object, either of type
2424
+ # {::Google::Cloud::BackupDR::V1::ListBackupPlansRequest} or an equivalent Hash.
2425
+ #
2426
+ # @param request [::Google::Cloud::BackupDR::V1::ListBackupPlansRequest, ::Hash]
2427
+ # A request object representing the call parameters. Required. To specify no
2428
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2429
+ # @param options [::Gapic::CallOptions, ::Hash]
2430
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2431
+ #
2432
+ # @overload list_backup_plans(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
2433
+ # Pass arguments to `list_backup_plans` via keyword arguments. Note that at
2434
+ # least one keyword argument is required. To specify no parameters, or to keep all
2435
+ # the default parameter values, pass an empty Hash as a request object (see above).
2436
+ #
2437
+ # @param parent [::String]
2438
+ # Required. The project and location for which to retrieve `BackupPlans`
2439
+ # information. Format: `projects/{project}/locations/{location}`. In Cloud
2440
+ # BackupDR, locations map to GCP regions, for e.g. **us-central1**. To
2441
+ # retrieve backup plans for all locations, use "-" for the
2442
+ # `{location}` value.
2443
+ # @param page_size [::Integer]
2444
+ # Optional. The maximum number of `BackupPlans` to return in a single
2445
+ # response. If not specified, a default value will be chosen by the service.
2446
+ # Note that the response may include a partial list and a caller should
2447
+ # only rely on the response's
2448
+ # {::Google::Cloud::BackupDR::V1::ListBackupPlansResponse#next_page_token next_page_token}
2449
+ # to determine if there are more instances left to be queried.
2450
+ # @param page_token [::String]
2451
+ # Optional. The value of
2452
+ # {::Google::Cloud::BackupDR::V1::ListBackupPlansResponse#next_page_token next_page_token}
2453
+ # received from a previous `ListBackupPlans` call.
2454
+ # Provide this to retrieve the subsequent page in a multi-page list of
2455
+ # results. When paginating, all other parameters provided to
2456
+ # `ListBackupPlans` must match the call that provided the page token.
2457
+ # @param filter [::String]
2458
+ # Optional. Field match expression used to filter the results.
2459
+ # @param order_by [::String]
2460
+ # Optional. Field by which to sort the results.
2461
+ #
2462
+ # @yield [response, operation] Access the result along with the RPC operation
2463
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::BackupDR::V1::BackupPlan>]
2464
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2465
+ #
2466
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::BackupDR::V1::BackupPlan>]
2467
+ #
2468
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2469
+ #
2470
+ # @example Basic example
2471
+ # require "google/cloud/backupdr/v1"
2472
+ #
2473
+ # # Create a client object. The client can be reused for multiple calls.
2474
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
2475
+ #
2476
+ # # Create a request. To set request fields, pass in keyword arguments.
2477
+ # request = Google::Cloud::BackupDR::V1::ListBackupPlansRequest.new
2478
+ #
2479
+ # # Call the list_backup_plans method.
2480
+ # result = client.list_backup_plans request
2481
+ #
2482
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
2483
+ # # over elements, and API calls will be issued to fetch pages as needed.
2484
+ # result.each do |item|
2485
+ # # Each element is of type ::Google::Cloud::BackupDR::V1::BackupPlan.
2486
+ # p item
2487
+ # end
2488
+ #
2489
+ def list_backup_plans request, options = nil
2490
+ raise ::ArgumentError, "request must be provided" if request.nil?
2491
+
2492
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::ListBackupPlansRequest
2493
+
2494
+ # Converts hash and nil to an options object
2495
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2496
+
2497
+ # Customize the options with defaults
2498
+ metadata = @config.rpcs.list_backup_plans.metadata.to_h
2499
+
2500
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2501
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2502
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2503
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
2504
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2505
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2506
+
2507
+ header_params = {}
2508
+ if request.parent
2509
+ header_params["parent"] = request.parent
2510
+ end
2511
+
2512
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2513
+ metadata[:"x-goog-request-params"] ||= request_params_header
2514
+
2515
+ options.apply_defaults timeout: @config.rpcs.list_backup_plans.timeout,
2516
+ metadata: metadata,
2517
+ retry_policy: @config.rpcs.list_backup_plans.retry_policy
2518
+
2519
+ options.apply_defaults timeout: @config.timeout,
2520
+ metadata: @config.metadata,
2521
+ retry_policy: @config.retry_policy
2522
+
2523
+ @backup_dr_stub.call_rpc :list_backup_plans, request, options: options do |response, operation|
2524
+ response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :list_backup_plans, request, response, operation, options
2525
+ yield response, operation if block_given?
2526
+ throw :response, response
2527
+ end
2528
+ rescue ::GRPC::BadStatus => e
2529
+ raise ::Google::Cloud::Error.from_error(e)
2530
+ end
2531
+
2532
+ ##
2533
+ # Deletes a single BackupPlan.
2534
+ #
2535
+ # @overload delete_backup_plan(request, options = nil)
2536
+ # Pass arguments to `delete_backup_plan` via a request object, either of type
2537
+ # {::Google::Cloud::BackupDR::V1::DeleteBackupPlanRequest} or an equivalent Hash.
2538
+ #
2539
+ # @param request [::Google::Cloud::BackupDR::V1::DeleteBackupPlanRequest, ::Hash]
2540
+ # A request object representing the call parameters. Required. To specify no
2541
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2542
+ # @param options [::Gapic::CallOptions, ::Hash]
2543
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2544
+ #
2545
+ # @overload delete_backup_plan(name: nil, request_id: nil)
2546
+ # Pass arguments to `delete_backup_plan` via keyword arguments. Note that at
2547
+ # least one keyword argument is required. To specify no parameters, or to keep all
2548
+ # the default parameter values, pass an empty Hash as a request object (see above).
2549
+ #
2550
+ # @param name [::String]
2551
+ # Required. The resource name of the `BackupPlan` to delete.
2552
+ #
2553
+ # Format: `projects/{project}/locations/{location}/backupPlans/{backup_plan}`
2554
+ # @param request_id [::String]
2555
+ # Optional. An optional request ID to identify requests. Specify a unique
2556
+ # request ID so that if you must retry your request, the server will know to
2557
+ # ignore the request if it has already been completed. The server will
2558
+ # guarantee that for at least 60 minutes after the first request.
2559
+ #
2560
+ # For example, consider a situation where you make an initial request and
2561
+ # the request times out. If you make the request again with the same request
2562
+ # ID, the server can check if original operation with the same request ID
2563
+ # was received, and if so, will ignore the second request. This prevents
2564
+ # clients from accidentally creating duplicate commitments.
2565
+ #
2566
+ # The request ID must be a valid UUID with the exception that zero UUID is
2567
+ # not supported (00000000-0000-0000-0000-000000000000).
2568
+ #
2569
+ # @yield [response, operation] Access the result along with the RPC operation
2570
+ # @yieldparam response [::Gapic::Operation]
2571
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2572
+ #
2573
+ # @return [::Gapic::Operation]
2574
+ #
2575
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2576
+ #
2577
+ # @example Basic example
2578
+ # require "google/cloud/backupdr/v1"
2579
+ #
2580
+ # # Create a client object. The client can be reused for multiple calls.
2581
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
2582
+ #
2583
+ # # Create a request. To set request fields, pass in keyword arguments.
2584
+ # request = Google::Cloud::BackupDR::V1::DeleteBackupPlanRequest.new
2585
+ #
2586
+ # # Call the delete_backup_plan method.
2587
+ # result = client.delete_backup_plan request
2588
+ #
2589
+ # # The returned object is of type Gapic::Operation. You can use it to
2590
+ # # check the status of an operation, cancel it, or wait for results.
2591
+ # # Here is how to wait for a response.
2592
+ # result.wait_until_done! timeout: 60
2593
+ # if result.response?
2594
+ # p result.response
2595
+ # else
2596
+ # puts "No response received."
2597
+ # end
2598
+ #
2599
+ def delete_backup_plan request, options = nil
2600
+ raise ::ArgumentError, "request must be provided" if request.nil?
2601
+
2602
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::DeleteBackupPlanRequest
2603
+
2604
+ # Converts hash and nil to an options object
2605
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2606
+
2607
+ # Customize the options with defaults
2608
+ metadata = @config.rpcs.delete_backup_plan.metadata.to_h
2609
+
2610
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2611
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2612
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2613
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
2614
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2615
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2616
+
2617
+ header_params = {}
2618
+ if request.name
2619
+ header_params["name"] = request.name
2620
+ end
2621
+
2622
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2623
+ metadata[:"x-goog-request-params"] ||= request_params_header
2624
+
2625
+ options.apply_defaults timeout: @config.rpcs.delete_backup_plan.timeout,
2626
+ metadata: metadata,
2627
+ retry_policy: @config.rpcs.delete_backup_plan.retry_policy
2628
+
2629
+ options.apply_defaults timeout: @config.timeout,
2630
+ metadata: @config.metadata,
2631
+ retry_policy: @config.retry_policy
2632
+
2633
+ @backup_dr_stub.call_rpc :delete_backup_plan, request, options: options do |response, operation|
2634
+ response = ::Gapic::Operation.new response, @operations_client, options: options
2635
+ yield response, operation if block_given?
2636
+ throw :response, response
2637
+ end
2638
+ rescue ::GRPC::BadStatus => e
2639
+ raise ::Google::Cloud::Error.from_error(e)
2640
+ end
2641
+
2642
+ ##
2643
+ # Create a BackupPlanAssociation
2644
+ #
2645
+ # @overload create_backup_plan_association(request, options = nil)
2646
+ # Pass arguments to `create_backup_plan_association` via a request object, either of type
2647
+ # {::Google::Cloud::BackupDR::V1::CreateBackupPlanAssociationRequest} or an equivalent Hash.
2648
+ #
2649
+ # @param request [::Google::Cloud::BackupDR::V1::CreateBackupPlanAssociationRequest, ::Hash]
2650
+ # A request object representing the call parameters. Required. To specify no
2651
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2652
+ # @param options [::Gapic::CallOptions, ::Hash]
2653
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2654
+ #
2655
+ # @overload create_backup_plan_association(parent: nil, backup_plan_association_id: nil, backup_plan_association: nil, request_id: nil)
2656
+ # Pass arguments to `create_backup_plan_association` via keyword arguments. Note that at
2657
+ # least one keyword argument is required. To specify no parameters, or to keep all
2658
+ # the default parameter values, pass an empty Hash as a request object (see above).
2659
+ #
2660
+ # @param parent [::String]
2661
+ # Required. The backup plan association project and location in the format
2662
+ # `projects/{project_id}/locations/{location}`. In Cloud BackupDR locations
2663
+ # map to GCP regions, for example **us-central1**.
2664
+ # @param backup_plan_association_id [::String]
2665
+ # Required. The name of the backup plan association to create. The name must
2666
+ # be unique for the specified project and location.
2667
+ # @param backup_plan_association [::Google::Cloud::BackupDR::V1::BackupPlanAssociation, ::Hash]
2668
+ # Required. The resource being created
2669
+ # @param request_id [::String]
2670
+ # Optional. An optional request ID to identify requests. Specify a unique
2671
+ # request ID so that if you must retry your request, the server will know to
2672
+ # ignore the request if it has already been completed. The server will
2673
+ # guarantee that for at least 60 minutes since the first request.
2674
+ #
2675
+ # For example, consider a situation where you make an initial request and t
2676
+ # he request times out. If you make the request again with the same request
2677
+ # ID, the server can check if original operation with the same request ID
2678
+ # was received, and if so, will ignore the second request. This prevents
2679
+ # clients from accidentally creating duplicate commitments.
2680
+ #
2681
+ # The request ID must be a valid UUID with the exception that zero UUID is
2682
+ # not supported (00000000-0000-0000-0000-000000000000).
2683
+ #
2684
+ # @yield [response, operation] Access the result along with the RPC operation
2685
+ # @yieldparam response [::Gapic::Operation]
2686
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2687
+ #
2688
+ # @return [::Gapic::Operation]
2689
+ #
2690
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2691
+ #
2692
+ # @example Basic example
2693
+ # require "google/cloud/backupdr/v1"
2694
+ #
2695
+ # # Create a client object. The client can be reused for multiple calls.
2696
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
2697
+ #
2698
+ # # Create a request. To set request fields, pass in keyword arguments.
2699
+ # request = Google::Cloud::BackupDR::V1::CreateBackupPlanAssociationRequest.new
2700
+ #
2701
+ # # Call the create_backup_plan_association method.
2702
+ # result = client.create_backup_plan_association request
2703
+ #
2704
+ # # The returned object is of type Gapic::Operation. You can use it to
2705
+ # # check the status of an operation, cancel it, or wait for results.
2706
+ # # Here is how to wait for a response.
2707
+ # result.wait_until_done! timeout: 60
2708
+ # if result.response?
2709
+ # p result.response
2710
+ # else
2711
+ # puts "No response received."
2712
+ # end
2713
+ #
2714
+ def create_backup_plan_association request, options = nil
2715
+ raise ::ArgumentError, "request must be provided" if request.nil?
2716
+
2717
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::CreateBackupPlanAssociationRequest
2718
+
2719
+ # Converts hash and nil to an options object
2720
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2721
+
2722
+ # Customize the options with defaults
2723
+ metadata = @config.rpcs.create_backup_plan_association.metadata.to_h
2724
+
2725
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2726
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2727
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2728
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
2729
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2730
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2731
+
2732
+ header_params = {}
2733
+ if request.parent
2734
+ header_params["parent"] = request.parent
2735
+ end
2736
+
2737
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2738
+ metadata[:"x-goog-request-params"] ||= request_params_header
2739
+
2740
+ options.apply_defaults timeout: @config.rpcs.create_backup_plan_association.timeout,
2741
+ metadata: metadata,
2742
+ retry_policy: @config.rpcs.create_backup_plan_association.retry_policy
2743
+
2744
+ options.apply_defaults timeout: @config.timeout,
2745
+ metadata: @config.metadata,
2746
+ retry_policy: @config.retry_policy
2747
+
2748
+ @backup_dr_stub.call_rpc :create_backup_plan_association, request, options: options do |response, operation|
2749
+ response = ::Gapic::Operation.new response, @operations_client, options: options
2750
+ yield response, operation if block_given?
2751
+ throw :response, response
2752
+ end
2753
+ rescue ::GRPC::BadStatus => e
2754
+ raise ::Google::Cloud::Error.from_error(e)
2755
+ end
2756
+
2757
+ ##
2758
+ # Gets details of a single BackupPlanAssociation.
2759
+ #
2760
+ # @overload get_backup_plan_association(request, options = nil)
2761
+ # Pass arguments to `get_backup_plan_association` via a request object, either of type
2762
+ # {::Google::Cloud::BackupDR::V1::GetBackupPlanAssociationRequest} or an equivalent Hash.
2763
+ #
2764
+ # @param request [::Google::Cloud::BackupDR::V1::GetBackupPlanAssociationRequest, ::Hash]
2765
+ # A request object representing the call parameters. Required. To specify no
2766
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2767
+ # @param options [::Gapic::CallOptions, ::Hash]
2768
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2769
+ #
2770
+ # @overload get_backup_plan_association(name: nil)
2771
+ # Pass arguments to `get_backup_plan_association` via keyword arguments. Note that at
2772
+ # least one keyword argument is required. To specify no parameters, or to keep all
2773
+ # the default parameter values, pass an empty Hash as a request object (see above).
2774
+ #
2775
+ # @param name [::String]
2776
+ # Required. Name of the backup plan association resource, in the format
2777
+ # `projects/{project}/locations/{location}/backupPlanAssociations/{backupPlanAssociationId}`
2778
+ #
2779
+ # @yield [response, operation] Access the result along with the RPC operation
2780
+ # @yieldparam response [::Google::Cloud::BackupDR::V1::BackupPlanAssociation]
2781
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2782
+ #
2783
+ # @return [::Google::Cloud::BackupDR::V1::BackupPlanAssociation]
2784
+ #
2785
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2786
+ #
2787
+ # @example Basic example
2788
+ # require "google/cloud/backupdr/v1"
2789
+ #
2790
+ # # Create a client object. The client can be reused for multiple calls.
2791
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
2792
+ #
2793
+ # # Create a request. To set request fields, pass in keyword arguments.
2794
+ # request = Google::Cloud::BackupDR::V1::GetBackupPlanAssociationRequest.new
2795
+ #
2796
+ # # Call the get_backup_plan_association method.
2797
+ # result = client.get_backup_plan_association request
2798
+ #
2799
+ # # The returned object is of type Google::Cloud::BackupDR::V1::BackupPlanAssociation.
2800
+ # p result
2801
+ #
2802
+ def get_backup_plan_association request, options = nil
2803
+ raise ::ArgumentError, "request must be provided" if request.nil?
2804
+
2805
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::GetBackupPlanAssociationRequest
2806
+
2807
+ # Converts hash and nil to an options object
2808
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2809
+
2810
+ # Customize the options with defaults
2811
+ metadata = @config.rpcs.get_backup_plan_association.metadata.to_h
2812
+
2813
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2814
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2815
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2816
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
2817
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2818
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2819
+
2820
+ header_params = {}
2821
+ if request.name
2822
+ header_params["name"] = request.name
2823
+ end
2824
+
2825
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2826
+ metadata[:"x-goog-request-params"] ||= request_params_header
2827
+
2828
+ options.apply_defaults timeout: @config.rpcs.get_backup_plan_association.timeout,
2829
+ metadata: metadata,
2830
+ retry_policy: @config.rpcs.get_backup_plan_association.retry_policy
2831
+
2832
+ options.apply_defaults timeout: @config.timeout,
2833
+ metadata: @config.metadata,
2834
+ retry_policy: @config.retry_policy
2835
+
2836
+ @backup_dr_stub.call_rpc :get_backup_plan_association, request, options: options do |response, operation|
2837
+ yield response, operation if block_given?
2838
+ end
2839
+ rescue ::GRPC::BadStatus => e
2840
+ raise ::Google::Cloud::Error.from_error(e)
2841
+ end
2842
+
2843
+ ##
2844
+ # Lists BackupPlanAssociations in a given project and location.
2845
+ #
2846
+ # @overload list_backup_plan_associations(request, options = nil)
2847
+ # Pass arguments to `list_backup_plan_associations` via a request object, either of type
2848
+ # {::Google::Cloud::BackupDR::V1::ListBackupPlanAssociationsRequest} or an equivalent Hash.
2849
+ #
2850
+ # @param request [::Google::Cloud::BackupDR::V1::ListBackupPlanAssociationsRequest, ::Hash]
2851
+ # A request object representing the call parameters. Required. To specify no
2852
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2853
+ # @param options [::Gapic::CallOptions, ::Hash]
2854
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2855
+ #
2856
+ # @overload list_backup_plan_associations(parent: nil, page_size: nil, page_token: nil, filter: nil)
2857
+ # Pass arguments to `list_backup_plan_associations` via keyword arguments. Note that at
2858
+ # least one keyword argument is required. To specify no parameters, or to keep all
2859
+ # the default parameter values, pass an empty Hash as a request object (see above).
2860
+ #
2861
+ # @param parent [::String]
2862
+ # Required. The project and location for which to retrieve backup Plan
2863
+ # Associations information, in the format
2864
+ # `projects/{project_id}/locations/{location}`. In Cloud BackupDR, locations
2865
+ # map to GCP regions, for example **us-central1**. To retrieve backup plan
2866
+ # associations for all locations, use "-" for the
2867
+ # `{location}` value.
2868
+ # @param page_size [::Integer]
2869
+ # Optional. Requested page size. Server may return fewer items than
2870
+ # requested. If unspecified, server will pick an appropriate default.
2871
+ # @param page_token [::String]
2872
+ # Optional. A token identifying a page of results the server should return.
2873
+ # @param filter [::String]
2874
+ # Optional. Filtering results
2875
+ #
2876
+ # @yield [response, operation] Access the result along with the RPC operation
2877
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::BackupDR::V1::BackupPlanAssociation>]
2878
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2879
+ #
2880
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::BackupDR::V1::BackupPlanAssociation>]
2881
+ #
2882
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2883
+ #
2884
+ # @example Basic example
2885
+ # require "google/cloud/backupdr/v1"
2886
+ #
2887
+ # # Create a client object. The client can be reused for multiple calls.
2888
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
2889
+ #
2890
+ # # Create a request. To set request fields, pass in keyword arguments.
2891
+ # request = Google::Cloud::BackupDR::V1::ListBackupPlanAssociationsRequest.new
2892
+ #
2893
+ # # Call the list_backup_plan_associations method.
2894
+ # result = client.list_backup_plan_associations request
2895
+ #
2896
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
2897
+ # # over elements, and API calls will be issued to fetch pages as needed.
2898
+ # result.each do |item|
2899
+ # # Each element is of type ::Google::Cloud::BackupDR::V1::BackupPlanAssociation.
2900
+ # p item
2901
+ # end
2902
+ #
2903
+ def list_backup_plan_associations request, options = nil
2904
+ raise ::ArgumentError, "request must be provided" if request.nil?
2905
+
2906
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::ListBackupPlanAssociationsRequest
2907
+
2908
+ # Converts hash and nil to an options object
2909
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2910
+
2911
+ # Customize the options with defaults
2912
+ metadata = @config.rpcs.list_backup_plan_associations.metadata.to_h
2913
+
2914
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2915
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2916
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2917
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
2918
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2919
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2920
+
2921
+ header_params = {}
2922
+ if request.parent
2923
+ header_params["parent"] = request.parent
2924
+ end
2925
+
2926
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2927
+ metadata[:"x-goog-request-params"] ||= request_params_header
2928
+
2929
+ options.apply_defaults timeout: @config.rpcs.list_backup_plan_associations.timeout,
2930
+ metadata: metadata,
2931
+ retry_policy: @config.rpcs.list_backup_plan_associations.retry_policy
2932
+
2933
+ options.apply_defaults timeout: @config.timeout,
2934
+ metadata: @config.metadata,
2935
+ retry_policy: @config.retry_policy
2936
+
2937
+ @backup_dr_stub.call_rpc :list_backup_plan_associations, request, options: options do |response, operation|
2938
+ response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :list_backup_plan_associations, request, response, operation, options
2939
+ yield response, operation if block_given?
2940
+ throw :response, response
2941
+ end
2942
+ rescue ::GRPC::BadStatus => e
2943
+ raise ::Google::Cloud::Error.from_error(e)
2944
+ end
2945
+
2946
+ ##
2947
+ # Deletes a single BackupPlanAssociation.
2948
+ #
2949
+ # @overload delete_backup_plan_association(request, options = nil)
2950
+ # Pass arguments to `delete_backup_plan_association` via a request object, either of type
2951
+ # {::Google::Cloud::BackupDR::V1::DeleteBackupPlanAssociationRequest} or an equivalent Hash.
2952
+ #
2953
+ # @param request [::Google::Cloud::BackupDR::V1::DeleteBackupPlanAssociationRequest, ::Hash]
2954
+ # A request object representing the call parameters. Required. To specify no
2955
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2956
+ # @param options [::Gapic::CallOptions, ::Hash]
2957
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2958
+ #
2959
+ # @overload delete_backup_plan_association(name: nil, request_id: nil)
2960
+ # Pass arguments to `delete_backup_plan_association` via keyword arguments. Note that at
2961
+ # least one keyword argument is required. To specify no parameters, or to keep all
2962
+ # the default parameter values, pass an empty Hash as a request object (see above).
2963
+ #
2964
+ # @param name [::String]
2965
+ # Required. Name of the backup plan association resource, in the format
2966
+ # `projects/{project}/locations/{location}/backupPlanAssociations/{backupPlanAssociationId}`
2967
+ # @param request_id [::String]
2968
+ # Optional. An optional request ID to identify requests. Specify a unique
2969
+ # request ID so that if you must retry your request, the server will know to
2970
+ # ignore the request if it has already been completed. The server will
2971
+ # guarantee that for at least 60 minutes after the first request.
2972
+ #
2973
+ # For example, consider a situation where you make an initial request and
2974
+ # the request times out. If you make the request again with the same request
2975
+ # ID, the server can check if original operation with the same request ID
2976
+ # was received, and if so, will ignore the second request. This prevents
2977
+ # clients from accidentally creating duplicate commitments.
2978
+ #
2979
+ # The request ID must be a valid UUID with the exception that zero UUID is
2980
+ # not supported (00000000-0000-0000-0000-000000000000).
2981
+ #
2982
+ # @yield [response, operation] Access the result along with the RPC operation
2983
+ # @yieldparam response [::Gapic::Operation]
2984
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2985
+ #
2986
+ # @return [::Gapic::Operation]
2987
+ #
2988
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2989
+ #
2990
+ # @example Basic example
2991
+ # require "google/cloud/backupdr/v1"
2992
+ #
2993
+ # # Create a client object. The client can be reused for multiple calls.
2994
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
2995
+ #
2996
+ # # Create a request. To set request fields, pass in keyword arguments.
2997
+ # request = Google::Cloud::BackupDR::V1::DeleteBackupPlanAssociationRequest.new
2998
+ #
2999
+ # # Call the delete_backup_plan_association method.
3000
+ # result = client.delete_backup_plan_association request
3001
+ #
3002
+ # # The returned object is of type Gapic::Operation. You can use it to
3003
+ # # check the status of an operation, cancel it, or wait for results.
3004
+ # # Here is how to wait for a response.
3005
+ # result.wait_until_done! timeout: 60
3006
+ # if result.response?
3007
+ # p result.response
3008
+ # else
3009
+ # puts "No response received."
3010
+ # end
3011
+ #
3012
+ def delete_backup_plan_association request, options = nil
3013
+ raise ::ArgumentError, "request must be provided" if request.nil?
3014
+
3015
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::DeleteBackupPlanAssociationRequest
3016
+
3017
+ # Converts hash and nil to an options object
3018
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
3019
+
3020
+ # Customize the options with defaults
3021
+ metadata = @config.rpcs.delete_backup_plan_association.metadata.to_h
3022
+
3023
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
3024
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3025
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
3026
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
3027
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
3028
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3029
+
3030
+ header_params = {}
3031
+ if request.name
3032
+ header_params["name"] = request.name
3033
+ end
3034
+
3035
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
3036
+ metadata[:"x-goog-request-params"] ||= request_params_header
3037
+
3038
+ options.apply_defaults timeout: @config.rpcs.delete_backup_plan_association.timeout,
3039
+ metadata: metadata,
3040
+ retry_policy: @config.rpcs.delete_backup_plan_association.retry_policy
3041
+
3042
+ options.apply_defaults timeout: @config.timeout,
3043
+ metadata: @config.metadata,
3044
+ retry_policy: @config.retry_policy
3045
+
3046
+ @backup_dr_stub.call_rpc :delete_backup_plan_association, request, options: options do |response, operation|
3047
+ response = ::Gapic::Operation.new response, @operations_client, options: options
3048
+ yield response, operation if block_given?
3049
+ throw :response, response
3050
+ end
3051
+ rescue ::GRPC::BadStatus => e
3052
+ raise ::Google::Cloud::Error.from_error(e)
3053
+ end
3054
+
3055
+ ##
3056
+ # Triggers a new Backup.
3057
+ #
3058
+ # @overload trigger_backup(request, options = nil)
3059
+ # Pass arguments to `trigger_backup` via a request object, either of type
3060
+ # {::Google::Cloud::BackupDR::V1::TriggerBackupRequest} or an equivalent Hash.
3061
+ #
3062
+ # @param request [::Google::Cloud::BackupDR::V1::TriggerBackupRequest, ::Hash]
3063
+ # A request object representing the call parameters. Required. To specify no
3064
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
3065
+ # @param options [::Gapic::CallOptions, ::Hash]
3066
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
3067
+ #
3068
+ # @overload trigger_backup(name: nil, rule_id: nil, request_id: nil)
3069
+ # Pass arguments to `trigger_backup` via keyword arguments. Note that at
3070
+ # least one keyword argument is required. To specify no parameters, or to keep all
3071
+ # the default parameter values, pass an empty Hash as a request object (see above).
3072
+ #
3073
+ # @param name [::String]
3074
+ # Required. Name of the backup plan association resource, in the format
3075
+ # `projects/{project}/locations/{location}/backupPlanAssociations/{backupPlanAssociationId}`
3076
+ # @param rule_id [::String]
3077
+ # Required. backup rule_id for which a backup needs to be triggered.
3078
+ # @param request_id [::String]
3079
+ # Optional. An optional request ID to identify requests. Specify a unique
3080
+ # request ID so that if you must retry your request, the server will know to
3081
+ # ignore the request if it has already been completed. The server will
3082
+ # guarantee that for at least 60 minutes after the first request.
3083
+ #
3084
+ # For example, consider a situation where you make an initial request and
3085
+ # the request times out. If you make the request again with the same request
3086
+ # ID, the server can check if original operation with the same request ID
3087
+ # was received, and if so, will ignore the second request. This prevents
3088
+ # clients from accidentally creating duplicate commitments.
3089
+ #
3090
+ # The request ID must be a valid UUID with the exception that zero UUID is
3091
+ # not supported (00000000-0000-0000-0000-000000000000).
3092
+ #
3093
+ # @yield [response, operation] Access the result along with the RPC operation
3094
+ # @yieldparam response [::Gapic::Operation]
3095
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
3096
+ #
3097
+ # @return [::Gapic::Operation]
3098
+ #
3099
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
3100
+ #
3101
+ # @example Basic example
3102
+ # require "google/cloud/backupdr/v1"
3103
+ #
3104
+ # # Create a client object. The client can be reused for multiple calls.
3105
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
3106
+ #
3107
+ # # Create a request. To set request fields, pass in keyword arguments.
3108
+ # request = Google::Cloud::BackupDR::V1::TriggerBackupRequest.new
3109
+ #
3110
+ # # Call the trigger_backup method.
3111
+ # result = client.trigger_backup request
3112
+ #
3113
+ # # The returned object is of type Gapic::Operation. You can use it to
3114
+ # # check the status of an operation, cancel it, or wait for results.
3115
+ # # Here is how to wait for a response.
3116
+ # result.wait_until_done! timeout: 60
3117
+ # if result.response?
3118
+ # p result.response
3119
+ # else
3120
+ # puts "No response received."
3121
+ # end
3122
+ #
3123
+ def trigger_backup request, options = nil
3124
+ raise ::ArgumentError, "request must be provided" if request.nil?
3125
+
3126
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::TriggerBackupRequest
3127
+
3128
+ # Converts hash and nil to an options object
3129
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
3130
+
3131
+ # Customize the options with defaults
3132
+ metadata = @config.rpcs.trigger_backup.metadata.to_h
3133
+
3134
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
3135
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3136
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
3137
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
3138
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
3139
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3140
+
3141
+ header_params = {}
3142
+ if request.name
3143
+ header_params["name"] = request.name
3144
+ end
3145
+
3146
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
3147
+ metadata[:"x-goog-request-params"] ||= request_params_header
3148
+
3149
+ options.apply_defaults timeout: @config.rpcs.trigger_backup.timeout,
3150
+ metadata: metadata,
3151
+ retry_policy: @config.rpcs.trigger_backup.retry_policy
3152
+
3153
+ options.apply_defaults timeout: @config.timeout,
3154
+ metadata: @config.metadata,
3155
+ retry_policy: @config.retry_policy
3156
+
3157
+ @backup_dr_stub.call_rpc :trigger_backup, request, options: options do |response, operation|
3158
+ response = ::Gapic::Operation.new response, @operations_client, options: options
3159
+ yield response, operation if block_given?
3160
+ throw :response, response
3161
+ end
3162
+ rescue ::GRPC::BadStatus => e
3163
+ raise ::Google::Cloud::Error.from_error(e)
3164
+ end
3165
+
3166
+ ##
3167
+ # Configuration class for the BackupDR API.
3168
+ #
3169
+ # This class represents the configuration for BackupDR,
3170
+ # providing control over timeouts, retry behavior, logging, transport
3171
+ # parameters, and other low-level controls. Certain parameters can also be
3172
+ # applied individually to specific RPCs. See
3173
+ # {::Google::Cloud::BackupDR::V1::BackupDR::Client::Configuration::Rpcs}
3174
+ # for a list of RPCs that can be configured independently.
3175
+ #
3176
+ # Configuration can be applied globally to all clients, or to a single client
3177
+ # on construction.
3178
+ #
3179
+ # @example
3180
+ #
3181
+ # # Modify the global config, setting the timeout for
3182
+ # # list_management_servers to 20 seconds,
3183
+ # # and all remaining timeouts to 10 seconds.
3184
+ # ::Google::Cloud::BackupDR::V1::BackupDR::Client.configure do |config|
3185
+ # config.timeout = 10.0
3186
+ # config.rpcs.list_management_servers.timeout = 20.0
3187
+ # end
3188
+ #
3189
+ # # Apply the above configuration only to a new client.
3190
+ # client = ::Google::Cloud::BackupDR::V1::BackupDR::Client.new do |config|
3191
+ # config.timeout = 10.0
3192
+ # config.rpcs.list_management_servers.timeout = 20.0
3193
+ # end
3194
+ #
3195
+ # @!attribute [rw] endpoint
3196
+ # A custom service endpoint, as a hostname or hostname:port. The default is
3197
+ # nil, indicating to use the default endpoint in the current universe domain.
3198
+ # @return [::String,nil]
3199
+ # @!attribute [rw] credentials
3200
+ # Credentials to send with calls. You may provide any of the following types:
3201
+ # * (`String`) The path to a service account key file in JSON format
3202
+ # * (`Hash`) A service account key as a Hash
3203
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
3204
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
3205
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
3206
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
3207
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
3208
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
3209
+ # * (`nil`) indicating no credentials
3210
+ # @return [::Object]
3211
+ # @!attribute [rw] scope
3212
+ # The OAuth scopes
3213
+ # @return [::Array<::String>]
3214
+ # @!attribute [rw] lib_name
3215
+ # The library name as recorded in instrumentation and logging
3216
+ # @return [::String]
3217
+ # @!attribute [rw] lib_version
3218
+ # The library version as recorded in instrumentation and logging
3219
+ # @return [::String]
3220
+ # @!attribute [rw] channel_args
3221
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
3222
+ # `GRPC::Core::Channel` object is provided as the credential.
3223
+ # @return [::Hash]
3224
+ # @!attribute [rw] interceptors
3225
+ # An array of interceptors that are run before calls are executed.
3226
+ # @return [::Array<::GRPC::ClientInterceptor>]
3227
+ # @!attribute [rw] timeout
3228
+ # The call timeout in seconds.
3229
+ # @return [::Numeric]
3230
+ # @!attribute [rw] metadata
3231
+ # Additional gRPC headers to be sent with the call.
3232
+ # @return [::Hash{::Symbol=>::String}]
3233
+ # @!attribute [rw] retry_policy
3234
+ # The retry policy. The value is a hash with the following keys:
3235
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
3236
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
3237
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
3238
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
3239
+ # trigger a retry.
3240
+ # @return [::Hash]
3241
+ # @!attribute [rw] quota_project
3242
+ # A separate project against which to charge quota.
3243
+ # @return [::String]
3244
+ # @!attribute [rw] universe_domain
3245
+ # The universe domain within which to make requests. This determines the
3246
+ # default endpoint URL. The default value of nil uses the environment
3247
+ # universe (usually the default "googleapis.com" universe).
3248
+ # @return [::String,nil]
3249
+ # @!attribute [rw] logger
3250
+ # A custom logger to use for request/response debug logging, or the value
3251
+ # `:default` (the default) to construct a default logger, or `nil` to
3252
+ # explicitly disable logging.
3253
+ # @return [::Logger,:default,nil]
3254
+ #
3255
+ class Configuration
3256
+ extend ::Gapic::Config
3257
+
3258
+ # @private
3259
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
3260
+ DEFAULT_ENDPOINT = "backupdr.googleapis.com"
3261
+
3262
+ config_attr :endpoint, nil, ::String, nil
3263
+ config_attr :credentials, nil do |value|
3264
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
3265
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
3266
+ allowed.any? { |klass| klass === value }
3267
+ end
3268
+ config_attr :scope, nil, ::String, ::Array, nil
3269
+ config_attr :lib_name, nil, ::String, nil
3270
+ config_attr :lib_version, nil, ::String, nil
3271
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
3272
+ config_attr :interceptors, nil, ::Array, nil
3273
+ config_attr :timeout, nil, ::Numeric, nil
3274
+ config_attr :metadata, nil, ::Hash, nil
3275
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
3276
+ config_attr :quota_project, nil, ::String, nil
3277
+ config_attr :universe_domain, nil, ::String, nil
3278
+ config_attr :logger, :default, ::Logger, nil, :default
3279
+
3280
+ # @private
3281
+ def initialize parent_config = nil
3282
+ @parent_config = parent_config unless parent_config.nil?
3283
+
3284
+ yield self if block_given?
3285
+ end
3286
+
3287
+ ##
3288
+ # Configurations for individual RPCs
3289
+ # @return [Rpcs]
3290
+ #
3291
+ def rpcs
3292
+ @rpcs ||= begin
3293
+ parent_rpcs = nil
3294
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
3295
+ Rpcs.new parent_rpcs
3296
+ end
3297
+ end
3298
+
3299
+ ##
3300
+ # Configuration for the channel pool
3301
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
3302
+ #
3303
+ def channel_pool
3304
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
3305
+ end
3306
+
3307
+ ##
3308
+ # Configuration RPC class for the BackupDR API.
3309
+ #
3310
+ # Includes fields providing the configuration for each RPC in this service.
3311
+ # Each configuration object is of type `Gapic::Config::Method` and includes
3312
+ # the following configuration fields:
3313
+ #
3314
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
3315
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
3316
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
3317
+ # include the following keys:
3318
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
3319
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
3320
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
3321
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
3322
+ # trigger a retry.
3323
+ #
3324
+ class Rpcs
3325
+ ##
3326
+ # RPC-specific configuration for `list_management_servers`
3327
+ # @return [::Gapic::Config::Method]
3328
+ #
3329
+ attr_reader :list_management_servers
3330
+ ##
3331
+ # RPC-specific configuration for `get_management_server`
3332
+ # @return [::Gapic::Config::Method]
800
3333
  #
801
3334
  attr_reader :get_management_server
802
3335
  ##
@@ -809,6 +3342,121 @@ module Google
809
3342
  # @return [::Gapic::Config::Method]
810
3343
  #
811
3344
  attr_reader :delete_management_server
3345
+ ##
3346
+ # RPC-specific configuration for `create_backup_vault`
3347
+ # @return [::Gapic::Config::Method]
3348
+ #
3349
+ attr_reader :create_backup_vault
3350
+ ##
3351
+ # RPC-specific configuration for `list_backup_vaults`
3352
+ # @return [::Gapic::Config::Method]
3353
+ #
3354
+ attr_reader :list_backup_vaults
3355
+ ##
3356
+ # RPC-specific configuration for `fetch_usable_backup_vaults`
3357
+ # @return [::Gapic::Config::Method]
3358
+ #
3359
+ attr_reader :fetch_usable_backup_vaults
3360
+ ##
3361
+ # RPC-specific configuration for `get_backup_vault`
3362
+ # @return [::Gapic::Config::Method]
3363
+ #
3364
+ attr_reader :get_backup_vault
3365
+ ##
3366
+ # RPC-specific configuration for `update_backup_vault`
3367
+ # @return [::Gapic::Config::Method]
3368
+ #
3369
+ attr_reader :update_backup_vault
3370
+ ##
3371
+ # RPC-specific configuration for `delete_backup_vault`
3372
+ # @return [::Gapic::Config::Method]
3373
+ #
3374
+ attr_reader :delete_backup_vault
3375
+ ##
3376
+ # RPC-specific configuration for `list_data_sources`
3377
+ # @return [::Gapic::Config::Method]
3378
+ #
3379
+ attr_reader :list_data_sources
3380
+ ##
3381
+ # RPC-specific configuration for `get_data_source`
3382
+ # @return [::Gapic::Config::Method]
3383
+ #
3384
+ attr_reader :get_data_source
3385
+ ##
3386
+ # RPC-specific configuration for `update_data_source`
3387
+ # @return [::Gapic::Config::Method]
3388
+ #
3389
+ attr_reader :update_data_source
3390
+ ##
3391
+ # RPC-specific configuration for `list_backups`
3392
+ # @return [::Gapic::Config::Method]
3393
+ #
3394
+ attr_reader :list_backups
3395
+ ##
3396
+ # RPC-specific configuration for `get_backup`
3397
+ # @return [::Gapic::Config::Method]
3398
+ #
3399
+ attr_reader :get_backup
3400
+ ##
3401
+ # RPC-specific configuration for `update_backup`
3402
+ # @return [::Gapic::Config::Method]
3403
+ #
3404
+ attr_reader :update_backup
3405
+ ##
3406
+ # RPC-specific configuration for `delete_backup`
3407
+ # @return [::Gapic::Config::Method]
3408
+ #
3409
+ attr_reader :delete_backup
3410
+ ##
3411
+ # RPC-specific configuration for `restore_backup`
3412
+ # @return [::Gapic::Config::Method]
3413
+ #
3414
+ attr_reader :restore_backup
3415
+ ##
3416
+ # RPC-specific configuration for `create_backup_plan`
3417
+ # @return [::Gapic::Config::Method]
3418
+ #
3419
+ attr_reader :create_backup_plan
3420
+ ##
3421
+ # RPC-specific configuration for `get_backup_plan`
3422
+ # @return [::Gapic::Config::Method]
3423
+ #
3424
+ attr_reader :get_backup_plan
3425
+ ##
3426
+ # RPC-specific configuration for `list_backup_plans`
3427
+ # @return [::Gapic::Config::Method]
3428
+ #
3429
+ attr_reader :list_backup_plans
3430
+ ##
3431
+ # RPC-specific configuration for `delete_backup_plan`
3432
+ # @return [::Gapic::Config::Method]
3433
+ #
3434
+ attr_reader :delete_backup_plan
3435
+ ##
3436
+ # RPC-specific configuration for `create_backup_plan_association`
3437
+ # @return [::Gapic::Config::Method]
3438
+ #
3439
+ attr_reader :create_backup_plan_association
3440
+ ##
3441
+ # RPC-specific configuration for `get_backup_plan_association`
3442
+ # @return [::Gapic::Config::Method]
3443
+ #
3444
+ attr_reader :get_backup_plan_association
3445
+ ##
3446
+ # RPC-specific configuration for `list_backup_plan_associations`
3447
+ # @return [::Gapic::Config::Method]
3448
+ #
3449
+ attr_reader :list_backup_plan_associations
3450
+ ##
3451
+ # RPC-specific configuration for `delete_backup_plan_association`
3452
+ # @return [::Gapic::Config::Method]
3453
+ #
3454
+ attr_reader :delete_backup_plan_association
3455
+ ##
3456
+ # RPC-specific configuration for `trigger_backup`
3457
+ # @return [::Gapic::Config::Method]
3458
+ #
3459
+ attr_reader :trigger_backup
812
3460
 
813
3461
  # @private
814
3462
  def initialize parent_rpcs = nil
@@ -820,6 +3468,52 @@ module Google
820
3468
  @create_management_server = ::Gapic::Config::Method.new create_management_server_config
821
3469
  delete_management_server_config = parent_rpcs.delete_management_server if parent_rpcs.respond_to? :delete_management_server
822
3470
  @delete_management_server = ::Gapic::Config::Method.new delete_management_server_config
3471
+ create_backup_vault_config = parent_rpcs.create_backup_vault if parent_rpcs.respond_to? :create_backup_vault
3472
+ @create_backup_vault = ::Gapic::Config::Method.new create_backup_vault_config
3473
+ list_backup_vaults_config = parent_rpcs.list_backup_vaults if parent_rpcs.respond_to? :list_backup_vaults
3474
+ @list_backup_vaults = ::Gapic::Config::Method.new list_backup_vaults_config
3475
+ fetch_usable_backup_vaults_config = parent_rpcs.fetch_usable_backup_vaults if parent_rpcs.respond_to? :fetch_usable_backup_vaults
3476
+ @fetch_usable_backup_vaults = ::Gapic::Config::Method.new fetch_usable_backup_vaults_config
3477
+ get_backup_vault_config = parent_rpcs.get_backup_vault if parent_rpcs.respond_to? :get_backup_vault
3478
+ @get_backup_vault = ::Gapic::Config::Method.new get_backup_vault_config
3479
+ update_backup_vault_config = parent_rpcs.update_backup_vault if parent_rpcs.respond_to? :update_backup_vault
3480
+ @update_backup_vault = ::Gapic::Config::Method.new update_backup_vault_config
3481
+ delete_backup_vault_config = parent_rpcs.delete_backup_vault if parent_rpcs.respond_to? :delete_backup_vault
3482
+ @delete_backup_vault = ::Gapic::Config::Method.new delete_backup_vault_config
3483
+ list_data_sources_config = parent_rpcs.list_data_sources if parent_rpcs.respond_to? :list_data_sources
3484
+ @list_data_sources = ::Gapic::Config::Method.new list_data_sources_config
3485
+ get_data_source_config = parent_rpcs.get_data_source if parent_rpcs.respond_to? :get_data_source
3486
+ @get_data_source = ::Gapic::Config::Method.new get_data_source_config
3487
+ update_data_source_config = parent_rpcs.update_data_source if parent_rpcs.respond_to? :update_data_source
3488
+ @update_data_source = ::Gapic::Config::Method.new update_data_source_config
3489
+ list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups
3490
+ @list_backups = ::Gapic::Config::Method.new list_backups_config
3491
+ get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup
3492
+ @get_backup = ::Gapic::Config::Method.new get_backup_config
3493
+ update_backup_config = parent_rpcs.update_backup if parent_rpcs.respond_to? :update_backup
3494
+ @update_backup = ::Gapic::Config::Method.new update_backup_config
3495
+ delete_backup_config = parent_rpcs.delete_backup if parent_rpcs.respond_to? :delete_backup
3496
+ @delete_backup = ::Gapic::Config::Method.new delete_backup_config
3497
+ restore_backup_config = parent_rpcs.restore_backup if parent_rpcs.respond_to? :restore_backup
3498
+ @restore_backup = ::Gapic::Config::Method.new restore_backup_config
3499
+ create_backup_plan_config = parent_rpcs.create_backup_plan if parent_rpcs.respond_to? :create_backup_plan
3500
+ @create_backup_plan = ::Gapic::Config::Method.new create_backup_plan_config
3501
+ get_backup_plan_config = parent_rpcs.get_backup_plan if parent_rpcs.respond_to? :get_backup_plan
3502
+ @get_backup_plan = ::Gapic::Config::Method.new get_backup_plan_config
3503
+ list_backup_plans_config = parent_rpcs.list_backup_plans if parent_rpcs.respond_to? :list_backup_plans
3504
+ @list_backup_plans = ::Gapic::Config::Method.new list_backup_plans_config
3505
+ delete_backup_plan_config = parent_rpcs.delete_backup_plan if parent_rpcs.respond_to? :delete_backup_plan
3506
+ @delete_backup_plan = ::Gapic::Config::Method.new delete_backup_plan_config
3507
+ create_backup_plan_association_config = parent_rpcs.create_backup_plan_association if parent_rpcs.respond_to? :create_backup_plan_association
3508
+ @create_backup_plan_association = ::Gapic::Config::Method.new create_backup_plan_association_config
3509
+ get_backup_plan_association_config = parent_rpcs.get_backup_plan_association if parent_rpcs.respond_to? :get_backup_plan_association
3510
+ @get_backup_plan_association = ::Gapic::Config::Method.new get_backup_plan_association_config
3511
+ list_backup_plan_associations_config = parent_rpcs.list_backup_plan_associations if parent_rpcs.respond_to? :list_backup_plan_associations
3512
+ @list_backup_plan_associations = ::Gapic::Config::Method.new list_backup_plan_associations_config
3513
+ delete_backup_plan_association_config = parent_rpcs.delete_backup_plan_association if parent_rpcs.respond_to? :delete_backup_plan_association
3514
+ @delete_backup_plan_association = ::Gapic::Config::Method.new delete_backup_plan_association_config
3515
+ trigger_backup_config = parent_rpcs.trigger_backup if parent_rpcs.respond_to? :trigger_backup
3516
+ @trigger_backup = ::Gapic::Config::Method.new trigger_backup_config
823
3517
 
824
3518
  yield self if block_given?
825
3519
  end