syntax = "proto3";

package yandex.cloud.mdb.redis.v1;

import "google/api/annotations.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "google/type/timeofday.proto";
import "yandex/cloud/api/operation.proto";
import "yandex/cloud/operation/operation.proto";
import "yandex/cloud/validation.proto";
import "yandex/cloud/mdb/redis/v1/backup.proto";
import "yandex/cloud/mdb/redis/v1/cluster.proto";
import "yandex/cloud/mdb/redis/v1/config/redis5_0.proto";
import "yandex/cloud/mdb/redis/v1/config/redis6_0.proto";
import "yandex/cloud/mdb/redis/v1/config/redis6_2.proto";
import "yandex/cloud/mdb/redis/v1/maintenance.proto";

option go_package = "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/redis/v1;redis";
option java_package = "yandex.cloud.api.mdb.redis.v1";

// A set of methods for managing Redis clusters.
service ClusterService {
  // Returns the specified Redis cluster.
  //
  // To get the list of available Redis clusters, make a [List] request.
  rpc Get (GetClusterRequest) returns (Cluster) {
    option (google.api.http) = { get: "/managed-redis/v1/clusters/{cluster_id}" };
  }

  // Retrieves the list of Redis clusters that belong
  // to the specified folder.
  rpc List (ListClustersRequest) returns (ListClustersResponse) {
    option (google.api.http) = { get: "/managed-redis/v1/clusters" };
  }

  // Creates a Redis cluster in the specified folder.
  rpc Create (CreateClusterRequest) returns (operation.Operation) {
    option (google.api.http) = { post: "/managed-redis/v1/clusters" body: "*" };
    option (yandex.cloud.api.operation) = {
      metadata: "CreateClusterMetadata"
      response: "Cluster"
    };
  }

  // Updates the specified Redis cluster.
  rpc Update (UpdateClusterRequest) returns (operation.Operation) {
    option (google.api.http) = { patch: "/managed-redis/v1/clusters/{cluster_id}" body: "*" };
    option (yandex.cloud.api.operation) = {
      metadata: "UpdateClusterMetadata"
      response: "Cluster"
    };
  }

  // Deletes the specified Redis cluster.
  rpc Delete (DeleteClusterRequest) returns (operation.Operation) {
    option (google.api.http) = { delete: "/managed-redis/v1/clusters/{cluster_id}" };
    option (yandex.cloud.api.operation) = {
      metadata: "DeleteClusterMetadata"
      response: "google.protobuf.Empty"
    };
  }

  // Start the specified Redis cluster.
  rpc Start (StartClusterRequest) returns (operation.Operation) {
    option (google.api.http) = { post: "/managed-redis/v1/clusters/{cluster_id}:start" };
    option (yandex.cloud.api.operation) = {
      metadata: "StartClusterMetadata"
      response: "Cluster"
    };
  }

  // Stop the specified Redis cluster.
  rpc Stop (StopClusterRequest) returns (operation.Operation) {
    option (google.api.http) = { post: "/managed-redis/v1/clusters/{cluster_id}:stop" };
    option (yandex.cloud.api.operation) = {
      metadata: "StopClusterMetadata"
      response: "Cluster"
    };
  }

  // Moves a Redis cluster to the specified folder.
  rpc Move (MoveClusterRequest) returns (operation.Operation) {
    option (google.api.http) = { post: "/managed-redis/v1/clusters/{cluster_id}:move" body: "*" };
    option (yandex.cloud.api.operation) = {
      metadata: "MoveClusterMetadata"
      response: "Cluster"
    };
  }

  // Creates a backup for the specified Redis cluster.
  rpc Backup (BackupClusterRequest) returns (operation.Operation) {
    option (google.api.http) = { post: "/managed-redis/v1/clusters/{cluster_id}:backup" };
    option (yandex.cloud.api.operation) = {
      metadata: "BackupClusterMetadata"
      response: "Cluster"
    };
  }

  // Creates a new Redis cluster using the specified backup.
  rpc Restore (RestoreClusterRequest) returns (operation.Operation) {
    option (google.api.http) = { post: "/managed-redis/v1/clusters:restore" body: "*" };
    option (yandex.cloud.api.operation) = {
      metadata: "RestoreClusterMetadata"
      response: "Cluster"
    };
  }

  // Reschedules planned maintenance operation.
  rpc RescheduleMaintenance (RescheduleMaintenanceRequest) returns (operation.Operation) {
    option (google.api.http) = { post: "/managed-redis/v1/clusters/{cluster_id}:rescheduleMaintenance" body: "*"};
    option (yandex.cloud.api.operation) = {
      metadata: "RescheduleMaintenanceMetadata"
      response: "Cluster"
    };
  }

  // Start a manual failover on the specified Redis cluster.
  rpc StartFailover (StartClusterFailoverRequest) returns (operation.Operation) {
    option (google.api.http) = { post: "/managed-redis/v1/clusters/{cluster_id}:startFailover" };
    option (yandex.cloud.api.operation) = {
      metadata: "StartClusterFailoverMetadata"
      response: "Cluster"
    };
  }

  // Retrieves logs for the specified Redis cluster.
  rpc ListLogs (ListClusterLogsRequest) returns (ListClusterLogsResponse) {
    option (google.api.http) = { get: "/managed-redis/v1/clusters/{cluster_id}:logs" };
  }

  // Same as ListLogs but using server-side streaming. Also allows for 'tail -f' semantics.
  rpc StreamLogs (StreamClusterLogsRequest) returns (stream StreamLogRecord) {
    option (google.api.http) = { get: "/managed-redis/v1/clusters/{cluster_id}:stream_logs" };
  }

  // Retrieves the list of operations for the specified cluster.
  rpc ListOperations (ListClusterOperationsRequest) returns (ListClusterOperationsResponse) {
    option (google.api.http) = { get: "/managed-redis/v1/clusters/{cluster_id}/operations" };
  }

  // Retrieves the list of available backups for the specified Redis cluster.
  rpc ListBackups (ListClusterBackupsRequest) returns (ListClusterBackupsResponse) {
    option (google.api.http) = { get: "/managed-redis/v1/clusters/{cluster_id}/backups" };
  }

  // Retrieves a list of hosts for the specified cluster.
  rpc ListHosts (ListClusterHostsRequest) returns (ListClusterHostsResponse) {
    option (google.api.http) = { get: "/managed-redis/v1/clusters/{cluster_id}/hosts" };
  }

  // Creates new hosts for a cluster.
  rpc AddHosts (AddClusterHostsRequest) returns (operation.Operation) {
    option (google.api.http) = { post: "/managed-redis/v1/clusters/{cluster_id}/hosts:batchCreate" body: "*" };
    option (yandex.cloud.api.operation) = {
      metadata: "AddClusterHostsMetadata"
      response: "google.protobuf.Empty"
    };
  }

  // Deletes the specified hosts for a cluster.
  rpc DeleteHosts (DeleteClusterHostsRequest) returns (operation.Operation) {
    option (google.api.http) = { post: "/managed-redis/v1/clusters/{cluster_id}/hosts:batchDelete" body: "*" };
    option (yandex.cloud.api.operation) = {
      metadata: "DeleteClusterHostsMetadata"
      response: "google.protobuf.Empty"
    };
  }

  // Returns the specified shard.
  rpc GetShard (GetClusterShardRequest) returns (Shard) {
    option (google.api.http) = { get: "/managed-redis/v1/clusters/{cluster_id}/shards/{shard_name}" };
  }

  // Retrieves a list of shards.
  rpc ListShards (ListClusterShardsRequest) returns (ListClusterShardsResponse) {
    option (google.api.http) = { get: "/managed-redis/v1/clusters/{cluster_id}/shards" };
  }

  // Creates a new shard.
  rpc AddShard (AddClusterShardRequest) returns (operation.Operation) {
    option (google.api.http) = { post: "/managed-redis/v1/clusters/{cluster_id}/shards" body: "*" };
    option (yandex.cloud.api.operation) = {
      metadata: "AddClusterShardMetadata"
      response: "Shard"
    };
  }

  // Deletes the specified shard.
  rpc DeleteShard (DeleteClusterShardRequest) returns (operation.Operation) {
    option (google.api.http) = { delete: "/managed-redis/v1/clusters/{cluster_id}/shards/{shard_name}" };
    option (yandex.cloud.api.operation) = {
      metadata: "DeleteClusterShardMetadata"
      response: "google.protobuf.Empty"
    };
  }

  // Rebalances the cluster. Evenly distributes all the hash slots between the shards.
  rpc Rebalance (RebalanceClusterRequest) returns (operation.Operation) {
    option (google.api.http) = { post: "/managed-redis/v1/clusters/{cluster_id}:rebalance" };
    option (yandex.cloud.api.operation) = {
      metadata: "RebalanceClusterMetadata"
      response: "Cluster"
    };
  }
}

