// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>A query filter used by <code>ListUsers</code> and <code>ListGroups</code>. This filter object provides the attribute name and attribute value to search users or groups.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct Filter {
/// <p>The attribute path that is used to specify which attribute name to search. Length limit is 255 characters. For example, <code>UserName</code> is a valid attribute path for the <code>ListUsers</code> API, and <code>DisplayName</code> is a valid attribute path for the <code>ListGroups</code> API.</p>
pub attribute_path: ::std::string::String,
/// <p>Represents the data for an attribute. Each attribute value is described as a name-value pair.</p>
pub attribute_value: ::std::string::String,
}
impl Filter {
/// <p>The attribute path that is used to specify which attribute name to search. Length limit is 255 characters. For example, <code>UserName</code> is a valid attribute path for the <code>ListUsers</code> API, and <code>DisplayName</code> is a valid attribute path for the <code>ListGroups</code> API.</p>
pub fn attribute_path(&self) -> &str {
use std::ops::Deref;
self.attribute_path.deref()
}
/// <p>Represents the data for an attribute. Each attribute value is described as a name-value pair.</p>
pub fn attribute_value(&self) -> &str {
use std::ops::Deref;
self.attribute_value.deref()
}
}
impl ::std::fmt::Debug for Filter {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
let mut formatter = f.debug_struct("Filter");
formatter.field("attribute_path", &self.attribute_path);
formatter.field("attribute_value", &"*** Sensitive Data Redacted ***");
formatter.finish()
}
}
impl Filter {
/// Creates a new builder-style object to manufacture [`Filter`](crate::types::Filter).
pub fn builder() -> crate::types::builders::FilterBuilder {
crate::types::builders::FilterBuilder::default()
}
}
/// A builder for [`Filter`](crate::types::Filter).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
pub struct FilterBuilder {
pub(crate) attribute_path: ::std::option::Option<::std::string::String>,
pub(crate) attribute_value: ::std::option::Option<::std::string::String>,
}
impl FilterBuilder {
/// <p>The attribute path that is used to specify which attribute name to search. Length limit is 255 characters. For example, <code>UserName</code> is a valid attribute path for the <code>ListUsers</code> API, and <code>DisplayName</code> is a valid attribute path for the <code>ListGroups</code> API.</p>
/// This field is required.
pub fn attribute_path(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.attribute_path = ::std::option::Option::Some(input.into());
self
}
/// <p>The attribute path that is used to specify which attribute name to search. Length limit is 255 characters. For example, <code>UserName</code> is a valid attribute path for the <code>ListUsers</code> API, and <code>DisplayName</code> is a valid attribute path for the <code>ListGroups</code> API.</p>
pub fn set_attribute_path(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.attribute_path = input;
self
}
/// <p>The attribute path that is used to specify which attribute name to search. Length limit is 255 characters. For example, <code>UserName</code> is a valid attribute path for the <code>ListUsers</code> API, and <code>DisplayName</code> is a valid attribute path for the <code>ListGroups</code> API.</p>
pub fn get_attribute_path(&self) -> &::std::option::Option<::std::string::String> {
&self.attribute_path
}
/// <p>Represents the data for an attribute. Each attribute value is described as a name-value pair.</p>
/// This field is required.
pub fn attribute_value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.attribute_value = ::std::option::Option::Some(input.into());
self
}
/// <p>Represents the data for an attribute. Each attribute value is described as a name-value pair.</p>
pub fn set_attribute_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.attribute_value = input;
self
}
/// <p>Represents the data for an attribute. Each attribute value is described as a name-value pair.</p>
pub fn get_attribute_value(&self) -> &::std::option::Option<::std::string::String> {
&self.attribute_value
}
/// Consumes the builder and constructs a [`Filter`](crate::types::Filter).
/// This method will fail if any of the following fields are not set:
/// - [`attribute_path`](crate::types::builders::FilterBuilder::attribute_path)
/// - [`attribute_value`](crate::types::builders::FilterBuilder::attribute_value)
pub fn build(self) -> ::std::result::Result<crate::types::Filter, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Filter {
attribute_path: self.attribute_path.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"attribute_path",
"attribute_path was not specified but it is required when building Filter",
)
})?,
attribute_value: self.attribute_value.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"attribute_value",
"attribute_value was not specified but it is required when building Filter",
)
})?,
})
}
}
impl ::std::fmt::Debug for FilterBuilder {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
let mut formatter = f.debug_struct("FilterBuilder");
formatter.field("attribute_path", &self.attribute_path);
formatter.field("attribute_value", &"*** Sensitive Data Redacted ***");
formatter.finish()
}
}