aws-sdk-lambda 1.121.0

AWS SDK for AWS Lambda
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>A function's environment variable settings. You can use environment variables to adjust your function's behavior without updating code. An environment variable is a pair of strings that are stored in a function's version-specific configuration.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct Environment {
    /// <p>Environment variable key-value pairs. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html">Using Lambda environment variables</a>.</p>
    pub variables: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
}
impl Environment {
    /// <p>Environment variable key-value pairs. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html">Using Lambda environment variables</a>.</p>
    pub fn variables(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        self.variables.as_ref()
    }
}
impl ::std::fmt::Debug for Environment {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("Environment");
        formatter.field("variables", &"*** Sensitive Data Redacted ***");
        formatter.finish()
    }
}
impl Environment {
    /// Creates a new builder-style object to manufacture [`Environment`](crate::types::Environment).
    pub fn builder() -> crate::types::builders::EnvironmentBuilder {
        crate::types::builders::EnvironmentBuilder::default()
    }
}

/// A builder for [`Environment`](crate::types::Environment).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct EnvironmentBuilder {
    pub(crate) variables: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
}
impl EnvironmentBuilder {
    /// Adds a key-value pair to `variables`.
    ///
    /// To override the contents of this collection use [`set_variables`](Self::set_variables).
    ///
    /// <p>Environment variable key-value pairs. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html">Using Lambda environment variables</a>.</p>
    pub fn variables(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut hash_map = self.variables.unwrap_or_default();
        hash_map.insert(k.into(), v.into());
        self.variables = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>Environment variable key-value pairs. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html">Using Lambda environment variables</a>.</p>
    pub fn set_variables(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
        self.variables = input;
        self
    }
    /// <p>Environment variable key-value pairs. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html">Using Lambda environment variables</a>.</p>
    pub fn get_variables(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        &self.variables
    }
    /// Consumes the builder and constructs a [`Environment`](crate::types::Environment).
    pub fn build(self) -> crate::types::Environment {
        crate::types::Environment { variables: self.variables }
    }
}
impl ::std::fmt::Debug for EnvironmentBuilder {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("EnvironmentBuilder");
        formatter.field("variables", &"*** Sensitive Data Redacted ***");
        formatter.finish()
    }
}