antimatter_api 2.0.13

Interact with the Antimatter Cloud API
Documentation
/*
 * Antimatter Public API
 *
 * Interact with the Antimatter Cloud API
 *
 * The version of the OpenAPI document: 2.0.13
 * Contact: support@antimatter.io
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

use serde_with::serde_as;

/// CapsuleCreateResponse : The response for the creation of a new capsule 
#[serde_as]
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CapsuleCreateResponse {
    /// A globally unique identifier for a capsule
    #[serde(rename = "id")]
    pub id: String,
    /// a CBOR encoded encryption key for the capsule
    #[serde_as(as = "serde_with::base64::Base64")]
    #[serde(rename = "dataKey")]
    pub data_key: Vec<u8>,
    /// a CBOR encoded encryption key for the capsule
    #[serde_as(as = "serde_with::base64::Base64")]
    #[serde(rename = "encryptedDataKey")]
    pub encrypted_data_key: Vec<u8>,
    /// The ID of the encryption key used to encrypt the data key. 
    #[serde(rename = "keyEncryptionKeyID")]
    pub key_encryption_key_id: i64,
    /// A token used to tie requests together when creating and reading capsules.
    #[serde(rename = "createToken")]
    pub create_token: String,
    #[serde(rename = "writeContextConfiguration")]
    pub write_context_configuration: Box<models::WriteContextConfigInfo>,
    /// Contains a CBOR encoded encryption key for the capsule that has been encrypted using the Disaster Recovery key. This field is ony set if disaster recovery has been enabled. 
    #[serde(rename = "disasterRecoveryToken", skip_serializing_if = "Option::is_none")]
    pub disaster_recovery_token: Option<String>,
}

impl CapsuleCreateResponse {
    /// The response for the creation of a new capsule 
    pub fn new(id: String, data_key: Vec<u8>, encrypted_data_key: Vec<u8>, key_encryption_key_id: i64, create_token: String, write_context_configuration: models::WriteContextConfigInfo) -> CapsuleCreateResponse {
        CapsuleCreateResponse {
            id,
            data_key,
            encrypted_data_key,
            key_encryption_key_id,
            create_token,
            write_context_configuration: Box::new(write_context_configuration),
            disaster_recovery_token: None,
        }
    }
}