google-cloud-redis-cluster-v1 0.4.2 → 0.6.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.
@@ -47,12 +47,6 @@ module Google
47
47
  # Note that location_id must be a GCP `region`; for example:
48
48
  # * `projects/redpepper-1290/locations/us-central1/clusters/my-redis`
49
49
  #
50
- # We use API version selector for Flex APIs
51
- # * The versioning strategy is release-based versioning
52
- # * Our backend CLH only deals with the superset version (called v1main)
53
- # * Existing backend for Redis Gen1 and MRR is not touched.
54
- # * More details in go/redis-flex-api-versioning
55
- #
56
50
  class Client
57
51
  # @private
58
52
  API_VERSION = ""
@@ -106,6 +100,22 @@ module Google
106
100
 
107
101
  default_config.rpcs.get_cluster_certificate_authority.timeout = 600.0
108
102
 
103
+ default_config.rpcs.reschedule_cluster_maintenance.timeout = 600.0
104
+
105
+ default_config.rpcs.list_backup_collections.timeout = 600.0
106
+
107
+ default_config.rpcs.get_backup_collection.timeout = 600.0
108
+
109
+ default_config.rpcs.list_backups.timeout = 600.0
110
+
111
+ default_config.rpcs.get_backup.timeout = 600.0
112
+
113
+ default_config.rpcs.delete_backup.timeout = 600.0
114
+
115
+ default_config.rpcs.export_backup.timeout = 600.0
116
+
117
+ default_config.rpcs.backup_cluster.timeout = 600.0
118
+
109
119
  default_config
110
120
  end
111
121
  yield @configure if block_given?
@@ -191,15 +201,27 @@ module Google
191
201
  endpoint: @config.endpoint,
192
202
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
193
203
  universe_domain: @config.universe_domain,
194
- credentials: credentials
204
+ credentials: credentials,
205
+ logger: @config.logger
195
206
  )
196
207
 
208
+ @cloud_redis_cluster_stub.logger(stub: true)&.info do |entry|
209
+ entry.set_system_name
210
+ entry.set_service
211
+ entry.message = "Created client for #{entry.service}"
212
+ entry.set_credentials_fields credentials
213
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
214
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
215
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
216
+ end
217
+
197
218
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
198
219
  config.credentials = credentials
199
220
  config.quota_project = @quota_project_id
200
221
  config.endpoint = @cloud_redis_cluster_stub.endpoint
201
222
  config.universe_domain = @cloud_redis_cluster_stub.universe_domain
202
223
  config.bindings_override = @config.bindings_override
224
+ config.logger = @cloud_redis_cluster_stub.logger if config.respond_to? :logger=
203
225
  end
204
226
  end
205
227
 
@@ -217,6 +239,15 @@ module Google
217
239
  #
218
240
  attr_reader :location_client
219
241
 
242
+ ##
243
+ # The logger used for request/response debug logging.
244
+ #
245
+ # @return [Logger]
246
+ #
247
+ def logger
248
+ @cloud_redis_cluster_stub.logger
249
+ end
250
+
220
251
  # Service calls
221
252
 
222
253
  ##
@@ -317,7 +348,6 @@ module Google
317
348
 
318
349
  @cloud_redis_cluster_stub.list_clusters request, options do |result, operation|
319
350
  yield result, operation if block_given?
320
- return result
321
351
  end
322
352
  rescue ::Gapic::Rest::Error => e
323
353
  raise ::Google::Cloud::Error.from_error(e)
@@ -398,7 +428,6 @@ module Google
398
428
 
399
429
  @cloud_redis_cluster_stub.get_cluster request, options do |result, operation|
400
430
  yield result, operation if block_given?
401
- return result
402
431
  end
403
432
  rescue ::Gapic::Rest::Error => e
404
433
  raise ::Google::Cloud::Error.from_error(e)
@@ -499,7 +528,7 @@ module Google
499
528
  @cloud_redis_cluster_stub.update_cluster request, options do |result, operation|
500
529
  result = ::Gapic::Operation.new result, @operations_client, options: options
501
530
  yield result, operation if block_given?
502
- return result
531
+ throw :response, result
503
532
  end
504
533
  rescue ::Gapic::Rest::Error => e
505
534
  raise ::Google::Cloud::Error.from_error(e)
@@ -591,7 +620,7 @@ module Google
591
620
  @cloud_redis_cluster_stub.delete_cluster request, options do |result, operation|
592
621
  result = ::Gapic::Operation.new result, @operations_client, options: options
593
622
  yield result, operation if block_given?
594
- return result
623
+ throw :response, result
595
624
  end
596
625
  rescue ::Gapic::Rest::Error => e
597
626
  raise ::Google::Cloud::Error.from_error(e)
@@ -700,7 +729,7 @@ module Google
700
729
  @cloud_redis_cluster_stub.create_cluster request, options do |result, operation|
701
730
  result = ::Gapic::Operation.new result, @operations_client, options: options
702
731
  yield result, operation if block_given?
703
- return result
732
+ throw :response, result
704
733
  end
705
734
  rescue ::Gapic::Rest::Error => e
706
735
  raise ::Google::Cloud::Error.from_error(e)
@@ -781,141 +810,888 @@ module Google
781
810
 
782
811
  @cloud_redis_cluster_stub.get_cluster_certificate_authority request, options do |result, operation|
783
812
  yield result, operation if block_given?
784
- return result
785
813
  end
786
814
  rescue ::Gapic::Rest::Error => e
787
815
  raise ::Google::Cloud::Error.from_error(e)
788
816
  end
789
817
 
790
818
  ##
791
- # Configuration class for the CloudRedisCluster REST API.
819
+ # Reschedules upcoming maintenance event.
792
820
  #
793
- # This class represents the configuration for CloudRedisCluster REST,
794
- # providing control over timeouts, retry behavior, logging, transport
795
- # parameters, and other low-level controls. Certain parameters can also be
796
- # applied individually to specific RPCs. See
797
- # {::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client::Configuration::Rpcs}
798
- # for a list of RPCs that can be configured independently.
821
+ # @overload reschedule_cluster_maintenance(request, options = nil)
822
+ # Pass arguments to `reschedule_cluster_maintenance` via a request object, either of type
823
+ # {::Google::Cloud::Redis::Cluster::V1::RescheduleClusterMaintenanceRequest} or an equivalent Hash.
799
824
  #
