envoy-types 0.7.5

Collection of protobuf types and other assets to work with the Envoy Proxy through Rust gRPC services.
Documentation
// This file is @generated by prost-build.
/// Rate limit configuration for a single domain.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RateLimitConfig {
    /// Name of the rate limit configuration. This should be unique for each configuration.
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// Domain name for the rate limit configuration.
    #[prost(string, tag = "2")]
    pub domain: ::prost::alloc::string::String,
    /// List of rate limit configuration descriptors.
    #[prost(message, repeated, tag = "3")]
    pub descriptors: ::prost::alloc::vec::Vec<RateLimitDescriptor>,
}
impl ::prost::Name for RateLimitConfig {
    const NAME: &'static str = "RateLimitConfig";
    const PACKAGE: &'static str = "ratelimit.config.ratelimit.v3";
    fn full_name() -> ::prost::alloc::string::String {
        "ratelimit.config.ratelimit.v3.RateLimitConfig".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "type.googleapis.com/ratelimit.config.ratelimit.v3.RateLimitConfig".into()
    }
}
/// Rate limit configuration descriptor.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RateLimitDescriptor {
    /// Key of the descriptor.
    #[prost(string, tag = "1")]
    pub key: ::prost::alloc::string::String,
    /// Optional value of the descriptor.
    #[prost(string, tag = "2")]
    pub value: ::prost::alloc::string::String,
    /// Rate limit policy of the descriptor.
    #[prost(message, optional, tag = "3")]
    pub rate_limit: ::core::option::Option<RateLimitPolicy>,
    /// List of sub rate limit descriptors.
    #[prost(message, repeated, tag = "4")]
    pub descriptors: ::prost::alloc::vec::Vec<RateLimitDescriptor>,
    /// Mark the descriptor as shadow. When the values is true, rate limit service allow requests to the backend.
    #[prost(bool, tag = "5")]
    pub shadow_mode: bool,
    /// Setting the `detailed_metric: true` for a descriptor will extend the metrics that are produced.
    #[prost(bool, tag = "6")]
    pub detailed_metric: bool,
    /// Mark the descriptor as quota mode. When quota_mode is true, the rate limit service will allow
    /// requests until all quota descriptors are over the limit.
    #[prost(bool, tag = "7")]
    pub quota_mode: bool,
}
impl ::prost::Name for RateLimitDescriptor {
    const NAME: &'static str = "RateLimitDescriptor";
    const PACKAGE: &'static str = "ratelimit.config.ratelimit.v3";
    fn full_name() -> ::prost::alloc::string::String {
        "ratelimit.config.ratelimit.v3.RateLimitDescriptor".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "type.googleapis.com/ratelimit.config.ratelimit.v3.RateLimitDescriptor".into()
    }
}
/// Rate-limit policy.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RateLimitPolicy {
    /// Unit of time for the rate limit.
    #[prost(enumeration = "RateLimitUnit", tag = "1")]
    pub unit: i32,
    /// Number of requests allowed in the policy within `unit` time.
    #[prost(uint32, tag = "2")]
    pub requests_per_unit: u32,
    /// Mark the rate limit policy as unlimited. All requests are allowed to the backend.
    #[prost(bool, tag = "3")]
    pub unlimited: bool,
    /// Optional name for the rate limit policy. Name the policy, if it should be replaced (dropped evaluation) by
    /// another policy.
    #[prost(string, tag = "4")]
    pub name: ::prost::alloc::string::String,
    /// List of rate limit policies, this rate limit policy will replace (drop evaluation)
    /// For more information: <https://github.com/envoyproxy/ratelimit/tree/0b2f4d5fb04bf55e1873e2c5e2bb28da67c0643f#replaces>
    /// Example: <https://github.com/envoyproxy/ratelimit/tree/0b2f4d5fb04bf55e1873e2c5e2bb28da67c0643f#example-7>
    #[prost(message, repeated, tag = "5")]
    pub replaces: ::prost::alloc::vec::Vec<RateLimitReplace>,
}
impl ::prost::Name for RateLimitPolicy {
    const NAME: &'static str = "RateLimitPolicy";
    const PACKAGE: &'static str = "ratelimit.config.ratelimit.v3";
    fn full_name() -> ::prost::alloc::string::String {
        "ratelimit.config.ratelimit.v3.RateLimitPolicy".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "type.googleapis.com/ratelimit.config.ratelimit.v3.RateLimitPolicy".into()
    }
}
/// Replace specifies the rate limit policy that should be replaced (dropped evaluation).
/// For more information: <https://github.com/envoyproxy/ratelimit/tree/0b2f4d5fb04bf55e1873e2c5e2bb28da67c0643f#replaces>
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RateLimitReplace {
    /// Name of the rate limit policy, that is being replaced (dropped evaluation).
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
}
impl ::prost::Name for RateLimitReplace {
    const NAME: &'static str = "RateLimitReplace";
    const PACKAGE: &'static str = "ratelimit.config.ratelimit.v3";
    fn full_name() -> ::prost::alloc::string::String {
        "ratelimit.config.ratelimit.v3.RateLimitReplace".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "type.googleapis.com/ratelimit.config.ratelimit.v3.RateLimitReplace".into()
    }
}
/// Identifies the unit of of time for rate limit.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum RateLimitUnit {
    /// The time unit is not known.
    Unknown = 0,
    /// The time unit representing a second.
    Second = 1,
    /// The time unit representing a minute.
    Minute = 2,
    /// The time unit representing an hour.
    Hour = 3,
    /// The time unit representing a day.
    Day = 4,
    /// The time unit representing a week.
    Week = 7,
    /// The time unit representing a month.
    Month = 5,
    /// The time unit representing a year.
    Year = 6,
}
impl RateLimitUnit {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unknown => "UNKNOWN",
            Self::Second => "SECOND",
            Self::Minute => "MINUTE",
            Self::Hour => "HOUR",
            Self::Day => "DAY",
            Self::Week => "WEEK",
            Self::Month => "MONTH",
            Self::Year => "YEAR",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "UNKNOWN" => Some(Self::Unknown),
            "SECOND" => Some(Self::Second),
            "MINUTE" => Some(Self::Minute),
            "HOUR" => Some(Self::Hour),
            "DAY" => Some(Self::Day),
            "WEEK" => Some(Self::Week),
            "MONTH" => Some(Self::Month),
            "YEAR" => Some(Self::Year),
            _ => None,
        }
    }
}