bitwarden_api_api/models/access_pre_check_response_model.rs
1/*
2 * Bitwarden Internal API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: latest
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12
13use crate::models;
14
15/// AccessPreCheckResponseModel : The resolved approval outcome for a cipher, without submitting a
16/// request — lets the client present the right workflow (pick a duration vs. pick a window and
17/// justify) before the requester commits.
18#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
19pub struct AccessPreCheckResponseModel {
20 #[serde(
21 rename = "object",
22 alias = "Object",
23 skip_serializing_if = "Option::is_none"
24 )]
25 pub object: Option<String>,
26 #[serde(
27 rename = "cipherId",
28 alias = "CipherId",
29 skip_serializing_if = "Option::is_none"
30 )]
31 pub cipher_id: Option<uuid::Uuid>,
32 #[serde(
33 rename = "approvalMode",
34 alias = "ApprovalMode",
35 skip_serializing_if = "Option::is_none"
36 )]
37 pub approval_mode: Option<models::AccessApprovalMode>,
38 /// True when the caller already holds an active lease: reveal the credential, no request
39 /// needed.
40 #[serde(
41 rename = "hasActiveLease",
42 alias = "HasActiveLease",
43 skip_serializing_if = "Option::is_none"
44 )]
45 pub has_active_lease: Option<bool>,
46 /// The duration, in seconds, the request form should pre-select: the governing rule's default,
47 /// or the global default, clamped to
48 /// Bit.Services.Pam.Api.Models.Response.AccessPreCheckResponseModel.MaxDurationSeconds.
49 #[serde(
50 rename = "defaultDurationSeconds",
51 alias = "DefaultDurationSeconds",
52 skip_serializing_if = "Option::is_none"
53 )]
54 pub default_duration_seconds: Option<i32>,
55 /// The longest duration (automatic path) or window span (human path), in seconds, that a
56 /// request for this cipher may ask for: the governing rule's cap narrowed by the global
57 /// ceiling. Submit enforces the same limit.
58 #[serde(
59 rename = "maxDurationSeconds",
60 alias = "MaxDurationSeconds",
61 skip_serializing_if = "Option::is_none"
62 )]
63 pub max_duration_seconds: Option<i32>,
64 /// Whether access could be started right now. False only when the per-cipher
65 /// single-active-lease constraint binds for this caller and another member holds the slot. A
66 /// hint, re-checked at start; an absent value means true.
67 #[serde(
68 rename = "canStartLease",
69 alias = "CanStartLease",
70 skip_serializing_if = "Option::is_none"
71 )]
72 pub can_start_lease: Option<bool>,
73 /// When the lease holding the slot ends. Null when
74 /// Bit.Services.Pam.Api.Models.Response.AccessPreCheckResponseModel.CanStartLease is true.
75 #[serde(
76 rename = "slotFreesAt",
77 alias = "SlotFreesAt",
78 skip_serializing_if = "Option::is_none"
79 )]
80 pub slot_frees_at: Option<String>,
81}
82
83impl AccessPreCheckResponseModel {
84 /// The resolved approval outcome for a cipher, without submitting a request — lets the client
85 /// present the right workflow (pick a duration vs. pick a window and justify) before the
86 /// requester commits.
87 pub fn new() -> AccessPreCheckResponseModel {
88 AccessPreCheckResponseModel {
89 object: None,
90 cipher_id: None,
91 approval_mode: None,
92 has_active_lease: None,
93 default_duration_seconds: None,
94 max_duration_seconds: None,
95 can_start_lease: None,
96 slot_frees_at: None,
97 }
98 }
99}