message GetClusterRequest {
  // ID of the Redis cluster to return.
  // To get the cluster ID use a [ClusterService.List] request.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];
}

message ListClustersRequest {
  // ID of the folder to list Redis clusters in.
  // To get the folder ID, use a [yandex.cloud.resourcemanager.v1.FolderService.List] request.
  string folder_id = 1 [(required) = true, (length) = "<=50"];

  // The maximum number of results per page to return. If the number of available
  // results is larger than [page_size], the service returns a [ListClustersResponse.next_page_token]
  // that can be used to get the next page of results in subsequent list requests.
  int64 page_size = 2 [(value) = "0-1000"];

  // Page token. To get the next page of results, set [page_token] to the [ListClustersResponse.next_page_token]
  // returned by a previous list request.
  string page_token = 3 [(length) = "<=100"];

  // A filter expression that filters clusters listed in the response.
  // The expression must specify:
  // 1. The field name. Currently you can only use filtering with the [Cluster.name] field.
  // 2. An operator. Can be either `=` or `!=` for single values, `IN` or `NOT IN` for lists of values.
  // 3. The value. Must be 3-63 characters long and match the regular expression `^[a-z]([-a-z0-9]{,61}[a-z0-9])?$`.
  string filter = 4 [(length) = "<=1000"];
}

