Skip to main content

aws_sdk_devopsguru/types/
_insight_time_range.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A time ranged that specifies when the observed behavior in an insight started and ended.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct InsightTimeRange {
7    /// <p>The time when the behavior described in an insight started.</p>
8    pub start_time: ::aws_smithy_types::DateTime,
9    /// <p>The time when the behavior described in an insight ended.</p>
10    pub end_time: ::std::option::Option<::aws_smithy_types::DateTime>,
11}
12impl InsightTimeRange {
13    /// <p>The time when the behavior described in an insight started.</p>
14    pub fn start_time(&self) -> &::aws_smithy_types::DateTime {
15        &self.start_time
16    }
17    /// <p>The time when the behavior described in an insight ended.</p>
18    pub fn end_time(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
19        self.end_time.as_ref()
20    }
21}
22impl InsightTimeRange {
23    /// Creates a new builder-style object to manufacture [`InsightTimeRange`](crate::types::InsightTimeRange).
24    pub fn builder() -> crate::types::builders::InsightTimeRangeBuilder {
25        crate::types::builders::InsightTimeRangeBuilder::default()
26    }
27}
28
29/// A builder for [`InsightTimeRange`](crate::types::InsightTimeRange).
30#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
31#[non_exhaustive]
32pub struct InsightTimeRangeBuilder {
33    pub(crate) start_time: ::std::option::Option<::aws_smithy_types::DateTime>,
34    pub(crate) end_time: ::std::option::Option<::aws_smithy_types::DateTime>,
35}
36impl InsightTimeRangeBuilder {
37    /// <p>The time when the behavior described in an insight started.</p>
38    /// This field is required.
39    pub fn start_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
40        self.start_time = ::std::option::Option::Some(input);
41        self
42    }
43    /// <p>The time when the behavior described in an insight started.</p>
44    pub fn set_start_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
45        self.start_time = input;
46        self
47    }
48    /// <p>The time when the behavior described in an insight started.</p>
49    pub fn get_start_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
50        &self.start_time
51    }
52    /// <p>The time when the behavior described in an insight ended.</p>
53    pub fn end_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
54        self.end_time = ::std::option::Option::Some(input);
55        self
56    }
57    /// <p>The time when the behavior described in an insight ended.</p>
58    pub fn set_end_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
59        self.end_time = input;
60        self
61    }
62    /// <p>The time when the behavior described in an insight ended.</p>
63    pub fn get_end_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
64        &self.end_time
65    }
66    /// Consumes the builder and constructs a [`InsightTimeRange`](crate::types::InsightTimeRange).
67    /// This method will fail if any of the following fields are not set:
68    /// - [`start_time`](crate::types::builders::InsightTimeRangeBuilder::start_time)
69    pub fn build(self) -> ::std::result::Result<crate::types::InsightTimeRange, ::aws_smithy_types::error::operation::BuildError> {
70        ::std::result::Result::Ok(crate::types::InsightTimeRange {
71            start_time: self.start_time.ok_or_else(|| {
72                ::aws_smithy_types::error::operation::BuildError::missing_field(
73                    "start_time",
74                    "start_time was not specified but it is required when building InsightTimeRange",
75                )
76            })?,
77            end_time: self.end_time,
78        })
79    }
80}