
// This file was autogenerated by go-to-protobuf. Do not edit it manually!

syntax = "proto2";

package github.com.akuity.kargo.internal.controller.rollouts.api.v1alpha1;

import "k8s.io/api/batch/v1/generated.proto";
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";

// Package-wide variables from generator "generated".
option go_package = "github.com/akuity/kargo/internal/controller/rollouts/api/v1alpha1";

message AnalysisRun {
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;

  optional AnalysisRunSpec spec = 2;

  optional AnalysisRunStatus status = 3;
}

message AnalysisRunList {
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;

  repeated AnalysisRun items = 2;
}

message AnalysisRunSpec {
  repeated Metric metrics = 1;

  repeated Argument args = 2;

  optional bool terminate = 3;

  repeated DryRun dryRun = 4;

  repeated MeasurementRetention measurementRetention = 5;
}

message AnalysisRunStatus {
  optional string phase = 1;

  optional string message = 2;

  repeated MetricResult metricResults = 3;

  optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time startedAt = 4;

  optional RunSummary runSummary = 5;

  optional RunSummary dryRunSummary = 6;
}

message AnalysisTemplate {
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;

  optional AnalysisTemplateSpec spec = 2;
}

message AnalysisTemplateList {
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;

  repeated AnalysisTemplate items = 2;
}

message AnalysisTemplateSpec {
  repeated Metric metrics = 1;

  repeated Argument args = 2;

  repeated DryRun dryRun = 3;

  repeated MeasurementRetention measurementRetention = 4;
}

message Argument {
  optional string name = 1;

  optional string value = 2;

  optional ValueFrom valueFrom = 3;
}

message Authentication {
  optional Sigv4Config sigv4 = 1;

  optional OAuth2Config oauth2 = 2;
}

message CloudWatchMetric {
  optional string interval = 1;

  repeated CloudWatchMetricDataQuery metricDataQueries = 2;
}

message CloudWatchMetricDataQuery {
  optional string id = 1;

  optional string expression = 2;

  optional string label = 3;

  optional CloudWatchMetricStat metricStat = 4;

  optional .k8s.io.apimachinery.pkg.util.intstr.IntOrString period = 5;

  optional bool returnData = 6;
}

message CloudWatchMetricStat {
  optional CloudWatchMetricStatMetric metric = 1;

  optional .k8s.io.apimachinery.pkg.util.intstr.IntOrString period = 2;

  optional string stat = 3;

  optional string unit = 4;
}

message CloudWatchMetricStatMetric {
  repeated CloudWatchMetricStatMetricDimension dimensions = 1;

  optional string metricName = 2;

  optional string namespace = 3;
}

message CloudWatchMetricStatMetricDimension {
  optional string name = 1;

  optional string value = 2;
}

message DatadogMetric {
  optional string interval = 1;

  optional string query = 2;

  map<string, string> queries = 3;

  optional string formula = 4;

  optional string apiVersion = 5;
}

message DryRun {
  optional string metricName = 1;
}

message FieldRef {
  // Required: Path of the field to select in the specified API version
  optional string fieldPath = 1;
}

message GraphiteMetric {
  optional string address = 1;

  optional string query = 2;
}

message InfluxdbMetric {
  optional string profile = 1;

  optional string query = 2;
}

message JobMetric {
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;

  optional .k8s.io.api.batch.v1.JobSpec spec = 2;
}

message KayentaMetric {
  optional string address = 1;

  optional string application = 2;

  optional string canaryConfigName = 3;

  optional string metricsAccountName = 4;

  optional string configurationAccountName = 5;

  optional string storageAccountName = 6;

  optional KayentaThreshold threshold = 7;

  repeated KayentaScope scopes = 8;
}

message KayentaScope {
  optional string name = 1;

  optional ScopeDetail controlScope = 2;

  optional ScopeDetail experimentScope = 3;
}

