aws_sdk_codeguruprofiler/operation/get_recommendations/
_get_recommendations_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The structure representing the GetRecommendationsResponse.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct GetRecommendationsOutput {
7    /// <p>The name of the profiling group the analysis data is about.</p>
8    pub profiling_group_name: ::std::string::String,
9    /// <p>The start time of the profile the analysis data is about. This is specified using the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020 1:15:02 PM UTC.</p>
10    pub profile_start_time: ::aws_smithy_types::DateTime,
11    /// <p>The end time of the profile the analysis data is about. This is specified using the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020 1:15:02 PM UTC.</p>
12    pub profile_end_time: ::aws_smithy_types::DateTime,
13    /// <p>The list of recommendations that the analysis found for this profile.</p>
14    pub recommendations: ::std::vec::Vec<crate::types::Recommendation>,
15    /// <p>The list of anomalies that the analysis has found for this profile.</p>
16    pub anomalies: ::std::vec::Vec<crate::types::Anomaly>,
17    _request_id: Option<String>,
18}
19impl GetRecommendationsOutput {
20    /// <p>The name of the profiling group the analysis data is about.</p>
21    pub fn profiling_group_name(&self) -> &str {
22        use std::ops::Deref;
23        self.profiling_group_name.deref()
24    }
25    /// <p>The start time of the profile the analysis data is about. This is specified using the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020 1:15:02 PM UTC.</p>
26    pub fn profile_start_time(&self) -> &::aws_smithy_types::DateTime {
27        &self.profile_start_time
28    }
29    /// <p>The end time of the profile the analysis data is about. This is specified using the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020 1:15:02 PM UTC.</p>
30    pub fn profile_end_time(&self) -> &::aws_smithy_types::DateTime {
31        &self.profile_end_time
32    }
33    /// <p>The list of recommendations that the analysis found for this profile.</p>
34    pub fn recommendations(&self) -> &[crate::types::Recommendation] {
35        use std::ops::Deref;
36        self.recommendations.deref()
37    }
38    /// <p>The list of anomalies that the analysis has found for this profile.</p>
39    pub fn anomalies(&self) -> &[crate::types::Anomaly] {
40        use std::ops::Deref;
41        self.anomalies.deref()
42    }
43}
44impl ::aws_types::request_id::RequestId for GetRecommendationsOutput {
45    fn request_id(&self) -> Option<&str> {
46        self._request_id.as_deref()
47    }
48}
49impl GetRecommendationsOutput {
50    /// Creates a new builder-style object to manufacture [`GetRecommendationsOutput`](crate::operation::get_recommendations::GetRecommendationsOutput).
51    pub fn builder() -> crate::operation::get_recommendations::builders::GetRecommendationsOutputBuilder {
52        crate::operation::get_recommendations::builders::GetRecommendationsOutputBuilder::default()
53    }
54}
55
56/// A builder for [`GetRecommendationsOutput`](crate::operation::get_recommendations::GetRecommendationsOutput).
57#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
58#[non_exhaustive]
59pub struct GetRecommendationsOutputBuilder {
60    pub(crate) profiling_group_name: ::std::option::Option<::std::string::String>,
61    pub(crate) profile_start_time: ::std::option::Option<::aws_smithy_types::DateTime>,
62    pub(crate) profile_end_time: ::std::option::Option<::aws_smithy_types::DateTime>,
63    pub(crate) recommendations: ::std::option::Option<::std::vec::Vec<crate::types::Recommendation>>,
64    pub(crate) anomalies: ::std::option::Option<::std::vec::Vec<crate::types::Anomaly>>,
65    _request_id: Option<String>,
66}
67impl GetRecommendationsOutputBuilder {
68    /// <p>The name of the profiling group the analysis data is about.</p>
69    /// This field is required.
70    pub fn profiling_group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
71        self.profiling_group_name = ::std::option::Option::Some(input.into());
72        self
73    }
74    /// <p>The name of the profiling group the analysis data is about.</p>
75    pub fn set_profiling_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
76        self.profiling_group_name = input;
77        self
78    }
79    /// <p>The name of the profiling group the analysis data is about.</p>
80    pub fn get_profiling_group_name(&self) -> &::std::option::Option<::std::string::String> {
81        &self.profiling_group_name
82    }
83    /// <p>The start time of the profile the analysis data is about. This is specified using the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020 1:15:02 PM UTC.</p>
84    /// This field is required.
85    pub fn profile_start_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
86        self.profile_start_time = ::std::option::Option::Some(input);
87        self
88    }
89    /// <p>The start time of the profile the analysis data is about. This is specified using the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020 1:15:02 PM UTC.</p>
90    pub fn set_profile_start_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
91        self.profile_start_time = input;
92        self
93    }
94    /// <p>The start time of the profile the analysis data is about. This is specified using the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020 1:15:02 PM UTC.</p>
95    pub fn get_profile_start_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
96        &self.profile_start_time
97    }
98    /// <p>The end time of the profile the analysis data is about. This is specified using the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020 1:15:02 PM UTC.</p>
99    /// This field is required.
100    pub fn profile_end_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
101        self.profile_end_time = ::std::option::Option::Some(input);
102        self
103    }
104    /// <p>The end time of the profile the analysis data is about. This is specified using the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020 1:15:02 PM UTC.</p>
105    pub fn set_profile_end_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
106        self.profile_end_time = input;
107        self
108    }
109    /// <p>The end time of the profile the analysis data is about. This is specified using the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020 1:15:02 PM UTC.</p>
110    pub fn get_profile_end_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
111        &self.profile_end_time
112    }
113    /// Appends an item to `recommendations`.
114    ///
115    /// To override the contents of this collection use [`set_recommendations`](Self::set_recommendations).
116    ///
117    /// <p>The list of recommendations that the analysis found for this profile.</p>
118    pub fn recommendations(mut self, input: crate::types::Recommendation) -> Self {
119        let mut v = self.recommendations.unwrap_or_default();
120        v.push(input);
121        self.recommendations = ::std::option::Option::Some(v);
122        self
123    }
124    /// <p>The list of recommendations that the analysis found for this profile.</p>
125    pub fn set_recommendations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Recommendation>>) -> Self {
126        self.recommendations = input;
127        self
128    }
129    /// <p>The list of recommendations that the analysis found for this profile.</p>
130    pub fn get_recommendations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Recommendation>> {
131        &self.recommendations
132    }
133    /// Appends an item to `anomalies`.
134    ///
135    /// To override the contents of this collection use [`set_anomalies`](Self::set_anomalies).
136    ///
137    /// <p>The list of anomalies that the analysis has found for this profile.</p>
138    pub fn anomalies(mut self, input: crate::types::Anomaly) -> Self {
139        let mut v = self.anomalies.unwrap_or_default();
140        v.push(input);
141        self.anomalies = ::std::option::Option::Some(v);
142        self
143    }
144    /// <p>The list of anomalies that the analysis has found for this profile.</p>
145    pub fn set_anomalies(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Anomaly>>) -> Self {
146        self.anomalies = input;
147        self
148    }
149    /// <p>The list of anomalies that the analysis has found for this profile.</p>
150    pub fn get_anomalies(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Anomaly>> {
151        &self.anomalies
152    }
153    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
154        self._request_id = Some(request_id.into());
155        self
156    }
157
158    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
159        self._request_id = request_id;
160        self
161    }
162    /// Consumes the builder and constructs a [`GetRecommendationsOutput`](crate::operation::get_recommendations::GetRecommendationsOutput).
163    /// This method will fail if any of the following fields are not set:
164    /// - [`profiling_group_name`](crate::operation::get_recommendations::builders::GetRecommendationsOutputBuilder::profiling_group_name)
165    /// - [`profile_start_time`](crate::operation::get_recommendations::builders::GetRecommendationsOutputBuilder::profile_start_time)
166    /// - [`profile_end_time`](crate::operation::get_recommendations::builders::GetRecommendationsOutputBuilder::profile_end_time)
167    /// - [`recommendations`](crate::operation::get_recommendations::builders::GetRecommendationsOutputBuilder::recommendations)
168    /// - [`anomalies`](crate::operation::get_recommendations::builders::GetRecommendationsOutputBuilder::anomalies)
169    pub fn build(
170        self,
171    ) -> ::std::result::Result<crate::operation::get_recommendations::GetRecommendationsOutput, ::aws_smithy_types::error::operation::BuildError>
172    {
173        ::std::result::Result::Ok(crate::operation::get_recommendations::GetRecommendationsOutput {
174            profiling_group_name: self.profiling_group_name.ok_or_else(|| {
175                ::aws_smithy_types::error::operation::BuildError::missing_field(
176                    "profiling_group_name",
177                    "profiling_group_name was not specified but it is required when building GetRecommendationsOutput",
178                )
179            })?,
180            profile_start_time: self.profile_start_time.ok_or_else(|| {
181                ::aws_smithy_types::error::operation::BuildError::missing_field(
182                    "profile_start_time",
183                    "profile_start_time was not specified but it is required when building GetRecommendationsOutput",
184                )
185            })?,
186            profile_end_time: self.profile_end_time.ok_or_else(|| {
187                ::aws_smithy_types::error::operation::BuildError::missing_field(
188                    "profile_end_time",
189                    "profile_end_time was not specified but it is required when building GetRecommendationsOutput",
190                )
191            })?,
192            recommendations: self.recommendations.ok_or_else(|| {
193                ::aws_smithy_types::error::operation::BuildError::missing_field(
194                    "recommendations",
195                    "recommendations was not specified but it is required when building GetRecommendationsOutput",
196                )
197            })?,
198            anomalies: self.anomalies.ok_or_else(|| {
199                ::aws_smithy_types::error::operation::BuildError::missing_field(
200                    "anomalies",
201                    "anomalies was not specified but it is required when building GetRecommendationsOutput",
202                )
203            })?,
204            _request_id: self._request_id,
205        })
206    }
207}