aws_sdk_cloudwatchlogs/operation/update_anomaly/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_anomaly::_update_anomaly_output::UpdateAnomalyOutputBuilder;
3
4pub use crate::operation::update_anomaly::_update_anomaly_input::UpdateAnomalyInputBuilder;
5
6impl crate::operation::update_anomaly::builders::UpdateAnomalyInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::update_anomaly::UpdateAnomalyOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::update_anomaly::UpdateAnomalyError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.update_anomaly();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `UpdateAnomaly`.
24///
25/// <p>Use this operation to <i>suppress</i> anomaly detection for a specified anomaly or pattern. If you suppress an anomaly, CloudWatch Logs won't report new occurrences of that anomaly and won't update that anomaly with new data. If you suppress a pattern, CloudWatch Logs won't report any anomalies related to that pattern.</p>
26/// <p>You must specify either <code>anomalyId</code> or <code>patternId</code>, but you can't specify both parameters in the same operation.</p>
27/// <p>If you have previously used this operation to suppress detection of a pattern or anomaly, you can use it again to cause CloudWatch Logs to end the suppression. To do this, use this operation and specify the anomaly or pattern to stop suppressing, and omit the <code>suppressionType</code> and <code>suppressionPeriod</code> parameters.</p>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct UpdateAnomalyFluentBuilder {
30    handle: ::std::sync::Arc<crate::client::Handle>,
31    inner: crate::operation::update_anomaly::builders::UpdateAnomalyInputBuilder,
32    config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35    crate::client::customize::internal::CustomizableSend<
36        crate::operation::update_anomaly::UpdateAnomalyOutput,
37        crate::operation::update_anomaly::UpdateAnomalyError,
38    > for UpdateAnomalyFluentBuilder
39{
40    fn send(
41        self,
42        config_override: crate::config::Builder,
43    ) -> crate::client::customize::internal::BoxFuture<
44        crate::client::customize::internal::SendResult<
45            crate::operation::update_anomaly::UpdateAnomalyOutput,
46            crate::operation::update_anomaly::UpdateAnomalyError,
47        >,
48    > {
49        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50    }
51}
52impl UpdateAnomalyFluentBuilder {
53    /// Creates a new `UpdateAnomalyFluentBuilder`.
54    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
55        Self {
56            handle,
57            inner: ::std::default::Default::default(),
58            config_override: ::std::option::Option::None,
59        }
60    }
61    /// Access the UpdateAnomaly as a reference.
62    pub fn as_input(&self) -> &crate::operation::update_anomaly::builders::UpdateAnomalyInputBuilder {
63        &self.inner
64    }
65    /// Sends the request and returns the response.
66    ///
67    /// If an error occurs, an `SdkError` will be returned with additional details that
68    /// can be matched against.
69    ///
70    /// By default, any retryable failures will be retried twice. Retry behavior
71    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
72    /// set when configuring the client.
73    pub async fn send(
74        self,
75    ) -> ::std::result::Result<
76        crate::operation::update_anomaly::UpdateAnomalyOutput,
77        ::aws_smithy_runtime_api::client::result::SdkError<
78            crate::operation::update_anomaly::UpdateAnomalyError,
79            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
80        >,
81    > {
82        let input = self
83            .inner
84            .build()
85            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
86        let runtime_plugins = crate::operation::update_anomaly::UpdateAnomaly::operation_runtime_plugins(
87            self.handle.runtime_plugins.clone(),
88            &self.handle.conf,
89            self.config_override,
90        );
91        crate::operation::update_anomaly::UpdateAnomaly::orchestrate(&runtime_plugins, input).await
92    }
93
94    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
95    pub fn customize(
96        self,
97    ) -> crate::client::customize::CustomizableOperation<
98        crate::operation::update_anomaly::UpdateAnomalyOutput,
99        crate::operation::update_anomaly::UpdateAnomalyError,
100        Self,
101    > {
102        crate::client::customize::CustomizableOperation::new(self)
103    }
104    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
105        self.set_config_override(::std::option::Option::Some(config_override.into()));
106        self
107    }
108
109    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
110        self.config_override = config_override;
111        self
112    }
113    /// <p>If you are suppressing or unsuppressing an anomaly, specify its unique ID here. You can find anomaly IDs by using the <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListAnomalies.html">ListAnomalies</a> operation.</p>
114    pub fn anomaly_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115        self.inner = self.inner.anomaly_id(input.into());
116        self
117    }
118    /// <p>If you are suppressing or unsuppressing an anomaly, specify its unique ID here. You can find anomaly IDs by using the <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListAnomalies.html">ListAnomalies</a> operation.</p>
119    pub fn set_anomaly_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.inner = self.inner.set_anomaly_id(input);
121        self
122    }
123    /// <p>If you are suppressing or unsuppressing an anomaly, specify its unique ID here. You can find anomaly IDs by using the <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListAnomalies.html">ListAnomalies</a> operation.</p>
124    pub fn get_anomaly_id(&self) -> &::std::option::Option<::std::string::String> {
125        self.inner.get_anomaly_id()
126    }
127    /// <p>If you are suppressing or unsuppressing an pattern, specify its unique ID here. You can find pattern IDs by using the <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListAnomalies.html">ListAnomalies</a> operation.</p>
128    pub fn pattern_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129        self.inner = self.inner.pattern_id(input.into());
130        self
131    }
132    /// <p>If you are suppressing or unsuppressing an pattern, specify its unique ID here. You can find pattern IDs by using the <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListAnomalies.html">ListAnomalies</a> operation.</p>
133    pub fn set_pattern_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
134        self.inner = self.inner.set_pattern_id(input);
135        self
136    }
137    /// <p>If you are suppressing or unsuppressing an pattern, specify its unique ID here. You can find pattern IDs by using the <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListAnomalies.html">ListAnomalies</a> operation.</p>
138    pub fn get_pattern_id(&self) -> &::std::option::Option<::std::string::String> {
139        self.inner.get_pattern_id()
140    }
141    /// <p>The ARN of the anomaly detector that this operation is to act on.</p>
142    pub fn anomaly_detector_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
143        self.inner = self.inner.anomaly_detector_arn(input.into());
144        self
145    }
146    /// <p>The ARN of the anomaly detector that this operation is to act on.</p>
147    pub fn set_anomaly_detector_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
148        self.inner = self.inner.set_anomaly_detector_arn(input);
149        self
150    }
151    /// <p>The ARN of the anomaly detector that this operation is to act on.</p>
152    pub fn get_anomaly_detector_arn(&self) -> &::std::option::Option<::std::string::String> {
153        self.inner.get_anomaly_detector_arn()
154    }
155    /// <p>Use this to specify whether the suppression to be temporary or infinite. If you specify <code>LIMITED</code>, you must also specify a <code>suppressionPeriod</code>. If you specify <code>INFINITE</code>, any value for <code>suppressionPeriod</code> is ignored.</p>
156    pub fn suppression_type(mut self, input: crate::types::SuppressionType) -> Self {
157        self.inner = self.inner.suppression_type(input);
158        self
159    }
160    /// <p>Use this to specify whether the suppression to be temporary or infinite. If you specify <code>LIMITED</code>, you must also specify a <code>suppressionPeriod</code>. If you specify <code>INFINITE</code>, any value for <code>suppressionPeriod</code> is ignored.</p>
161    pub fn set_suppression_type(mut self, input: ::std::option::Option<crate::types::SuppressionType>) -> Self {
162        self.inner = self.inner.set_suppression_type(input);
163        self
164    }
165    /// <p>Use this to specify whether the suppression to be temporary or infinite. If you specify <code>LIMITED</code>, you must also specify a <code>suppressionPeriod</code>. If you specify <code>INFINITE</code>, any value for <code>suppressionPeriod</code> is ignored.</p>
166    pub fn get_suppression_type(&self) -> &::std::option::Option<crate::types::SuppressionType> {
167        self.inner.get_suppression_type()
168    }
169    /// <p>If you are temporarily suppressing an anomaly or pattern, use this structure to specify how long the suppression is to last.</p>
170    pub fn suppression_period(mut self, input: crate::types::SuppressionPeriod) -> Self {
171        self.inner = self.inner.suppression_period(input);
172        self
173    }
174    /// <p>If you are temporarily suppressing an anomaly or pattern, use this structure to specify how long the suppression is to last.</p>
175    pub fn set_suppression_period(mut self, input: ::std::option::Option<crate::types::SuppressionPeriod>) -> Self {
176        self.inner = self.inner.set_suppression_period(input);
177        self
178    }
179    /// <p>If you are temporarily suppressing an anomaly or pattern, use this structure to specify how long the suppression is to last.</p>
180    pub fn get_suppression_period(&self) -> &::std::option::Option<crate::types::SuppressionPeriod> {
181        self.inner.get_suppression_period()
182    }
183    /// <p>Set this to <code>true</code> to prevent CloudWatch Logs from displaying this behavior as an anomaly in the future. The behavior is then treated as baseline behavior. However, if similar but more severe occurrences of this behavior occur in the future, those will still be reported as anomalies.</p>
184    /// <p>The default is <code>false</code></p>
185    pub fn baseline(mut self, input: bool) -> Self {
186        self.inner = self.inner.baseline(input);
187        self
188    }
189    /// <p>Set this to <code>true</code> to prevent CloudWatch Logs from displaying this behavior as an anomaly in the future. The behavior is then treated as baseline behavior. However, if similar but more severe occurrences of this behavior occur in the future, those will still be reported as anomalies.</p>
190    /// <p>The default is <code>false</code></p>
191    pub fn set_baseline(mut self, input: ::std::option::Option<bool>) -> Self {
192        self.inner = self.inner.set_baseline(input);
193        self
194    }
195    /// <p>Set this to <code>true</code> to prevent CloudWatch Logs from displaying this behavior as an anomaly in the future. The behavior is then treated as baseline behavior. However, if similar but more severe occurrences of this behavior occur in the future, those will still be reported as anomalies.</p>
196    /// <p>The default is <code>false</code></p>
197    pub fn get_baseline(&self) -> &::std::option::Option<bool> {
198        self.inner.get_baseline()
199    }
200}