Skip to main content

nominal_api_conjure/conjure/objects/authorization/
issue_sandbox_token_request.rs

1/// Request a short-lived bearer token for one of the sandbox workspaces configured
2/// on the gatekeeper service. Intended for in-cluster integration test runners.
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Serialize,
7    conjure_object::serde::Deserialize,
8    PartialEq,
9    Eq,
10    PartialOrd,
11    Ord,
12    Hash
13)]
14#[serde(crate = "conjure_object::serde")]
15#[conjure_object::private::staged_builder::staged_builder]
16#[builder(crate = conjure_object::private::staged_builder, update, inline)]
17pub struct IssueSandboxTokenRequest {
18    #[builder(default, into)]
19    #[serde(
20        rename = "requestedTtlSeconds",
21        skip_serializing_if = "Option::is_none",
22        default
23    )]
24    requested_ttl_seconds: Option<conjure_object::SafeLong>,
25    #[builder(default, into)]
26    #[serde(
27        rename = "sandboxWorkspace",
28        skip_serializing_if = "Option::is_none",
29        default
30    )]
31    sandbox_workspace: Option<super::SandboxWorkspace>,
32}
33impl IssueSandboxTokenRequest {
34    /// Constructs a new instance of the type.
35    #[inline]
36    pub fn new() -> Self {
37        Self::builder().build()
38    }
39    /// Desired token lifetime in seconds. Capped server-side at 3600 (1h).
40    /// Omit to use the server default (the cap). Non-positive values are
41    /// rejected with SandboxTokenUnavailable rather than silently
42    /// upgraded to the cap.
43    #[inline]
44    pub fn requested_ttl_seconds(&self) -> Option<conjure_object::SafeLong> {
45        self.requested_ttl_seconds.as_ref().map(|o| *o)
46    }
47    /// Which sandbox workspace to create a token for. The default is PRIMARY.
48    #[inline]
49    pub fn sandbox_workspace(&self) -> Option<&super::SandboxWorkspace> {
50        self.sandbox_workspace.as_ref().map(|o| &*o)
51    }
52}