aws-sdk-eksauth 1.95.0

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

/// <p>An object containing the name of the Kubernetes service account inside the cluster to associate the IAM credentials with.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Subject {
    /// <p>The name of the Kubernetes namespace inside the cluster to create the association in. The service account and the pods that use the service account must be in this namespace.</p>
    pub namespace: ::std::string::String,
    /// <p>The name of the Kubernetes service account inside the cluster to associate the IAM credentials with.</p>
    pub service_account: ::std::string::String,
}
impl Subject {
    /// <p>The name of the Kubernetes namespace inside the cluster to create the association in. The service account and the pods that use the service account must be in this namespace.</p>
    pub fn namespace(&self) -> &str {
        use std::ops::Deref;
        self.namespace.deref()
    }
    /// <p>The name of the Kubernetes service account inside the cluster to associate the IAM credentials with.</p>
    pub fn service_account(&self) -> &str {
        use std::ops::Deref;
        self.service_account.deref()
    }
}
impl Subject {
    /// Creates a new builder-style object to manufacture [`Subject`](crate::types::Subject).
    pub fn builder() -> crate::types::builders::SubjectBuilder {
        crate::types::builders::SubjectBuilder::default()
    }
}

/// A builder for [`Subject`](crate::types::Subject).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct SubjectBuilder {
    pub(crate) namespace: ::std::option::Option<::std::string::String>,
    pub(crate) service_account: ::std::option::Option<::std::string::String>,
}
impl SubjectBuilder {
    /// <p>The name of the Kubernetes namespace inside the cluster to create the association in. The service account and the pods that use the service account must be in this namespace.</p>
    /// This field is required.
    pub fn namespace(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.namespace = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the Kubernetes namespace inside the cluster to create the association in. The service account and the pods that use the service account must be in this namespace.</p>
    pub fn set_namespace(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.namespace = input;
        self
    }
    /// <p>The name of the Kubernetes namespace inside the cluster to create the association in. The service account and the pods that use the service account must be in this namespace.</p>
    pub fn get_namespace(&self) -> &::std::option::Option<::std::string::String> {
        &self.namespace
    }
    /// <p>The name of the Kubernetes service account inside the cluster to associate the IAM credentials with.</p>
    /// This field is required.
    pub fn service_account(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.service_account = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the Kubernetes service account inside the cluster to associate the IAM credentials with.</p>
    pub fn set_service_account(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.service_account = input;
        self
    }
    /// <p>The name of the Kubernetes service account inside the cluster to associate the IAM credentials with.</p>
    pub fn get_service_account(&self) -> &::std::option::Option<::std::string::String> {
        &self.service_account
    }
    /// Consumes the builder and constructs a [`Subject`](crate::types::Subject).
    /// This method will fail if any of the following fields are not set:
    /// - [`namespace`](crate::types::builders::SubjectBuilder::namespace)
    /// - [`service_account`](crate::types::builders::SubjectBuilder::service_account)
    pub fn build(self) -> ::std::result::Result<crate::types::Subject, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Subject {
            namespace: self.namespace.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "namespace",
                    "namespace was not specified but it is required when building Subject",
                )
            })?,
            service_account: self.service_account.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "service_account",
                    "service_account was not specified but it is required when building Subject",
                )
            })?,
        })
    }
}