ora 0.12.7

Part of the Ora scheduler framework.
Documentation
// This file is @generated by prost-build.
/// A schedule is a tool for executing jobs at a specific times.
///
/// Schedules create new jobs based on various criteria.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Schedule {
    /// The repeat policy for the schedule.
    #[prost(message, optional, tag = "1")]
    pub scheduling: ::core::option::Option<SchedulingPolicy>,
    /// The job to be used as a template
    /// when creating new jobs.
    #[prost(message, optional, tag = "2")]
    pub job_template: ::core::option::Option<super::super::jobs::v1::Job>,
    /// The labels of the schedule.
    #[prost(message, repeated, tag = "3")]
    pub labels: ::prost::alloc::vec::Vec<super::super::common::v1::Label>,
    /// The time range for the schedule.
    ///
    /// The schedule will not create jobs outside of the time range.
    /// If the time range is not provided, the schedule will create jobs
    /// indefinitely.
    #[prost(message, optional, tag = "4")]
    pub time_range: ::core::option::Option<super::super::common::v1::TimeRange>,
}
impl ::prost::Name for Schedule {
    const NAME: &'static str = "Schedule";
    const PACKAGE: &'static str = "ora.schedules.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.schedules.v1.Schedule".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.schedules.v1.Schedule".into()
    }
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SchedulingPolicy {
    /// The policy for repeating jobs.
    #[prost(oneof = "scheduling_policy::Policy", tags = "1, 2")]
    pub policy: ::core::option::Option<scheduling_policy::Policy>,
}
/// Nested message and enum types in `SchedulingPolicy`.
pub mod scheduling_policy {
    /// The policy for repeating jobs.
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum Policy {
        /// Repeat jobs with a given interval.
        #[prost(message, tag = "1")]
        Interval(super::SchedulingPolicyInterval),
        /// Repeat jobs according to a cron expression.
        #[prost(message, tag = "2")]
        Cron(super::SchedulingPolicyCron),
    }
}
impl ::prost::Name for SchedulingPolicy {
    const NAME: &'static str = "SchedulingPolicy";
    const PACKAGE: &'static str = "ora.schedules.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.schedules.v1.SchedulingPolicy".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.schedules.v1.SchedulingPolicy".into()
    }
}
/// Repeat jobs with a given interval.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SchedulingPolicyInterval {
    /// The interval between each job.
    #[prost(message, optional, tag = "1")]
    pub interval: ::core::option::Option<::prost_types::Duration>,
    /// Whether to immediately create a job
    /// when the schedule is created.
    #[prost(bool, tag = "2")]
    pub immediate: bool,
    /// The policy for missed jobs.
    #[prost(enumeration = "MissedTimePolicy", tag = "3")]
    pub missed_time_policy: i32,
}
impl ::prost::Name for SchedulingPolicyInterval {
    const NAME: &'static str = "SchedulingPolicyInterval";
    const PACKAGE: &'static str = "ora.schedules.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.schedules.v1.SchedulingPolicyInterval".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.schedules.v1.SchedulingPolicyInterval".into()
    }
}
/// Repeat jobs according to a cron expression.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SchedulingPolicyCron {
    /// The cron expression for the schedule.
    ///
    /// The reference implementation uses the cron expression
    /// format supported by the `cronexpr` Rust crate (<<https://docs.rs/cronexpr/latest/cronexpr/>>).
    #[prost(string, tag = "1")]
    pub cron_expression: ::prost::alloc::string::String,
    /// Whether to immediately create a job
    /// when the schedule is created.
    #[prost(bool, tag = "2")]
    pub immediate: bool,
    /// The policy for missed jobs.
    #[prost(enumeration = "MissedTimePolicy", tag = "3")]
    pub missed_time_policy: i32,
}
impl ::prost::Name for SchedulingPolicyCron {
    const NAME: &'static str = "SchedulingPolicyCron";
    const PACKAGE: &'static str = "ora.schedules.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.schedules.v1.SchedulingPolicyCron".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.schedules.v1.SchedulingPolicyCron".into()
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum MissedTimePolicy {
    /// The policy is unspecified.
    Unspecified = 0,
    /// Skip the missed times.
    Skip = 1,
    /// Create a job for each missed time.
    Create = 2,
}
impl MissedTimePolicy {
    /// 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::Unspecified => "MISSED_TIME_POLICY_UNSPECIFIED",
            Self::Skip => "MISSED_TIME_POLICY_SKIP",
            Self::Create => "MISSED_TIME_POLICY_CREATE",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "MISSED_TIME_POLICY_UNSPECIFIED" => Some(Self::Unspecified),
            "MISSED_TIME_POLICY_SKIP" => Some(Self::Skip),
            "MISSED_TIME_POLICY_CREATE" => Some(Self::Create),
            _ => None,
        }
    }
}