aws_sdk_greengrassv2/operation/get_component/
_get_component_output.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 GetComponentOutput {
6    /// <p>The format of the recipe.</p>
7    pub recipe_output_format: crate::types::RecipeOutputFormat,
8    /// <p>The recipe of the component version.</p>
9    pub recipe: ::aws_smithy_types::Blob,
10    /// <p>A list of key-value pairs that contain metadata for the resource. For more information, see <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/tag-resources.html">Tag your resources</a> in the <i>IoT Greengrass V2 Developer Guide</i>.</p>
11    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
12    _request_id: Option<String>,
13}
14impl GetComponentOutput {
15    /// <p>The format of the recipe.</p>
16    pub fn recipe_output_format(&self) -> &crate::types::RecipeOutputFormat {
17        &self.recipe_output_format
18    }
19    /// <p>The recipe of the component version.</p>
20    pub fn recipe(&self) -> &::aws_smithy_types::Blob {
21        &self.recipe
22    }
23    /// <p>A list of key-value pairs that contain metadata for the resource. For more information, see <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/tag-resources.html">Tag your resources</a> in the <i>IoT Greengrass V2 Developer Guide</i>.</p>
24    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
25        self.tags.as_ref()
26    }
27}
28impl ::aws_types::request_id::RequestId for GetComponentOutput {
29    fn request_id(&self) -> Option<&str> {
30        self._request_id.as_deref()
31    }
32}
33impl GetComponentOutput {
34    /// Creates a new builder-style object to manufacture [`GetComponentOutput`](crate::operation::get_component::GetComponentOutput).
35    pub fn builder() -> crate::operation::get_component::builders::GetComponentOutputBuilder {
36        crate::operation::get_component::builders::GetComponentOutputBuilder::default()
37    }
38}
39
40/// A builder for [`GetComponentOutput`](crate::operation::get_component::GetComponentOutput).
41#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
42#[non_exhaustive]
43pub struct GetComponentOutputBuilder {
44    pub(crate) recipe_output_format: ::std::option::Option<crate::types::RecipeOutputFormat>,
45    pub(crate) recipe: ::std::option::Option<::aws_smithy_types::Blob>,
46    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
47    _request_id: Option<String>,
48}
49impl GetComponentOutputBuilder {
50    /// <p>The format of the recipe.</p>
51    /// This field is required.
52    pub fn recipe_output_format(mut self, input: crate::types::RecipeOutputFormat) -> Self {
53        self.recipe_output_format = ::std::option::Option::Some(input);
54        self
55    }
56    /// <p>The format of the recipe.</p>
57    pub fn set_recipe_output_format(mut self, input: ::std::option::Option<crate::types::RecipeOutputFormat>) -> Self {
58        self.recipe_output_format = input;
59        self
60    }
61    /// <p>The format of the recipe.</p>
62    pub fn get_recipe_output_format(&self) -> &::std::option::Option<crate::types::RecipeOutputFormat> {
63        &self.recipe_output_format
64    }
65    /// <p>The recipe of the component version.</p>
66    /// This field is required.
67    pub fn recipe(mut self, input: ::aws_smithy_types::Blob) -> Self {
68        self.recipe = ::std::option::Option::Some(input);
69        self
70    }
71    /// <p>The recipe of the component version.</p>
72    pub fn set_recipe(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
73        self.recipe = input;
74        self
75    }
76    /// <p>The recipe of the component version.</p>
77    pub fn get_recipe(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
78        &self.recipe
79    }
80    /// Adds a key-value pair to `tags`.
81    ///
82    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
83    ///
84    /// <p>A list of key-value pairs that contain metadata for the resource. For more information, see <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/tag-resources.html">Tag your resources</a> in the <i>IoT Greengrass V2 Developer Guide</i>.</p>
85    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
86        let mut hash_map = self.tags.unwrap_or_default();
87        hash_map.insert(k.into(), v.into());
88        self.tags = ::std::option::Option::Some(hash_map);
89        self
90    }
91    /// <p>A list of key-value pairs that contain metadata for the resource. For more information, see <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/tag-resources.html">Tag your resources</a> in the <i>IoT Greengrass V2 Developer Guide</i>.</p>
92    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
93        self.tags = input;
94        self
95    }
96    /// <p>A list of key-value pairs that contain metadata for the resource. For more information, see <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/tag-resources.html">Tag your resources</a> in the <i>IoT Greengrass V2 Developer Guide</i>.</p>
97    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
98        &self.tags
99    }
100    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
101        self._request_id = Some(request_id.into());
102        self
103    }
104
105    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
106        self._request_id = request_id;
107        self
108    }
109    /// Consumes the builder and constructs a [`GetComponentOutput`](crate::operation::get_component::GetComponentOutput).
110    /// This method will fail if any of the following fields are not set:
111    /// - [`recipe_output_format`](crate::operation::get_component::builders::GetComponentOutputBuilder::recipe_output_format)
112    /// - [`recipe`](crate::operation::get_component::builders::GetComponentOutputBuilder::recipe)
113    pub fn build(
114        self,
115    ) -> ::std::result::Result<crate::operation::get_component::GetComponentOutput, ::aws_smithy_types::error::operation::BuildError> {
116        ::std::result::Result::Ok(crate::operation::get_component::GetComponentOutput {
117            recipe_output_format: self.recipe_output_format.ok_or_else(|| {
118                ::aws_smithy_types::error::operation::BuildError::missing_field(
119                    "recipe_output_format",
120                    "recipe_output_format was not specified but it is required when building GetComponentOutput",
121                )
122            })?,
123            recipe: self.recipe.ok_or_else(|| {
124                ::aws_smithy_types::error::operation::BuildError::missing_field(
125                    "recipe",
126                    "recipe was not specified but it is required when building GetComponentOutput",
127                )
128            })?,
129            tags: self.tags,
130            _request_id: self._request_id,
131        })
132    }
133}