1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Creates a subset of items within an attribute that are modified. For example, you can use this operation to create a subset of items that cost $5 or less. To do this, you specify <code>"AttributeName": "price"</code>, <code>"AttributeValue": "5"</code>, and <code>"Condition": "LESS_THAN"</code>. Pair this operation with the <code>Action</code> operation within the <code>CreateWhatIfForecastRequest$TimeSeriesTransformations</code> operation to define how the attribute is modified.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct TimeSeriesCondition {
/// <p>The item_id, dimension name, IM name, or timestamp that you are modifying.</p>
pub attribute_name: ::std::string::String,
/// <p>The value that is applied for the chosen <code>Condition</code>.</p>
pub attribute_value: ::std::string::String,
/// <p>The condition to apply. Valid values are <code>EQUALS</code>, <code>NOT_EQUALS</code>, <code>LESS_THAN</code> and <code>GREATER_THAN</code>.</p>
pub condition: crate::types::Condition,
}
impl TimeSeriesCondition {
/// <p>The item_id, dimension name, IM name, or timestamp that you are modifying.</p>
pub fn attribute_name(&self) -> &str {
use std::ops::Deref;
self.attribute_name.deref()
}
/// <p>The value that is applied for the chosen <code>Condition</code>.</p>
pub fn attribute_value(&self) -> &str {
use std::ops::Deref;
self.attribute_value.deref()
}
/// <p>The condition to apply. Valid values are <code>EQUALS</code>, <code>NOT_EQUALS</code>, <code>LESS_THAN</code> and <code>GREATER_THAN</code>.</p>
pub fn condition(&self) -> &crate::types::Condition {
&self.condition
}
}
impl TimeSeriesCondition {
/// Creates a new builder-style object to manufacture [`TimeSeriesCondition`](crate::types::TimeSeriesCondition).
pub fn builder() -> crate::types::builders::TimeSeriesConditionBuilder {
crate::types::builders::TimeSeriesConditionBuilder::default()
}
}
/// A builder for [`TimeSeriesCondition`](crate::types::TimeSeriesCondition).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct TimeSeriesConditionBuilder {
pub(crate) attribute_name: ::std::option::Option<::std::string::String>,
pub(crate) attribute_value: ::std::option::Option<::std::string::String>,
pub(crate) condition: ::std::option::Option<crate::types::Condition>,
}
impl TimeSeriesConditionBuilder {
/// <p>The item_id, dimension name, IM name, or timestamp that you are modifying.</p>
/// This field is required.
pub fn attribute_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.attribute_name = ::std::option::Option::Some(input.into());
self
}
/// <p>The item_id, dimension name, IM name, or timestamp that you are modifying.</p>
pub fn set_attribute_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.attribute_name = input;
self
}
/// <p>The item_id, dimension name, IM name, or timestamp that you are modifying.</p>
pub fn get_attribute_name(&self) -> &::std::option::Option<::std::string::String> {
&self.attribute_name
}
/// <p>The value that is applied for the chosen <code>Condition</code>.</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>The value that is applied for the chosen <code>Condition</code>.</p>
pub fn set_attribute_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.attribute_value = input;
self
}
/// <p>The value that is applied for the chosen <code>Condition</code>.</p>
pub fn get_attribute_value(&self) -> &::std::option::Option<::std::string::String> {
&self.attribute_value
}
/// <p>The condition to apply. Valid values are <code>EQUALS</code>, <code>NOT_EQUALS</code>, <code>LESS_THAN</code> and <code>GREATER_THAN</code>.</p>
/// This field is required.
pub fn condition(mut self, input: crate::types::Condition) -> Self {
self.condition = ::std::option::Option::Some(input);
self
}
/// <p>The condition to apply. Valid values are <code>EQUALS</code>, <code>NOT_EQUALS</code>, <code>LESS_THAN</code> and <code>GREATER_THAN</code>.</p>
pub fn set_condition(mut self, input: ::std::option::Option<crate::types::Condition>) -> Self {
self.condition = input;
self
}
/// <p>The condition to apply. Valid values are <code>EQUALS</code>, <code>NOT_EQUALS</code>, <code>LESS_THAN</code> and <code>GREATER_THAN</code>.</p>
pub fn get_condition(&self) -> &::std::option::Option<crate::types::Condition> {
&self.condition
}
/// Consumes the builder and constructs a [`TimeSeriesCondition`](crate::types::TimeSeriesCondition).
/// This method will fail if any of the following fields are not set:
/// - [`attribute_name`](crate::types::builders::TimeSeriesConditionBuilder::attribute_name)
/// - [`attribute_value`](crate::types::builders::TimeSeriesConditionBuilder::attribute_value)
/// - [`condition`](crate::types::builders::TimeSeriesConditionBuilder::condition)
pub fn build(self) -> ::std::result::Result<crate::types::TimeSeriesCondition, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::TimeSeriesCondition {
attribute_name: self.attribute_name.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"attribute_name",
"attribute_name was not specified but it is required when building TimeSeriesCondition",
)
})?,
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 TimeSeriesCondition",
)
})?,
condition: self.condition.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"condition",
"condition was not specified but it is required when building TimeSeriesCondition",
)
})?,
})
}
}