800
- # Configuration can be applied globally to all clients, or to a single client
801
- # on construction.
825
+ # @param request [::Google::Cloud::Redis::Cluster::V1::RescheduleClusterMaintenanceRequest, ::Hash]
826
+ # A request object representing the call parameters. Required. To specify no
827
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
828
+ # @param options [::Gapic::CallOptions, ::Hash]
829
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
802
830
  #
803
- # @example
831
+ # @overload reschedule_cluster_maintenance(name: nil, reschedule_type: nil, schedule_time: nil)
832
+ # Pass arguments to `reschedule_cluster_maintenance` via keyword arguments. Note that at
833
+ # least one keyword argument is required. To specify no parameters, or to keep all
834
+ # the default parameter values, pass an empty Hash as a request object (see above).
804
835
  #
805
- # # Modify the global config, setting the timeout for
806
- # # list_clusters to 20 seconds,
807
- # # and all remaining timeouts to 10 seconds.
808
- # ::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.configure do |config|
809
- # config.timeout = 10.0
810
- # config.rpcs.list_clusters.timeout = 20.0
811
- # end
836
+ # @param name [::String]
837
+ # Required. Redis Cluster instance resource name using the form:
838
+ # `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
839
+ # where `location_id` refers to a GCP region.
840
+ # @param reschedule_type [::Google::Cloud::Redis::Cluster::V1::RescheduleClusterMaintenanceRequest::RescheduleType]
841
+ # Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as
842
+ # well.
843
+ # @param schedule_time [::Google::Protobuf::Timestamp, ::Hash]
844
+ # Optional. Timestamp when the maintenance shall be rescheduled to if
845
+ # reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for
846
+ # example `2012-11-15T16:19:00.094Z`.
847
+ # @yield [result, operation] Access the result along with the TransportOperation object
848
+ # @yieldparam result [::Gapic::Operation]
849
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
812
850
  #
813
- # # Apply the above configuration only to a new client.
814
- # client = ::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.new do |config|
815
- # config.timeout = 10.0
816
- # config.rpcs.list_clusters.timeout = 20.0
817
- # end
851
+ # @return [::Gapic::Operation]
818
852
  #
819
- # @!attribute [rw] endpoint
820
- # A custom service endpoint, as a hostname or hostname:port. The default is
821
- # nil, indicating to use the default endpoint in the current universe domain.
822
- # @return [::String,nil]
823
- # @!attribute [rw] credentials
824
- # Credentials to send with calls. You may provide any of the following types:
825
- # * (`String`) The path to a service account key file in JSON format
826
- # * (`Hash`) A service account key as a Hash
827
- # * (`Google::Auth::Credentials`) A googleauth credentials object
828
- # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
829
- # * (`Signet::OAuth2::Client`) A signet oauth2 client object
830
- # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
831
- # * (`nil`) indicating no credentials
832
- # @return [::Object]
833
- # @!attribute [rw] scope
834
- # The OAuth scopes
835
- # @return [::Array<::String>]
836
- # @!attribute [rw] lib_name
837
- # The library name as recorded in instrumentation and logging
838
- # @return [::String]
839
- # @!attribute [rw] lib_version
840
- # The library version as recorded in instrumentation and logging
841
- # @return [::String]
842
- # @!attribute [rw] timeout
843
- # The call timeout in seconds.
844
- # @return [::Numeric]
845
- # @!attribute [rw] metadata
846
- # Additional headers to be sent with the call.
847
- # @return [::Hash{::Symbol=>::String}]
848
- # @!attribute [rw] retry_policy
849
- # The retry policy. The value is a hash with the following keys:
850
- # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
851
- # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
852
- # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
853
- # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
854
- # trigger a retry.
855
- # @return [::Hash]
856
- # @!attribute [rw] quota_project
857
- # A separate project against which to charge quota.
858
- # @return [::String]
859
- # @!attribute [rw] universe_domain
860
- # The universe domain within which to make requests. This determines the
861
- # default endpoint URL. The default value of nil uses the environment
862
- # universe (usually the default "googleapis.com" universe).
863
- # @return [::String,nil]
853
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
864
854
  #
865
- class Configuration
866
- extend ::Gapic::Config
855
+ # @example Basic example
856
+ # require "google/cloud/redis/cluster/v1"
857
+ #
858
+ # # Create a client object. The client can be reused for multiple calls.
859
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.new
860
+ #
861
+ # # Create a request. To set request fields, pass in keyword arguments.
862
+ # request = Google::Cloud::Redis::Cluster::V1::RescheduleClusterMaintenanceRequest.new
863
+ #
864
+ # # Call the reschedule_cluster_maintenance method.
865
+ # result = client.reschedule_cluster_maintenance request
866
+ #
867
+ # # The returned object is of type Gapic::Operation. You can use it to
868
+ # # check the status of an operation, cancel it, or wait for results.
869
+ # # Here is how to wait for a response.
870
+ # result.wait_until_done! timeout: 60
871
+ # if result.response?
872
+ # p result.response
873
+ # else
874
+ # puts "No response received."
875
+ # end
876
+ #
877
+ def reschedule_cluster_maintenance request, options = nil
878
+ raise ::ArgumentError, "request must be provided" if request.nil?
867
879
 
868
- # @private
869
- # The endpoint specific to the default "googleapis.com" universe. Deprecated.
870
- DEFAULT_ENDPOINT = "redis.googleapis.com"
880
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::RescheduleClusterMaintenanceRequest
871
881
 
872
- config_attr :endpoint, nil, ::String, nil
873
- config_attr :credentials, nil do |value|
874
- allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
875
- allowed.any? { |klass| klass === value }
876
- end
877
- config_attr :scope, nil, ::String, ::Array, nil
878
- config_attr :lib_name, nil, ::String, nil
879
- config_attr :lib_version, nil, ::String, nil
880
- config_attr :timeout, nil, ::Numeric, nil
881
- config_attr :metadata, nil, ::Hash, nil
882
- config_attr :retry_policy, nil, ::Hash, ::Proc, nil
883
- config_attr :quota_project, nil, ::String, nil
884
- config_attr :universe_domain, nil, ::String, nil
882
+ # Converts hash and nil to an options object
883
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
885
884
 
886
- # @private
887
- # Overrides for http bindings for the RPCs of this service
888
- # are only used when this service is used as mixin, and only
889
- # by the host service.
890
- # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
891
- config_attr :bindings_override, {}, ::Hash, nil
885
+ # Customize the options with defaults
886
+ call_metadata = @config.rpcs.reschedule_cluster_maintenance.metadata.to_h
892
887
 
