google-cloud-redis-cluster-v1 0.5.0 → 1.0.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.
@@ -45,12 +45,6 @@ module Google
45
45
  # Note that location_id must be a GCP `region`; for example:
46
46
  # * `projects/redpepper-1290/locations/us-central1/clusters/my-redis`
47
47
  #
48
- # We use API version selector for Flex APIs
49
- # * The versioning strategy is release-based versioning
50
- # * Our backend CLH only deals with the superset version (called v1main)
51
- # * Existing backend for Redis Gen1 and MRR is not touched.
52
- # * More details in go/redis-flex-api-versioning
53
- #
54
48
  class Client
55
49
  # @private
56
50
  API_VERSION = ""
@@ -104,6 +98,22 @@ module Google
104
98
 
105
99
  default_config.rpcs.get_cluster_certificate_authority.timeout = 600.0
106
100
 
101
+ default_config.rpcs.reschedule_cluster_maintenance.timeout = 600.0
102
+
103
+ default_config.rpcs.list_backup_collections.timeout = 600.0
104
+
105
+ default_config.rpcs.get_backup_collection.timeout = 600.0
106
+
107
+ default_config.rpcs.list_backups.timeout = 600.0
108
+
109
+ default_config.rpcs.get_backup.timeout = 600.0
110
+
111
+ default_config.rpcs.delete_backup.timeout = 600.0
112
+
113
+ default_config.rpcs.export_backup.timeout = 600.0
114
+
115
+ default_config.rpcs.backup_cluster.timeout = 600.0
116
+
107
117
  default_config
108
118
  end
109
119
  yield @configure if block_given?
@@ -856,194 +866,1036 @@ module Google
856
866
  end
857
867
 
858
868
  ##
859
- # Configuration class for the CloudRedisCluster API.
869
+ # Reschedules upcoming maintenance event.
860
870
  #
861
- # This class represents the configuration for CloudRedisCluster,
862
- # providing control over timeouts, retry behavior, logging, transport
863
- # parameters, and other low-level controls. Certain parameters can also be
864
- # applied individually to specific RPCs. See
865
- # {::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Client::Configuration::Rpcs}
866
- # for a list of RPCs that can be configured independently.
871
+ # @overload reschedule_cluster_maintenance(request, options = nil)
872
+ # Pass arguments to `reschedule_cluster_maintenance` via a request object, either of type
873
+ # {::Google::Cloud::Redis::Cluster::V1::RescheduleClusterMaintenanceRequest} or an equivalent Hash.
867
874
  #
868
- # Configuration can be applied globally to all clients, or to a single client
869
- # on construction.
875
+ # @param request [::Google::Cloud::Redis::Cluster::V1::RescheduleClusterMaintenanceRequest, ::Hash]
876
+ # A request object representing the call parameters. Required. To specify no
877
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
878
+ # @param options [::Gapic::CallOptions, ::Hash]
879
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
870
880
  #
871
- # @example
881
+ # @overload reschedule_cluster_maintenance(name: nil, reschedule_type: nil, schedule_time: nil)
882
+ # Pass arguments to `reschedule_cluster_maintenance` via keyword arguments. Note that at
883
+ # least one keyword argument is required. To specify no parameters, or to keep all
884
+ # the default parameter values, pass an empty Hash as a request object (see above).
872
885
  #
873
- # # Modify the global config, setting the timeout for
874
- # # list_clusters to 20 seconds,
875
- # # and all remaining timeouts to 10 seconds.
876
- # ::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Client.configure do |config|
877
- # config.timeout = 10.0
878
- # config.rpcs.list_clusters.timeout = 20.0
879
- # end
886
+ # @param name [::String]
887
+ # Required. Redis Cluster instance resource name using the form:
888
+ # `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
889
+ # where `location_id` refers to a GCP region.
890
+ # @param reschedule_type [::Google::Cloud::Redis::Cluster::V1::RescheduleClusterMaintenanceRequest::RescheduleType]
891
+ # Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as
892
+ # well.
893
+ # @param schedule_time [::Google::Protobuf::Timestamp, ::Hash]
894
+ # Optional. Timestamp when the maintenance shall be rescheduled to if
895
+ # reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for
896
+ # example `2012-11-15T16:19:00.094Z`.
880
897
  #
881
- # # Apply the above configuration only to a new client.
882
- # client = ::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Client.new do |config|
883
- # config.timeout = 10.0
884
- # config.rpcs.list_clusters.timeout = 20.0
885
- # end
898
+ # @yield [response, operation] Access the result along with the RPC operation
899
+ # @yieldparam response [::Gapic::Operation]
900
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
886
901
  #
887
- # @!attribute [rw] endpoint
888
- # A custom service endpoint, as a hostname or hostname:port. The default is
889
- # nil, indicating to use the default endpoint in the current universe domain.
890
- # @return [::String,nil]
891
- # @!attribute [rw] credentials
892
- # Credentials to send with calls. You may provide any of the following types:
893
- # * (`String`) The path to a service account key file in JSON format
894
- # * (`Hash`) A service account key as a Hash
895
- # * (`Google::Auth::Credentials`) A googleauth credentials object
896
- # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
897
- # * (`Signet::OAuth2::Client`) A signet oauth2 client object
898
- # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
899
- # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
900
- # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
901
- # * (`nil`) indicating no credentials
902
- # @return [::Object]
903
- # @!attribute [rw] scope
904
- # The OAuth scopes
905
- # @return [::Array<::String>]
906
- # @!attribute [rw] lib_name
907
- # The library name as recorded in instrumentation and logging
908
- # @return [::String]
909
- # @!attribute [rw] lib_version
910
- # The library version as recorded in instrumentation and logging
911
- # @return [::String]
912
- # @!attribute [rw] channel_args
913
- # Extra parameters passed to the gRPC channel. Note: this is ignored if a
914
- # `GRPC::Core::Channel` object is provided as the credential.
915
- # @return [::Hash]
916
- # @!attribute [rw] interceptors
917
- # An array of interceptors that are run before calls are executed.
918
- # @return [::Array<::GRPC::ClientInterceptor>]
919
- # @!attribute [rw] timeout
920
- # The call timeout in seconds.
921
- # @return [::Numeric]
922
- # @!attribute [rw] metadata
923
- # Additional gRPC headers to be sent with the call.
924
- # @return [::Hash{::Symbol=>::String}]
925
- # @!attribute [rw] retry_policy
926
- # The retry policy. The value is a hash with the following keys:
927
- # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
928
- # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
929
- # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
930
- # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
931
- # trigger a retry.
932
- # @return [::Hash]
933
- # @!attribute [rw] quota_project
934
- # A separate project against which to charge quota.
935
- # @return [::String]
936
- # @!attribute [rw] universe_domain
937
- # The universe domain within which to make requests. This determines the
938
- # default endpoint URL. The default value of nil uses the environment
939
- # universe (usually the default "googleapis.com" universe).
940
- # @return [::String,nil]
941
- # @!attribute [rw] logger
942
- # A custom logger to use for request/response debug logging, or the value
943
- # `:default` (the default) to construct a default logger, or `nil` to
944
- # explicitly disable logging.
945
- # @return [::Logger,:default,nil]
902
+ # @return [::Gapic::Operation]
946
903
  #
