aws_sdk_arcregionswitch/operation/create_plan/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_plan::_create_plan_output::CreatePlanOutputBuilder;
3
4pub use crate::operation::create_plan::_create_plan_input::CreatePlanInputBuilder;
5
6impl crate::operation::create_plan::builders::CreatePlanInputBuilder {
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_plan::CreatePlanOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_plan::CreatePlanError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_plan();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreatePlan`.
24///
25/// <p>Creates a new Region switch plan. A plan defines the steps required to shift traffic from one Amazon Web Services Region to another.</p>
26/// <p>You must specify a name for the plan, the primary Region, and at least one additional Region. You can also provide a description, execution role, recovery time objective, associated alarms, triggers, and workflows that define the steps to execute during a Region switch.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct CreatePlanFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::create_plan::builders::CreatePlanInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34    crate::client::customize::internal::CustomizableSend<
35        crate::operation::create_plan::CreatePlanOutput,
36        crate::operation::create_plan::CreatePlanError,
37    > for CreatePlanFluentBuilder
38{
39    fn send(
40        self,
41        config_override: crate::config::Builder,
42    ) -> crate::client::customize::internal::BoxFuture<
43        crate::client::customize::internal::SendResult<
44            crate::operation::create_plan::CreatePlanOutput,
45            crate::operation::create_plan::CreatePlanError,
46        >,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl CreatePlanFluentBuilder {
52    /// Creates a new `CreatePlanFluentBuilder`.
53    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54        Self {
55            handle,
56            inner: ::std::default::Default::default(),
57            config_override: ::std::option::Option::None,
58        }
59    }
60    /// Access the CreatePlan as a reference.
61    pub fn as_input(&self) -> &crate::operation::create_plan::builders::CreatePlanInputBuilder {
62        &self.inner
63    }
64    /// Sends the request and returns the response.
65    ///
66    /// If an error occurs, an `SdkError` will be returned with additional details that
67    /// can be matched against.
68    ///
69    /// By default, any retryable failures will be retried twice. Retry behavior
70    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71    /// set when configuring the client.
72    pub async fn send(
73        self,
74    ) -> ::std::result::Result<
75        crate::operation::create_plan::CreatePlanOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::create_plan::CreatePlanError,
78            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79        >,
80    > {
81        let input = self
82            .inner
83            .build()
84            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85        let runtime_plugins = crate::operation::create_plan::CreatePlan::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::create_plan::CreatePlan::orchestrate(&runtime_plugins, input).await
91    }
92
93    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94    pub fn customize(
95        self,
96    ) -> crate::client::customize::CustomizableOperation<
97        crate::operation::create_plan::CreatePlanOutput,
98        crate::operation::create_plan::CreatePlanError,
99        Self,
100    > {
101        crate::client::customize::CustomizableOperation::new(self)
102    }
103    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104        self.set_config_override(::std::option::Option::Some(config_override.into()));
105        self
106    }
107
108    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109        self.config_override = config_override;
110        self
111    }
112    /// <p>The description of a Region switch plan.</p>
113    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.inner = self.inner.description(input.into());
115        self
116    }
117    /// <p>The description of a Region switch plan.</p>
118    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119        self.inner = self.inner.set_description(input);
120        self
121    }
122    /// <p>The description of a Region switch plan.</p>
123    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
124        self.inner.get_description()
125    }
126    ///
127    /// Appends an item to `workflows`.
128    ///
129    /// To override the contents of this collection use [`set_workflows`](Self::set_workflows).
130    ///
131    /// <p>An array of workflows included in a Region switch plan.</p>
132    pub fn workflows(mut self, input: crate::types::Workflow) -> Self {
133        self.inner = self.inner.workflows(input);
134        self
135    }
136    /// <p>An array of workflows included in a Region switch plan.</p>
137    pub fn set_workflows(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Workflow>>) -> Self {
138        self.inner = self.inner.set_workflows(input);
139        self
140    }
141    /// <p>An array of workflows included in a Region switch plan.</p>
142    pub fn get_workflows(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Workflow>> {
143        self.inner.get_workflows()
144    }
145    /// <p>An execution role is a way to categorize a Region switch plan.</p>
146    pub fn execution_role(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
147        self.inner = self.inner.execution_role(input.into());
148        self
149    }
150    /// <p>An execution role is a way to categorize a Region switch plan.</p>
151    pub fn set_execution_role(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152        self.inner = self.inner.set_execution_role(input);
153        self
154    }
155    /// <p>An execution role is a way to categorize a Region switch plan.</p>
156    pub fn get_execution_role(&self) -> &::std::option::Option<::std::string::String> {
157        self.inner.get_execution_role()
158    }
159    /// <p>Optionally, you can specify an recovery time objective for a Region switch plan, in minutes.</p>
160    pub fn recovery_time_objective_minutes(mut self, input: i32) -> Self {
161        self.inner = self.inner.recovery_time_objective_minutes(input);
162        self
163    }
164    /// <p>Optionally, you can specify an recovery time objective for a Region switch plan, in minutes.</p>
165    pub fn set_recovery_time_objective_minutes(mut self, input: ::std::option::Option<i32>) -> Self {
166        self.inner = self.inner.set_recovery_time_objective_minutes(input);
167        self
168    }
169    /// <p>Optionally, you can specify an recovery time objective for a Region switch plan, in minutes.</p>
170    pub fn get_recovery_time_objective_minutes(&self) -> &::std::option::Option<i32> {
171        self.inner.get_recovery_time_objective_minutes()
172    }
173    ///
174    /// Adds a key-value pair to `associatedAlarms`.
175    ///
176    /// To override the contents of this collection use [`set_associated_alarms`](Self::set_associated_alarms).
177    ///
178    /// <p>The alarms associated with a Region switch plan.</p>
179    pub fn associated_alarms(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::AssociatedAlarm) -> Self {
180        self.inner = self.inner.associated_alarms(k.into(), v);
181        self
182    }
183    /// <p>The alarms associated with a Region switch plan.</p>
184    pub fn set_associated_alarms(
185        mut self,
186        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AssociatedAlarm>>,
187    ) -> Self {
188        self.inner = self.inner.set_associated_alarms(input);
189        self
190    }
191    /// <p>The alarms associated with a Region switch plan.</p>
192    pub fn get_associated_alarms(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AssociatedAlarm>> {
193        self.inner.get_associated_alarms()
194    }
195    ///
196    /// Appends an item to `triggers`.
197    ///
198    /// To override the contents of this collection use [`set_triggers`](Self::set_triggers).
199    ///
200    /// <p>The triggers associated with a Region switch plan.</p>
201    pub fn triggers(mut self, input: crate::types::Trigger) -> Self {
202        self.inner = self.inner.triggers(input);
203        self
204    }
205    /// <p>The triggers associated with a Region switch plan.</p>
206    pub fn set_triggers(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Trigger>>) -> Self {
207        self.inner = self.inner.set_triggers(input);
208        self
209    }
210    /// <p>The triggers associated with a Region switch plan.</p>
211    pub fn get_triggers(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Trigger>> {
212        self.inner.get_triggers()
213    }
214    /// <p>The name of a Region switch plan.</p>
215    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
216        self.inner = self.inner.name(input.into());
217        self
218    }
219    /// <p>The name of a Region switch plan.</p>
220    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
221        self.inner = self.inner.set_name(input);
222        self
223    }
224    /// <p>The name of a Region switch plan.</p>
225    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
226        self.inner.get_name()
227    }
228    ///
229    /// Appends an item to `regions`.
230    ///
231    /// To override the contents of this collection use [`set_regions`](Self::set_regions).
232    ///
233    /// <p>An array that specifies the Amazon Web Services Regions for a Region switch plan. Specify two Regions.</p>
234    pub fn regions(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
235        self.inner = self.inner.regions(input.into());
236        self
237    }
238    /// <p>An array that specifies the Amazon Web Services Regions for a Region switch plan. Specify two Regions.</p>
239    pub fn set_regions(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
240        self.inner = self.inner.set_regions(input);
241        self
242    }
243    /// <p>An array that specifies the Amazon Web Services Regions for a Region switch plan. Specify two Regions.</p>
244    pub fn get_regions(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
245        self.inner.get_regions()
246    }
247    /// <p>The recovery approach for a Region switch plan, which can be active/active (activeActive) or active/passive (activePassive).</p>
248    pub fn recovery_approach(mut self, input: crate::types::RecoveryApproach) -> Self {
249        self.inner = self.inner.recovery_approach(input);
250        self
251    }
252    /// <p>The recovery approach for a Region switch plan, which can be active/active (activeActive) or active/passive (activePassive).</p>
253    pub fn set_recovery_approach(mut self, input: ::std::option::Option<crate::types::RecoveryApproach>) -> Self {
254        self.inner = self.inner.set_recovery_approach(input);
255        self
256    }
257    /// <p>The recovery approach for a Region switch plan, which can be active/active (activeActive) or active/passive (activePassive).</p>
258    pub fn get_recovery_approach(&self) -> &::std::option::Option<crate::types::RecoveryApproach> {
259        self.inner.get_recovery_approach()
260    }
261    /// <p>The primary Amazon Web Services Region for the application. This is the Region where the application normally runs before any Region switch occurs.</p>
262    pub fn primary_region(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
263        self.inner = self.inner.primary_region(input.into());
264        self
265    }
266    /// <p>The primary Amazon Web Services Region for the application. This is the Region where the application normally runs before any Region switch occurs.</p>
267    pub fn set_primary_region(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
268        self.inner = self.inner.set_primary_region(input);
269        self
270    }
271    /// <p>The primary Amazon Web Services Region for the application. This is the Region where the application normally runs before any Region switch occurs.</p>
272    pub fn get_primary_region(&self) -> &::std::option::Option<::std::string::String> {
273        self.inner.get_primary_region()
274    }
275    ///
276    /// Adds a key-value pair to `tags`.
277    ///
278    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
279    ///
280    /// <p>The tags to apply to the Region switch plan.</p>
281    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
282        self.inner = self.inner.tags(k.into(), v.into());
283        self
284    }
285    /// <p>The tags to apply to the Region switch plan.</p>
286    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
287        self.inner = self.inner.set_tags(input);
288        self
289    }
290    /// <p>The tags to apply to the Region switch plan.</p>
291    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
292        self.inner.get_tags()
293    }
294}