893
- # @private
894
- def initialize parent_config = nil
895
- @parent_config = parent_config unless parent_config.nil?
888
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
889
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
890
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
891
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION,
892
+ transports_version_send: [:rest]
896
893
 
897
- yield self if block_given?
894
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
895
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
896
+
897
+ options.apply_defaults timeout: @config.rpcs.reschedule_cluster_maintenance.timeout,
898
+ metadata: call_metadata,
899
+ retry_policy: @config.rpcs.reschedule_cluster_maintenance.retry_policy
900
+
901
+ options.apply_defaults timeout: @config.timeout,
902
+ metadata: @config.metadata,
903
+ retry_policy: @config.retry_policy
904
+
905
+ @cloud_redis_cluster_stub.reschedule_cluster_maintenance request, options do |result, operation|
906
+ result = ::Gapic::Operation.new result, @operations_client, options: options
907
+ yield result, operation if block_given?
908
+ throw :response, result
898
909
  end
910
+ rescue ::Gapic::Rest::Error => e
911
+ raise ::Google::Cloud::Error.from_error(e)
912
+ end
899
913
 
900
- ##
901
- # Configurations for individual RPCs
902
- # @return [Rpcs]
903
- #
904
- def rpcs
905
- @rpcs ||= begin
906
- parent_rpcs = nil
907
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
908
- Rpcs.new parent_rpcs
909
- end
914
+ ##
915
+ # Lists all backup collections owned by a consumer project in either the
916
+ # specified location (region) or all locations.
917
+ #
918
+ # If `location_id` is specified as `-` (wildcard), then all regions
919
+ # available to the project are queried, and the results are aggregated.
920
+ #
921
+ # @overload list_backup_collections(request, options = nil)
922
+ # Pass arguments to `list_backup_collections` via a request object, either of type
923
+ # {::Google::Cloud::Redis::Cluster::V1::ListBackupCollectionsRequest} or an equivalent Hash.
924
+ #
925
+ # @param request [::Google::Cloud::Redis::Cluster::V1::ListBackupCollectionsRequest, ::Hash]
926
+ # A request object representing the call parameters. Required. To specify no
927
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
928
+ # @param options [::Gapic::CallOptions, ::Hash]
929
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
930
+ #
931
+ # @overload list_backup_collections(parent: nil, page_size: nil, page_token: nil)
932
+ # Pass arguments to `list_backup_collections` via keyword arguments. Note that at
933
+ # least one keyword argument is required. To specify no parameters, or to keep all
934
+ # the default parameter values, pass an empty Hash as a request object (see above).
935
+ #
936
+ # @param parent [::String]
937
+ # Required. The resource name of the backupCollection location using the
938
+ # form:
939
+ # `projects/{project_id}/locations/{location_id}`
940
+ # where `location_id` refers to a GCP region.
941
+ # @param page_size [::Integer]
942
+ # Optional. The maximum number of items to return.
943
+ #
944
+ # If not specified, a default value of 1000 will be used by the service.
945
+ # Regardless of the page_size value, the response may include a partial list
946
+ # and a caller should only rely on response's
947
+ # {::Google::Cloud::Redis::Cluster::V1::ListBackupCollectionsResponse#next_page_token `next_page_token`}
948
+ # to determine if there are more clusters left to be queried.
949
+ # @param page_token [::String]
950
+ # Optional. The `next_page_token` value returned from a previous
951
+ # [ListBackupCollections] request, if any.
952
+ # @yield [result, operation] Access the result along with the TransportOperation object
953
+ # @yieldparam result [::Google::Cloud::Redis::Cluster::V1::ListBackupCollectionsResponse]
954
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
955
+ #
956
+ # @return [::Google::Cloud::Redis::Cluster::V1::ListBackupCollectionsResponse]
957
+ #
958
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
959
+ #
960
+ # @example Basic example
961
+ # require "google/cloud/redis/cluster/v1"
962
+ #
963
+ # # Create a client object. The client can be reused for multiple calls.
964
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.new
965
+ #
966
+ # # Create a request. To set request fields, pass in keyword arguments.
967
+ # request = Google::Cloud::Redis::Cluster::V1::ListBackupCollectionsRequest.new
968
+ #
969
+ # # Call the list_backup_collections method.
970
+ # result = client.list_backup_collections request
971
+ #
972
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
973
+ # # over elements, and API calls will be issued to fetch pages as needed.
974
+ # result.each do |item|
975
+ # # Each element is of type ::Google::Cloud::Redis::Cluster::V1::BackupCollection.
976
+ # p item
977
+ # end
978
+ #
979
+ def list_backup_collections request, options = nil
980
+ raise ::ArgumentError, "request must be provided" if request.nil?
981
+
982
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::ListBackupCollectionsRequest
983
+
984
+ # Converts hash and nil to an options object
985
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
986
+
987
+ # Customize the options with defaults
988
+ call_metadata = @config.rpcs.list_backup_collections.metadata.to_h
989
+
990
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
991
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
992
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
993
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION,
994
+ transports_version_send: [:rest]
995
+
996
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
997
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
998
+
999
+ options.apply_defaults timeout: @config.rpcs.list_backup_collections.timeout,
1000
+ metadata: call_metadata,
1001
+ retry_policy: @config.rpcs.list_backup_collections.retry_policy
1002
+
1003
+ options.apply_defaults timeout: @config.timeout,
1004
+ metadata: @config.metadata,
1005
+ retry_policy: @config.retry_policy
1006
+
1007
+ @cloud_redis_cluster_stub.list_backup_collections request, options do |result, operation|
1008
+ yield result, operation if block_given?
910
1009
  end
1010
+ rescue ::Gapic::Rest::Error => e
1011
+ raise ::Google::Cloud::Error.from_error(e)
1012
+ end
911
1013
 
