syntax = "proto3";

package yandex.cloud.ydb.v1;

import "google/api/annotations.proto";
import "yandex/cloud/api/operation.proto";
import "yandex/cloud/operation/operation.proto";
import "yandex/cloud/validation.proto";
import "yandex/cloud/ydb/v1/backup.proto";

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

// A set of methods for managing backups.
service BackupService {
  // Returns the specified backup.
  rpc Get (GetBackupRequest) returns (Backup) {
    option (google.api.http) = { get: "/ydb/v1/backups/{backup_id}" };
  }

  rpc ListPaths(ListPathsRequest) returns (ListPathsResponse) {
    option (google.api.http) = { get: "/ydb/v1/backups/{backup_id}/paths" };
  }

  // Retrieves a list of backups.
  rpc List (ListBackupsRequest) returns (ListBackupsResponse) {
    option (google.api.http) = { get: "/ydb/v1/backups" };
  }

  // Deletes the specified backup.
  rpc Delete (DeleteBackupRequest) returns (operation.Operation) {
    option (google.api.http) = { delete: "/ydb/v1/backups/{backup_id}" };
    option (yandex.cloud.api.operation) = {
      metadata: "DeleteBackupMetadata"
      response: "google.protobuf.Empty"
    };
  }
}

message ListPathsRequest {
  // Required. ID of the YDB backup.
  string backup_id = 1 [(required) = true, (length) = "<=50"];

  // The maximum number of results per page that should be returned. If the number of available
  // results is larger than `page_size`, the service returns a `next_page_token` that can be used
  // to get the next page of results in subsequent ListPaths requests.
  // Acceptable values are 0 to 1000, inclusive. Default value: 100.
  int64 page_size = 2 [(value) = "0-1000"];

  // Page token. Set `page_token` to the `next_page_token` returned by a previous ListPaths
  // request to get the next page of results.
  string page_token = 3 [(length) = "<=100"];
}

message ListPathsResponse {
  repeated string paths = 1;
  string next_page_token = 2;
}



message GetBackupRequest {
  // Required. ID of the YDB backup.
  string backup_id = 1 [(required) = true, (length) = "<=50"];
}

message ListBackupsRequest {
  string folder_id = 1;

  // The maximum number of results per page that should be returned. If the number of available
  // results is larger than `page_size`, the service returns a `next_page_token` that can be used
  // to get the next page of results in subsequent ListBackups requests.
  // Acceptable values are 0 to 1000, inclusive. Default value: 100.
  int64 page_size = 2 [(value) = "0-1000"];

  // Page token. Set `page_token` to the `next_page_token` returned by a previous ListBackups
  // request to get the next page of results.
  string page_token = 3 [(length) = "<=100"];
}

message ListBackupsResponse {
  repeated Backup backups = 1;

  // This token allows you to get the next page of results for ListBackups requests,
  // if the number of results is larger than `page_size` specified in the request.
  // To get the next page, specify the value of `next_page_token` as a value for
  // the `page_token` parameter in the next ListBackups request. Subsequent ListBackups
  // requests will have their own `next_page_token` to continue paging through the results.
  string next_page_token = 2;
}


message DeleteBackupRequest {
  string backup_id = 1;
}

message DeleteBackupMetadata {
  string backup_id = 1;
  string database_id = 2;
}