message ListClustersResponse {
  // List of Redis clusters.
  repeated Cluster clusters = 1;

  // This token allows you to get the next page of results for list requests. If the number of results
  // is larger than [ListClustersRequest.page_size], use the [next_page_token] as the value
  // for the [ListClustersRequest.page_token] parameter in the next list request. Each subsequent
  // list request will have its own [next_page_token] to continue paging through the results.
  string next_page_token = 2;
}

message CreateClusterRequest {
  // ID of the folder to create the Redis cluster in.
  string folder_id = 1 [(required) = true, (length) = "<=50"];

  // Name of the Redis cluster. The name must be unique within the folder.
  string name = 2 [(required) = true, (length) = "<=63", (pattern) = "[a-zA-Z0-9_-]*"];

  // Description of the Redis cluster.
  string description = 3 [(length) = "<=256"];

  // Custom labels for the Redis cluster as `key:value` pairs. Maximum 64 per cluster.
  // For example, "project": "mvp" or "source": "dictionary".
  map<string, string> labels = 4 [(yandex.cloud.size) = "<=64", (length) = "<=63", (pattern) = "[-_0-9a-z]*", (map_key).length = "<=63", (map_key).pattern = "[a-z][-_0-9a-z]*"];

  // Deployment environment of the Redis cluster.
  Cluster.Environment environment = 5 [(required) = true];

  // Configuration and resources for hosts that should be created for the Redis cluster.
  ConfigSpec config_spec = 6 [(required) = true];

  // Individual configurations for hosts that should be created for the Redis cluster.
  repeated HostSpec host_specs = 7 [(size) = ">0"];

  // ID of the network to create the cluster in.
  string network_id = 10 [(required) = true, (length) = "<=50"];

  // Redis cluster mode on/off.
  bool sharded = 11;

  // User security groups
  repeated string security_group_ids = 12;

  // TLS port and functionality on\off
  google.protobuf.BoolValue tls_enabled = 13;

  // Deletion Protection inhibits deletion of the cluster
  bool deletion_protection = 14;
}

message CreateClusterMetadata {
  // ID of the Redis cluster that is being created.
  string cluster_id = 1;
}

message UpdateClusterRequest {
  // ID of the Redis cluster to update.
  // To get the Redis cluster ID, use a [ClusterService.List] request.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];

  // Field mask that specifies which fields of the Redis cluster should be updated.
  google.protobuf.FieldMask update_mask = 2;

  // New description of the Redis cluster.
  string description = 3 [(length) = "<=256"];

  // Custom labels for the Redis cluster as `` key:value `` pairs. Maximum 64 per cluster.
  // For example, "project": "mvp" or "source": "dictionary".
  //
  // The new set of labels will completely replace the old ones. To add a label, request the current
  // set with the [ClusterService.Get] method, then send an [ClusterService.Update] request with the new label added to the set.
  map<string, string> labels = 4 [(yandex.cloud.size) = "<=64", (length) = "<=63", (pattern) = "[-_0-9a-z]*", (map_key).length = "<=63", (map_key).pattern = "[a-z][-_0-9a-z]*"];

  // New configuration and resources for hosts in the cluster.
  ConfigSpec config_spec = 5;

  // New name for the cluster.
  string name = 6 [(length) = "<=63", (pattern) = "[a-zA-Z0-9_-]*"];

  // New maintenance window settings for the cluster.
  MaintenanceWindow maintenance_window = 7;

  // User security groups
  repeated string security_group_ids = 8;

  // Deletion Protection inhibits deletion of the cluster
  bool deletion_protection = 9;
}

