// Copyright 2017 Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";
package prometheus;

import "types.proto";
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";
import "gogoproto/gogo.proto";

option go_package = "prompb";

option (gogoproto.sizer_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.goproto_getters_all) = false;


service Admin {
  // Snapshot creates a snapshot of all current data into 'snapshots/<datetime>-<rand>' under the TSDB's data directory.
  rpc TSDBSnapshot(TSDBSnapshotRequest) returns (TSDBSnapshotResponse) {
    option (google.api.http) = {
      post: "/v2/admin/tsdb/snapshot"
    };
  }

  // CleanTombstones removes the deleted data from disk and cleans up the existing tombstones.
  rpc TSDBCleanTombstones(TSDBCleanTombstonesRequest) returns (TSDBCleanTombstonesResponse) {
    option (google.api.http) = {
      post: "/v2/admin/tsdb/clean_tombstones"
    };
  }

  // DeleteSeries deletes data for a selection of series in a time range.
  rpc DeleteSeries(SeriesDeleteRequest) returns (SeriesDeleteResponse) {
    option (google.api.http) = {
      post: "/v2/admin/tsdb/delete_series"
      body: "*"
    };
  }
}


message TSDBSnapshotRequest {
  bool skip_head = 1;
}

message TSDBSnapshotResponse {
  string name = 1;
}

message TSDBCleanTombstonesRequest {
}

message TSDBCleanTombstonesResponse {
}

message SeriesDeleteRequest {
  google.protobuf.Timestamp min_time = 1 [(gogoproto.stdtime) = true];
  google.protobuf.Timestamp max_time = 2 [(gogoproto.stdtime) = true];
  repeated LabelMatcher matchers     = 3 [(gogoproto.nullable) = false];
}

message SeriesDeleteResponse {
}