azure_security_keyvault_secrets 1.0.0

Rust wrappers around Microsoft Azure REST APIs - Azure Key Vault Secrets
Documentation
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
//
// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT.

use super::DeletionRecoveryLevel;
use azure_core::{base64, fmt::SafeDebug, time::OffsetDateTime};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;

/// The backup secret result, containing the backup blob.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[non_exhaustive]
pub struct BackupSecretResult {
    /// The backup blob containing the backed up secret.
    ///
    /// Operational visibility: Read
    #[serde(
        default,
        deserialize_with = "base64::option::deserialize_url_safe",
        serialize_with = "base64::option::serialize_url_safe",
        skip_serializing
    )]
    pub value: Option<Vec<u8>>,
}

/// A Deleted Secret consisting of its previous id, attributes and its tags, as well as information on when it will be purged.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[non_exhaustive]
pub struct DeletedSecret {
    /// The secret management attributes.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub attributes: Option<SecretAttributes>,

    /// The content type of the secret.
    #[serde(rename = "contentType", skip_serializing_if = "Option::is_none")]
    pub content_type: Option<String>,

    /// The time when the secret was deleted, in UTC
    ///
    /// Operational visibility: Read
    #[serde(
        default,
        rename = "deletedDate",
        skip_serializing,
        with = "azure_core::time::unix_time::option"
    )]
    pub deleted_date: Option<OffsetDateTime>,

    /// The secret id.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,

    /// If this is a secret backing a KV certificate, then this field specifies the corresponding key backing the KV certificate.
    ///
    /// Operational visibility: Read
    #[serde(skip_serializing)]
    pub kid: Option<String>,

    /// True if the secret's lifetime is managed by key vault. If this is a secret backing a certificate, then managed will be
    /// true.
    ///
    /// Operational visibility: Read
    #[serde(skip_serializing)]
    pub managed: Option<bool>,

    /// The version of the previous certificate, if applicable. Applies only to certificates created after June 1, 2025. Certificates
    /// created before this date are not retroactively updated.
    #[serde(rename = "previousVersion", skip_serializing_if = "Option::is_none")]
    pub previous_version: Option<String>,

    /// The url of the recovery object, used to identify and recover the deleted secret.
    #[serde(rename = "recoveryId", skip_serializing_if = "Option::is_none")]
    pub recovery_id: Option<String>,

    /// The time when the secret is scheduled to be purged, in UTC
    ///
    /// Operational visibility: Read
    #[serde(
        default,
        rename = "scheduledPurgeDate",
        skip_serializing,
        with = "azure_core::time::unix_time::option"
    )]
    pub scheduled_purge_date: Option<OffsetDateTime>,

    /// Application specific metadata in the form of key-value pairs.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<HashMap<String, String>>,

    /// The secret value.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub value: Option<String>,
}

/// The deleted secret item containing metadata about the deleted secret.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[non_exhaustive]
pub struct DeletedSecretProperties {
    /// The secret management attributes.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub attributes: Option<SecretAttributes>,

    /// Type of the secret value such as a password.
    #[serde(rename = "contentType", skip_serializing_if = "Option::is_none")]
    pub content_type: Option<String>,

    /// The time when the secret was deleted, in UTC
    ///
    /// Operational visibility: Read
    #[serde(
        default,
        rename = "deletedDate",
        skip_serializing,
        with = "azure_core::time::unix_time::option"
    )]
    pub deleted_date: Option<OffsetDateTime>,

    /// Secret identifier.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,

    /// True if the secret's lifetime is managed by key vault. If this is a key backing a certificate, then managed will be true.
    ///
    /// Operational visibility: Read
    #[serde(skip_serializing)]
    pub managed: Option<bool>,

    /// The url of the recovery object, used to identify and recover the deleted secret.
    #[serde(rename = "recoveryId", skip_serializing_if = "Option::is_none")]
    pub recovery_id: Option<String>,

    /// The time when the secret is scheduled to be purged, in UTC
    ///
    /// Operational visibility: Read
    #[serde(
        default,
        rename = "scheduledPurgeDate",
        skip_serializing,
        with = "azure_core::time::unix_time::option"
    )]
    pub scheduled_purge_date: Option<OffsetDateTime>,

    /// Application specific metadata in the form of key-value pairs.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<HashMap<String, String>>,
}

/// The key vault error exception.
#[derive(Clone, Deserialize, SafeDebug, Serialize)]
pub struct KeyVaultError {
    /// The key vault server error.
    ///
    /// Operational visibility: Read
    #[serde(skip_serializing)]
    pub error: Option<KeyVaultErrorError>,
}

/// The key vault server error.
#[derive(Clone, Deserialize, SafeDebug, Serialize)]
pub struct KeyVaultErrorError {
    /// The error code.
    ///
    /// Operational visibility: Read
    #[serde(skip_serializing)]
    pub code: Option<String>,

    /// The key vault server error.
    ///
    /// Operational visibility: Read
    #[serde(rename = "innererror", skip_serializing)]
    pub inner_error: Option<Box<KeyVaultErrorError>>,

    /// The error message.
    ///
    /// Operational visibility: Read
    #[serde(skip_serializing)]
    pub message: Option<String>,
}

/// The deleted secret list result
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[non_exhaustive]
pub struct ListDeletedSecretPropertiesResult {
    /// The URL to get the next set of deleted secrets.
    ///
    /// Operational visibility: Read
    #[serde(rename = "nextLink", skip_serializing)]
    pub next_link: Option<String>,

