syntax = "proto3";

package v1beta2;

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

service Disk {
    // ListDiskLocations returns locations <Adapter, Bus, Target, LUN ID> of all
    // disk devices enumerated by the host
    rpc ListDiskLocations(ListDiskLocationsRequest) returns (ListDiskLocationsResponse) {}

    // PartitionDisk initializes and partitions a disk device (if the disk has not
    // been partitioned already) and returns the resulting volume device ID
    rpc PartitionDisk(PartitionDiskRequest) returns (PartitionDiskResponse) {}

    // Rescan refreshes the host's storage cache
    rpc Rescan(RescanRequest) returns (RescanResponse) {}

    // ListDiskIDs returns a map of DiskID objects where the key is the disk number
    rpc ListDiskIDs(ListDiskIDsRequest) returns (ListDiskIDsResponse) {}

    // DiskStats returns the stats for the disk
    rpc DiskStats(DiskStatsRequest) returns (DiskStatsResponse) {}

    // SetAttachState sets the offline/online state of a disk
    rpc SetAttachState(SetAttachStateRequest) returns (SetAttachStateResponse) {}

    // GetAttachState gets the offline/online state of a disk
    rpc GetAttachState(GetAttachStateRequest) returns (GetAttachStateResponse) {}
}

message ListDiskLocationsRequest {
    // Intentionally empty
}

message DiskLocation {
    string Adapter = 1;
    string Bus = 2;
    string Target = 3;
    string LUNID = 4;
}

message ListDiskLocationsResponse {
    // Map of disk device IDs and <adapter, bus, target, lun ID> associated with each disk device
    map <string, DiskLocation> disk_locations = 1;
}

message PartitionDiskRequest {
    // Disk device ID of the disk to partition
    string diskID = 1;
}

message PartitionDiskResponse {
    // Intentionally empty
}

message RescanRequest {
    // Intentionally empty
}

message RescanResponse {
    // Intentionally empty
}

message ListDiskIDsRequest {
    // Intentionally empty
}

message DiskIDs {
    // Map of Disk ID types and Disk ID values
    map <string, string> identifiers = 1;
}

message ListDiskIDsResponse {
    // Map of disk device numbers and IDs <page83> associated with each disk device
    map <string, DiskIDs> diskIDs = 1;
}

message DiskStatsRequest {
    // Disk device ID of the disk to get the size from
    string diskID = 1;
}

message DiskStatsResponse {
    //Total size of the volume
    int64 diskSize = 1;
}

message SetAttachStateRequest {
    // Disk device ID (number) of the disk which state will change
    string diskID = 1;

    // Online state to set for the disk. true for online, false for offline
    bool isOnline = 2;
}

message SetAttachStateResponse {
}

message GetAttachStateRequest {
    // Disk device ID (number) of the disk
    string diskID = 1;
}

message GetAttachStateResponse {
    // Online state of the disk. true for online, false for offline
    bool isOnline = 1;
}

