Skip to main content

orvanta_api/models/
workspace_entitlements.rs

1/*
2 * Orvanta API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 6.5.0
7 * Contact: contact@orvanta.cloud
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct WorkspaceEntitlements {
16    #[serde(rename = "tier")]
17    pub tier: Tier,
18    #[serde(rename = "expires_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
19    pub expires_at: Option<Option<String>>,
20    #[serde(rename = "limits")]
21    pub limits: serde_json::Value,
22    #[serde(rename = "seats", deserialize_with = "Option::deserialize")]
23    pub seats: Option<Box<models::WorkspaceEntitlementsSeats>>,
24    #[serde(rename = "seats_used", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25    pub seats_used: Option<Option<Box<models::WorkspaceEntitlementsSeatsUsed>>>,
26    #[serde(rename = "licence_mode")]
27    pub licence_mode: models::LicenceMode,
28    /// whose licence answers -- the instance's or the workspace's own
29    #[serde(rename = "scope")]
30    pub scope: Scope,
31    #[serde(rename = "state")]
32    pub state: models::LicenceHealth,
33    #[serde(rename = "read_only")]
34    pub read_only: bool,
35    #[serde(rename = "first_failure_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
36    pub first_failure_at: Option<Option<String>>,
37    #[serde(rename = "grace_deadline", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
38    pub grace_deadline: Option<Option<String>>,
39    #[serde(rename = "missing_since", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
40    pub missing_since: Option<Option<String>>,
41}
42
43impl WorkspaceEntitlements {
44    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 {
45        WorkspaceEntitlements {
46            tier,
47            expires_at: None,
48            limits,
49            seats: if let Some(x) = seats {Some(Box::new(x))} else {None},
50            seats_used: None,
51            licence_mode,
52            scope,
53            state,
54            read_only,
55            first_failure_at: None,
56            grace_deadline: None,
57            missing_since: None,
58        }
59    }
60}
61/// 
62#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
63pub enum Tier {
64    #[serde(rename = "trial")]
65    Trial,
66    #[serde(rename = "solo")]
67    Solo,
68    #[serde(rename = "teams")]
69    Teams,
70    #[serde(rename = "business")]
71    Business,
72    #[serde(rename = "enterprise")]
73    Enterprise,
74}
75
76impl Default for Tier {
77    fn default() -> Tier {
78        Self::Trial
79    }
80}
81/// whose licence answers -- the instance's or the workspace's own
82#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
83pub enum Scope {
84    #[serde(rename = "instance")]
85    Instance,
86    #[serde(rename = "workspace")]
87    Workspace,
88}
89
90impl Default for Scope {
91    fn default() -> Scope {
92        Self::Instance
93    }
94}
95