947
- class Configuration
948
- extend ::Gapic::Config
904
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
905
+ #
906
+ # @example Basic example
907
+ # require "google/cloud/redis/cluster/v1"
908
+ #
909
+ # # Create a client object. The client can be reused for multiple calls.
910
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Client.new
911
+ #
912
+ # # Create a request. To set request fields, pass in keyword arguments.
913
+ # request = Google::Cloud::Redis::Cluster::V1::RescheduleClusterMaintenanceRequest.new
914
+ #
915
+ # # Call the reschedule_cluster_maintenance method.
916
+ # result = client.reschedule_cluster_maintenance request
917
+ #
918
+ # # The returned object is of type Gapic::Operation. You can use it to
919
+ # # check the status of an operation, cancel it, or wait for results.
920
+ # # Here is how to wait for a response.
921
+ # result.wait_until_done! timeout: 60
922
+ # if result.response?
923
+ # p result.response
924
+ # else
925
+ # puts "No response received."
926
+ # end
927
+ #
928
+ def reschedule_cluster_maintenance request, options = nil
929
+ raise ::ArgumentError, "request must be provided" if request.nil?
949
930
 
950
- # @private
951
- # The endpoint specific to the default "googleapis.com" universe. Deprecated.
952
- DEFAULT_ENDPOINT = "redis.googleapis.com"
931
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::RescheduleClusterMaintenanceRequest
953
932
 
954
- config_attr :endpoint, nil, ::String, nil
955
- config_attr :credentials, nil do |value|
956
- allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
957
- allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
958
- allowed.any? { |klass| klass === value }
959
- end
960
- config_attr :scope, nil, ::String, ::Array, nil
961
- config_attr :lib_name, nil, ::String, nil
962
- config_attr :lib_version, nil, ::String, nil
963
- config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
964
- config_attr :interceptors, nil, ::Array, nil
965
- config_attr :timeout, nil, ::Numeric, nil
966
- config_attr :metadata, nil, ::Hash, nil
967
- config_attr :retry_policy, nil, ::Hash, ::Proc, nil
968
- config_attr :quota_project, nil, ::String, nil
969
- config_attr :universe_domain, nil, ::String, nil
970
- config_attr :logger, :default, ::Logger, nil, :default
933
+ # Converts hash and nil to an options object
934
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
971
935
 
972
- # @private
973
- def initialize parent_config = nil
974
- @parent_config = parent_config unless parent_config.nil?
936
+ # Customize the options with defaults
937
+ metadata = @config.rpcs.reschedule_cluster_maintenance.metadata.to_h
975
938
 
976
- yield self if block_given?
977
- end
939
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
940
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
941
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
942
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION
943
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
944
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
978
945
 
979
- ##
980
- # Configurations for individual RPCs
981
- # @return [Rpcs]
982
- #
983
- def rpcs
984
- @rpcs ||= begin
985
- parent_rpcs = nil
986
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
987
- Rpcs.new parent_rpcs
988
- end
946
+ header_params = {}
947
+ if request.name
948
+ header_params["name"] = request.name
989
949
  end
990
950
 
991
- ##
992
- # Configuration for the channel pool
993
- # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
994
- #
995
- def channel_pool
996
- @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
951
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
952
+ metadata[:"x-goog-request-params"] ||= request_params_header
953
+
954
+ options.apply_defaults timeout: @config.rpcs.reschedule_cluster_maintenance.timeout,
955
+ metadata: metadata,
956
+ retry_policy: @config.rpcs.reschedule_cluster_maintenance.retry_policy
957
+
958
+ options.apply_defaults timeout: @config.timeout,
959
+ metadata: @config.metadata,
960
+ retry_policy: @config.retry_policy
961
+
962
+ @cloud_redis_cluster_stub.call_rpc :reschedule_cluster_maintenance, request, options: options do |response, operation|
963
+ response = ::Gapic::Operation.new response, @operations_client, options: options
964
+ yield response, operation if block_given?
965
+ throw :response, response
997
966
  end
967
+ rescue ::GRPC::BadStatus => e
968
+ raise ::Google::Cloud::Error.from_error(e)
969
+ end
998
970
 
