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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>The object that defines the time length of an exclusion window.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Window {
/// <p>The unit of time for the exclusion window duration. Valid values: MINUTE, HOUR, DAY, MONTH.</p>
pub duration_unit: crate::types::DurationUnit,
/// <p>The number of time units for the exclusion window length.</p>
pub duration: i32,
}
impl Window {
/// <p>The unit of time for the exclusion window duration. Valid values: MINUTE, HOUR, DAY, MONTH.</p>
pub fn duration_unit(&self) -> &crate::types::DurationUnit {
&self.duration_unit
}
/// <p>The number of time units for the exclusion window length.</p>
pub fn duration(&self) -> i32 {
self.duration
}
}
impl Window {
/// Creates a new builder-style object to manufacture [`Window`](crate::types::Window).
pub fn builder() -> crate::types::builders::WindowBuilder {
crate::types::builders::WindowBuilder::default()
}
}
/// A builder for [`Window`](crate::types::Window).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct WindowBuilder {
pub(crate) duration_unit: ::std::option::Option<crate::types::DurationUnit>,
pub(crate) duration: ::std::option::Option<i32>,
}
impl WindowBuilder {
/// <p>The unit of time for the exclusion window duration. Valid values: MINUTE, HOUR, DAY, MONTH.</p>
/// This field is required.
pub fn duration_unit(mut self, input: crate::types::DurationUnit) -> Self {
self.duration_unit = ::std::option::Option::Some(input);
self
}
/// <p>The unit of time for the exclusion window duration. Valid values: MINUTE, HOUR, DAY, MONTH.</p>
pub fn set_duration_unit(mut self, input: ::std::option::Option<crate::types::DurationUnit>) -> Self {
self.duration_unit = input;
self
}
/// <p>The unit of time for the exclusion window duration. Valid values: MINUTE, HOUR, DAY, MONTH.</p>
pub fn get_duration_unit(&self) -> &::std::option::Option<crate::types::DurationUnit> {
&self.duration_unit
}
/// <p>The number of time units for the exclusion window length.</p>
/// This field is required.
pub fn duration(mut self, input: i32) -> Self {
self.duration = ::std::option::Option::Some(input);
self
}
/// <p>The number of time units for the exclusion window length.</p>
pub fn set_duration(mut self, input: ::std::option::Option<i32>) -> Self {
self.duration = input;
self
}
/// <p>The number of time units for the exclusion window length.</p>
pub fn get_duration(&self) -> &::std::option::Option<i32> {
&self.duration
}
/// Consumes the builder and constructs a [`Window`](crate::types::Window).
/// This method will fail if any of the following fields are not set:
/// - [`duration_unit`](crate::types::builders::WindowBuilder::duration_unit)
/// - [`duration`](crate::types::builders::WindowBuilder::duration)
pub fn build(self) -> ::std::result::Result<crate::types::Window, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Window {
duration_unit: self.duration_unit.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"duration_unit",
"duration_unit was not specified but it is required when building Window",
)
})?,
duration: self.duration.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"duration",
"duration was not specified but it is required when building Window",
)
})?,
})
}
}