syntax = "proto3";

package v1beta2;

option go_package = "github.com/kubernetes-csi/csi-proxy/client/api/volume/v1beta2";

service Volume {
    // ListVolumesOnDisk returns the volume IDs (in \\.\Volume{GUID} format) for
    // all volumes on a Disk device
    rpc ListVolumesOnDisk(ListVolumesOnDiskRequest) returns (ListVolumesOnDiskResponse) {}
    // MountVolume mounts the volume at the requested global staging path
    rpc MountVolume(MountVolumeRequest) returns (MountVolumeResponse) {}
    // DismountVolume gracefully dismounts a volume
    rpc DismountVolume(DismountVolumeRequest) returns (DismountVolumeResponse) {}
    // IsVolumeFormatted checks if a volume is formatted with NTFS
    rpc IsVolumeFormatted(IsVolumeFormattedRequest) returns (IsVolumeFormattedResponse) {}
    // FormatVolume formats a volume with the provided file system
    rpc FormatVolume(FormatVolumeRequest) returns (FormatVolumeResponse) {}
    // ResizeVolume performs resizing of the partition and file system for a block based volume
    rpc ResizeVolume(ResizeVolumeRequest) returns (ResizeVolumeResponse) {}
    // VolumeStats gathers DiskSize, VolumeSize and VolumeUsedSize for a volume
    rpc VolumeStats(VolumeStatsRequest) returns (VolumeStatsResponse) {}
    // GetVolumeDiskNumber gets the disk number of the disk where the volume is located
    rpc GetVolumeDiskNumber(VolumeDiskNumberRequest) returns (VolumeDiskNumberResponse) {}
    // GetVolumeIDFromMount gets the volume id for a given mount
    rpc GetVolumeIDFromMount(VolumeIDFromMountRequest) returns (VolumeIDFromMountResponse) {}
    // WriteVolumeCache write volume cache to disk
    rpc WriteVolumeCache(WriteVolumeCacheRequest) returns (WriteVolumeCacheResponse) {}
}

message ListVolumesOnDiskRequest {
    // Disk device ID of the disk to query for volumes
    string disk_id = 1;
}

message ListVolumesOnDiskResponse {
    // Volume device IDs of volumes on the specified disk
    repeated string volume_ids = 1;
}

message MountVolumeRequest {
    // Volume device ID of the volume to mount
    string volume_id = 1;
    // Path in the host's file system where the volume needs to be mounted
    string path = 2;
}

message MountVolumeResponse {
    // Intentionally empty
}

message DismountVolumeRequest {
    // Volume device ID of the volume to dismount
    string volume_id = 1;
    // Path where the volume has been mounted.
    string path = 2;
}

message DismountVolumeResponse {
    // Intentionally empty
}

message IsVolumeFormattedRequest {
    // Volume device ID of the volume to check
    string volume_id = 1;
}

message IsVolumeFormattedResponse {
    // Is the volume formatted with NTFS
    bool formatted = 1;
}

message FormatVolumeRequest {
    // Volume device ID of the volume to format
    string volume_id = 1;
}

message FormatVolumeResponse {
    // Intentionally empty
}

message ResizeVolumeRequest {
    // Volume device ID of the volume to dismount
    string volume_id = 1;
    // New size of the volume
    int64 size = 2;
}

message ResizeVolumeResponse {
    // Intentionally empty
}

message VolumeStatsRequest{
    // Volume device Id of the volume to get the stats for
    string volume_id = 1;
}

message VolumeStatsResponse{
    // Capacity of the volume
    int64 volumeSize = 1;
    // Used bytes
    int64 volumeUsedSize = 2;
}

message VolumeDiskNumberRequest{
    // Volume device Id of the volume to get the disk number for
    string volume_id = 1;
}

message VolumeDiskNumberResponse{
    // Corresponding disk number
    int64 diskNumber = 1;
}

message VolumeIDFromMountRequest {
    // Mount
    string mount = 1;
}

message VolumeIDFromMountResponse {
    // Mount
    string volume_id = 1;
}

message WriteVolumeCacheRequest {
    // Volume device ID of the volume to flush the cache
    string volume_id = 1;
}

message WriteVolumeCacheResponse {
    // Intentionally empty
}