aws_sdk_applicationsignals/operation/create_service_level_objective/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_service_level_objective::_create_service_level_objective_output::CreateServiceLevelObjectiveOutputBuilder;
3
4pub use crate::operation::create_service_level_objective::_create_service_level_objective_input::CreateServiceLevelObjectiveInputBuilder;
5
6impl crate::operation::create_service_level_objective::builders::CreateServiceLevelObjectiveInputBuilder {
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::create_service_level_objective::CreateServiceLevelObjectiveOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_service_level_objective::CreateServiceLevelObjectiveError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_service_level_objective();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateServiceLevelObjective`.
24///
25/// <p>Creates a service level objective (SLO), which can help you ensure that your critical business operations are meeting customer expectations. Use SLOs to set and track specific target levels for the reliability and availability of your applications and services. SLOs use service level indicators (SLIs) to calculate whether the application is performing at the level that you want.</p>
26/// <p>Create an SLO to set a target for a service or operation’s availability or latency. CloudWatch measures this target frequently you can find whether it has been breached.</p>
27/// <p>The target performance quality that is defined for an SLO is the <i>attainment goal</i>.</p>
28/// <p>You can set SLO targets for your applications that are discovered by Application Signals, using critical metrics such as latency and availability. You can also set SLOs against any CloudWatch metric or math expression that produces a time series.</p><note>
29/// <p>You can't create an SLO for a service operation that was discovered by Application Signals until after that operation has reported standard metrics to Application Signals.</p>
30/// </note>
31/// <p>When you create an SLO, you specify whether it is a <i>period-based SLO</i> or a <i>request-based SLO</i>. Each type of SLO has a different way of evaluating your application's performance against its attainment goal.</p>
32/// <ul>
33/// <li>
34/// <p>A <i>period-based SLO</i> uses defined <i>periods</i> of time within a specified total time interval. For each period of time, Application Signals determines whether the application met its goal. The attainment rate is calculated as the <code>number of good periods/number of total periods</code>.</p>
35/// <p>For example, for a period-based SLO, meeting an attainment goal of 99.9% means that within your interval, your application must meet its performance goal during at least 99.9% of the time periods.</p></li>
36/// <li>
37/// <p>A <i>request-based SLO</i> doesn't use pre-defined periods of time. Instead, the SLO measures <code>number of good requests/number of total requests</code> during the interval. At any time, you can find the ratio of good requests to total requests for the interval up to the time stamp that you specify, and measure that ratio against the goal set in your SLO.</p></li>
38/// </ul>
39/// <p>After you have created an SLO, you can retrieve error budget reports for it. An <i>error budget</i> is the amount of time or amount of requests that your application can be non-compliant with the SLO's goal, and still have your application meet the goal.</p>
40/// <ul>
41/// <li>
42/// <p>For a period-based SLO, the error budget starts at a number defined by the highest number of periods that can fail to meet the threshold, while still meeting the overall goal. The <i>remaining error budget</i> decreases with every failed period that is recorded. The error budget within one interval can never increase.</p>
43/// <p>For example, an SLO with a threshold that 99.95% of requests must be completed under 2000ms every month translates to an error budget of 21.9 minutes of downtime per month.</p></li>
44/// <li>
45/// <p>For a request-based SLO, the remaining error budget is dynamic and can increase or decrease, depending on the ratio of good requests to total requests.</p></li>
46/// </ul>
47/// <p>For more information about SLOs, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-ServiceLevelObjectives.html"> Service level objectives (SLOs)</a>.</p>
48/// <p>When you perform a <code>CreateServiceLevelObjective</code> operation, Application Signals creates the <i>AWSServiceRoleForCloudWatchApplicationSignals</i> service-linked role, if it doesn't already exist in your account. This service- linked role has the following permissions:</p>
49/// <ul>
50/// <li>
51/// <p><code>xray:GetServiceGraph</code></p></li>
52/// <li>
53/// <p><code>logs:StartQuery</code></p></li>
54/// <li>
55/// <p><code>logs:GetQueryResults</code></p></li>
56/// <li>
57/// <p><code>cloudwatch:GetMetricData</code></p></li>
58/// <li>
59/// <p><code>cloudwatch:ListMetrics</code></p></li>
60/// <li>
61/// <p><code>tag:GetResources</code></p></li>
62/// <li>
63/// <p><code>autoscaling:DescribeAutoScalingGroups</code></p></li>
64/// </ul>
65#[derive(::std::clone::Clone, ::std::fmt::Debug)]
66pub struct CreateServiceLevelObjectiveFluentBuilder {
67    handle: ::std::sync::Arc<crate::client::Handle>,
68    inner: crate::operation::create_service_level_objective::builders::CreateServiceLevelObjectiveInputBuilder,
69    config_override: ::std::option::Option<crate::config::Builder>,
70}
71impl
72    crate::client::customize::internal::CustomizableSend<
73        crate::operation::create_service_level_objective::CreateServiceLevelObjectiveOutput,
74        crate::operation::create_service_level_objective::CreateServiceLevelObjectiveError,
75    > for CreateServiceLevelObjectiveFluentBuilder
76{
77    fn send(
78        self,
79        config_override: crate::config::Builder,
80    ) -> crate::client::customize::internal::BoxFuture<
81        crate::client::customize::internal::SendResult<
82            crate::operation::create_service_level_objective::CreateServiceLevelObjectiveOutput,
83            crate::operation::create_service_level_objective::CreateServiceLevelObjectiveError,
84        >,
85    > {
86        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
87    }
88}
89impl CreateServiceLevelObjectiveFluentBuilder {
90    /// Creates a new `CreateServiceLevelObjectiveFluentBuilder`.
91    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
92        Self {
93            handle,
94            inner: ::std::default::Default::default(),
95            config_override: ::std::option::Option::None,
96        }
97    }
98    /// Access the CreateServiceLevelObjective as a reference.
99    pub fn as_input(&self) -> &crate::operation::create_service_level_objective::builders::CreateServiceLevelObjectiveInputBuilder {
100        &self.inner
101    }
102    /// Sends the request and returns the response.
103    ///
104    /// If an error occurs, an `SdkError` will be returned with additional details that
105    /// can be matched against.
106    ///
107    /// By default, any retryable failures will be retried twice. Retry behavior
108    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
109    /// set when configuring the client.
110    pub async fn send(
111        self,
112    ) -> ::std::result::Result<
113        crate::operation::create_service_level_objective::CreateServiceLevelObjectiveOutput,
114        ::aws_smithy_runtime_api::client::result::SdkError<
115            crate::operation::create_service_level_objective::CreateServiceLevelObjectiveError,
116            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
117        >,
118    > {
119        let input = self
120            .inner
121            .build()
122            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
123        let runtime_plugins = crate::operation::create_service_level_objective::CreateServiceLevelObjective::operation_runtime_plugins(
124            self.handle.runtime_plugins.clone(),
125            &self.handle.conf,
126            self.config_override,
127        );
128        crate::operation::create_service_level_objective::CreateServiceLevelObjective::orchestrate(&runtime_plugins, input).await
129    }
130
131    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
132    pub fn customize(
133        self,
134    ) -> crate::client::customize::CustomizableOperation<
135        crate::operation::create_service_level_objective::CreateServiceLevelObjectiveOutput,
136        crate::operation::create_service_level_objective::CreateServiceLevelObjectiveError,
137        Self,
138    > {
139        crate::client::customize::CustomizableOperation::new(self)
140    }
141    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
142        self.set_config_override(::std::option::Option::Some(config_override.into()));
143        self
144    }
145
146    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
147        self.config_override = config_override;
148        self
149    }
150    /// <p>A name for this SLO.</p>
151    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
152        self.inner = self.inner.name(input.into());
153        self
154    }
155    /// <p>A name for this SLO.</p>
156    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
157        self.inner = self.inner.set_name(input);
158        self
159    }
160    /// <p>A name for this SLO.</p>
161    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
162        self.inner.get_name()
163    }
164    /// <p>An optional description for this SLO.</p>
165    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
166        self.inner = self.inner.description(input.into());
167        self
168    }
169    /// <p>An optional description for this SLO.</p>
170    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
171        self.inner = self.inner.set_description(input);
172        self
173    }
174    /// <p>An optional description for this SLO.</p>
175    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
176        self.inner.get_description()
177    }
178    /// <p>If this SLO is a period-based SLO, this structure defines the information about what performance metric this SLO will monitor.</p>
179    /// <p>You can't specify both <code>RequestBasedSliConfig</code> and <code>SliConfig</code> in the same operation.</p>
180    pub fn sli_config(mut self, input: crate::types::ServiceLevelIndicatorConfig) -> Self {
181        self.inner = self.inner.sli_config(input);
182        self
183    }
184    /// <p>If this SLO is a period-based SLO, this structure defines the information about what performance metric this SLO will monitor.</p>
185    /// <p>You can't specify both <code>RequestBasedSliConfig</code> and <code>SliConfig</code> in the same operation.</p>
186    pub fn set_sli_config(mut self, input: ::std::option::Option<crate::types::ServiceLevelIndicatorConfig>) -> Self {
187        self.inner = self.inner.set_sli_config(input);
188        self
189    }
190    /// <p>If this SLO is a period-based SLO, this structure defines the information about what performance metric this SLO will monitor.</p>
191    /// <p>You can't specify both <code>RequestBasedSliConfig</code> and <code>SliConfig</code> in the same operation.</p>
192    pub fn get_sli_config(&self) -> &::std::option::Option<crate::types::ServiceLevelIndicatorConfig> {
193        self.inner.get_sli_config()
194    }
195    /// <p>If this SLO is a request-based SLO, this structure defines the information about what performance metric this SLO will monitor.</p>
196    /// <p>You can't specify both <code>RequestBasedSliConfig</code> and <code>SliConfig</code> in the same operation.</p>
197    pub fn request_based_sli_config(mut self, input: crate::types::RequestBasedServiceLevelIndicatorConfig) -> Self {
198        self.inner = self.inner.request_based_sli_config(input);
199        self
200    }
201    /// <p>If this SLO is a request-based SLO, this structure defines the information about what performance metric this SLO will monitor.</p>
202    /// <p>You can't specify both <code>RequestBasedSliConfig</code> and <code>SliConfig</code> in the same operation.</p>
203    pub fn set_request_based_sli_config(mut self, input: ::std::option::Option<crate::types::RequestBasedServiceLevelIndicatorConfig>) -> Self {
204        self.inner = self.inner.set_request_based_sli_config(input);
205        self
206    }
207    /// <p>If this SLO is a request-based SLO, this structure defines the information about what performance metric this SLO will monitor.</p>
208    /// <p>You can't specify both <code>RequestBasedSliConfig</code> and <code>SliConfig</code> in the same operation.</p>
209    pub fn get_request_based_sli_config(&self) -> &::std::option::Option<crate::types::RequestBasedServiceLevelIndicatorConfig> {
210        self.inner.get_request_based_sli_config()
211    }
212    /// <p>This structure contains the attributes that determine the goal of the SLO.</p>
213    pub fn goal(mut self, input: crate::types::Goal) -> Self {
214        self.inner = self.inner.goal(input);
215        self
216    }
217    /// <p>This structure contains the attributes that determine the goal of the SLO.</p>
218    pub fn set_goal(mut self, input: ::std::option::Option<crate::types::Goal>) -> Self {
219        self.inner = self.inner.set_goal(input);
220        self
221    }
222    /// <p>This structure contains the attributes that determine the goal of the SLO.</p>
223    pub fn get_goal(&self) -> &::std::option::Option<crate::types::Goal> {
224        self.inner.get_goal()
225    }
226    ///
227    /// Appends an item to `Tags`.
228    ///
229    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
230    ///
231    /// <p>A list of key-value pairs to associate with the SLO. You can associate as many as 50 tags with an SLO. To be able to associate tags with the SLO when you create the SLO, you must have the <code>cloudwatch:TagResource</code> permission.</p>
232    /// <p>Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.</p>
233    pub fn tags(mut self, input: crate::types::Tag) -> Self {
234        self.inner = self.inner.tags(input);
235        self
236    }
237    /// <p>A list of key-value pairs to associate with the SLO. You can associate as many as 50 tags with an SLO. To be able to associate tags with the SLO when you create the SLO, you must have the <code>cloudwatch:TagResource</code> permission.</p>
238    /// <p>Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.</p>
239    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
240        self.inner = self.inner.set_tags(input);
241        self
242    }
243    /// <p>A list of key-value pairs to associate with the SLO. You can associate as many as 50 tags with an SLO. To be able to associate tags with the SLO when you create the SLO, you must have the <code>cloudwatch:TagResource</code> permission.</p>
244    /// <p>Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.</p>
245    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
246        self.inner.get_tags()
247    }
248    ///
249    /// Appends an item to `BurnRateConfigurations`.
250    ///
251    /// To override the contents of this collection use [`set_burn_rate_configurations`](Self::set_burn_rate_configurations).
252    ///
253    /// <p>Use this array to create <i>burn rates</i> for this SLO. Each burn rate is a metric that indicates how fast the service is consuming the error budget, relative to the attainment goal of the SLO.</p>
254    pub fn burn_rate_configurations(mut self, input: crate::types::BurnRateConfiguration) -> Self {
255        self.inner = self.inner.burn_rate_configurations(input);
256        self
257    }
258    /// <p>Use this array to create <i>burn rates</i> for this SLO. Each burn rate is a metric that indicates how fast the service is consuming the error budget, relative to the attainment goal of the SLO.</p>
259    pub fn set_burn_rate_configurations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::BurnRateConfiguration>>) -> Self {
260        self.inner = self.inner.set_burn_rate_configurations(input);
261        self
262    }
263    /// <p>Use this array to create <i>burn rates</i> for this SLO. Each burn rate is a metric that indicates how fast the service is consuming the error budget, relative to the attainment goal of the SLO.</p>
264    pub fn get_burn_rate_configurations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::BurnRateConfiguration>> {
265        self.inner.get_burn_rate_configurations()
266    }
267}