912
- ##
913
- # Configuration RPC class for the CloudRedisCluster API.
914
- #
915
- # Includes fields providing the configuration for each RPC in this service.
916
- # Each configuration object is of type `Gapic::Config::Method` and includes
917
- # the following configuration fields:
918
- #
1014
+ ##
1015
+ # Get a backup collection.
1016
+ #
1017
+ # @overload get_backup_collection(request, options = nil)
1018
+ # Pass arguments to `get_backup_collection` via a request object, either of type
1019
+ # {::Google::Cloud::Redis::Cluster::V1::GetBackupCollectionRequest} or an equivalent Hash.
1020
+ #
1021
+ # @param request [::Google::Cloud::Redis::Cluster::V1::GetBackupCollectionRequest, ::Hash]
1022
+ # A request object representing the call parameters. Required. To specify no
1023
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1024
+ # @param options [::Gapic::CallOptions, ::Hash]
1025
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1026
+ #
1027
+ # @overload get_backup_collection(name: nil)
1028
+ # Pass arguments to `get_backup_collection` via keyword arguments. Note that at
1029
+ # least one keyword argument is required. To specify no parameters, or to keep all
1030
+ # the default parameter values, pass an empty Hash as a request object (see above).
1031
+ #
1032
+ # @param name [::String]
1033
+ # Required. Redis backupCollection resource name using the form:
1034
+ # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}`
1035
+ # where `location_id` refers to a GCP region.
1036
+ # @yield [result, operation] Access the result along with the TransportOperation object
1037
+ # @yieldparam result [::Google::Cloud::Redis::Cluster::V1::BackupCollection]
1038
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1039
+ #
1040
+ # @return [::Google::Cloud::Redis::Cluster::V1::BackupCollection]
1041
+ #
1042
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1043
+ #
1044
+ # @example Basic example
1045
+ # require "google/cloud/redis/cluster/v1"
1046
+ #
1047
+ # # Create a client object. The client can be reused for multiple calls.
1048
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.new
1049
+ #
1050
+ # # Create a request. To set request fields, pass in keyword arguments.
1051
+ # request = Google::Cloud::Redis::Cluster::V1::GetBackupCollectionRequest.new
1052
+ #
1053
+ # # Call the get_backup_collection method.
1054
+ # result = client.get_backup_collection request
1055
+ #
1056
+ # # The returned object is of type Google::Cloud::Redis::Cluster::V1::BackupCollection.
1057
+ # p result
1058
+ #
1059
+ def get_backup_collection request, options = nil
1060
+ raise ::ArgumentError, "request must be provided" if request.nil?
1061
+
1062
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::GetBackupCollectionRequest
1063
+
1064
+ # Converts hash and nil to an options object
1065
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1066
+
1067
+ # Customize the options with defaults
1068
+ call_metadata = @config.rpcs.get_backup_collection.metadata.to_h
1069
+
1070
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1071
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1072
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1073
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION,
1074
+ transports_version_send: [:rest]
1075
+
1076
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1077
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1078
+
1079
+ options.apply_defaults timeout: @config.rpcs.get_backup_collection.timeout,
1080
+ metadata: call_metadata,
1081
+ retry_policy: @config.rpcs.get_backup_collection.retry_policy
1082
+
1083
+ options.apply_defaults timeout: @config.timeout,
1084
+ metadata: @config.metadata,
1085
+ retry_policy: @config.retry_policy
1086
+
1087
+ @cloud_redis_cluster_stub.get_backup_collection request, options do |result, operation|
1088
+ yield result, operation if block_given?
1089
+ end
1090
+ rescue ::Gapic::Rest::Error => e
1091
+ raise ::Google::Cloud::Error.from_error(e)
1092
+ end
1093
+
1094
+ ##
1095
+ # Lists all backups owned by a backup collection.
1096
+ #
1097
+ # @overload list_backups(request, options = nil)
1098
+ # Pass arguments to `list_backups` via a request object, either of type
1099
+ # {::Google::Cloud::Redis::Cluster::V1::ListBackupsRequest} or an equivalent Hash.
1100
+ #
1101
+ # @param request [::Google::Cloud::Redis::Cluster::V1::ListBackupsRequest, ::Hash]
1102
+ # A request object representing the call parameters. Required. To specify no
1103
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1104
+ # @param options [::Gapic::CallOptions, ::Hash]
1105
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1106
+ #
1107
+ # @overload list_backups(parent: nil, page_size: nil, page_token: nil)
1108
+ # Pass arguments to `list_backups` via keyword arguments. Note that at
1109
+ # least one keyword argument is required. To specify no parameters, or to keep all
1110
+ # the default parameter values, pass an empty Hash as a request object (see above).
1111
+ #
1112
+ # @param parent [::String]
1113
+ # Required. The resource name of the backupCollection using the form:
1114
+ # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}`
1115
+ # @param page_size [::Integer]
1116
+ # Optional. The maximum number of items to return.
1117
+ #
1118
+ # If not specified, a default value of 1000 will be used by the service.
1119
+ # Regardless of the page_size value, the response may include a partial list
1120
+ # and a caller should only rely on response's
1121
+ # {::Google::Cloud::Redis::Cluster::V1::ListBackupsResponse#next_page_token `next_page_token`}
1122
+ # to determine if there are more clusters left to be queried.
1123
+ # @param page_token [::String]
1124
+ # Optional. The `next_page_token` value returned from a previous
1125
+ # [ListBackupCollections] request, if any.
1126
+ # @yield [result, operation] Access the result along with the TransportOperation object
1127
+ # @yieldparam result [::Google::Cloud::Redis::Cluster::V1::ListBackupsResponse]
1128
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1129
+ #
1130
+ # @return [::Google::Cloud::Redis::Cluster::V1::ListBackupsResponse]
1131
+ #
1132
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1133
+ #
1134
+ # @example Basic example
1135
+ # require "google/cloud/redis/cluster/v1"
1136
+ #
1137
+ # # Create a client object. The client can be reused for multiple calls.
1138
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.new
1139
+ #
1140
+ # # Create a request. To set request fields, pass in keyword arguments.
1141
+ # request = Google::Cloud::Redis::Cluster::V1::ListBackupsRequest.new
1142
+ #
1143
+ # # Call the list_backups method.
1144
+ # result = client.list_backups request
1145
+ #
1146
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1147
+ # # over elements, and API calls will be issued to fetch pages as needed.
1148
+ # result.each do |item|
1149
+ # # Each element is of type ::Google::Cloud::Redis::Cluster::V1::Backup.
1150
+ # p item
1151
+ # end
1152
+ #
1153
+ def list_backups request, options = nil
1154
+ raise ::ArgumentError, "request must be provided" if request.nil?
1155
+
1156
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::ListBackupsRequest
1157
+
1158
+ # Converts hash and nil to an options object
1159
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1160
+
1161
+ # Customize the options with defaults
1162
+ call_metadata = @config.rpcs.list_backups.metadata.to_h
1163
+
1164
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1165
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1166
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1167
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION,
1168
+ transports_version_send: [:rest]
1169
+
1170
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1171
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1172
+
1173
+ options.apply_defaults timeout: @config.rpcs.list_backups.timeout,
1174
+ metadata: call_metadata,
1175
+ retry_policy: @config.rpcs.list_backups.retry_policy
1176
+
1177
+ options.apply_defaults timeout: @config.timeout,
1178
+ metadata: @config.metadata,
1179
+ retry_policy: @config.retry_policy
1180
+
1181
+ @cloud_redis_cluster_stub.list_backups request, options do |result, operation|
1182
+ yield result, operation if block_given?
1183
+ end
1184
+ rescue ::Gapic::Rest::Error => e
1185
+ raise ::Google::Cloud::Error.from_error(e)
1186
+ end
1187
+
1188
+ ##
1189
+ # Gets the details of a specific backup.
1190
+ #
1191
+ # @overload get_backup(request, options = nil)
1192
+ # Pass arguments to `get_backup` via a request object, either of type
1193
+ # {::Google::Cloud::Redis::Cluster::V1::GetBackupRequest} or an equivalent Hash.
1194
+ #
1195
+ # @param request [::Google::Cloud::Redis::Cluster::V1::GetBackupRequest, ::Hash]
1196
+ # A request object representing the call parameters. Required. To specify no
1197
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1198
+ # @param options [::Gapic::CallOptions, ::Hash]
1199
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1200
+ #
1201
+ # @overload get_backup(name: nil)
1202
+ # Pass arguments to `get_backup` via keyword arguments. Note that at
1203
+ # least one keyword argument is required. To specify no parameters, or to keep all
1204
+ # the default parameter values, pass an empty Hash as a request object (see above).
1205
+ #
1206
+ # @param name [::String]
1207
+ # Required. Redis backup resource name using the form:
1208
+ # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
1209
+ # @yield [result, operation] Access the result along with the TransportOperation object
1210
+ # @yieldparam result [::Google::Cloud::Redis::Cluster::V1::Backup]
1211
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1212
+ #
1213
+ # @return [::Google::Cloud::Redis::Cluster::V1::Backup]
1214
+ #
1215
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1216
+ #
1217
+ # @example Basic example
1218
+ # require "google/cloud/redis/cluster/v1"
1219
+ #
1220
+ # # Create a client object. The client can be reused for multiple calls.
1221
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.new
1222
+ #
1223
+ # # Create a request. To set request fields, pass in keyword arguments.
1224
+ # request = Google::Cloud::Redis::Cluster::V1::GetBackupRequest.new
1225
+ #
1226
+ # # Call the get_backup method.
1227
+ # result = client.get_backup request
1228
+ #
1229
+ # # The returned object is of type Google::Cloud::Redis::Cluster::V1::Backup.
1230
+ # p result
1231
+ #
1232
+ def get_backup request, options = nil
1233
+ raise ::ArgumentError, "request must be provided" if request.nil?
1234
+
1235
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::GetBackupRequest
1236
+
1237
+ # Converts hash and nil to an options object
1238
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1239
+
1240
+ # Customize the options with defaults
1241
+ call_metadata = @config.rpcs.get_backup.metadata.to_h
1242
+
1243
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1244
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1245
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1246
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION,
1247
+ transports_version_send: [:rest]
1248
+
1249
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1250
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1251
+
1252
+ options.apply_defaults timeout: @config.rpcs.get_backup.timeout,
1253
+ metadata: call_metadata,
1254
+ retry_policy: @config.rpcs.get_backup.retry_policy
1255
+
1256
+ options.apply_defaults timeout: @config.timeout,
1257
+ metadata: @config.metadata,
1258
+ retry_policy: @config.retry_policy
1259
+
1260
+ @cloud_redis_cluster_stub.get_backup request, options do |result, operation|
1261
+ yield result, operation if block_given?
1262
+ end
1263
+ rescue ::Gapic::Rest::Error => e
1264
+ raise ::Google::Cloud::Error.from_error(e)
1265
+ end
1266
+
1267
+ ##
1268
+ # Deletes a specific backup.
1269
+ #
1270
+ # @overload delete_backup(request, options = nil)
1271
+ # Pass arguments to `delete_backup` via a request object, either of type
1272
+ # {::Google::Cloud::Redis::Cluster::V1::DeleteBackupRequest} or an equivalent Hash.
1273
+ #
1274
+ # @param request [::Google::Cloud::Redis::Cluster::V1::DeleteBackupRequest, ::Hash]
1275
+ # A request object representing the call parameters. Required. To specify no
1276
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1277
+ # @param options [::Gapic::CallOptions, ::Hash]
1278
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1279
+ #
1280
+ # @overload delete_backup(name: nil, request_id: nil)
1281
+ # Pass arguments to `delete_backup` via keyword arguments. Note that at
1282
+ # least one keyword argument is required. To specify no parameters, or to keep all
1283
+ # the default parameter values, pass an empty Hash as a request object (see above).
1284
+ #
1285
+ # @param name [::String]
1286
+ # Required. Redis backup resource name using the form:
1287
+ # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
1288
+ # @param request_id [::String]
1289
+ # Optional. Idempotent request UUID.
1290
+ # @yield [result, operation] Access the result along with the TransportOperation object
1291
+ # @yieldparam result [::Gapic::Operation]
1292
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1293
+ #
1294
+ # @return [::Gapic::Operation]
1295
+ #
1296
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1297
+ #
1298
+ # @example Basic example
1299
+ # require "google/cloud/redis/cluster/v1"
1300
+ #
1301
+ # # Create a client object. The client can be reused for multiple calls.
1302
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.new
1303
+ #
1304
+ # # Create a request. To set request fields, pass in keyword arguments.
1305
+ # request = Google::Cloud::Redis::Cluster::V1::DeleteBackupRequest.new
1306
+ #
1307
+ # # Call the delete_backup method.
1308
+ # result = client.delete_backup request
1309
+ #
1310
+ # # The returned object is of type Gapic::Operation. You can use it to
1311
+ # # check the status of an operation, cancel it, or wait for results.
1312
+ # # Here is how to wait for a response.
1313
+ # result.wait_until_done! timeout: 60
1314
+ # if result.response?
1315
+ # p result.response
1316
+ # else
1317
+ # puts "No response received."
1318
+ # end
1319
+ #
1320
+ def delete_backup request, options = nil
1321
+ raise ::ArgumentError, "request must be provided" if request.nil?
1322
+
1323
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::DeleteBackupRequest
1324
+
1325
+ # Converts hash and nil to an options object
1326
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1327
+
1328
+ # Customize the options with defaults
1329
+ call_metadata = @config.rpcs.delete_backup.metadata.to_h
1330
+
1331
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1332
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1333
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1334
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION,
1335
+ transports_version_send: [:rest]
1336
+
1337
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1338
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1339
+
1340
+ options.apply_defaults timeout: @config.rpcs.delete_backup.timeout,
1341
+ metadata: call_metadata,
1342
+ retry_policy: @config.rpcs.delete_backup.retry_policy
1343
+
1344
+ options.apply_defaults timeout: @config.timeout,
1345
+ metadata: @config.metadata,
1346
+ retry_policy: @config.retry_policy
1347
+
1348
+ @cloud_redis_cluster_stub.delete_backup request, options do |result, operation|
1349
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1350
+ yield result, operation if block_given?
1351
+ throw :response, result
1352
+ end
1353
+ rescue ::Gapic::Rest::Error => e
1354
+ raise ::Google::Cloud::Error.from_error(e)
1355
+ end
1356
+
1357
+ ##
1358
+ # Exports a specific backup to a customer target Cloud Storage URI.
1359
+ #
1360
+ # @overload export_backup(request, options = nil)
1361
+ # Pass arguments to `export_backup` via a request object, either of type
1362
+ # {::Google::Cloud::Redis::Cluster::V1::ExportBackupRequest} or an equivalent Hash.
1363
+ #
1364
+ # @param request [::Google::Cloud::Redis::Cluster::V1::ExportBackupRequest, ::Hash]
1365
+ # A request object representing the call parameters. Required. To specify no
1366
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1367
+ # @param options [::Gapic::CallOptions, ::Hash]
1368
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1369
+ #
1370
+ # @overload export_backup(gcs_bucket: nil, name: nil)
1371
+ # Pass arguments to `export_backup` via keyword arguments. Note that at
1372
+ # least one keyword argument is required. To specify no parameters, or to keep all
1373
+ # the default parameter values, pass an empty Hash as a request object (see above).
1374
+ #
1375
+ # @param gcs_bucket [::String]
1376
+ # Google Cloud Storage bucket, like "my-bucket".
1377
+ # @param name [::String]
1378
+ # Required. Redis backup resource name using the form:
1379
+ # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
1380
+ # @yield [result, operation] Access the result along with the TransportOperation object
1381
+ # @yieldparam result [::Gapic::Operation]
1382
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1383
+ #
1384
+ # @return [::Gapic::Operation]
1385
+ #
1386
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1387
+ #
1388
+ # @example Basic example
1389
+ # require "google/cloud/redis/cluster/v1"
1390
+ #
1391
+ # # Create a client object. The client can be reused for multiple calls.
1392
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.new
1393
+ #
1394
+ # # Create a request. To set request fields, pass in keyword arguments.
1395
+ # request = Google::Cloud::Redis::Cluster::V1::ExportBackupRequest.new
1396
+ #
1397
+ # # Call the export_backup method.
1398
+ # result = client.export_backup request
1399
+ #
1400
+ # # The returned object is of type Gapic::Operation. You can use it to
1401
+ # # check the status of an operation, cancel it, or wait for results.
1402
+ # # Here is how to wait for a response.
1403
+ # result.wait_until_done! timeout: 60
1404
+ # if result.response?
1405
+ # p result.response
1406
+ # else
1407
+ # puts "No response received."
1408
+ # end
1409
+ #
1410
+ def export_backup request, options = nil
1411
+ raise ::ArgumentError, "request must be provided" if request.nil?
1412
+
1413
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::ExportBackupRequest
1414
+
1415
+ # Converts hash and nil to an options object
1416
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1417
+
1418
+ # Customize the options with defaults
1419
+ call_metadata = @config.rpcs.export_backup.metadata.to_h
1420
+
1421
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1422
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1423
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1424
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION,
1425
+ transports_version_send: [:rest]
1426
+
1427
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1428
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1429
+
1430
+ options.apply_defaults timeout: @config.rpcs.export_backup.timeout,
1431
+ metadata: call_metadata,
1432
+ retry_policy: @config.rpcs.export_backup.retry_policy
1433
+
1434
+ options.apply_defaults timeout: @config.timeout,
1435
+ metadata: @config.metadata,
1436
+ retry_policy: @config.retry_policy
1437
+
1438
+ @cloud_redis_cluster_stub.export_backup request, options do |result, operation|
1439
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1440
+ yield result, operation if block_given?
1441
+ throw :response, result
1442
+ end
1443
+ rescue ::Gapic::Rest::Error => e
1444
+ raise ::Google::Cloud::Error.from_error(e)
1445
+ end
1446
+
1447
+ ##
1448
+ # Backup Redis Cluster.
1449
+ # If this is the first time a backup is being created, a backup collection
1450
+ # will be created at the backend, and this backup belongs to this collection.
1451
+ # Both collection and backup will have a resource name. Backup will be
1452
+ # executed for each shard. A replica (primary if nonHA) will be selected to
1453
+ # perform the execution. Backup call will be rejected if there is an ongoing
1454
+ # backup or update operation. Be aware that during preview, if the cluster's
1455
+ # internal software version is too old, critical update will be performed
1456
+ # before actual backup. Once the internal software version is updated to the
1457
+ # minimum version required by the backup feature, subsequent backups will not
1458
+ # require critical update. After preview, there will be no critical update
1459
+ # needed for backup.
1460
+ #
1461
+ # @overload backup_cluster(request, options = nil)
1462
+ # Pass arguments to `backup_cluster` via a request object, either of type
1463
+ # {::Google::Cloud::Redis::Cluster::V1::BackupClusterRequest} or an equivalent Hash.
1464
+ #
1465
+ # @param request [::Google::Cloud::Redis::Cluster::V1::BackupClusterRequest, ::Hash]
1466
+ # A request object representing the call parameters. Required. To specify no
1467
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1468
+ # @param options [::Gapic::CallOptions, ::Hash]
1469
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1470
+ #
1471
+ # @overload backup_cluster(name: nil, ttl: nil, backup_id: nil)
1472
+ # Pass arguments to `backup_cluster` via keyword arguments. Note that at
1473
+ # least one keyword argument is required. To specify no parameters, or to keep all
1474
+ # the default parameter values, pass an empty Hash as a request object (see above).
1475
+ #
1476
+ # @param name [::String]
1477
+ # Required. Redis cluster resource name using the form:
1478
+ # `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
1479
+ # where `location_id` refers to a GCP region.
1480
+ # @param ttl [::Google::Protobuf::Duration, ::Hash]
1481
+ # Optional. TTL for the backup to expire. Value range is 1 day to 100 years.
1482
+ # If not specified, the default value is 100 years.
1483
+ # @param backup_id [::String]
1484
+ # Optional. The id of the backup to be created. If not specified, the
1485
+ # default value ([YYYYMMDDHHMMSS]_[Shortened Cluster UID] is used.
1486
+ # @yield [result, operation] Access the result along with the TransportOperation object
1487
+ # @yieldparam result [::Gapic::Operation]
1488
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1489
+ #
1490
+ # @return [::Gapic::Operation]
1491
+ #
1492
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1493
+ #
1494
+ # @example Basic example
1495
+ # require "google/cloud/redis/cluster/v1"
1496
+ #
1497
+ # # Create a client object. The client can be reused for multiple calls.
1498
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.new
1499
+ #
1500
+ # # Create a request. To set request fields, pass in keyword arguments.
1501
+ # request = Google::Cloud::Redis::Cluster::V1::BackupClusterRequest.new
1502
+ #
1503
+ # # Call the backup_cluster method.
1504
+ # result = client.backup_cluster request
1505
+ #
1506
+ # # The returned object is of type Gapic::Operation. You can use it to
1507
+ # # check the status of an operation, cancel it, or wait for results.
1508
+ # # Here is how to wait for a response.
1509
+ # result.wait_until_done! timeout: 60
1510
+ # if result.response?
1511
+ # p result.response
1512
+ # else
1513
+ # puts "No response received."
1514
+ # end
1515
+ #
1516
+ def backup_cluster request, options = nil
1517
+ raise ::ArgumentError, "request must be provided" if request.nil?
1518
+
1519
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::BackupClusterRequest
1520
+
1521
+ # Converts hash and nil to an options object
1522
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1523
+
1524
+ # Customize the options with defaults
1525
+ call_metadata = @config.rpcs.backup_cluster.metadata.to_h
1526
+
1527
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1528
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1529
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1530
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION,
1531
+ transports_version_send: [:rest]
1532
+
1533
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1534
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1535
+
1536
+ options.apply_defaults timeout: @config.rpcs.backup_cluster.timeout,
1537
+ metadata: call_metadata,
1538
+ retry_policy: @config.rpcs.backup_cluster.retry_policy
1539
+
1540
+ options.apply_defaults timeout: @config.timeout,
1541
+ metadata: @config.metadata,
1542
+ retry_policy: @config.retry_policy
1543
+
1544
+ @cloud_redis_cluster_stub.backup_cluster request, options do |result, operation|
1545
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1546
+ yield result, operation if block_given?
1547
+ throw :response, result
1548
+ end
1549
+ rescue ::Gapic::Rest::Error => e
1550
+ raise ::Google::Cloud::Error.from_error(e)
1551
+ end
1552
+
1553
+ ##
1554
+ # Configuration class for the CloudRedisCluster REST API.
1555
+ #
1556
+ # This class represents the configuration for CloudRedisCluster REST,
1557
+ # providing control over timeouts, retry behavior, logging, transport
1558
+ # parameters, and other low-level controls. Certain parameters can also be
1559
+ # applied individually to specific RPCs. See
1560
+ # {::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client::Configuration::Rpcs}
1561
+ # for a list of RPCs that can be configured independently.
1562
+ #
1563
+ # Configuration can be applied globally to all clients, or to a single client
1564
+ # on construction.
1565
+ #
1566
+ # @example
1567
+ #
1568
+ # # Modify the global config, setting the timeout for
1569
+ # # list_clusters to 20 seconds,
1570
+ # # and all remaining timeouts to 10 seconds.
1571
+ # ::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.configure do |config|
1572
+ # config.timeout = 10.0
1573
+ # config.rpcs.list_clusters.timeout = 20.0
1574
+ # end
1575
+ #
1576
+ # # Apply the above configuration only to a new client.
1577
+ # client = ::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.new do |config|
1578
+ # config.timeout = 10.0
1579
+ # config.rpcs.list_clusters.timeout = 20.0
1580
+ # end
1581
+ #
1582
+ # @!attribute [rw] endpoint
1583
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1584
+ # nil, indicating to use the default endpoint in the current universe domain.
1585
+ # @return [::String,nil]
1586
+ # @!attribute [rw] credentials
1587
+ # Credentials to send with calls. You may provide any of the following types:
1588
+ # * (`String`) The path to a service account key file in JSON format
1589
+ # * (`Hash`) A service account key as a Hash
1590
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1591
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1592
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1593
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1594
+ # * (`nil`) indicating no credentials
1595
+ #
1596
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
1597
+ # external source for authentication to Google Cloud, you must validate it before
1598
+ # providing it to a Google API client library. Providing an unvalidated credential
1599
+ # configuration to Google APIs can compromise the security of your systems and data.
1600
+ # For more information, refer to [Validate credential configurations from external
1601
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1602
+ # @return [::Object]
1603
+ # @!attribute [rw] scope
1604
+ # The OAuth scopes
1605
+ # @return [::Array<::String>]
1606
+ # @!attribute [rw] lib_name
1607
+ # The library name as recorded in instrumentation and logging
1608
+ # @return [::String]
1609
+ # @!attribute [rw] lib_version
1610
+ # The library version as recorded in instrumentation and logging
1611
+ # @return [::String]
1612
+ # @!attribute [rw] timeout
1613
+ # The call timeout in seconds.
1614
+ # @return [::Numeric]
1615
+ # @!attribute [rw] metadata
1616
+ # Additional headers to be sent with the call.
1617
+ # @return [::Hash{::Symbol=>::String}]
1618
+ # @!attribute [rw] retry_policy
1619
+ # The retry policy. The value is a hash with the following keys:
1620
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1621
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1622
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1623
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1624
+ # trigger a retry.
1625
+ # @return [::Hash]
1626
+ # @!attribute [rw] quota_project
1627
+ # A separate project against which to charge quota.
1628
+ # @return [::String]
1629
+ # @!attribute [rw] universe_domain
1630
+ # The universe domain within which to make requests. This determines the
1631
+ # default endpoint URL. The default value of nil uses the environment
1632
+ # universe (usually the default "googleapis.com" universe).
1633
+ # @return [::String,nil]
1634
+ # @!attribute [rw] logger
1635
+ # A custom logger to use for request/response debug logging, or the value
1636
+ # `:default` (the default) to construct a default logger, or `nil` to
1637
+ # explicitly disable logging.
1638
+ # @return [::Logger,:default,nil]
1639
+ #
1640
+ class Configuration
1641
+ extend ::Gapic::Config
1642
+
1643
+ # @private
1644
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1645
+ DEFAULT_ENDPOINT = "redis.googleapis.com"
1646
+
1647
+ config_attr :endpoint, nil, ::String, nil
1648
+ config_attr :credentials, nil do |value|
1649
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1650
+ allowed.any? { |klass| klass === value }
1651
+ end
1652
+ config_attr :scope, nil, ::String, ::Array, nil
1653
+ config_attr :lib_name, nil, ::String, nil
1654
+ config_attr :lib_version, nil, ::String, nil
1655
+ config_attr :timeout, nil, ::Numeric, nil
1656
+ config_attr :metadata, nil, ::Hash, nil
1657
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1658
+ config_attr :quota_project, nil, ::String, nil
1659
+ config_attr :universe_domain, nil, ::String, nil
1660
+
1661
+ # @private
1662
+ # Overrides for http bindings for the RPCs of this service
1663
+ # are only used when this service is used as mixin, and only
1664
+ # by the host service.
1665
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1666
+ config_attr :bindings_override, {}, ::Hash, nil
1667
+ config_attr :logger, :default, ::Logger, nil, :default
1668
+
1669
+ # @private
1670
+ def initialize parent_config = nil
1671
+ @parent_config = parent_config unless parent_config.nil?
1672
+
1673
+ yield self if block_given?
1674
+ end
1675
+
1676
+ ##
1677
+ # Configurations for individual RPCs
1678
+ # @return [Rpcs]
1679
+ #
1680
+ def rpcs
1681
+ @rpcs ||= begin
1682
+ parent_rpcs = nil
1683
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1684
+ Rpcs.new parent_rpcs
1685
+ end
1686
+ end
1687
+
1688
+ ##
1689
+ # Configuration RPC class for the CloudRedisCluster API.
1690
+ #
1691
+ # Includes fields providing the configuration for each RPC in this service.
1692
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1693
+ # the following configuration fields:
1694
+ #
919
1695
  # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
