orvanta-api 6.5.0

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
Documentation
/*
 * Orvanta API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 6.5.0
 * Contact: contact@orvanta.cloud
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WorkspaceEntitlements {
    #[serde(rename = "tier")]
    pub tier: Tier,
    #[serde(rename = "expires_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub expires_at: Option<Option<String>>,
    #[serde(rename = "limits")]
    pub limits: serde_json::Value,
    #[serde(rename = "seats", deserialize_with = "Option::deserialize")]
    pub seats: Option<Box<models::WorkspaceEntitlementsSeats>>,
    #[serde(rename = "seats_used", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub seats_used: Option<Option<Box<models::WorkspaceEntitlementsSeatsUsed>>>,
    #[serde(rename = "licence_mode")]
    pub licence_mode: models::LicenceMode,
    /// whose licence answers -- the instance's or the workspace's own
    #[serde(rename = "scope")]
    pub scope: Scope,
    #[serde(rename = "state")]
    pub state: models::LicenceHealth,
    #[serde(rename = "read_only")]
    pub read_only: bool,
    #[serde(rename = "first_failure_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub first_failure_at: Option<Option<String>>,
    #[serde(rename = "grace_deadline", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub grace_deadline: Option<Option<String>>,
    #[serde(rename = "missing_since", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub missing_since: Option<Option<String>>,
}

impl WorkspaceEntitlements {
    pub fn new(tier: Tier, limits: serde_json::Value, seats: Option<models::WorkspaceEntitlementsSeats>, licence_mode: models::LicenceMode, scope: Scope, state: models::LicenceHealth, read_only: bool) -> WorkspaceEntitlements {
        WorkspaceEntitlements {
            tier,
            expires_at: None,
            limits,
            seats: if let Some(x) = seats {Some(Box::new(x))} else {None},
            seats_used: None,
            licence_mode,
            scope,
            state,
            read_only,
            first_failure_at: None,
            grace_deadline: None,
            missing_since: None,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Tier {
    #[serde(rename = "trial")]
    Trial,
    #[serde(rename = "solo")]
    Solo,
    #[serde(rename = "teams")]
    Teams,
    #[serde(rename = "business")]
    Business,
    #[serde(rename = "enterprise")]
    Enterprise,
}

impl Default for Tier {
    fn default() -> Tier {
        Self::Trial
    }
}
/// whose licence answers -- the instance's or the workspace's own
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Scope {
    #[serde(rename = "instance")]
    Instance,
    #[serde(rename = "workspace")]
    Workspace,
}

impl Default for Scope {
    fn default() -> Scope {
        Self::Instance
    }
}