Skip to main content

bitwarden_api_api/models/
organization_user_v2_upgrade_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#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct OrganizationUserV2UpgradeRequestModel {
17    #[serde(rename = "organizationUserId", alias = "OrganizationUserId")]
18    pub organization_user_id: uuid::Uuid,
19    /// The key id of the user key the new
20    /// Bit.Api.KeyManagement.Models.Requests.OrganizationUserV2UpgradeRequestModel.
21    /// AccountRecoveryKey wraps. The server checks it against the member's user row. When it no
22    /// longer matches, the server skips the update and the membership stays pending. It is
23    /// required to unenroll a member as well, so that a stale request cannot undo a rotation the
24    /// admin has not read.
25    #[serde(rename = "userKeyId", alias = "UserKeyId")]
26    pub user_key_id: String,
27    /// The member's V2 user key wrapped with the organization's public key, or null to unenroll
28    /// the member from account recovery. Send null when the upgrade cannot be completed, for
29    /// example when the V2 upgrade token does not contain a usable user key. The member keeps
30    /// their vault, and the organization's enrollment policy prompts them to enroll again. A blank
31    /// key is rejected, because only a key or its absence is meaningful.
32    #[serde(
33        rename = "accountRecoveryKey",
34        alias = "AccountRecoveryKey",
35        skip_serializing_if = "Option::is_none"
36    )]
37    pub account_recovery_key: Option<String>,
38}
39
40impl OrganizationUserV2UpgradeRequestModel {
41    pub fn new(
42        organization_user_id: uuid::Uuid,
43        user_key_id: String,
44    ) -> OrganizationUserV2UpgradeRequestModel {
45        OrganizationUserV2UpgradeRequestModel {
46            organization_user_id,
47            user_key_id,
48            account_recovery_key: None,
49        }
50    }
51}