920
1696
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
921
1697
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
@@ -957,6 +1733,46 @@ module Google
957
1733
  # @return [::Gapic::Config::Method]
958
1734
  #
959
1735
  attr_reader :get_cluster_certificate_authority
1736
+ ##
1737
+ # RPC-specific configuration for `reschedule_cluster_maintenance`
1738
+ # @return [::Gapic::Config::Method]
1739
+ #
1740
+ attr_reader :reschedule_cluster_maintenance
1741
+ ##
1742
+ # RPC-specific configuration for `list_backup_collections`
1743
+ # @return [::Gapic::Config::Method]
1744
+ #
1745
+ attr_reader :list_backup_collections
1746
+ ##
1747
+ # RPC-specific configuration for `get_backup_collection`
1748
+ # @return [::Gapic::Config::Method]
1749
+ #
1750
+ attr_reader :get_backup_collection
1751
+ ##
1752
+ # RPC-specific configuration for `list_backups`
1753
+ # @return [::Gapic::Config::Method]
1754
+ #
1755
+ attr_reader :list_backups
1756
+ ##
1757
+ # RPC-specific configuration for `get_backup`
1758
+ # @return [::Gapic::Config::Method]
1759
+ #
1760
+ attr_reader :get_backup
1761
+ ##
1762
+ # RPC-specific configuration for `delete_backup`
1763
+ # @return [::Gapic::Config::Method]
1764
+ #
1765
+ attr_reader :delete_backup
1766
+ ##
1767
+ # RPC-specific configuration for `export_backup`
1768
+ # @return [::Gapic::Config::Method]
1769
+ #
1770
+ attr_reader :export_backup
1771
+ ##
1772
+ # RPC-specific configuration for `backup_cluster`
1773
+ # @return [::Gapic::Config::Method]
1774
+ #
1775
+ attr_reader :backup_cluster
960
1776
 
