aws_sdk_backup/types/
_date_range.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>This is a resource filter containing FromDate: DateTime and ToDate: DateTime. Both values are required. Future DateTime values are not permitted.</p>
4/// <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>
5#[non_exhaustive]
6#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
7pub struct DateRange {
8    /// <p>This value is the beginning date, inclusive.</p>
9    /// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
10    pub from_date: ::aws_smithy_types::DateTime,
11    /// <p>This value is the end date, inclusive.</p>
12    /// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
13    pub to_date: ::aws_smithy_types::DateTime,
14}
15impl DateRange {
16    /// <p>This value is the beginning date, inclusive.</p>
17    /// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
18    pub fn from_date(&self) -> &::aws_smithy_types::DateTime {
19        &self.from_date
20    }
21    /// <p>This value is the end date, inclusive.</p>
22    /// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
23    pub fn to_date(&self) -> &::aws_smithy_types::DateTime {
24        &self.to_date
25    }
26}
27impl DateRange {
28    /// Creates a new builder-style object to manufacture [`DateRange`](crate::types::DateRange).
29    pub fn builder() -> crate::types::builders::DateRangeBuilder {
30        crate::types::builders::DateRangeBuilder::default()
31    }
32}
33
34/// A builder for [`DateRange`](crate::types::DateRange).
35#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
36#[non_exhaustive]
37pub struct DateRangeBuilder {
38    pub(crate) from_date: ::std::option::Option<::aws_smithy_types::DateTime>,
39    pub(crate) to_date: ::std::option::Option<::aws_smithy_types::DateTime>,
40}
41impl DateRangeBuilder {
42    /// <p>This value is the beginning date, inclusive.</p>
43    /// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
44    /// This field is required.
45    pub fn from_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
46        self.from_date = ::std::option::Option::Some(input);
47        self
48    }
49    /// <p>This value is the beginning date, inclusive.</p>
50    /// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
51    pub fn set_from_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
52        self.from_date = input;
53        self
54    }
55    /// <p>This value is the beginning date, inclusive.</p>
56    /// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
57    pub fn get_from_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
58        &self.from_date
59    }
60    /// <p>This value is the end date, inclusive.</p>
61    /// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
62    /// This field is required.
63    pub fn to_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
64        self.to_date = ::std::option::Option::Some(input);
65        self
66    }
67    /// <p>This value is the end date, inclusive.</p>
68    /// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
69    pub fn set_to_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
70        self.to_date = input;
71        self
72    }
73    /// <p>This value is the end date, inclusive.</p>
74    /// <p>The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).</p>
75    pub fn get_to_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
76        &self.to_date
77    }
78    /// Consumes the builder and constructs a [`DateRange`](crate::types::DateRange).
79    /// This method will fail if any of the following fields are not set:
80    /// - [`from_date`](crate::types::builders::DateRangeBuilder::from_date)
81    /// - [`to_date`](crate::types::builders::DateRangeBuilder::to_date)
82    pub fn build(self) -> ::std::result::Result<crate::types::DateRange, ::aws_smithy_types::error::operation::BuildError> {
83        ::std::result::Result::Ok(crate::types::DateRange {
84            from_date: self.from_date.ok_or_else(|| {
85                ::aws_smithy_types::error::operation::BuildError::missing_field(
86                    "from_date",
87                    "from_date was not specified but it is required when building DateRange",
88                )
89            })?,
90            to_date: self.to_date.ok_or_else(|| {
91                ::aws_smithy_types::error::operation::BuildError::missing_field(
92                    "to_date",
93                    "to_date was not specified but it is required when building DateRange",
94                )
95            })?,
96        })
97    }
98}