Skip to main content

aws_sdk_devopsguru/types/
_recommendation_related_anomaly.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Information about an anomaly that is related to a recommendation.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct RecommendationRelatedAnomaly {
7    /// <p>An array of objects that represent resources in which DevOps Guru detected anomalous behavior. Each object contains the name and type of the resource.</p>
8    pub resources: ::std::option::Option<::std::vec::Vec<crate::types::RecommendationRelatedAnomalyResource>>,
9    /// <p>Information about where the anomalous behavior related the recommendation was found. For example, details in Amazon CloudWatch metrics.</p>
10    pub source_details: ::std::option::Option<::std::vec::Vec<crate::types::RecommendationRelatedAnomalySourceDetail>>,
11    /// <p>The ID of an anomaly that generated the insight with this recommendation.</p>
12    pub anomaly_id: ::std::option::Option<::std::string::String>,
13}
14impl RecommendationRelatedAnomaly {
15    /// <p>An array of objects that represent resources in which DevOps Guru detected anomalous behavior. Each object contains the name and type of the resource.</p>
16    ///
17    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.resources.is_none()`.
18    pub fn resources(&self) -> &[crate::types::RecommendationRelatedAnomalyResource] {
19        self.resources.as_deref().unwrap_or_default()
20    }
21    /// <p>Information about where the anomalous behavior related the recommendation was found. For example, details in Amazon CloudWatch metrics.</p>
22    ///
23    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.source_details.is_none()`.
24    pub fn source_details(&self) -> &[crate::types::RecommendationRelatedAnomalySourceDetail] {
25        self.source_details.as_deref().unwrap_or_default()
26    }
27    /// <p>The ID of an anomaly that generated the insight with this recommendation.</p>
28    pub fn anomaly_id(&self) -> ::std::option::Option<&str> {
29        self.anomaly_id.as_deref()
30    }
31}
32impl RecommendationRelatedAnomaly {
33    /// Creates a new builder-style object to manufacture [`RecommendationRelatedAnomaly`](crate::types::RecommendationRelatedAnomaly).
34    pub fn builder() -> crate::types::builders::RecommendationRelatedAnomalyBuilder {
35        crate::types::builders::RecommendationRelatedAnomalyBuilder::default()
36    }
37}
38
39/// A builder for [`RecommendationRelatedAnomaly`](crate::types::RecommendationRelatedAnomaly).
40#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
41#[non_exhaustive]
42pub struct RecommendationRelatedAnomalyBuilder {
43    pub(crate) resources: ::std::option::Option<::std::vec::Vec<crate::types::RecommendationRelatedAnomalyResource>>,
44    pub(crate) source_details: ::std::option::Option<::std::vec::Vec<crate::types::RecommendationRelatedAnomalySourceDetail>>,
45    pub(crate) anomaly_id: ::std::option::Option<::std::string::String>,
46}
47impl RecommendationRelatedAnomalyBuilder {
48    /// Appends an item to `resources`.
49    ///
50    /// To override the contents of this collection use [`set_resources`](Self::set_resources).
51    ///
52    /// <p>An array of objects that represent resources in which DevOps Guru detected anomalous behavior. Each object contains the name and type of the resource.</p>
53    pub fn resources(mut self, input: crate::types::RecommendationRelatedAnomalyResource) -> Self {
54        let mut v = self.resources.unwrap_or_default();
55        v.push(input);
56        self.resources = ::std::option::Option::Some(v);
57        self
58    }
59    /// <p>An array of objects that represent resources in which DevOps Guru detected anomalous behavior. Each object contains the name and type of the resource.</p>
60    pub fn set_resources(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RecommendationRelatedAnomalyResource>>) -> Self {
61        self.resources = input;
62        self
63    }
64    /// <p>An array of objects that represent resources in which DevOps Guru detected anomalous behavior. Each object contains the name and type of the resource.</p>
65    pub fn get_resources(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RecommendationRelatedAnomalyResource>> {
66        &self.resources
67    }
68    /// Appends an item to `source_details`.
69    ///
70    /// To override the contents of this collection use [`set_source_details`](Self::set_source_details).
71    ///
72    /// <p>Information about where the anomalous behavior related the recommendation was found. For example, details in Amazon CloudWatch metrics.</p>
73    pub fn source_details(mut self, input: crate::types::RecommendationRelatedAnomalySourceDetail) -> Self {
74        let mut v = self.source_details.unwrap_or_default();
75        v.push(input);
76        self.source_details = ::std::option::Option::Some(v);
77        self
78    }
79    /// <p>Information about where the anomalous behavior related the recommendation was found. For example, details in Amazon CloudWatch metrics.</p>
80    pub fn set_source_details(
81        mut self,
82        input: ::std::option::Option<::std::vec::Vec<crate::types::RecommendationRelatedAnomalySourceDetail>>,
83    ) -> Self {
84        self.source_details = input;
85        self
86    }
87    /// <p>Information about where the anomalous behavior related the recommendation was found. For example, details in Amazon CloudWatch metrics.</p>
88    pub fn get_source_details(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RecommendationRelatedAnomalySourceDetail>> {
89        &self.source_details
90    }
91    /// <p>The ID of an anomaly that generated the insight with this recommendation.</p>
92    pub fn anomaly_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
93        self.anomaly_id = ::std::option::Option::Some(input.into());
94        self
95    }
96    /// <p>The ID of an anomaly that generated the insight with this recommendation.</p>
97    pub fn set_anomaly_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
98        self.anomaly_id = input;
99        self
100    }
101    /// <p>The ID of an anomaly that generated the insight with this recommendation.</p>
102    pub fn get_anomaly_id(&self) -> &::std::option::Option<::std::string::String> {
103        &self.anomaly_id
104    }
105    /// Consumes the builder and constructs a [`RecommendationRelatedAnomaly`](crate::types::RecommendationRelatedAnomaly).
106    pub fn build(self) -> crate::types::RecommendationRelatedAnomaly {
107        crate::types::RecommendationRelatedAnomaly {
108            resources: self.resources,
109            source_details: self.source_details,
110            anomaly_id: self.anomaly_id,
111        }
112    }
113}