message UpdateClusterMetadata {
  // ID of the Redis cluster that is being updated.
  string cluster_id = 1;
}

message DeleteClusterRequest {
  // ID of the Redis cluster to delete.
  // To get the Redis cluster ID, use a [ClusterService.List] request.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];
}

message DeleteClusterMetadata {
  // ID of the Redis cluster that is being deleted.
  string cluster_id = 1;
}

message StartClusterRequest {
  // ID of the Redis cluster to start.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];
}

message StartClusterMetadata {
  // ID of the Redis cluster.
  string cluster_id = 1;
}

message StopClusterRequest {
  // ID of the Redis cluster to stop.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];
}

message StopClusterMetadata {
  // ID of the Redis cluster.
  string cluster_id = 1;
}

message MoveClusterRequest {
  // ID of the Redis cluster to move.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];

  // ID of the destination folder.
  string destination_folder_id = 2 [(required) = true, (length) = "<=50"];
}

message MoveClusterMetadata {
  // ID of the Redis cluster being moved.
  string cluster_id = 1;

  // ID of the source folder.
  string source_folder_id = 2;

  // ID of the destination folder.
  string destination_folder_id = 3;
}

message BackupClusterRequest {
  // ID of the Redis cluster to back up.
  // To get the Redis cluster ID, use a [ClusterService.List] request.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];
}

message BackupClusterMetadata {
  // ID of the Redis cluster that is being backed up.
  string cluster_id = 1;
}

message RestoreClusterRequest {
  // ID of the backup to create a cluster from.
  // To get the backup ID, use a [ClusterService.ListBackups] request.
  string backup_id = 1 [(required) = true];

  // Name of the new Redis cluster. The name must be unique within the folder.
  string name = 2 [(required) = true, (length) = "<=63", (pattern) = "[a-zA-Z0-9_-]*"];

  // Description of the new Redis cluster.
  string description = 3 [(length) = "<=256"];

  // Custom labels for the Redis cluster as `` key:value `` pairs. Maximum 64 per cluster.
  // For example, "project": "mvp" or "source": "dictionary".
  map<string, string> labels = 4 [(yandex.cloud.size) = "<=64", (length) = "<=63", (pattern) = "[-_0-9a-z]*", (map_key).length = "<=63", (map_key).pattern = "[a-z][-_0-9a-z]*"];

  // Deployment environment of the new Redis cluster.
  Cluster.Environment environment = 5 [(required) = true];

  // Configuration for the Redis cluster to be created.
  ConfigSpec config_spec = 6 [(required) = true];

  // Configurations for Redis hosts that should be created for
  // the cluster that is being created from the backup.
  repeated HostSpec host_specs = 7 [(size) = ">0"];

  // ID of the network to create the Redis cluster in.
  string network_id = 8 [(required) = true, (length) = "<=50"];

  // ID of the folder to create the Redis cluster in.
  string folder_id = 9 [(length) = "<=50"];

  // User security groups
  repeated string security_group_ids = 10;

  // TLS port and functionality on\off
  google.protobuf.BoolValue tls_enabled = 11;
}

message RestoreClusterMetadata {
  // ID of the new Redis cluster that is being created from a backup.
  string cluster_id = 1;

  // ID of the backup that is being used for creating a cluster.
  string backup_id = 2;
}

message StartClusterFailoverRequest {
  // ID of the Redis cluster to start failover on.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];
}

