bitwarden_api_api/models/create_rotation_config_request_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/// CreateRotationConfigRequestModel : Creates a rotation config for a cipher (spec
16/// `CreateRotationConfig`).
17/// Bit.Services.Pam.AccessConnector.Rotation.Api.Models.Request.CreateRotationConfigRequestModel.
18/// ScheduleCron is a Quartz 6-field cron expression; null means no scheduled rotation (on-demand
19/// and/or access-end only).
20#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
21pub struct CreateRotationConfigRequestModel {
22 /// The organization cipher holding the credential this config rotates. A cipher has at most
23 /// one rotation config.
24 #[serde(rename = "cipherId", alias = "CipherId")]
25 pub cipher_id: uuid::Uuid,
26 /// The target system the rotated account lives on.
27 #[serde(rename = "targetSystemId", alias = "TargetSystemId")]
28 pub target_system_id: uuid::Uuid,
29 /// The account this config rotates on the target system. Opaque to the server -- never parsed.
30 #[serde(rename = "accountIdentity", alias = "AccountIdentity")]
31 pub account_identity: String,
32 /// When true, the access connector terminates the account's live sessions after each rotation.
33 /// Only an automatic target that supports session termination can honour it.
34 #[serde(
35 rename = "terminateSessions",
36 alias = "TerminateSessions",
37 skip_serializing_if = "Option::is_none"
38 )]
39 pub terminate_sessions: Option<bool>,
40 /// The scheduled-rotation cadence, as a Quartz 6-field cron expression evaluated in UTC. Null
41 /// means no scheduled rotation -- the config rotates on demand and/or on access end only.
42 #[serde(
43 rename = "scheduleCron",
44 alias = "ScheduleCron",
45 skip_serializing_if = "Option::is_none"
46 )]
47 pub schedule_cron: Option<String>,
48 /// When true, the credential is rotated whenever an access lease on the cipher ends, whether
49 /// it expired or was revoked.
50 #[serde(
51 rename = "rotateOnAccessEnd",
52 alias = "RotateOnAccessEnd",
53 skip_serializing_if = "Option::is_none"
54 )]
55 pub rotate_on_access_end: Option<bool>,
56}
57
58impl CreateRotationConfigRequestModel {
59 /// Creates a rotation config for a cipher (spec `CreateRotationConfig`).
60 /// Bit.Services.Pam.AccessConnector.Rotation.Api.Models.Request.
61 /// CreateRotationConfigRequestModel.ScheduleCron is a Quartz 6-field cron expression; null
62 /// means no scheduled rotation (on-demand and/or access-end only).
63 pub fn new(
64 cipher_id: uuid::Uuid,
65 target_system_id: uuid::Uuid,
66 account_identity: String,
67 ) -> CreateRotationConfigRequestModel {
68 CreateRotationConfigRequestModel {
69 cipher_id,
70 target_system_id,
71 account_identity,
72 terminate_sessions: None,
73 schedule_cron: None,
74 rotate_on_access_end: None,
75 }
76 }
77}