999
- ##
1000
- # Configuration RPC class for the CloudRedisCluster API.
1001
- #
1002
- # Includes fields providing the configuration for each RPC in this service.
1003
- # Each configuration object is of type `Gapic::Config::Method` and includes
1004
- # the following configuration fields:
1005
- #
1006
- # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1007
- # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1008
- # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1009
- # include the following keys:
1010
- # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1011
- # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1012
- # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1013
- # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1014
- # trigger a retry.
1015
- #
1016
- class Rpcs
1017
- ##
1018
- # RPC-specific configuration for `list_clusters`
1019
- # @return [::Gapic::Config::Method]
1020
- #
1021
- attr_reader :list_clusters
1022
- ##
1023
- # RPC-specific configuration for `get_cluster`
1024
- # @return [::Gapic::Config::Method]
1025
- #
1026
- attr_reader :get_cluster
1027
- ##
1028
- # RPC-specific configuration for `update_cluster`
1029
- # @return [::Gapic::Config::Method]
1030
- #
1031
- attr_reader :update_cluster
1032
- ##
1033
- # RPC-specific configuration for `delete_cluster`
1034
- # @return [::Gapic::Config::Method]
1035
- #
1036
- attr_reader :delete_cluster
1037
- ##
1038
- # RPC-specific configuration for `create_cluster`
1039
- # @return [::Gapic::Config::Method]
1040
- #
1041
- attr_reader :create_cluster
1042
- ##
1043
- # RPC-specific configuration for `get_cluster_certificate_authority`
1044
- # @return [::Gapic::Config::Method]
1045
- #
1046
- attr_reader :get_cluster_certificate_authority
971
+ ##
972
+ # Lists all backup collections owned by a consumer project in either the
973
+ # specified location (region) or all locations.
974
+ #
975
+ # If `location_id` is specified as `-` (wildcard), then all regions
976
+ # available to the project are queried, and the results are aggregated.
977
+ #
978
+ # @overload list_backup_collections(request, options = nil)
979
+ # Pass arguments to `list_backup_collections` via a request object, either of type
980
+ # {::Google::Cloud::Redis::Cluster::V1::ListBackupCollectionsRequest} or an equivalent Hash.
981
+ #
982
+ # @param request [::Google::Cloud::Redis::Cluster::V1::ListBackupCollectionsRequest, ::Hash]
983
+ # A request object representing the call parameters. Required. To specify no
984
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
985
+ # @param options [::Gapic::CallOptions, ::Hash]
986
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
987
+ #
988
+ # @overload list_backup_collections(parent: nil, page_size: nil, page_token: nil)
989
+ # Pass arguments to `list_backup_collections` via keyword arguments. Note that at
990
+ # least one keyword argument is required. To specify no parameters, or to keep all
991
+ # the default parameter values, pass an empty Hash as a request object (see above).
992
+ #
993
+ # @param parent [::String]
994
+ # Required. The resource name of the backupCollection location using the
995
+ # form:
996
+ # `projects/{project_id}/locations/{location_id}`
997
+ # where `location_id` refers to a GCP region.
998
+ # @param page_size [::Integer]
999
+ # Optional. The maximum number of items to return.
1000
+ #
1001
+ # If not specified, a default value of 1000 will be used by the service.
1002
+ # Regardless of the page_size value, the response may include a partial list
1003
+ # and a caller should only rely on response's
1004
+ # {::Google::Cloud::Redis::Cluster::V1::ListBackupCollectionsResponse#next_page_token `next_page_token`}
1005
+ # to determine if there are more clusters left to be queried.
1006
+ # @param page_token [::String]
1007
+ # Optional. The `next_page_token` value returned from a previous
1008
+ # [ListBackupCollections] request, if any.
1009
+ #
1010
+ # @yield [response, operation] Access the result along with the RPC operation
1011
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Redis::Cluster::V1::BackupCollection>]
1012
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1013
+ #
1014
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Redis::Cluster::V1::BackupCollection>]
1015
+ #
1016
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1017
+ #
1018
+ # @example Basic example
1019
+ # require "google/cloud/redis/cluster/v1"
1020
+ #
1021
+ # # Create a client object. The client can be reused for multiple calls.
1022
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Client.new
1023
+ #
1024
+ # # Create a request. To set request fields, pass in keyword arguments.
1025
+ # request = Google::Cloud::Redis::Cluster::V1::ListBackupCollectionsRequest.new
1026
+ #
1027
+ # # Call the list_backup_collections method.
1028
+ # result = client.list_backup_collections request
1029
+ #
1030
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1031
+ # # over elements, and API calls will be issued to fetch pages as needed.
1032
+ # result.each do |item|
1033
+ # # Each element is of type ::Google::Cloud::Redis::Cluster::V1::BackupCollection.
1034
+ # p item
1035
+ # end
1036
+ #
1037
+ def list_backup_collections request, options = nil
1038
+ raise ::ArgumentError, "request must be provided" if request.nil?
1039
+
1040
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::ListBackupCollectionsRequest
1041
+
1042
+ # Converts hash and nil to an options object
1043
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1044
+
1045
+ # Customize the options with defaults
1046
+ metadata = @config.rpcs.list_backup_collections.metadata.to_h
1047
+
1048
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1049
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1050
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1051
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION
1052
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1053
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1054
+
1055
+ header_params = {}
1056
+ if request.parent
1057
+ header_params["parent"] = request.parent
1058
+ end
1059
+
1060
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1061
+ metadata[:"x-goog-request-params"] ||= request_params_header
1062
+
1063
+ options.apply_defaults timeout: @config.rpcs.list_backup_collections.timeout,
1064
+ metadata: metadata,
1065
+ retry_policy: @config.rpcs.list_backup_collections.retry_policy
1066
+
1067
+ options.apply_defaults timeout: @config.timeout,
1068
+ metadata: @config.metadata,
1069
+ retry_policy: @config.retry_policy
1070
+
1071
+ @cloud_redis_cluster_stub.call_rpc :list_backup_collections, request, options: options do |response, operation|
1072
+ response = ::Gapic::PagedEnumerable.new @cloud_redis_cluster_stub, :list_backup_collections, request, response, operation, options
1073
+ yield response, operation if block_given?
1074
+ throw :response, response
1075
+ end
1076
+ rescue ::GRPC::BadStatus => e
1077
+ raise ::Google::Cloud::Error.from_error(e)
1078
+ end
1079
+
1080
+ ##
1081
+ # Get a backup collection.
1082
+ #
1083
+ # @overload get_backup_collection(request, options = nil)
1084
+ # Pass arguments to `get_backup_collection` via a request object, either of type
1085
+ # {::Google::Cloud::Redis::Cluster::V1::GetBackupCollectionRequest} or an equivalent Hash.
1086
+ #
1087
+ # @param request [::Google::Cloud::Redis::Cluster::V1::GetBackupCollectionRequest, ::Hash]
1088
+ # A request object representing the call parameters. Required. To specify no
1089
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1090
+ # @param options [::Gapic::CallOptions, ::Hash]
1091
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1092
+ #
1093
+ # @overload get_backup_collection(name: nil)
1094
+ # Pass arguments to `get_backup_collection` via keyword arguments. Note that at
1095
+ # least one keyword argument is required. To specify no parameters, or to keep all
1096
+ # the default parameter values, pass an empty Hash as a request object (see above).
1097
+ #
1098
+ # @param name [::String]
1099
+ # Required. Redis backupCollection resource name using the form:
1100
+ # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}`
1101
+ # where `location_id` refers to a GCP region.
1102
+ #
1103
+ # @yield [response, operation] Access the result along with the RPC operation
1104
+ # @yieldparam response [::Google::Cloud::Redis::Cluster::V1::BackupCollection]
1105
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1106
+ #
1107
+ # @return [::Google::Cloud::Redis::Cluster::V1::BackupCollection]
1108
+ #
1109
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1110
+ #
1111
+ # @example Basic example
1112
+ # require "google/cloud/redis/cluster/v1"
1113
+ #
1114
+ # # Create a client object. The client can be reused for multiple calls.
1115
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Client.new
1116
+ #
1117
+ # # Create a request. To set request fields, pass in keyword arguments.
1118
+ # request = Google::Cloud::Redis::Cluster::V1::GetBackupCollectionRequest.new
1119
+ #
1120
+ # # Call the get_backup_collection method.
1121
+ # result = client.get_backup_collection request
1122
+ #
1123
+ # # The returned object is of type Google::Cloud::Redis::Cluster::V1::BackupCollection.
1124
+ # p result
1125
+ #
1126
+ def get_backup_collection request, options = nil
1127
+ raise ::ArgumentError, "request must be provided" if request.nil?
1128
+
1129
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::GetBackupCollectionRequest
1130
+
1131
+ # Converts hash and nil to an options object
1132
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1133
+
1134
+ # Customize the options with defaults
1135
+ metadata = @config.rpcs.get_backup_collection.metadata.to_h
1136
+
1137
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1138
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1139
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1140
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION
1141
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1142
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1143
+
1144
+ header_params = {}
1145
+ if request.name
1146
+ header_params["name"] = request.name
1147
+ end
1148
+
1149
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1150
+ metadata[:"x-goog-request-params"] ||= request_params_header
1151
+
1152
+ options.apply_defaults timeout: @config.rpcs.get_backup_collection.timeout,
1153
+ metadata: metadata,
1154
+ retry_policy: @config.rpcs.get_backup_collection.retry_policy
1155
+
1156
+ options.apply_defaults timeout: @config.timeout,
1157
+ metadata: @config.metadata,
1158
+ retry_policy: @config.retry_policy
1159
+
1160
+ @cloud_redis_cluster_stub.call_rpc :get_backup_collection, request, options: options do |response, operation|
1161
+ yield response, operation if block_given?
1162
+ end
1163
+ rescue ::GRPC::BadStatus => e
1164
+ raise ::Google::Cloud::Error.from_error(e)
1165
+ end
1166
+
1167
+ ##
1168
+ # Lists all backups owned by a backup collection.
1169
+ #
1170
+ # @overload list_backups(request, options = nil)
1171
+ # Pass arguments to `list_backups` via a request object, either of type
1172
+ # {::Google::Cloud::Redis::Cluster::V1::ListBackupsRequest} or an equivalent Hash.
1173
+ #
1174
+ # @param request [::Google::Cloud::Redis::Cluster::V1::ListBackupsRequest, ::Hash]
1175
+ # A request object representing the call parameters. Required. To specify no
1176
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1177
+ # @param options [::Gapic::CallOptions, ::Hash]
1178
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1179
+ #
1180
+ # @overload list_backups(parent: nil, page_size: nil, page_token: nil)
1181
+ # Pass arguments to `list_backups` via keyword arguments. Note that at
1182
+ # least one keyword argument is required. To specify no parameters, or to keep all
1183
+ # the default parameter values, pass an empty Hash as a request object (see above).
1184
+ #
1185
+ # @param parent [::String]
1186
+ # Required. The resource name of the backupCollection using the form:
1187
+ # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}`
1188
+ # @param page_size [::Integer]
1189
+ # Optional. The maximum number of items to return.
1190
+ #
1191
+ # If not specified, a default value of 1000 will be used by the service.
1192
+ # Regardless of the page_size value, the response may include a partial list
1193
+ # and a caller should only rely on response's
1194
+ # {::Google::Cloud::Redis::Cluster::V1::ListBackupsResponse#next_page_token `next_page_token`}
1195
+ # to determine if there are more clusters left to be queried.
1196
+ # @param page_token [::String]
1197
+ # Optional. The `next_page_token` value returned from a previous
1198
+ # [ListBackupCollections] request, if any.
1199
+ #
1200
+ # @yield [response, operation] Access the result along with the RPC operation
1201
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Redis::Cluster::V1::Backup>]
1202
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1203
+ #
1204
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Redis::Cluster::V1::Backup>]
1205
+ #
1206
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1207
+ #
1208
+ # @example Basic example
1209
+ # require "google/cloud/redis/cluster/v1"
1210
+ #
1211
+ # # Create a client object. The client can be reused for multiple calls.
1212
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Client.new
1213
+ #
1214
+ # # Create a request. To set request fields, pass in keyword arguments.
1215
+ # request = Google::Cloud::Redis::Cluster::V1::ListBackupsRequest.new
1216
+ #
1217
+ # # Call the list_backups method.
1218
+ # result = client.list_backups request
1219
+ #
1220
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1221
+ # # over elements, and API calls will be issued to fetch pages as needed.
1222
+ # result.each do |item|
1223
+ # # Each element is of type ::Google::Cloud::Redis::Cluster::V1::Backup.
1224
+ # p item
1225
+ # end
1226
+ #
1227
+ def list_backups request, options = nil
1228
+ raise ::ArgumentError, "request must be provided" if request.nil?
1229
+
1230
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::ListBackupsRequest
1231
+
1232
+ # Converts hash and nil to an options object
1233
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1234
+
1235
+ # Customize the options with defaults
1236
+ metadata = @config.rpcs.list_backups.metadata.to_h
1237
+
1238
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1239
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1240
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1241
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION
1242
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1243
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1244
+
1245
+ header_params = {}
1246
+ if request.parent
1247
+ header_params["parent"] = request.parent
1248
+ end
1249
+
1250
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1251
+ metadata[:"x-goog-request-params"] ||= request_params_header
1252
+
1253
+ options.apply_defaults timeout: @config.rpcs.list_backups.timeout,
1254
+ metadata: metadata,
1255
+ retry_policy: @config.rpcs.list_backups.retry_policy
1256
+
1257
+ options.apply_defaults timeout: @config.timeout,
1258
+ metadata: @config.metadata,
1259
+ retry_policy: @config.retry_policy
1260
+
1261
+ @cloud_redis_cluster_stub.call_rpc :list_backups, request, options: options do |response, operation|
1262
+ response = ::Gapic::PagedEnumerable.new @cloud_redis_cluster_stub, :list_backups, request, response, operation, options
1263
+ yield response, operation if block_given?
1264
+ throw :response, response
1265
+ end
1266
+ rescue ::GRPC::BadStatus => e
1267
+ raise ::Google::Cloud::Error.from_error(e)
1268
+ end
1269
+
1270
+ ##
1271
+ # Gets the details of a specific backup.
1272
+ #
1273
+ # @overload get_backup(request, options = nil)
1274
+ # Pass arguments to `get_backup` via a request object, either of type
1275
+ # {::Google::Cloud::Redis::Cluster::V1::GetBackupRequest} or an equivalent Hash.
1276
+ #
1277
+ # @param request [::Google::Cloud::Redis::Cluster::V1::GetBackupRequest, ::Hash]
1278
+ # A request object representing the call parameters. Required. To specify no
1279
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1280
+ # @param options [::Gapic::CallOptions, ::Hash]
1281
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1282
+ #
1283
+ # @overload get_backup(name: nil)
1284
+ # Pass arguments to `get_backup` via keyword arguments. Note that at
1285
+ # least one keyword argument is required. To specify no parameters, or to keep all
1286
+ # the default parameter values, pass an empty Hash as a request object (see above).
1287
+ #
1288
+ # @param name [::String]
1289
+ # Required. Redis backup resource name using the form:
1290
+ # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
1291
+ #
1292
+ # @yield [response, operation] Access the result along with the RPC operation
1293
+ # @yieldparam response [::Google::Cloud::Redis::Cluster::V1::Backup]
1294
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1295
+ #
1296
+ # @return [::Google::Cloud::Redis::Cluster::V1::Backup]
1297
+ #
1298
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1299
+ #
1300
+ # @example Basic example
1301
+ # require "google/cloud/redis/cluster/v1"
1302
+ #
1303
+ # # Create a client object. The client can be reused for multiple calls.
1304
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Client.new
1305
+ #
1306
+ # # Create a request. To set request fields, pass in keyword arguments.
1307
+ # request = Google::Cloud::Redis::Cluster::V1::GetBackupRequest.new
1308
+ #
1309
+ # # Call the get_backup method.
1310
+ # result = client.get_backup request
1311
+ #
1312
+ # # The returned object is of type Google::Cloud::Redis::Cluster::V1::Backup.
1313
+ # p result
1314
+ #
1315
+ def get_backup request, options = nil
1316
+ raise ::ArgumentError, "request must be provided" if request.nil?
1317
+
1318
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::GetBackupRequest
1319
+
1320
+ # Converts hash and nil to an options object
1321
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1322
+
1323
+ # Customize the options with defaults
1324
+ metadata = @config.rpcs.get_backup.metadata.to_h
1325
+
1326
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1327
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1328
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1329
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION
1330
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1331
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1332
+
1333
+ header_params = {}
1334
+ if request.name
1335
+ header_params["name"] = request.name
1336
+ end
1337
+
1338
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1339
+ metadata[:"x-goog-request-params"] ||= request_params_header
1340
+
1341
+ options.apply_defaults timeout: @config.rpcs.get_backup.timeout,
1342
+ metadata: metadata,
1343
+ retry_policy: @config.rpcs.get_backup.retry_policy
1344
+
1345
+ options.apply_defaults timeout: @config.timeout,
1346
+ metadata: @config.metadata,
1347
+ retry_policy: @config.retry_policy
1348
+
1349
+ @cloud_redis_cluster_stub.call_rpc :get_backup, request, options: options do |response, operation|
1350
+ yield response, operation if block_given?
1351
+ end
1352
+ rescue ::GRPC::BadStatus => e
1353
+ raise ::Google::Cloud::Error.from_error(e)
1354
+ end
1355
+
1356
+ ##
1357
+ # Deletes a specific backup.
1358
+ #
1359
+ # @overload delete_backup(request, options = nil)
1360
+ # Pass arguments to `delete_backup` via a request object, either of type
1361
+ # {::Google::Cloud::Redis::Cluster::V1::DeleteBackupRequest} or an equivalent Hash.
1362
+ #
1363
+ # @param request [::Google::Cloud::Redis::Cluster::V1::DeleteBackupRequest, ::Hash]
1364
+ # A request object representing the call parameters. Required. To specify no
1365
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1366
+ # @param options [::Gapic::CallOptions, ::Hash]
1367
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1368
+ #
1369
+ # @overload delete_backup(name: nil, request_id: nil)
1370
+ # Pass arguments to `delete_backup` via keyword arguments. Note that at
1371
+ # least one keyword argument is required. To specify no parameters, or to keep all
1372
+ # the default parameter values, pass an empty Hash as a request object (see above).
1373
+ #
1374
+ # @param name [::String]
1375
+ # Required. Redis backup resource name using the form:
1376
+ # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
1377
+ # @param request_id [::String]
1378
+ # Optional. Idempotent request UUID.
1379
+ #
1380
+ # @yield [response, operation] Access the result along with the RPC operation
1381
+ # @yieldparam response [::Gapic::Operation]
1382
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1383
+ #
1384
+ # @return [::Gapic::Operation]
1385
+ #
1386
+ # @raise [::Google::Cloud::Error] if the RPC 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::Client.new
1393
+ #
1394
+ # # Create a request. To set request fields, pass in keyword arguments.
1395
+ # request = Google::Cloud::Redis::Cluster::V1::DeleteBackupRequest.new
1396
+ #
1397
+ # # Call the delete_backup method.
1398
+ # result = client.delete_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 delete_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::DeleteBackupRequest
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
+ metadata = @config.rpcs.delete_backup.metadata.to_h
1420
+
1421
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1422
+ 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
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1426
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1427
+
1428
+ header_params = {}
1429
+ if request.name
1430
+ header_params["name"] = request.name
1431
+ end
1432
+
1433
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1434
+ metadata[:"x-goog-request-params"] ||= request_params_header
1435
+
1436
+ options.apply_defaults timeout: @config.rpcs.delete_backup.timeout,
1437
+ metadata: metadata,
1438
+ retry_policy: @config.rpcs.delete_backup.retry_policy
1439
+
1440
+ options.apply_defaults timeout: @config.timeout,
1441
+ metadata: @config.metadata,
1442
+ retry_policy: @config.retry_policy
1443
+
1444
+ @cloud_redis_cluster_stub.call_rpc :delete_backup, request, options: options do |response, operation|
1445
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1446
+ yield response, operation if block_given?
1447
+ throw :response, response
1448
+ end
1449
+ rescue ::GRPC::BadStatus => e
1450
+ raise ::Google::Cloud::Error.from_error(e)
1451
+ end
1452
+
1453
+ ##
1454
+ # Exports a specific backup to a customer target Cloud Storage URI.
1455
+ #
1456
+ # @overload export_backup(request, options = nil)
1457
+ # Pass arguments to `export_backup` via a request object, either of type
1458
+ # {::Google::Cloud::Redis::Cluster::V1::ExportBackupRequest} or an equivalent Hash.
1459
+ #
1460
+ # @param request [::Google::Cloud::Redis::Cluster::V1::ExportBackupRequest, ::Hash]
1461
+ # A request object representing the call parameters. Required. To specify no
1462
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1463
+ # @param options [::Gapic::CallOptions, ::Hash]
1464
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1465
+ #
1466
+ # @overload export_backup(gcs_bucket: nil, name: nil)
1467
+ # Pass arguments to `export_backup` via keyword arguments. Note that at
1468
+ # least one keyword argument is required. To specify no parameters, or to keep all
1469
+ # the default parameter values, pass an empty Hash as a request object (see above).
1470
+ #
1471
+ # @param gcs_bucket [::String]
1472
+ # Google Cloud Storage bucket, like "my-bucket".
1473
+ # @param name [::String]
1474
+ # Required. Redis backup resource name using the form:
1475
+ # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
1476
+ #
1477
+ # @yield [response, operation] Access the result along with the RPC operation
1478
+ # @yieldparam response [::Gapic::Operation]
1479
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1480
+ #
1481
+ # @return [::Gapic::Operation]
1482
+ #
1483
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1484
+ #
1485
+ # @example Basic example
1486
+ # require "google/cloud/redis/cluster/v1"
1487
+ #
1488
+ # # Create a client object. The client can be reused for multiple calls.
1489
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Client.new
1490
+ #
1491
+ # # Create a request. To set request fields, pass in keyword arguments.
1492
+ # request = Google::Cloud::Redis::Cluster::V1::ExportBackupRequest.new
1493
+ #
1494
+ # # Call the export_backup method.
1495
+ # result = client.export_backup request
1496
+ #
1497
+ # # The returned object is of type Gapic::Operation. You can use it to
1498
+ # # check the status of an operation, cancel it, or wait for results.
1499
+ # # Here is how to wait for a response.
1500
+ # result.wait_until_done! timeout: 60
1501
+ # if result.response?
1502
+ # p result.response
1503
+ # else
1504
+ # puts "No response received."
1505
+ # end
1506
+ #
1507
+ def export_backup request, options = nil
1508
+ raise ::ArgumentError, "request must be provided" if request.nil?
1509
+
1510
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::ExportBackupRequest
1511
+
1512
+ # Converts hash and nil to an options object
1513
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1514
+
1515
+ # Customize the options with defaults
1516
+ metadata = @config.rpcs.export_backup.metadata.to_h
1517
+
1518
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1519
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1520
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1521
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION
1522
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1523
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1524
+
1525
+ header_params = {}
1526
+ if request.name
1527
+ header_params["name"] = request.name
1528
+ end
1529
+
1530
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1531
+ metadata[:"x-goog-request-params"] ||= request_params_header
1532
+
1533
+ options.apply_defaults timeout: @config.rpcs.export_backup.timeout,
1534
+ metadata: metadata,
1535
+ retry_policy: @config.rpcs.export_backup.retry_policy
1536
+
1537
+ options.apply_defaults timeout: @config.timeout,
1538
+ metadata: @config.metadata,
1539
+ retry_policy: @config.retry_policy
1540
+
1541
+ @cloud_redis_cluster_stub.call_rpc :export_backup, request, options: options do |response, operation|
1542
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1543
+ yield response, operation if block_given?
1544
+ throw :response, response
1545
+ end
1546
+ rescue ::GRPC::BadStatus => e
1547
+ raise ::Google::Cloud::Error.from_error(e)
1548
+ end
1549
+
1550
+ ##
1551
+ # Backup Redis Cluster.
1552
+ # If this is the first time a backup is being created, a backup collection
1553
+ # will be created at the backend, and this backup belongs to this collection.
1554
+ # Both collection and backup will have a resource name. Backup will be
1555
+ # executed for each shard. A replica (primary if nonHA) will be selected to
1556
+ # perform the execution. Backup call will be rejected if there is an ongoing
1557
+ # backup or update operation. Be aware that during preview, if the cluster's
1558
+ # internal software version is too old, critical update will be performed
1559
+ # before actual backup. Once the internal software version is updated to the
1560
+ # minimum version required by the backup feature, subsequent backups will not
1561
+ # require critical update. After preview, there will be no critical update
1562
+ # needed for backup.
1563
+ #
1564
+ # @overload backup_cluster(request, options = nil)
1565
+ # Pass arguments to `backup_cluster` via a request object, either of type
1566
+ # {::Google::Cloud::Redis::Cluster::V1::BackupClusterRequest} or an equivalent Hash.
1567
+ #
1568
+ # @param request [::Google::Cloud::Redis::Cluster::V1::BackupClusterRequest, ::Hash]
1569
+ # A request object representing the call parameters. Required. To specify no
1570
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1571
+ # @param options [::Gapic::CallOptions, ::Hash]
1572
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1573
+ #
1574
+ # @overload backup_cluster(name: nil, ttl: nil, backup_id: nil)
1575
+ # Pass arguments to `backup_cluster` via keyword arguments. Note that at
1576
+ # least one keyword argument is required. To specify no parameters, or to keep all
1577
+ # the default parameter values, pass an empty Hash as a request object (see above).
1578
+ #
1579
+ # @param name [::String]
1580
+ # Required. Redis cluster resource name using the form:
1581
+ # `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
1582
+ # where `location_id` refers to a GCP region.
1583
+ # @param ttl [::Google::Protobuf::Duration, ::Hash]
1584
+ # Optional. TTL for the backup to expire. Value range is 1 day to 100 years.
1585
+ # If not specified, the default value is 100 years.
1586
+ # @param backup_id [::String]
1587
+ # Optional. The id of the backup to be created. If not specified, the
1588
+ # default value ([YYYYMMDDHHMMSS]_[Shortened Cluster UID] is used.
1589
+ #
1590
+ # @yield [response, operation] Access the result along with the RPC operation
1591
+ # @yieldparam response [::Gapic::Operation]
1592
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1593
+ #
1594
+ # @return [::Gapic::Operation]
1595
+ #
1596
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1597
+ #
1598
+ # @example Basic example
1599
+ # require "google/cloud/redis/cluster/v1"
1600
+ #
1601
+ # # Create a client object. The client can be reused for multiple calls.
1602
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Client.new
1603
+ #
1604
+ # # Create a request. To set request fields, pass in keyword arguments.
1605
+ # request = Google::Cloud::Redis::Cluster::V1::BackupClusterRequest.new
1606
+ #
1607
+ # # Call the backup_cluster method.
1608
+ # result = client.backup_cluster request
1609
+ #
1610
+ # # The returned object is of type Gapic::Operation. You can use it to
1611
+ # # check the status of an operation, cancel it, or wait for results.
1612
+ # # Here is how to wait for a response.
1613
+ # result.wait_until_done! timeout: 60
1614
+ # if result.response?
1615
+ # p result.response
1616
+ # else
1617
+ # puts "No response received."
1618
+ # end
1619
+ #
1620
+ def backup_cluster request, options = nil
1621
+ raise ::ArgumentError, "request must be provided" if request.nil?
1622
+
1623
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::BackupClusterRequest
1624
+
1625
+ # Converts hash and nil to an options object
1626
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1627
+
1628
+ # Customize the options with defaults
1629
+ metadata = @config.rpcs.backup_cluster.metadata.to_h
1630
+
1631
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1632
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1633
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1634
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION
1635
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1636
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1637
+
1638
+ header_params = {}
1639
+ if request.name
1640
+ header_params["name"] = request.name
1641
+ end
1642
+
1643
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1644
+ metadata[:"x-goog-request-params"] ||= request_params_header
1645
+
1646
+ options.apply_defaults timeout: @config.rpcs.backup_cluster.timeout,
1647
+ metadata: metadata,
1648
+ retry_policy: @config.rpcs.backup_cluster.retry_policy
1649
+
1650
+ options.apply_defaults timeout: @config.timeout,
1651
+ metadata: @config.metadata,
1652
+ retry_policy: @config.retry_policy
1653
+
1654
+ @cloud_redis_cluster_stub.call_rpc :backup_cluster, request, options: options do |response, operation|
1655
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1656
+ yield response, operation if block_given?
1657
+ throw :response, response
1658
+ end
1659
+ rescue ::GRPC::BadStatus => e
1660
+ raise ::Google::Cloud::Error.from_error(e)
1661
+ end
1662
+
1663
+ ##
1664
+ # Configuration class for the CloudRedisCluster API.
1665
+ #
1666
+ # This class represents the configuration for CloudRedisCluster,
1667
+ # providing control over timeouts, retry behavior, logging, transport
1668
+ # parameters, and other low-level controls. Certain parameters can also be
1669
+ # applied individually to specific RPCs. See
1670
+ # {::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Client::Configuration::Rpcs}
1671
+ # for a list of RPCs that can be configured independently.
1672
+ #
1673
+ # Configuration can be applied globally to all clients, or to a single client
1674
+ # on construction.
1675
+ #
1676
+ # @example
1677
+ #
1678
+ # # Modify the global config, setting the timeout for
1679
+ # # list_clusters to 20 seconds,
1680
+ # # and all remaining timeouts to 10 seconds.
1681
+ # ::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Client.configure do |config|
1682
+ # config.timeout = 10.0
1683
+ # config.rpcs.list_clusters.timeout = 20.0
1684
+ # end
1685
+ #
1686
+ # # Apply the above configuration only to a new client.
1687
+ # client = ::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Client.new do |config|
1688
+ # config.timeout = 10.0
1689
+ # config.rpcs.list_clusters.timeout = 20.0
1690
+ # end
1691
+ #
1692
+ # @!attribute [rw] endpoint
1693
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1694
+ # nil, indicating to use the default endpoint in the current universe domain.
1695
+ # @return [::String,nil]
1696
+ # @!attribute [rw] credentials
1697
+ # Credentials to send with calls. You may provide any of the following types:
1698
+ # * (`String`) The path to a service account key file in JSON format
1699
+ # * (`Hash`) A service account key as a Hash
1700
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1701
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1702
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1703
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1704
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1705
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1706
+ # * (`nil`) indicating no credentials
1707
+ #
1708
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
1709
+ # external source for authentication to Google Cloud, you must validate it before
1710
+ # providing it to a Google API client library. Providing an unvalidated credential
1711
+ # configuration to Google APIs can compromise the security of your systems and data.
1712
+ # For more information, refer to [Validate credential configurations from external
1713
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1714
+ # @return [::Object]
1715
+ # @!attribute [rw] scope
1716
+ # The OAuth scopes
1717
+ # @return [::Array<::String>]
1718
+ # @!attribute [rw] lib_name
1719
+ # The library name as recorded in instrumentation and logging
1720
+ # @return [::String]
1721
+ # @!attribute [rw] lib_version
1722
+ # The library version as recorded in instrumentation and logging
1723
+ # @return [::String]
1724
+ # @!attribute [rw] channel_args
1725
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
1726
+ # `GRPC::Core::Channel` object is provided as the credential.
1727
+ # @return [::Hash]
1728
+ # @!attribute [rw] interceptors
1729
+ # An array of interceptors that are run before calls are executed.
1730
+ # @return [::Array<::GRPC::ClientInterceptor>]
1731
+ # @!attribute [rw] timeout
1732
+ # The call timeout in seconds.
1733
+ # @return [::Numeric]
1734
+ # @!attribute [rw] metadata
1735
+ # Additional gRPC headers to be sent with the call.
1736
+ # @return [::Hash{::Symbol=>::String}]
1737
+ # @!attribute [rw] retry_policy
1738
+ # The retry policy. The value is a hash with the following keys:
1739
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1740
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1741
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1742
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1743
+ # trigger a retry.
1744
+ # @return [::Hash]
1745
+ # @!attribute [rw] quota_project
1746
+ # A separate project against which to charge quota.
1747
+ # @return [::String]
1748
+ # @!attribute [rw] universe_domain
1749
+ # The universe domain within which to make requests. This determines the
1750
+ # default endpoint URL. The default value of nil uses the environment
1751
+ # universe (usually the default "googleapis.com" universe).
1752
+ # @return [::String,nil]
1753
+ # @!attribute [rw] logger
1754
+ # A custom logger to use for request/response debug logging, or the value
1755
+ # `:default` (the default) to construct a default logger, or `nil` to
1756
+ # explicitly disable logging.
1757
+ # @return [::Logger,:default,nil]
1758
+ #
1759
+ class Configuration
1760
+ extend ::Gapic::Config
1761
+
1762
+ # @private
1763
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1764
+ DEFAULT_ENDPOINT = "redis.googleapis.com"
1765
+
1766
+ config_attr :endpoint, nil, ::String, nil
1767
+ config_attr :credentials, nil do |value|
1768
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1769
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1770
+ allowed.any? { |klass| klass === value }
1771
+ end
1772
+ config_attr :scope, nil, ::String, ::Array, nil
1773
+ config_attr :lib_name, nil, ::String, nil
1774
+ config_attr :lib_version, nil, ::String, nil
1775
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1776
+ config_attr :interceptors, nil, ::Array, nil
1777
+ config_attr :timeout, nil, ::Numeric, nil
1778
+ config_attr :metadata, nil, ::Hash, nil
1779
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1780
+ config_attr :quota_project, nil, ::String, nil
1781
+ config_attr :universe_domain, nil, ::String, nil
1782
+ config_attr :logger, :default, ::Logger, nil, :default
1783
+
1784
+ # @private
1785
+ def initialize parent_config = nil
1786
+ @parent_config = parent_config unless parent_config.nil?
1787
+
1788
+ yield self if block_given?
1789
+ end
1790
+
1791
+ ##
1792
+ # Configurations for individual RPCs
1793
+ # @return [Rpcs]
1794
+ #
1795
+ def rpcs
1796
+ @rpcs ||= begin
1797
+ parent_rpcs = nil
1798
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1799
+ Rpcs.new parent_rpcs
1800
+ end
1801
+ end
1802
+
1803
+ ##
1804
+ # Configuration for the channel pool
1805
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
1806
+ #
1807
+ def channel_pool
1808
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
1809
+ end
1810
+
1811
+ ##
1812
+ # Configuration RPC class for the CloudRedisCluster API.
1813
+ #
1814
+ # Includes fields providing the configuration for each RPC in this service.
1815
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1816
+ # the following configuration fields:
1817
+ #
1818
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1819
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1820
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1821
+ # include the following keys:
1822
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1823
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1824
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1825
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1826
+ # trigger a retry.
1827
+ #
1828
+ class Rpcs
1829
+ ##
1830
+ # RPC-specific configuration for `list_clusters`
1831
+ # @return [::Gapic::Config::Method]
1832
+ #
1833
+ attr_reader :list_clusters
1834
+ ##
1835
+ # RPC-specific configuration for `get_cluster`
1836
+ # @return [::Gapic::Config::Method]
1837
+ #
1838
+ attr_reader :get_cluster
1839
+ ##
1840
+ # RPC-specific configuration for `update_cluster`
1841
+ # @return [::Gapic::Config::Method]
1842
+ #
1843
+ attr_reader :update_cluster
1844
+ ##
1845
+ # RPC-specific configuration for `delete_cluster`
1846
+ # @return [::Gapic::Config::Method]
1847
+ #
1848
+ attr_reader :delete_cluster
1849
+ ##
1850
+ # RPC-specific configuration for `create_cluster`
1851
+ # @return [::Gapic::Config::Method]
1852
+ #
1853
+ attr_reader :create_cluster
1854
+ ##
1855
+ # RPC-specific configuration for `get_cluster_certificate_authority`
1856
+ # @return [::Gapic::Config::Method]
1857
+ #
1858
+ attr_reader :get_cluster_certificate_authority
1859
+ ##
1860
+ # RPC-specific configuration for `reschedule_cluster_maintenance`
1861
+ # @return [::Gapic::Config::Method]
1862
+ #
1863
+ attr_reader :reschedule_cluster_maintenance
1864
+ ##
1865
+ # RPC-specific configuration for `list_backup_collections`
1866
+ # @return [::Gapic::Config::Method]
1867
+ #
1868
+ attr_reader :list_backup_collections
1869
+ ##
1870
+ # RPC-specific configuration for `get_backup_collection`
1871
+ # @return [::Gapic::Config::Method]
1872
+ #
1873
+ attr_reader :get_backup_collection
1874
+ ##
1875
+ # RPC-specific configuration for `list_backups`
1876
+ # @return [::Gapic::Config::Method]
1877
+ #
1878
+ attr_reader :list_backups
1879
+ ##
1880
+ # RPC-specific configuration for `get_backup`
1881
+ # @return [::Gapic::Config::Method]
1882
+ #
1883
+ attr_reader :get_backup
1884
+ ##
1885
+ # RPC-specific configuration for `delete_backup`
1886
+ # @return [::Gapic::Config::Method]
1887
+ #
1888
+ attr_reader :delete_backup
1889
+ ##
1890
+ # RPC-specific configuration for `export_backup`
1891
+ # @return [::Gapic::Config::Method]
1892
+ #
1893
+ attr_reader :export_backup
1894
+ ##
1895
+ # RPC-specific configuration for `backup_cluster`
1896
+ # @return [::Gapic::Config::Method]
1897
+ #
1898
+ attr_reader :backup_cluster
1047
1899
 