message StartClusterFailoverMetadata {
  // ID of the Redis cluster on which failover will be initiated.
  string cluster_id = 1;
}
message RescheduleMaintenanceRequest {
  // ID of the Redis cluster to reschedule the maintenance operation for.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];

  enum RescheduleType {
    RESCHEDULE_TYPE_UNSPECIFIED = 0;

    // Start the maintenance operation immediately.
    IMMEDIATE = 1;

    // Start the maintenance operation within the next available maintenance window.
    NEXT_AVAILABLE_WINDOW = 2;

    // Start the maintenance operation at the specific time.
    SPECIFIC_TIME = 3;
  }

  // The type of reschedule request.
  RescheduleType reschedule_type = 2[(required) = true];

  // The time until which this maintenance operation should be delayed. The value should be ahead of the first time when the maintenance operation has been scheduled for no more than two weeks. The value can also point to the past moment of time if [reschedule_type.IMMEDIATE] reschedule type is chosen.
  google.protobuf.Timestamp delayed_until = 3;
}

message RescheduleMaintenanceMetadata {
  // Required. ID of the Redis cluster.
  string cluster_id = 1;

  // Required. The time until which this maintenance operation is to be delayed.
  google.protobuf.Timestamp delayed_until = 4;
}

message LogRecord {
  // Log record timestamp in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
  google.protobuf.Timestamp timestamp = 1;

  // Contents of the log record.
  map<string, string> message = 2;
}

message ListClusterLogsRequest {
  // ID of the Redis cluster to request logs for.
  // To get the Redis cluster ID use a [ClusterService.List] request.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];

  // Columns from the logs table to request.
  // If no columns are specified, entire log records are returned.
  repeated string column_filter = 2;

  ServiceType service_type = 3;

  enum ServiceType {
    SERVICE_TYPE_UNSPECIFIED = 0;

    // Logs of Redis activity.
    REDIS = 1;
  }

  // Start timestamp for the logs request, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
  google.protobuf.Timestamp from_time = 4;

  // End timestamp for the logs request, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
  google.protobuf.Timestamp to_time = 5;

  // The maximum number of results per page to return. If the number of available
  // results is larger than [page_size], the service returns a [ListClusterLogsResponse.next_page_token]
  // that can be used to get the next page of results in subsequent list requests.
  int64 page_size = 6 [(value) = "0-1000"];

  // Page token. To get the next page of results, set [page_token] to the
  // [ListClusterLogsResponse.next_page_token] returned by a previous list request.
  string page_token = 7 [(length) = "<=100"];
}

message ListClusterLogsResponse {
  // Requested log records.
  repeated LogRecord logs = 1;

  // This token allows you to get the next page of results for list requests. If the number of results
  // is larger than [ListClusterLogsRequest.page_size], use the [next_page_token] as the value
  // for the [ListClusterLogsRequest.page_token] query parameter in the next list request.
  // Each subsequent list request will have its own [next_page_token] to continue paging through the results.
  // This value is interchangeable with `next_record_token` from StreamLogs method.
  string next_page_token = 2;
}

message StreamLogRecord {
  // One of the requested log records.
  LogRecord record = 1;

  // This token allows you to continue streaming logs starting from the exact
  // same record. To continue streaming, specify value of `next_record_token`
  // as value for `record_token` parameter in the next StreamLogs request.
  // This value is interchangeable with `next_page_token` from ListLogs method.
  string next_record_token = 2;
}

message StreamClusterLogsRequest {
  // Required. ID of the Redis cluster.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];

  // Columns from logs table to get in the response.
  repeated string column_filter = 2;

  ServiceType service_type = 3;

  enum ServiceType {
    SERVICE_TYPE_UNSPECIFIED = 0;

    // Logs of Redis activity.
    REDIS = 1;
  }

  // Start timestamp for the logs request.
  google.protobuf.Timestamp from_time = 4;

  // End timestamp for the logs request.
  // If this field is not set, all existing logs will be sent and then the new ones as
  // they appear. In essence it has 'tail -f' semantics.
  google.protobuf.Timestamp to_time = 5;

  // Record token. Set `record_token` to the `next_record_token` returned by a previous StreamLogs
  // request to start streaming from next log record.
  string record_token = 6 [(length) = "<=100"];

  // A filter expression that filters resources listed in the response.
  // The expression must specify:
  // 1. The field name. Currently filtering can be applied to the [LogRecord.logs.hostname] field
  // 2. A conditional operator. Can be either `=` or `!=` for single values, `IN` or `NOT IN` for lists of values.
  // 3. The value. Must be 3-63 characters long and match the regular expression `^[a-z][-a-z0-9]{1,61}[a-z0-9]$`.
  // Examples of a filter `message.hostname='node1.db.cloud.yandex.net'`.
  string filter = 7 [(length) = "<=1000"];
}

