// Copyright 2018 Istio Authors
//
// 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 Type, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

// $title: CloudWatch
// $description: Adapter for cloudwatch metrics.
// $location: https://istio.io/docs/reference/config/policy-and-telemetry/adapters/cloudwatch.html
// $aliases:
// $  - /docs/reference/config/adapters/cloudwatch.html

// The CloudWatch adapter enables Istio to deliver metrics to
// [Amazon CloudWatch](https://aws.amazon.com/cloudwatch/).
//
// To push metrics to CloudWatch using this adapter you must provide AWS credentials the AWS SDK.
// (see [AWS docs](https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/setup-credentials.html)).
//
// The handler configuration must contain the same metrics as the instance configuration.
// The metrics specified in both instance and handler configurations will be sent to CloudWatch.
//
// This adapter supports the [metric template](https://istio.io/docs/reference/config/policy-and-telemetry/templates/metric/).
package adapter.cloudwatch.config;

option go_package="config";

// Configuration for the `cloudwatch` adapter.
message Params {
    // CloudWatch metric namespace.
    string namespace = 1;

    // A map of Istio metric name to CloudWatch metric info.
    map<string, MetricDatum> metric_info = 2;

    // CloudWatch metric format.
    message MetricDatum {
      enum Unit {
        None = 0;
        Seconds = 1;
        Microseconds = 2;
        Milliseconds = 3;
        Count = 4;
        Bytes = 5;
        Kilobytes = 6;
        Megabytes = 7;
        Gigabytes = 8;
        Terabytes = 9;
        Bits = 10;
        Kilobits = 11;
        Megabits = 12;
        Gigabits = 13;
        Terabits = 14;
        Percent = 15;
        Bytes_Second = 16;
        Kilobytes_Second = 17;
        Megabytes_Second = 18;
        Gigabytes_Second = 19;
        Terabytes_Second = 20;
        Bits_Second = 21;
        Kilobits_Second = 22;
        Megabits_Second = 23;
        Gigabits_Second = 24;
        Terabits_Second = 25;
        Count_Second = 26;
      }
      // The unit of the metric. Must be valid cloudwatch unit value.
      // [CloudWatch docs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html)
      Unit unit = 3;
    }
}
