// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>If <code>SSEKMS</code> is specified for <code>ObjectEncryption</code>, this data type specifies the Amazon Web Services KMS key Amazon Resource Name (ARN) to use and whether to use an S3 Bucket Key for server-side encryption using Key Management Service (KMS) keys (SSE-KMS).</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct SsekmsEncryption {
    /// <p>Specifies the Amazon Web Services KMS key Amazon Resource Name (ARN) to use for the updated server-side encryption type. Required if <code>ObjectEncryption</code> specifies <code>SSEKMS</code>.</p><note>
    /// <p>You must specify the full Amazon Web Services KMS key ARN. The KMS key ID and KMS key alias aren't supported.</p>
    /// </note>
    /// <p>Pattern: (<code>arn:aws\[-a-z0-9\]*:kms:\[-a-z0-9\]*:\[0-9\]{12}:key/.+</code>)</p>
    pub kms_key_arn: ::std::string::String,
    /// <p>Specifies whether Amazon S3 should use an S3 Bucket Key for object encryption with server-side encryption using Key Management Service (KMS) keys (SSE-KMS). If this value isn't specified, it defaults to <code>false</code>. Setting this value to <code>true</code> causes Amazon S3 to use an S3 Bucket Key for object encryption with SSE-KMS. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-key.html"> Using Amazon S3 Bucket Keys</a> in the <i>Amazon S3 User Guide</i>.</p>
    /// <p>Valid Values: <code>true</code> | <code>false</code></p>
    pub bucket_key_enabled: ::std::option::Option<bool>,
}
impl SsekmsEncryption {
    /// <p>Specifies the Amazon Web Services KMS key Amazon Resource Name (ARN) to use for the updated server-side encryption type. Required if <code>ObjectEncryption</code> specifies <code>SSEKMS</code>.</p><note>
    /// <p>You must specify the full Amazon Web Services KMS key ARN. The KMS key ID and KMS key alias aren't supported.</p>
    /// </note>
    /// <p>Pattern: (<code>arn:aws\[-a-z0-9\]*:kms:\[-a-z0-9\]*:\[0-9\]{12}:key/.+</code>)</p>
    pub fn kms_key_arn(&self) -> &str {
        use std::ops::Deref;
        self.kms_key_arn.deref()
    }
    /// <p>Specifies whether Amazon S3 should use an S3 Bucket Key for object encryption with server-side encryption using Key Management Service (KMS) keys (SSE-KMS). If this value isn't specified, it defaults to <code>false</code>. Setting this value to <code>true</code> causes Amazon S3 to use an S3 Bucket Key for object encryption with SSE-KMS. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-key.html"> Using Amazon S3 Bucket Keys</a> in the <i>Amazon S3 User Guide</i>.</p>
    /// <p>Valid Values: <code>true</code> | <code>false</code></p>
    pub fn bucket_key_enabled(&self) -> ::std::option::Option<bool> {
        self.bucket_key_enabled
    }
}
impl ::std::fmt::Debug for SsekmsEncryption {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("SsekmsEncryption");
        formatter.field("kms_key_arn", &"*** Sensitive Data Redacted ***");
        formatter.field("bucket_key_enabled", &self.bucket_key_enabled);
        formatter.finish()
    }
}
impl SsekmsEncryption {
    /// Creates a new builder-style object to manufacture [`SsekmsEncryption`](crate::types::SsekmsEncryption).
    pub fn builder() -> crate::types::builders::SsekmsEncryptionBuilder {
        crate::types::builders::SsekmsEncryptionBuilder::default()
    }
}

