aws_sdk_databrew/operation/create_recipe/
_create_recipe_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 CreateRecipeInput {
6    /// <p>A description for the recipe.</p>
7    pub description: ::std::option::Option<::std::string::String>,
8    /// <p>A unique name for the recipe. Valid characters are alphanumeric (A-Z, a-z, 0-9), hyphen (-), period (.), and space.</p>
9    pub name: ::std::option::Option<::std::string::String>,
10    /// <p>An array containing the steps to be performed by the recipe. Each recipe step consists of one recipe action and (optionally) an array of condition expressions.</p>
11    pub steps: ::std::option::Option<::std::vec::Vec<crate::types::RecipeStep>>,
12    /// <p>Metadata tags to apply to this recipe.</p>
13    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
14}
15impl CreateRecipeInput {
16    /// <p>A description for the recipe.</p>
17    pub fn description(&self) -> ::std::option::Option<&str> {
18        self.description.as_deref()
19    }
20    /// <p>A unique name for the recipe. Valid characters are alphanumeric (A-Z, a-z, 0-9), hyphen (-), period (.), and space.</p>
21    pub fn name(&self) -> ::std::option::Option<&str> {
22        self.name.as_deref()
23    }
24    /// <p>An array containing the steps to be performed by the recipe. Each recipe step consists of one recipe action and (optionally) an array of condition expressions.</p>
25    ///
26    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.steps.is_none()`.
27    pub fn steps(&self) -> &[crate::types::RecipeStep] {
28        self.steps.as_deref().unwrap_or_default()
29    }
30    /// <p>Metadata tags to apply to this recipe.</p>
31    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
32        self.tags.as_ref()
33    }
34}
35impl CreateRecipeInput {
36    /// Creates a new builder-style object to manufacture [`CreateRecipeInput`](crate::operation::create_recipe::CreateRecipeInput).
37    pub fn builder() -> crate::operation::create_recipe::builders::CreateRecipeInputBuilder {
38        crate::operation::create_recipe::builders::CreateRecipeInputBuilder::default()
39    }
40}
41
42/// A builder for [`CreateRecipeInput`](crate::operation::create_recipe::CreateRecipeInput).
43#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
44#[non_exhaustive]
45pub struct CreateRecipeInputBuilder {
46    pub(crate) description: ::std::option::Option<::std::string::String>,
47    pub(crate) name: ::std::option::Option<::std::string::String>,
48    pub(crate) steps: ::std::option::Option<::std::vec::Vec<crate::types::RecipeStep>>,
49    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
50}
51impl CreateRecipeInputBuilder {
52    /// <p>A description for the recipe.</p>
53    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
54        self.description = ::std::option::Option::Some(input.into());
55        self
56    }
57    /// <p>A description for the recipe.</p>
58    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
59        self.description = input;
60        self
61    }
62    /// <p>A description for the recipe.</p>
63    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
64        &self.description
65    }
66    /// <p>A unique name for the recipe. Valid characters are alphanumeric (A-Z, a-z, 0-9), hyphen (-), period (.), and space.</p>
67    /// This field is required.
68    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
69        self.name = ::std::option::Option::Some(input.into());
70        self
71    }
72    /// <p>A unique name for the recipe. Valid characters are alphanumeric (A-Z, a-z, 0-9), hyphen (-), period (.), and space.</p>
73    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
74        self.name = input;
75        self
76    }
77    /// <p>A unique name for the recipe. Valid characters are alphanumeric (A-Z, a-z, 0-9), hyphen (-), period (.), and space.</p>
78    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
79        &self.name
80    }
81    /// Appends an item to `steps`.
82    ///
83    /// To override the contents of this collection use [`set_steps`](Self::set_steps).
84    ///
85    /// <p>An array containing the steps to be performed by the recipe. Each recipe step consists of one recipe action and (optionally) an array of condition expressions.</p>
86    pub fn steps(mut self, input: crate::types::RecipeStep) -> Self {
87        let mut v = self.steps.unwrap_or_default();
88        v.push(input);
89        self.steps = ::std::option::Option::Some(v);
90        self
91    }
92    /// <p>An array containing the steps to be performed by the recipe. Each recipe step consists of one recipe action and (optionally) an array of condition expressions.</p>
93    pub fn set_steps(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RecipeStep>>) -> Self {
94        self.steps = input;
95        self
96    }
97    /// <p>An array containing the steps to be performed by the recipe. Each recipe step consists of one recipe action and (optionally) an array of condition expressions.</p>
98    pub fn get_steps(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RecipeStep>> {
99        &self.steps
100    }
101    /// Adds a key-value pair to `tags`.
102    ///
103    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
104    ///
105    /// <p>Metadata tags to apply to this recipe.</p>
106    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
107        let mut hash_map = self.tags.unwrap_or_default();
108        hash_map.insert(k.into(), v.into());
109        self.tags = ::std::option::Option::Some(hash_map);
110        self
111    }
112    /// <p>Metadata tags to apply to this recipe.</p>
113    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
114        self.tags = input;
115        self
116    }
117    /// <p>Metadata tags to apply to this recipe.</p>
118    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
119        &self.tags
120    }
121    /// Consumes the builder and constructs a [`CreateRecipeInput`](crate::operation::create_recipe::CreateRecipeInput).
122    pub fn build(
123        self,
124    ) -> ::std::result::Result<crate::operation::create_recipe::CreateRecipeInput, ::aws_smithy_types::error::operation::BuildError> {
125        ::std::result::Result::Ok(crate::operation::create_recipe::CreateRecipeInput {
126            description: self.description,
127            name: self.name,
128            steps: self.steps,
129            tags: self.tags,
130        })
131    }
132}