aws_sdk_resiliencehub/operation/create_app/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_app::_create_app_output::CreateAppOutputBuilder;
3
4pub use crate::operation::create_app::_create_app_input::CreateAppInputBuilder;
5
6impl crate::operation::create_app::builders::CreateAppInputBuilder {
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_app::CreateAppOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_app::CreateAppError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_app();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateApp`.
24///
25/// <p>Creates an Resilience Hub application. An Resilience Hub application is a collection of Amazon Web Services resources structured to prevent and recover Amazon Web Services application disruptions. To describe a Resilience Hub application, you provide an application name, resources from one or more CloudFormation stacks, Resource Groups, Terraform state files, AppRegistry applications, and an appropriate resiliency policy. In addition, you can also add resources that are located on Amazon Elastic Kubernetes Service (Amazon EKS) clusters as optional resources. For more information about the number of resources supported per application, see <a href="https://docs.aws.amazon.com/general/latest/gr/resiliencehub.html#limits_resiliencehub">Service quotas</a>.</p>
26/// <p>After you create an Resilience Hub application, you publish it so that you can run a resiliency assessment on it. You can then use recommendations from the assessment to improve resiliency by running another assessment, comparing results, and then iterating the process until you achieve your goals for recovery time objective (RTO) and recovery point objective (RPO).</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct CreateAppFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::create_app::builders::CreateAppInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl crate::client::customize::internal::CustomizableSend<crate::operation::create_app::CreateAppOutput, crate::operation::create_app::CreateAppError>
34    for CreateAppFluentBuilder
35{
36    fn send(
37        self,
38        config_override: crate::config::Builder,
39    ) -> crate::client::customize::internal::BoxFuture<
40        crate::client::customize::internal::SendResult<crate::operation::create_app::CreateAppOutput, crate::operation::create_app::CreateAppError>,
41    > {
42        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
43    }
44}
45impl CreateAppFluentBuilder {
46    /// Creates a new `CreateAppFluentBuilder`.
47    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
48        Self {
49            handle,
50            inner: ::std::default::Default::default(),
51            config_override: ::std::option::Option::None,
52        }
53    }
54    /// Access the CreateApp as a reference.
55    pub fn as_input(&self) -> &crate::operation::create_app::builders::CreateAppInputBuilder {
56        &self.inner
57    }
58    /// Sends the request and returns the response.
59    ///
60    /// If an error occurs, an `SdkError` will be returned with additional details that
61    /// can be matched against.
62    ///
63    /// By default, any retryable failures will be retried twice. Retry behavior
64    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
65    /// set when configuring the client.
66    pub async fn send(
67        self,
68    ) -> ::std::result::Result<
69        crate::operation::create_app::CreateAppOutput,
70        ::aws_smithy_runtime_api::client::result::SdkError<
71            crate::operation::create_app::CreateAppError,
72            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
73        >,
74    > {
75        let input = self
76            .inner
77            .build()
78            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
79        let runtime_plugins = crate::operation::create_app::CreateApp::operation_runtime_plugins(
80            self.handle.runtime_plugins.clone(),
81            &self.handle.conf,
82            self.config_override,
83        );
84        crate::operation::create_app::CreateApp::orchestrate(&runtime_plugins, input).await
85    }
86
87    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
88    pub fn customize(
89        self,
90    ) -> crate::client::customize::CustomizableOperation<
91        crate::operation::create_app::CreateAppOutput,
92        crate::operation::create_app::CreateAppError,
93        Self,
94    > {
95        crate::client::customize::CustomizableOperation::new(self)
96    }
97    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
98        self.set_config_override(::std::option::Option::Some(config_override.into()));
99        self
100    }
101
102    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
103        self.config_override = config_override;
104        self
105    }
106    /// <p>Name of the application.</p>
107    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
108        self.inner = self.inner.name(input.into());
109        self
110    }
111    /// <p>Name of the application.</p>
112    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
113        self.inner = self.inner.set_name(input);
114        self
115    }
116    /// <p>Name of the application.</p>
117    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
118        self.inner.get_name()
119    }
120    /// <p>The optional description for an app.</p>
121    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
122        self.inner = self.inner.description(input.into());
123        self
124    }
125    /// <p>The optional description for an app.</p>
126    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
127        self.inner = self.inner.set_description(input);
128        self
129    }
130    /// <p>The optional description for an app.</p>
131    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
132        self.inner.get_description()
133    }
134    /// <p>Amazon Resource Name (ARN) of the resiliency policy. The format for this ARN is: arn:<code>partition</code>:resiliencehub:<code>region</code>:<code>account</code>:resiliency-policy/<code>policy-id</code>. For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html"> Amazon Resource Names (ARNs)</a> in the <i>Amazon Web Services General Reference</i> guide.</p>
135    pub fn policy_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
136        self.inner = self.inner.policy_arn(input.into());
137        self
138    }
139    /// <p>Amazon Resource Name (ARN) of the resiliency policy. The format for this ARN is: arn:<code>partition</code>:resiliencehub:<code>region</code>:<code>account</code>:resiliency-policy/<code>policy-id</code>. For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html"> Amazon Resource Names (ARNs)</a> in the <i>Amazon Web Services General Reference</i> guide.</p>
140    pub fn set_policy_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
141        self.inner = self.inner.set_policy_arn(input);
142        self
143    }
144    /// <p>Amazon Resource Name (ARN) of the resiliency policy. The format for this ARN is: arn:<code>partition</code>:resiliencehub:<code>region</code>:<code>account</code>:resiliency-policy/<code>policy-id</code>. For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html"> Amazon Resource Names (ARNs)</a> in the <i>Amazon Web Services General Reference</i> guide.</p>
145    pub fn get_policy_arn(&self) -> &::std::option::Option<::std::string::String> {
146        self.inner.get_policy_arn()
147    }
148    ///
149    /// Adds a key-value pair to `tags`.
150    ///
151    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
152    ///
153    /// <p>Tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key/value pair.</p>
154    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
155        self.inner = self.inner.tags(k.into(), v.into());
156        self
157    }
158    /// <p>Tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key/value pair.</p>
159    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
160        self.inner = self.inner.set_tags(input);
161        self
162    }
163    /// <p>Tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key/value pair.</p>
164    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
165        self.inner.get_tags()
166    }
167    /// <p>Used for an idempotency token. A client token is a unique, case-sensitive string of up to 64 ASCII characters. You should not reuse the same client token for other API requests.</p>
168    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
169        self.inner = self.inner.client_token(input.into());
170        self
171    }
172    /// <p>Used for an idempotency token. A client token is a unique, case-sensitive string of up to 64 ASCII characters. You should not reuse the same client token for other API requests.</p>
173    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
174        self.inner = self.inner.set_client_token(input);
175        self
176    }
177    /// <p>Used for an idempotency token. A client token is a unique, case-sensitive string of up to 64 ASCII characters. You should not reuse the same client token for other API requests.</p>
178    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
179        self.inner.get_client_token()
180    }
181    /// <p>Assessment execution schedule with 'Daily' or 'Disabled' values.</p>
182    pub fn assessment_schedule(mut self, input: crate::types::AppAssessmentScheduleType) -> Self {
183        self.inner = self.inner.assessment_schedule(input);
184        self
185    }
186    /// <p>Assessment execution schedule with 'Daily' or 'Disabled' values.</p>
187    pub fn set_assessment_schedule(mut self, input: ::std::option::Option<crate::types::AppAssessmentScheduleType>) -> Self {
188        self.inner = self.inner.set_assessment_schedule(input);
189        self
190    }
191    /// <p>Assessment execution schedule with 'Daily' or 'Disabled' values.</p>
192    pub fn get_assessment_schedule(&self) -> &::std::option::Option<crate::types::AppAssessmentScheduleType> {
193        self.inner.get_assessment_schedule()
194    }
195    /// <p>Defines the roles and credentials that Resilience Hub would use while creating the application, importing its resources, and running an assessment.</p>
196    pub fn permission_model(mut self, input: crate::types::PermissionModel) -> Self {
197        self.inner = self.inner.permission_model(input);
198        self
199    }
200    /// <p>Defines the roles and credentials that Resilience Hub would use while creating the application, importing its resources, and running an assessment.</p>
201    pub fn set_permission_model(mut self, input: ::std::option::Option<crate::types::PermissionModel>) -> Self {
202        self.inner = self.inner.set_permission_model(input);
203        self
204    }
205    /// <p>Defines the roles and credentials that Resilience Hub would use while creating the application, importing its resources, and running an assessment.</p>
206    pub fn get_permission_model(&self) -> &::std::option::Option<crate::types::PermissionModel> {
207        self.inner.get_permission_model()
208    }
209    ///
210    /// Appends an item to `eventSubscriptions`.
211    ///
212    /// To override the contents of this collection use [`set_event_subscriptions`](Self::set_event_subscriptions).
213    ///
214    /// <p>The list of events you would like to subscribe and get notification for. Currently, Resilience Hub supports only <b>Drift detected</b> and <b>Scheduled assessment failure</b> events notification.</p>
215    pub fn event_subscriptions(mut self, input: crate::types::EventSubscription) -> Self {
216        self.inner = self.inner.event_subscriptions(input);
217        self
218    }
219    /// <p>The list of events you would like to subscribe and get notification for. Currently, Resilience Hub supports only <b>Drift detected</b> and <b>Scheduled assessment failure</b> events notification.</p>
220    pub fn set_event_subscriptions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::EventSubscription>>) -> Self {
221        self.inner = self.inner.set_event_subscriptions(input);
222        self
223    }
224    /// <p>The list of events you would like to subscribe and get notification for. Currently, Resilience Hub supports only <b>Drift detected</b> and <b>Scheduled assessment failure</b> events notification.</p>
225    pub fn get_event_subscriptions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::EventSubscription>> {
226        self.inner.get_event_subscriptions()
227    }
228    /// <p>Amazon Resource Name (ARN) of Resource Groups group that is integrated with an AppRegistry application. For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html"> Amazon Resource Names (ARNs)</a> in the <i>Amazon Web Services General Reference</i> guide.</p>
229    pub fn aws_application_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
230        self.inner = self.inner.aws_application_arn(input.into());
231        self
232    }
233    /// <p>Amazon Resource Name (ARN) of Resource Groups group that is integrated with an AppRegistry application. For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html"> Amazon Resource Names (ARNs)</a> in the <i>Amazon Web Services General Reference</i> guide.</p>
234    pub fn set_aws_application_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
235        self.inner = self.inner.set_aws_application_arn(input);
236        self
237    }
238    /// <p>Amazon Resource Name (ARN) of Resource Groups group that is integrated with an AppRegistry application. For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html"> Amazon Resource Names (ARNs)</a> in the <i>Amazon Web Services General Reference</i> guide.</p>
239    pub fn get_aws_application_arn(&self) -> &::std::option::Option<::std::string::String> {
240        self.inner.get_aws_application_arn()
241    }
242}