    /// A response message containing a list of deleted secrets in the key vault along with a link to the next page of deleted
    /// secrets.
    ///
    /// Operational visibility: Read
    #[serde(default, skip_serializing)]
    pub value: Vec<DeletedSecretProperties>,
}

/// The secret list result.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[non_exhaustive]
pub struct ListSecretPropertiesResult {
    /// The URL to get the next set of secrets.
    ///
    /// Operational visibility: Read
    #[serde(rename = "nextLink", skip_serializing)]
    pub next_link: Option<String>,

    /// A response message containing a list of secrets in the key vault along with a link to the next page of secrets.
    ///
    /// Operational visibility: Read
    #[serde(default, skip_serializing)]
    pub value: Vec<SecretProperties>,
}

/// The secret restore parameters.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
pub struct RestoreSecretParameters {
    /// The backup blob associated with a secret bundle.
    #[serde(
        default,
        deserialize_with = "base64::option::deserialize_url_safe",
        rename = "value",
        serialize_with = "base64::option::serialize_url_safe",
        skip_serializing_if = "Option::is_none"
    )]
    pub secret_backup: Option<Vec<u8>>,
}

/// A secret consisting of a value, id and its attributes.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[non_exhaustive]
pub struct Secret {
    /// The secret management attributes.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub attributes: Option<SecretAttributes>,

    /// The content type of the secret.
    #[serde(rename = "contentType", skip_serializing_if = "Option::is_none")]
    pub content_type: Option<String>,

    /// The secret id.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,

    /// If this is a secret backing a KV certificate, then this field specifies the corresponding key backing the KV certificate.
    ///
    /// Operational visibility: Read
    #[serde(skip_serializing)]
    pub kid: Option<String>,

    /// True if the secret's lifetime is managed by key vault. If this is a secret backing a certificate, then managed will be
    /// true.
    ///
    /// Operational visibility: Read
    #[serde(skip_serializing)]
    pub managed: Option<bool>,

    /// The version of the previous certificate, if applicable. Applies only to certificates created after June 1, 2025. Certificates
    /// created before this date are not retroactively updated.
    #[serde(rename = "previousVersion", skip_serializing_if = "Option::is_none")]
    pub previous_version: Option<String>,

    /// Application specific metadata in the form of key-value pairs.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<HashMap<String, String>>,

    /// The secret value.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub value: Option<String>,
}

/// The secret management attributes.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
pub struct SecretAttributes {
    /// Creation time in UTC.
    ///
    /// Operational visibility: Read
    #[serde(
        default,
        skip_serializing,
        with = "azure_core::time::unix_time::option"
    )]
    pub created: Option<OffsetDateTime>,

    /// Determines whether the object is enabled.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,

    /// Expiry date in UTC.
    #[serde(
        default,
        rename = "exp",
        skip_serializing_if = "Option::is_none",
        with = "azure_core::time::unix_time::option"
    )]
    pub expires: Option<OffsetDateTime>,

    /// Not before date in UTC.
    #[serde(
        default,
        rename = "nbf",
        skip_serializing_if = "Option::is_none",
        with = "azure_core::time::unix_time::option"
    )]
    pub not_before: Option<OffsetDateTime>,

    /// softDelete data retention days. Value should be >=7 and <=90 when softDelete enabled, otherwise 0.
    ///
    /// Operational visibility: Read
    #[serde(rename = "recoverableDays", skip_serializing)]
    pub recoverable_days: Option<i32>,

    /// Reflects the deletion recovery level currently in effect for secrets in the current vault. If it contains 'Purgeable',
    /// the secret can be permanently deleted by a privileged user; otherwise, only the system can purge the secret, at the end
    /// of the retention interval.
    ///
    /// Operational visibility: Read
    #[serde(rename = "recoveryLevel", skip_serializing)]
    pub recovery_level: Option<DeletionRecoveryLevel>,

    /// Last updated time in UTC.
    ///
    /// Operational visibility: Read
    #[serde(
        default,
        skip_serializing,
        with = "azure_core::time::unix_time::option"
    )]
    pub updated: Option<OffsetDateTime>,
}

/// The secret item containing secret metadata.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[non_exhaustive]
pub struct SecretProperties {
    /// The secret management attributes.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub attributes: Option<SecretAttributes>,

    /// Type of the secret value such as a password.
    #[serde(rename = "contentType", skip_serializing_if = "Option::is_none")]
    pub content_type: Option<String>,

    /// Secret identifier.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,

    /// True if the secret's lifetime is managed by key vault. If this is a key backing a certificate, then managed will be true.
    ///
    /// Operational visibility: Read
    #[serde(skip_serializing)]
    pub managed: Option<bool>,

    /// Application specific metadata in the form of key-value pairs.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<HashMap<String, String>>,
}

/// The secret set parameters.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
pub struct SetSecretParameters {
    /// Type of the secret value such as a password.
    #[serde(rename = "contentType", skip_serializing_if = "Option::is_none")]
    pub content_type: Option<String>,

    /// The secret management attributes.
    #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")]
    pub secret_attributes: Option<SecretAttributes>,

    /// Application specific metadata in the form of key-value pairs.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<HashMap<String, String>>,

    /// The value of the secret.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub value: Option<String>,
}

/// The secret update parameters.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
pub struct UpdateSecretPropertiesParameters {
    /// Type of the secret value such as a password.
    #[serde(rename = "contentType", skip_serializing_if = "Option::is_none")]
    pub content_type: Option<String>,

    /// The secret management attributes.
    #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")]
    pub secret_attributes: Option<SecretAttributes>,

    /// Application specific metadata in the form of key-value pairs.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<HashMap<String, String>>,
}