message ListClusterOperationsRequest {
  // ID of the Redis cluster to list operations for.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];

  // The maximum number of results per page to return. If the number of available
  // results is larger than [page_size], the service returns a [ListClusterOperationsResponse.next_page_token]
  // that can be used to get the next page of results in subsequent list requests.
  int64 page_size = 2 [(value) = "0-1000"];

  // Page token.  To get the next page of results, set [page_token] to the [ListClusterOperationsResponse.next_page_token]
  // returned by a previous list request.
  string page_token = 3 [(length) = "<=100"];
}

message ListClusterOperationsResponse {
  // List of operations for the specified Redis cluster.
  repeated operation.Operation operations = 1;

  // This token allows you to get the next page of results for list requests. If the number of results
  // is larger than [ListClusterOperationsRequest.page_size], use the [next_page_token] as the value
  // for the [ListClusterOperationsRequest.page_token] query parameter in the next list request.
  // Each subsequent list request will have its own [next_page_token] to continue paging through the results.
  string next_page_token = 2;
}

message ListClusterBackupsRequest {
  // ID of the Redis cluster.
  // To get the Redis cluster ID use a [ClusterService.List] request.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];

  // The maximum number of results per page to return. If the number of available
  // results is larger than [page_size], the service returns a [ListClusterBackupsResponse.next_page_token]
  // that can be used to get the next page of results in subsequent list requests.
  int64 page_size = 2 [(value) = "0-1000"];

  // Page token.  To get the next page of results, set [page_token] to the [ListClusterBackupsResponse.next_page_token]
  // returned by a previous list request.
  string page_token = 3 [(length) = "<=100"];
}

message ListClusterBackupsResponse {
  // List of Redis backups.
  repeated Backup backups = 1;

  // This token allows you to get the next page of results for list requests. If the number of results
  // is larger than [ListClusterBackupsRequest.page_size], use the [next_page_token] as the value
  // for the [ListClusterBackupsRequest.page_token] query parameter in the next list request.
  // Each subsequent list request will have its own [next_page_token] to continue paging through the results.
  string next_page_token = 2;
}

message ListClusterHostsRequest {
  // ID of the Redis cluster.
  // To get the Redis cluster ID use a [ClusterService.List] request.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];

  // The maximum number of results per page to return. If the number of available
  // results is larger than [page_size], the service returns a [ListClusterHostsResponse.next_page_token]
  // that can be used to get the next page of results in subsequent list requests.
  int64 page_size = 2 [(value) = "0-1000"];

  // Page token.  To get the next page of results, set [page_token] to the [ListClusterHostsResponse.next_page_token]
  // returned by a previous list request.
  string page_token = 3 [(length) = "<=100"];
}

message ListClusterHostsResponse {
  // List of hosts for the cluster.
  repeated Host hosts = 1;

  // This token allows you to get the next page of results for list requests. If the number of results
  // is larger than [ListClusterHostsRequest.page_size], use the [next_page_token] as the value
  // for the [ListClusterHostsRequest.page_token] query parameter in the next list request.
  // Each subsequent list request will have its own [next_page_token] to continue paging through the results.
  string next_page_token = 2;
}

message AddClusterHostsRequest {
  // ID of the Redis cluster to add hosts to.
  // To get the Redis cluster ID, use a [ClusterService.List] request.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];

  // Configurations for Redis hosts that should be added to the cluster.
  repeated HostSpec host_specs = 2 [(size) = ">0"];
}

message AddClusterHostsMetadata {
  // ID of the Redis cluster to which the hosts are being added.
  string cluster_id = 1;

  // Names of hosts that are being added to the cluster.
  repeated string host_names = 2;
}

message DeleteClusterHostsRequest {
  // ID of the Redis cluster to remove hosts from.
  // To get the Redis cluster ID, use a [ClusterService.List] request.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];

  // Names of hosts to delete.
  repeated string host_names = 2 [(size) = ">0", (length) = "<=253"];
}

message DeleteClusterHostsMetadata {
  // ID of the Redis cluster to remove hosts from.
  string cluster_id = 1;

  // Names of hosts that are being deleted.
  repeated string host_names = 2;
}

