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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>This is a resource filter containing FromDate: DateTime and ToDate: DateTime. Both values are required. Future DateTime values are not permitted.</p>
/// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds ((milliseconds are optional). For example, the value 1516925490.087 represents Friday, January 26, 2018 12:11:30.087 AM.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct DateRange {
/// <p>This value is the beginning date, inclusive.</p>
/// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
pub from_date: ::aws_smithy_types::DateTime,
/// <p>This value is the end date, inclusive.</p>
/// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
pub to_date: ::aws_smithy_types::DateTime,
}
impl DateRange {
/// <p>This value is the beginning date, inclusive.</p>
/// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
pub fn from_date(&self) -> &::aws_smithy_types::DateTime {
&self.from_date
}
/// <p>This value is the end date, inclusive.</p>
/// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
pub fn to_date(&self) -> &::aws_smithy_types::DateTime {
&self.to_date
}
}
impl DateRange {
/// Creates a new builder-style object to manufacture [`DateRange`](crate::types::DateRange).
pub fn builder() -> crate::types::builders::DateRangeBuilder {
crate::types::builders::DateRangeBuilder::default()
}
}
/// A builder for [`DateRange`](crate::types::DateRange).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct DateRangeBuilder {
pub(crate) from_date: ::std::option::Option<::aws_smithy_types::DateTime>,
pub(crate) to_date: ::std::option::Option<::aws_smithy_types::DateTime>,
}
impl DateRangeBuilder {
/// <p>This value is the beginning date, inclusive.</p>
/// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
/// This field is required.
pub fn from_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.from_date = ::std::option::Option::Some(input);
self
}
/// <p>This value is the beginning date, inclusive.</p>
/// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
pub fn set_from_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.from_date = input;
self
}
/// <p>This value is the beginning date, inclusive.</p>
/// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
pub fn get_from_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
&self.from_date
}
/// <p>This value is the end date, inclusive.</p>
/// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
/// This field is required.
pub fn to_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.to_date = ::std::option::Option::Some(input);
self
}
/// <p>This value is the end date, inclusive.</p>
/// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
pub fn set_to_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.to_date = input;
self
}
/// <p>This value is the end date, inclusive.</p>
/// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
pub fn get_to_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
&self.to_date
}
/// Consumes the builder and constructs a [`DateRange`](crate::types::DateRange).
/// This method will fail if any of the following fields are not set:
/// - [`from_date`](crate::types::builders::DateRangeBuilder::from_date)
/// - [`to_date`](crate::types::builders::DateRangeBuilder::to_date)
pub fn build(self) -> ::std::result::Result<crate::types::DateRange, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::DateRange {
from_date: self.from_date.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"from_date",
"from_date was not specified but it is required when building DateRange",
)
})?,
to_date: self.to_date.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"to_date",
"to_date was not specified but it is required when building DateRange",
)
})?,
})
}
}