openai-client-base 0.16.0

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 crate::models;
use serde::{Deserialize, Serialize};

/// VaultCredentialAuthResourceEnvironmentVariable : Metadata for an HTTP credential used only in OpenAI-hosted environments. Sandbox code receives a placeholder. The proxy substitutes the secret for allowed HTTPS destinations on ports 443 and 8443. The real secret is not available to sandbox code for local computation and is never returned in this resource.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct VaultCredentialAuthResourceEnvironmentVariable {
    /// The type of the object. Always `environment_variable`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// The environment variable name that receives the placeholder in the sandbox.
    #[serde(rename = "secret_name")]
    pub secret_name: String,
    #[serde(rename = "networking")]
    pub networking: Box<models::VaultCredentialNetworkingResource>,
}

impl VaultCredentialAuthResourceEnvironmentVariable {
    /// Metadata for an HTTP credential used only in OpenAI-hosted environments. Sandbox code receives a placeholder. The proxy substitutes the secret for allowed HTTPS destinations on ports 443 and 8443. The real secret is not available to sandbox code for local computation and is never returned in this resource.
    pub fn new(
        r#type: Type,
        secret_name: String,
        networking: models::VaultCredentialNetworkingResource,
    ) -> VaultCredentialAuthResourceEnvironmentVariable {
        VaultCredentialAuthResourceEnvironmentVariable {
            r#type,
            secret_name,
            networking: Box::new(networking),
        }
    }
}
/// 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 VaultCredentialAuthResourceEnvironmentVariable {
    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),
        }
    }
}