Skip to main content

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#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
18pub struct CreateRotationConfigRequestModel {
19    /// The organization cipher to rotate. A cipher has at most one rotation config.
20    #[serde(rename = "cipherId", alias = "CipherId")]
21    pub cipher_id: uuid::Uuid,
22    #[serde(rename = "targetSystemId", alias = "TargetSystemId")]
23    pub target_system_id: uuid::Uuid,
24    /// The config's sealed blob.
25    #[serde(rename = "sealedData", alias = "SealedData")]
26    pub sealed_data: String,
27    /// The content key of the sealed blob, wrapped by the organization key.
28    #[serde(rename = "wrappedKey", alias = "WrappedKey")]
29    pub wrapped_key: String,
30    /// A Quartz 6-field cron expression evaluated in UTC. Null means no scheduled rotation.
31    #[serde(
32        rename = "scheduleCron",
33        alias = "ScheduleCron",
34        skip_serializing_if = "Option::is_none"
35    )]
36    pub schedule_cron: Option<String>,
37    /// When true, the credential rotates whenever a lease on the cipher ends, however it ended.
38    #[serde(
39        rename = "rotateOnAccessEnd",
40        alias = "RotateOnAccessEnd",
41        skip_serializing_if = "Option::is_none"
42    )]
43    pub rotate_on_access_end: Option<bool>,
44}
45
46impl CreateRotationConfigRequestModel {
47    /// Creates a rotation config for a cipher (spec `CreateRotationConfig`).
48    pub fn new(
49        cipher_id: uuid::Uuid,
50        target_system_id: uuid::Uuid,
51        sealed_data: String,
52        wrapped_key: String,
53    ) -> CreateRotationConfigRequestModel {
54        CreateRotationConfigRequestModel {
55            cipher_id,
56            target_system_id,
57            sealed_data,
58            wrapped_key,
59            schedule_cron: None,
60            rotate_on_access_end: None,
61        }
62    }
63}