/// A builder for [`SsekmsEncryption`](crate::types::SsekmsEncryption).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct SsekmsEncryptionBuilder {
    pub(crate) kms_key_arn: ::std::option::Option<::std::string::String>,
    pub(crate) bucket_key_enabled: ::std::option::Option<bool>,
}
impl SsekmsEncryptionBuilder {
    /// <p>Specifies the Amazon Web Services KMS key Amazon Resource Name (ARN) to use for the updated server-side encryption type. Required if <code>ObjectEncryption</code> specifies <code>SSEKMS</code>.</p><note>
    /// <p>You must specify the full Amazon Web Services KMS key ARN. The KMS key ID and KMS key alias aren't supported.</p>
    /// </note>
    /// <p>Pattern: (<code>arn:aws\[-a-z0-9\]*:kms:\[-a-z0-9\]*:\[0-9\]{12}:key/.+</code>)</p>
    /// This field is required.
    pub fn kms_key_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.kms_key_arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Specifies the Amazon Web Services KMS key Amazon Resource Name (ARN) to use for the updated server-side encryption type. Required if <code>ObjectEncryption</code> specifies <code>SSEKMS</code>.</p><note>
    /// <p>You must specify the full Amazon Web Services KMS key ARN. The KMS key ID and KMS key alias aren't supported.</p>
    /// </note>
    /// <p>Pattern: (<code>arn:aws\[-a-z0-9\]*:kms:\[-a-z0-9\]*:\[0-9\]{12}:key/.+</code>)</p>
    pub fn set_kms_key_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.kms_key_arn = input;
        self
    }
    /// <p>Specifies the Amazon Web Services KMS key Amazon Resource Name (ARN) to use for the updated server-side encryption type. Required if <code>ObjectEncryption</code> specifies <code>SSEKMS</code>.</p><note>
    /// <p>You must specify the full Amazon Web Services KMS key ARN. The KMS key ID and KMS key alias aren't supported.</p>
    /// </note>
    /// <p>Pattern: (<code>arn:aws\[-a-z0-9\]*:kms:\[-a-z0-9\]*:\[0-9\]{12}:key/.+</code>)</p>
    pub fn get_kms_key_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.kms_key_arn
    }
    /// <p>Specifies whether Amazon S3 should use an S3 Bucket Key for object encryption with server-side encryption using Key Management Service (KMS) keys (SSE-KMS). If this value isn't specified, it defaults to <code>false</code>. Setting this value to <code>true</code> causes Amazon S3 to use an S3 Bucket Key for object encryption with SSE-KMS. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-key.html"> Using Amazon S3 Bucket Keys</a> in the <i>Amazon S3 User Guide</i>.</p>
    /// <p>Valid Values: <code>true</code> | <code>false</code></p>
    pub fn bucket_key_enabled(mut self, input: bool) -> Self {
        self.bucket_key_enabled = ::std::option::Option::Some(input);
        self
    }
    /// <p>Specifies whether Amazon S3 should use an S3 Bucket Key for object encryption with server-side encryption using Key Management Service (KMS) keys (SSE-KMS). If this value isn't specified, it defaults to <code>false</code>. Setting this value to <code>true</code> causes Amazon S3 to use an S3 Bucket Key for object encryption with SSE-KMS. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-key.html"> Using Amazon S3 Bucket Keys</a> in the <i>Amazon S3 User Guide</i>.</p>
    /// <p>Valid Values: <code>true</code> | <code>false</code></p>
    pub fn set_bucket_key_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
        self.bucket_key_enabled = input;
        self
    }
    /// <p>Specifies whether Amazon S3 should use an S3 Bucket Key for object encryption with server-side encryption using Key Management Service (KMS) keys (SSE-KMS). If this value isn't specified, it defaults to <code>false</code>. Setting this value to <code>true</code> causes Amazon S3 to use an S3 Bucket Key for object encryption with SSE-KMS. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-key.html"> Using Amazon S3 Bucket Keys</a> in the <i>Amazon S3 User Guide</i>.</p>
    /// <p>Valid Values: <code>true</code> | <code>false</code></p>
    pub fn get_bucket_key_enabled(&self) -> &::std::option::Option<bool> {
        &self.bucket_key_enabled
    }
    /// Consumes the builder and constructs a [`SsekmsEncryption`](crate::types::SsekmsEncryption).
    /// This method will fail if any of the following fields are not set:
    /// - [`kms_key_arn`](crate::types::builders::SsekmsEncryptionBuilder::kms_key_arn)
    pub fn build(self) -> ::std::result::Result<crate::types::SsekmsEncryption, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::SsekmsEncryption {
            kms_key_arn: self.kms_key_arn.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "kms_key_arn",
                    "kms_key_arn was not specified but it is required when building SsekmsEncryption",
                )
            })?,
            bucket_key_enabled: self.bucket_key_enabled,
        })
    }
}
impl ::std::fmt::Debug for SsekmsEncryptionBuilder {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("SsekmsEncryptionBuilder");
        formatter.field("kms_key_arn", &"*** Sensitive Data Redacted ***");
        formatter.field("bucket_key_enabled", &self.bucket_key_enabled);
        formatter.finish()
    }
}