message KayentaThreshold {
  optional int64 pass = 1;

  optional int64 marginal = 2;
}

message Measurement {
  optional string phase = 1;

  optional string message = 2;

  optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time startedAt = 3;

  optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time finishedAt = 4;

  optional string value = 5;

  map<string, string> metadata = 6;

  optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time resumeAt = 7;
}

message MeasurementRetention {
  optional string metricName = 1;

  optional int32 limit = 2;
}

message Metric {
  optional string name = 1;

  optional string interval = 2;

  optional string initialDelay = 3;

  optional .k8s.io.apimachinery.pkg.util.intstr.IntOrString count = 4;

  optional string successCondition = 5;

  optional string failureCondition = 6;

  optional .k8s.io.apimachinery.pkg.util.intstr.IntOrString failureLimit = 7;

  optional .k8s.io.apimachinery.pkg.util.intstr.IntOrString inconclusiveLimit = 8;

  optional .k8s.io.apimachinery.pkg.util.intstr.IntOrString consecutiveErrorLimit = 9;

  optional MetricProvider provider = 10;
}

message MetricProvider {
  optional PrometheusMetric prometheus = 1;

  optional KayentaMetric kayenta = 2;

  optional WebMetric web = 3;

  optional DatadogMetric datadog = 4;

  optional WavefrontMetric wavefront = 5;

  optional NewRelicMetric newRelic = 6;

  optional JobMetric job = 7;

  optional CloudWatchMetric cloudWatch = 8;

  optional GraphiteMetric graphite = 9;

  optional InfluxdbMetric influxdb = 10;

  optional SkyWalkingMetric skywalking = 11;

  map<string, bytes> plugin = 12;
}

message MetricResult {
  optional string name = 1;

  optional string phase = 2;

  repeated Measurement measurements = 3;

  optional string message = 4;

  optional int32 count = 5;

  optional int32 successful = 6;

  optional int32 failed = 7;

  optional int32 inconclusive = 8;

  optional int32 error = 9;

  optional int32 consecutiveError = 10;

  optional bool dryRun = 11;

  map<string, string> metadata = 12;
}

message NewRelicMetric {
  optional string profile = 1;

  optional string query = 2;
}

message OAuth2Config {
  optional string tokenUrl = 1;

  optional string clientId = 2;

  optional string clientSecret = 3;

  repeated string scopes = 4;
}

message PrometheusMetric {
  optional string address = 1;

  optional string query = 2;

  optional Authentication authentication = 3;

  optional int64 timeout = 4;

  optional bool insecure = 5;

  repeated WebMetricHeader headers = 6;
}

message RunSummary {
  optional int32 count = 1;

  optional int32 successful = 2;

  optional int32 failed = 3;

  optional int32 inconclusive = 4;

  optional int32 error = 5;
}

message ScopeDetail {
  optional string scope = 1;

  optional string region = 2;

  optional int64 step = 3;

  optional string start = 4;

  optional string end = 5;
}

message SecretKeyRef {
  optional string name = 1;

  optional string key = 2;
}

message Sigv4Config {
  optional string region = 1;

  optional string profile = 2;

  optional string roleArn = 3;
}

message SkyWalkingMetric {
  optional string address = 1;

  optional string query = 2;

  optional string interval = 3;
}

message ValueFrom {
  optional SecretKeyRef secretKeyRef = 1;

  optional FieldRef fieldRef = 2;
}

message WavefrontMetric {
  optional string address = 1;

  optional string query = 2;
}

message WebMetric {
  optional string method = 1;

  // URL is the address of the web metric
  optional string url = 2;

  repeated WebMetricHeader headers = 3;

  optional string body = 4;

  optional int64 timeoutSeconds = 5;

  optional string jsonPath = 6;

  optional bool insecure = 7;

  optional bytes jsonBody = 8;

  optional Authentication authentication = 9;
}

message WebMetricHeader {
  optional string key = 1;

  optional string value = 2;
}

