syntax = "proto3";

package config_checker.v1;

import "google/api/field_behavior.proto";
import "google/protobuf/empty.proto";

service ConfigCheckerService {
  rpc CheckConfiguration(CheckConfigurationRequest) returns (CheckConfigurationResponse) {}
  rpc SetupImage(SetupImageRequest) returns (google.protobuf.Empty) {}
  rpc ListImages(ListImagesRequest) returns (ListImagesResponse) {}
  rpc TearDownImages(TearDownImagesRequest) returns (TearDownImagesResponse) {}
}

message Target {
  string component = 1 [(google.api.field_behavior) = REQUIRED];
  string version = 2 [(google.api.field_behavior) = REQUIRED];
}

message Image {
  Target target = 1 [(google.api.field_behavior) = REQUIRED];
  string image_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  repeated string image_names = 5 [(google.api.field_behavior) = REQUIRED];
  int64 created_at = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
}

message CheckConfigurationRequest {
  Target target = 1 [(google.api.field_behavior) = REQUIRED];
  string configuration = 2 [(google.api.field_behavior) = REQUIRED];
}

message CheckConfigurationResponse {
  string err_msg = 1;
}

message SetupImageRequest {
  Target target = 1 [(google.api.field_behavior) = REQUIRED];
}

message ListImagesRequest {}

message ListImagesResponse {
  repeated Image images = 1;
}

message TearDownImagesRequest {
  repeated Target targets = 1 [(google.api.field_behavior) = REQUIRED];
}

message TearDownImagesResponse {
  repeated string deleted = 1;
  repeated string untagged = 2;
}