1048
1900
  # @private
1049
1901
  def initialize parent_rpcs = nil
@@ -1059,6 +1911,22 @@ module Google
1059
1911
  @create_cluster = ::Gapic::Config::Method.new create_cluster_config
1060
1912
  get_cluster_certificate_authority_config = parent_rpcs.get_cluster_certificate_authority if parent_rpcs.respond_to? :get_cluster_certificate_authority
1061
1913
  @get_cluster_certificate_authority = ::Gapic::Config::Method.new get_cluster_certificate_authority_config
1914
+ reschedule_cluster_maintenance_config = parent_rpcs.reschedule_cluster_maintenance if parent_rpcs.respond_to? :reschedule_cluster_maintenance
1915
+ @reschedule_cluster_maintenance = ::Gapic::Config::Method.new reschedule_cluster_maintenance_config
1916
+ list_backup_collections_config = parent_rpcs.list_backup_collections if parent_rpcs.respond_to? :list_backup_collections
1917
+ @list_backup_collections = ::Gapic::Config::Method.new list_backup_collections_config
1918
+ get_backup_collection_config = parent_rpcs.get_backup_collection if parent_rpcs.respond_to? :get_backup_collection
1919
+ @get_backup_collection = ::Gapic::Config::Method.new get_backup_collection_config
1920
+ list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups
1921
+ @list_backups = ::Gapic::Config::Method.new list_backups_config
1922
+ get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup
1923
+ @get_backup = ::Gapic::Config::Method.new get_backup_config
1924
+ delete_backup_config = parent_rpcs.delete_backup if parent_rpcs.respond_to? :delete_backup
1925
+ @delete_backup = ::Gapic::Config::Method.new delete_backup_config
1926
+ export_backup_config = parent_rpcs.export_backup if parent_rpcs.respond_to? :export_backup
1927
+ @export_backup = ::Gapic::Config::Method.new export_backup_config
1928
+ backup_cluster_config = parent_rpcs.backup_cluster if parent_rpcs.respond_to? :backup_cluster
1929
+ @backup_cluster = ::Gapic::Config::Method.new backup_cluster_config
1062
1930
 
1063
1931
  yield self if block_given?
1064
1932
  end