syntax = "proto3";

option go_package = "v1";
option java_package = "io.stackrox.proto.api.v1";

import "google/api/annotations.proto";
import "api/v1/common.proto";
import "api/v1/search_service.proto";
import "api/v1/empty.proto";
import "storage/multiplier.proto";
import "storage/deployment.proto";

package v1;


message DeploymentLabelsResponse {
    message LabelValues {
        repeated string values = 1;
    }
    map<string, LabelValues> labels     = 1;
    repeated string values              = 2;
}

message GetMultipliersResponse {
    repeated storage.Multiplier multipliers = 1;
}


message ListDeploymentsResponse {
    repeated storage.ListDeployment deployments = 1;
}

message GetDeploymentsResponse {
    repeated storage.Deployment deployments = 1;
}

service DeploymentService {

    rpc GetDeployment (ResourceByID) returns (storage.Deployment) {
        option (google.api.http) = {
            get: "/v1/deployments/{id}"
        };
    }

    rpc ListDeployments (RawQuery) returns (ListDeploymentsResponse) {
        option (google.api.http) = {
            get: "/v1/deployments"
        };
    }

    rpc GetLabels (Empty) returns (DeploymentLabelsResponse) {
        option (google.api.http) = {
            get: "/v1/deployments/metadata/labels"
        };
    }

    rpc GetMultipliers (Empty) returns (GetMultipliersResponse) {
        option (google.api.http) = {
            get: "/v1/deployments/metadata/multipliers"
        };
    }

    rpc AddMultiplier (storage.Multiplier) returns (storage.Multiplier) {
        option (google.api.http) = {
            post: "/v1/deployments/metadata/multipliers"
            body: "*"
        };
    }

    rpc UpdateMultiplier (storage.Multiplier) returns (Empty) {
        option (google.api.http) = {
            put: "/v1/deployments/metadata/multipliers/{id}"
        };
    }

    rpc RemoveMultiplier (ResourceByID) returns (Empty) {
        option (google.api.http) = {
            delete: "/v1/deployments/metadata/multipliers/{id}"
        };
    }
}
