aws_sdk_arcregionswitch/operation/create_plan/
_create_plan_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreatePlanInput {
6    /// <p>The description of a Region switch plan.</p>
7    pub description: ::std::option::Option<::std::string::String>,
8    /// <p>An array of workflows included in a Region switch plan.</p>
9    pub workflows: ::std::option::Option<::std::vec::Vec<crate::types::Workflow>>,
10    /// <p>An execution role is a way to categorize a Region switch plan.</p>
11    pub execution_role: ::std::option::Option<::std::string::String>,
12    /// <p>Optionally, you can specify an recovery time objective for a Region switch plan, in minutes.</p>
13    pub recovery_time_objective_minutes: ::std::option::Option<i32>,
14    /// <p>The alarms associated with a Region switch plan.</p>
15    pub associated_alarms: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AssociatedAlarm>>,
16    /// <p>The triggers associated with a Region switch plan.</p>
17    pub triggers: ::std::option::Option<::std::vec::Vec<crate::types::Trigger>>,
18    /// <p>The name of a Region switch plan.</p>
19    pub name: ::std::option::Option<::std::string::String>,
20    /// <p>An array that specifies the Amazon Web Services Regions for a Region switch plan. Specify two Regions.</p>
21    pub regions: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
22    /// <p>The recovery approach for a Region switch plan, which can be active/active (activeActive) or active/passive (activePassive).</p>
23    pub recovery_approach: ::std::option::Option<crate::types::RecoveryApproach>,
24    /// <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>
25    pub primary_region: ::std::option::Option<::std::string::String>,
26    /// <p>The tags to apply to the Region switch plan.</p>
27    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
28}
29impl CreatePlanInput {
30    /// <p>The description of a Region switch plan.</p>
31    pub fn description(&self) -> ::std::option::Option<&str> {
32        self.description.as_deref()
33    }
34    /// <p>An array of workflows included in a Region switch plan.</p>
35    ///
36    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.workflows.is_none()`.
37    pub fn workflows(&self) -> &[crate::types::Workflow] {
38        self.workflows.as_deref().unwrap_or_default()
39    }
40    /// <p>An execution role is a way to categorize a Region switch plan.</p>
41    pub fn execution_role(&self) -> ::std::option::Option<&str> {
42        self.execution_role.as_deref()
43    }
44    /// <p>Optionally, you can specify an recovery time objective for a Region switch plan, in minutes.</p>
45    pub fn recovery_time_objective_minutes(&self) -> ::std::option::Option<i32> {
46        self.recovery_time_objective_minutes
47    }
48    /// <p>The alarms associated with a Region switch plan.</p>
49    pub fn associated_alarms(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::AssociatedAlarm>> {
50        self.associated_alarms.as_ref()
51    }
52    /// <p>The triggers associated with a Region switch plan.</p>
53    ///
54    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.triggers.is_none()`.
55    pub fn triggers(&self) -> &[crate::types::Trigger] {
56        self.triggers.as_deref().unwrap_or_default()
57    }
58    /// <p>The name of a Region switch plan.</p>
59    pub fn name(&self) -> ::std::option::Option<&str> {
60        self.name.as_deref()
61    }
62    /// <p>An array that specifies the Amazon Web Services Regions for a Region switch plan. Specify two Regions.</p>
63    ///
64    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.regions.is_none()`.
65    pub fn regions(&self) -> &[::std::string::String] {
66        self.regions.as_deref().unwrap_or_default()
67    }
68    /// <p>The recovery approach for a Region switch plan, which can be active/active (activeActive) or active/passive (activePassive).</p>
69    pub fn recovery_approach(&self) -> ::std::option::Option<&crate::types::RecoveryApproach> {
70        self.recovery_approach.as_ref()
71    }
72    /// <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>
73    pub fn primary_region(&self) -> ::std::option::Option<&str> {
74        self.primary_region.as_deref()
75    }
76    /// <p>The tags to apply to the Region switch plan.</p>
77    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
78        self.tags.as_ref()
79    }
80}
81impl CreatePlanInput {
82    /// Creates a new builder-style object to manufacture [`CreatePlanInput`](crate::operation::create_plan::CreatePlanInput).
83    pub fn builder() -> crate::operation::create_plan::builders::CreatePlanInputBuilder {
84        crate::operation::create_plan::builders::CreatePlanInputBuilder::default()
85    }
86}
87
88/// A builder for [`CreatePlanInput`](crate::operation::create_plan::CreatePlanInput).
89#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
90#[non_exhaustive]
91pub struct CreatePlanInputBuilder {
92    pub(crate) description: ::std::option::Option<::std::string::String>,
93    pub(crate) workflows: ::std::option::Option<::std::vec::Vec<crate::types::Workflow>>,
94    pub(crate) execution_role: ::std::option::Option<::std::string::String>,
95    pub(crate) recovery_time_objective_minutes: ::std::option::Option<i32>,
96    pub(crate) associated_alarms: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AssociatedAlarm>>,
97    pub(crate) triggers: ::std::option::Option<::std::vec::Vec<crate::types::Trigger>>,
98    pub(crate) name: ::std::option::Option<::std::string::String>,
99    pub(crate) regions: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
100    pub(crate) recovery_approach: ::std::option::Option<crate::types::RecoveryApproach>,
101    pub(crate) primary_region: ::std::option::Option<::std::string::String>,
102    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
103}
104impl CreatePlanInputBuilder {
105    /// <p>The description of a Region switch plan.</p>
106    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
107        self.description = ::std::option::Option::Some(input.into());
108        self
109    }
110    /// <p>The description of a Region switch plan.</p>
111    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
112        self.description = input;
113        self
114    }
115    /// <p>The description of a Region switch plan.</p>
116    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
117        &self.description
118    }
119    /// Appends an item to `workflows`.
120    ///
121    /// To override the contents of this collection use [`set_workflows`](Self::set_workflows).
122    ///
123    /// <p>An array of workflows included in a Region switch plan.</p>
124    pub fn workflows(mut self, input: crate::types::Workflow) -> Self {
125        let mut v = self.workflows.unwrap_or_default();
126        v.push(input);
127        self.workflows = ::std::option::Option::Some(v);
128        self
129    }
130    /// <p>An array of workflows included in a Region switch plan.</p>
131    pub fn set_workflows(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Workflow>>) -> Self {
132        self.workflows = input;
133        self
134    }
135    /// <p>An array of workflows included in a Region switch plan.</p>
136    pub fn get_workflows(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Workflow>> {
137        &self.workflows
138    }
139    /// <p>An execution role is a way to categorize a Region switch plan.</p>
140    /// This field is required.
141    pub fn execution_role(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
142        self.execution_role = ::std::option::Option::Some(input.into());
143        self
144    }
145    /// <p>An execution role is a way to categorize a Region switch plan.</p>
146    pub fn set_execution_role(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
147        self.execution_role = input;
148        self
149    }
150    /// <p>An execution role is a way to categorize a Region switch plan.</p>
151    pub fn get_execution_role(&self) -> &::std::option::Option<::std::string::String> {
152        &self.execution_role
153    }
154    /// <p>Optionally, you can specify an recovery time objective for a Region switch plan, in minutes.</p>
155    pub fn recovery_time_objective_minutes(mut self, input: i32) -> Self {
156        self.recovery_time_objective_minutes = ::std::option::Option::Some(input);
157        self
158    }
159    /// <p>Optionally, you can specify an recovery time objective for a Region switch plan, in minutes.</p>
160    pub fn set_recovery_time_objective_minutes(mut self, input: ::std::option::Option<i32>) -> Self {
161        self.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 get_recovery_time_objective_minutes(&self) -> &::std::option::Option<i32> {
166        &self.recovery_time_objective_minutes
167    }
168    /// Adds a key-value pair to `associated_alarms`.
169    ///
170    /// To override the contents of this collection use [`set_associated_alarms`](Self::set_associated_alarms).
171    ///
172    /// <p>The alarms associated with a Region switch plan.</p>
173    pub fn associated_alarms(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::AssociatedAlarm) -> Self {
174        let mut hash_map = self.associated_alarms.unwrap_or_default();
175        hash_map.insert(k.into(), v);
176        self.associated_alarms = ::std::option::Option::Some(hash_map);
177        self
178    }
179    /// <p>The alarms associated with a Region switch plan.</p>
180    pub fn set_associated_alarms(
181        mut self,
182        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AssociatedAlarm>>,
183    ) -> Self {
184        self.associated_alarms = input;
185        self
186    }
187    /// <p>The alarms associated with a Region switch plan.</p>
188    pub fn get_associated_alarms(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AssociatedAlarm>> {
189        &self.associated_alarms
190    }
191    /// Appends an item to `triggers`.
192    ///
193    /// To override the contents of this collection use [`set_triggers`](Self::set_triggers).
194    ///
195    /// <p>The triggers associated with a Region switch plan.</p>
196    pub fn triggers(mut self, input: crate::types::Trigger) -> Self {
197        let mut v = self.triggers.unwrap_or_default();
198        v.push(input);
199        self.triggers = ::std::option::Option::Some(v);
200        self
201    }
202    /// <p>The triggers associated with a Region switch plan.</p>
203    pub fn set_triggers(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Trigger>>) -> Self {
204        self.triggers = input;
205        self
206    }
207    /// <p>The triggers associated with a Region switch plan.</p>
208    pub fn get_triggers(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Trigger>> {
209        &self.triggers
210    }
211    /// <p>The name of a Region switch plan.</p>
212    /// This field is required.
213    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
214        self.name = ::std::option::Option::Some(input.into());
215        self
216    }
217    /// <p>The name of a Region switch plan.</p>
218    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
219        self.name = input;
220        self
221    }
222    /// <p>The name of a Region switch plan.</p>
223    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
224        &self.name
225    }
226    /// Appends an item to `regions`.
227    ///
228    /// To override the contents of this collection use [`set_regions`](Self::set_regions).
229    ///
230    /// <p>An array that specifies the Amazon Web Services Regions for a Region switch plan. Specify two Regions.</p>
231    pub fn regions(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
232        let mut v = self.regions.unwrap_or_default();
233        v.push(input.into());
234        self.regions = ::std::option::Option::Some(v);
235        self
236    }
237    /// <p>An array that specifies the Amazon Web Services Regions for a Region switch plan. Specify two Regions.</p>
238    pub fn set_regions(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
239        self.regions = input;
240        self
241    }
242    /// <p>An array that specifies the Amazon Web Services Regions for a Region switch plan. Specify two Regions.</p>
243    pub fn get_regions(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
244        &self.regions
245    }
246    /// <p>The recovery approach for a Region switch plan, which can be active/active (activeActive) or active/passive (activePassive).</p>
247    /// This field is required.
248    pub fn recovery_approach(mut self, input: crate::types::RecoveryApproach) -> Self {
249        self.recovery_approach = ::std::option::Option::Some(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.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.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.primary_region = ::std::option::Option::Some(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.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.primary_region
274    }
275    /// Adds a key-value pair to `tags`.
276    ///
277    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
278    ///
279    /// <p>The tags to apply to the Region switch plan.</p>
280    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
281        let mut hash_map = self.tags.unwrap_or_default();
282        hash_map.insert(k.into(), v.into());
283        self.tags = ::std::option::Option::Some(hash_map);
284        self
285    }
286    /// <p>The tags to apply to the Region switch plan.</p>
287    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
288        self.tags = input;
289        self
290    }
291    /// <p>The tags to apply to the Region switch plan.</p>
292    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
293        &self.tags
294    }
295    /// Consumes the builder and constructs a [`CreatePlanInput`](crate::operation::create_plan::CreatePlanInput).
296    pub fn build(self) -> ::std::result::Result<crate::operation::create_plan::CreatePlanInput, ::aws_smithy_types::error::operation::BuildError> {
297        ::std::result::Result::Ok(crate::operation::create_plan::CreatePlanInput {
298            description: self.description,
299            workflows: self.workflows,
300            execution_role: self.execution_role,
301            recovery_time_objective_minutes: self.recovery_time_objective_minutes,
302            associated_alarms: self.associated_alarms,
303            triggers: self.triggers,
304            name: self.name,
305            regions: self.regions,
306            recovery_approach: self.recovery_approach,
307            primary_region: self.primary_region,
308            tags: self.tags,
309        })
310    }
311}