961
1777
  # @private
962
1778
  def initialize parent_rpcs = nil
@@ -972,6 +1788,22 @@ module Google
972
1788
  @create_cluster = ::Gapic::Config::Method.new create_cluster_config
973
1789
  get_cluster_certificate_authority_config = parent_rpcs.get_cluster_certificate_authority if parent_rpcs.respond_to? :get_cluster_certificate_authority
974
1790
  @get_cluster_certificate_authority = ::Gapic::Config::Method.new get_cluster_certificate_authority_config
1791
+ reschedule_cluster_maintenance_config = parent_rpcs.reschedule_cluster_maintenance if parent_rpcs.respond_to? :reschedule_cluster_maintenance
1792
+ @reschedule_cluster_maintenance = ::Gapic::Config::Method.new reschedule_cluster_maintenance_config
1793
+ list_backup_collections_config = parent_rpcs.list_backup_collections if parent_rpcs.respond_to? :list_backup_collections
1794
+ @list_backup_collections = ::Gapic::Config::Method.new list_backup_collections_config
1795
+ get_backup_collection_config = parent_rpcs.get_backup_collection if parent_rpcs.respond_to? :get_backup_collection
1796
+ @get_backup_collection = ::Gapic::Config::Method.new get_backup_collection_config
1797
+ list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups
1798
+ @list_backups = ::Gapic::Config::Method.new list_backups_config
1799
+ get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup
1800
+ @get_backup = ::Gapic::Config::Method.new get_backup_config
1801
+ delete_backup_config = parent_rpcs.delete_backup if parent_rpcs.respond_to? :delete_backup
1802
+ @delete_backup = ::Gapic::Config::Method.new delete_backup_config
1803
+ export_backup_config = parent_rpcs.export_backup if parent_rpcs.respond_to? :export_backup
1804
+ @export_backup = ::Gapic::Config::Method.new export_backup_config
1805
+ backup_cluster_config = parent_rpcs.backup_cluster if parent_rpcs.respond_to? :backup_cluster
1806
+ @backup_cluster = ::Gapic::Config::Method.new backup_cluster_config
975
1807
 
976
1808
  yield self if block_given?
977
1809
  end