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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>The time period of the request. </p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct DateInterval {
/// <p>The beginning of the time period. The start date is inclusive. For example, if <code>start</code> is <code>2017-01-01</code>, Amazon Web Services retrieves cost and usage data starting at <code>2017-01-01</code> up to the end date. The start date must be equal to or no later than the current date to avoid a validation error.</p>
pub start: ::std::string::String,
/// <p>The end of the time period. The end date is exclusive. For example, if <code>end</code> is <code>2017-05-01</code>, Amazon Web Services retrieves cost and usage data from the start date up to, but not including, <code>2017-05-01</code>.</p>
pub end: ::std::string::String,
}
impl DateInterval {
/// <p>The beginning of the time period. The start date is inclusive. For example, if <code>start</code> is <code>2017-01-01</code>, Amazon Web Services retrieves cost and usage data starting at <code>2017-01-01</code> up to the end date. The start date must be equal to or no later than the current date to avoid a validation error.</p>
pub fn start(&self) -> &str {
use std::ops::Deref;
self.start.deref()
}
/// <p>The end of the time period. The end date is exclusive. For example, if <code>end</code> is <code>2017-05-01</code>, Amazon Web Services retrieves cost and usage data from the start date up to, but not including, <code>2017-05-01</code>.</p>
pub fn end(&self) -> &str {
use std::ops::Deref;
self.end.deref()
}
}
impl DateInterval {
/// Creates a new builder-style object to manufacture [`DateInterval`](crate::types::DateInterval).
pub fn builder() -> crate::types::builders::DateIntervalBuilder {
crate::types::builders::DateIntervalBuilder::default()
}
}
/// A builder for [`DateInterval`](crate::types::DateInterval).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct DateIntervalBuilder {
pub(crate) start: ::std::option::Option<::std::string::String>,
pub(crate) end: ::std::option::Option<::std::string::String>,
}
impl DateIntervalBuilder {
/// <p>The beginning of the time period. The start date is inclusive. For example, if <code>start</code> is <code>2017-01-01</code>, Amazon Web Services retrieves cost and usage data starting at <code>2017-01-01</code> up to the end date. The start date must be equal to or no later than the current date to avoid a validation error.</p>
/// This field is required.
pub fn start(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.start = ::std::option::Option::Some(input.into());
self
}
/// <p>The beginning of the time period. The start date is inclusive. For example, if <code>start</code> is <code>2017-01-01</code>, Amazon Web Services retrieves cost and usage data starting at <code>2017-01-01</code> up to the end date. The start date must be equal to or no later than the current date to avoid a validation error.</p>
pub fn set_start(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.start = input;
self
}
/// <p>The beginning of the time period. The start date is inclusive. For example, if <code>start</code> is <code>2017-01-01</code>, Amazon Web Services retrieves cost and usage data starting at <code>2017-01-01</code> up to the end date. The start date must be equal to or no later than the current date to avoid a validation error.</p>
pub fn get_start(&self) -> &::std::option::Option<::std::string::String> {
&self.start
}
/// <p>The end of the time period. The end date is exclusive. For example, if <code>end</code> is <code>2017-05-01</code>, Amazon Web Services retrieves cost and usage data from the start date up to, but not including, <code>2017-05-01</code>.</p>
/// This field is required.
pub fn end(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.end = ::std::option::Option::Some(input.into());
self
}
/// <p>The end of the time period. The end date is exclusive. For example, if <code>end</code> is <code>2017-05-01</code>, Amazon Web Services retrieves cost and usage data from the start date up to, but not including, <code>2017-05-01</code>.</p>
pub fn set_end(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.end = input;
self
}
/// <p>The end of the time period. The end date is exclusive. For example, if <code>end</code> is <code>2017-05-01</code>, Amazon Web Services retrieves cost and usage data from the start date up to, but not including, <code>2017-05-01</code>.</p>
pub fn get_end(&self) -> &::std::option::Option<::std::string::String> {
&self.end
}
/// Consumes the builder and constructs a [`DateInterval`](crate::types::DateInterval).
/// This method will fail if any of the following fields are not set:
/// - [`start`](crate::types::builders::DateIntervalBuilder::start)
/// - [`end`](crate::types::builders::DateIntervalBuilder::end)
pub fn build(self) -> ::std::result::Result<crate::types::DateInterval, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::DateInterval {
start: self.start.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"start",
"start was not specified but it is required when building DateInterval",
)
})?,
end: self.end.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"end",
"end was not specified but it is required when building DateInterval",
)
})?,
})
}
}