openai-client-base 0.16.1

Auto-generated Rust client for the OpenAI API
/*
 * OpenAI API
 *
 * The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
 *
 * The version of the OpenAPI document: 2.3.0
 *
 * Generated by: https://openapi-generator.tech
 */

use serde::{Deserialize, Serialize};

/// RotateVaultCredentialAuthParamEnvironmentVariable : Replace the secret for an OpenAI-hosted environment credential. The environment variable name and networking configuration remain unchanged.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct RotateVaultCredentialAuthParamEnvironmentVariable {
    /// The type of the object. Always `environment_variable`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// The write-only replacement secret. Never returned in credential resources or supplied directly to sandbox code. Must be nonempty and must not contain carriage returns, newlines, or NUL bytes.
    #[serde(rename = "secret_value")]
    pub secret_value: String,
}

impl RotateVaultCredentialAuthParamEnvironmentVariable {
    /// Replace the secret for an OpenAI-hosted environment credential. The environment variable name and networking configuration remain unchanged.
    pub fn new(
        r#type: Type,
        secret_value: String,
    ) -> RotateVaultCredentialAuthParamEnvironmentVariable {
        RotateVaultCredentialAuthParamEnvironmentVariable {
            r#type,
            secret_value,
        }
    }
}
/// The type of the object. Always `environment_variable`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "environment_variable")]
    EnvironmentVariable,
}

impl Default for Type {
    fn default() -> Type {
        Self::EnvironmentVariable
    }
}

impl std::fmt::Display for RotateVaultCredentialAuthParamEnvironmentVariable {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match serde_json::to_string(self) {
            Ok(s) => write!(f, "{}", s),
            Err(_) => Err(std::fmt::Error),
        }
    }
}