message GetClusterShardRequest {
  // ID of the Redis cluster the shard belongs to.
  // To get the cluster ID use a [ClusterService.List] request.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];

  // Name of Redis shard to return.
  // To get the shard name use a [ClusterService.ListShards] request.
  string shard_name = 2 [(required) = true, (length) = "<=63", (pattern) = "[a-zA-Z0-9_-]*"];
}

message ListClusterShardsRequest {
  // ID of the Redis cluster to list shards in.
  // To get the cluster ID use a [ClusterService.List] request.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];

  // The maximum number of results per page to return. If the number of available
  // results is larger than [page_size],
  // the service returns a [ListClusterShardsResponse.next_page_token]
  // that can be used to get the next page of results in subsequent list requests.
  // Default value: 100.
  int64 page_size = 2 [(value) = "<=1000"];

  // Page token. To get the next page of results, set [page_token] to the
  // [ListClusterShardsResponse.next_page_token] returned by a previous list request.
  string page_token = 3 [(length) = "<=100"];
}

message ListClusterShardsResponse {
  // List of Redis shards.
  repeated Shard shards = 1;
  // This token allows you to get the next page of results for list requests. If the number of results
  // is larger than [ListClusterShardsRequest.page_size], use
  // the [next_page_token] as the value
  // for the [ListClusterShardsRequest.page_token] query parameter
  // in the next list request. Each subsequent list request will have its own
  // [next_page_token] to continue paging through the results.
  string next_page_token = 2;
}

message AddClusterShardRequest {
  // ID of the Redis cluster to create a shard in.
  // To get the cluster ID use a [ClusterService.List] request.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];

  // Name of the shard.
  // The name must be unique within the cluster.
  string shard_name = 2 [(required) = true, (length) = "<=63", (pattern) = "[a-zA-Z0-9_-]*"];

  // Configurations for Redis hosts that should be created with the shard.
  // Must contain at least one element.
  repeated HostSpec host_specs = 4 [(size) = ">0"];
}

message AddClusterShardMetadata {
  // ID of the Redis cluster that a shard is being added to.
  string cluster_id = 1;

  // Name of the Redis shard that is being created.
  string shard_name = 2;
}

message DeleteClusterShardRequest {
  // ID of the Redis cluster the shard belongs to.
  // To get the cluster ID use a [ClusterService.List] request.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];

  // Name of the Redis shard to delete.
  // To get the shard name use a [ClusterService.ListShards] request.
  string shard_name = 2 [(required) = true, (length) = "<=63", (pattern) = "[a-zA-Z0-9_-]*"];
}

message DeleteClusterShardMetadata {
  // ID of the Redis cluster the shard belongs to.
  string cluster_id = 1;

  // Name of the Redis shard that is being deleted.
  string shard_name = 2;
}

message RebalanceClusterRequest {
  // ID of the Redis cluster to rebalance.
  // To get the cluster ID use a [ClusterService.List] request.
  string cluster_id = 1 [(required) = true, (length) = "<=50"];
}

message RebalanceClusterMetadata {
  // ID of the Redis cluster that is being rebalancing.
  string cluster_id = 1;
}

message HostSpec {
  // ID of the availability zone where the host resides.
  // To get a list of available zones, use the [yandex.cloud.compute.v1.ZoneService.List] request.
  string zone_id = 1;

  // ID of the subnet that the host should belong to. This subnet should be a part
  // of the network that the cluster belongs to.
  // The ID of the network is set in the field [Cluster.network_id].
  string subnet_id = 2;

  // ID of the Redis shard the host belongs to.
  // To get the shard ID use a [ClusterService.ListShards] request.
  string shard_name = 3 [(length) = "<=63", (pattern) = "[a-zA-Z0-9_-]*"];
}

message ConfigSpec {
  // Version of Redis used in the cluster.
  string version = 1;

  // Configuration of a Redis cluster.
  oneof redis_spec {
    config.RedisConfig5_0 redis_config_5_0 = 2 [json_name="redisConfig_5_0"];
    config.RedisConfig6_0 redis_config_6_0 = 6 [json_name="redisConfig_6_0"];
    config.RedisConfig6_2 redis_config_6_2 = 7 [json_name="redisConfig_6_2"];
  }

  // Resources allocated to Redis hosts.
  Resources resources = 3;

  // Time to start the daily backup, in the UTC timezone.
  google.type.TimeOfDay backup_window_start = 4;

  // Access policy to DB
  Access access = 5;
}
