aws_sdk_honeycode/operation/tag_resource/
_tag_resource_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 TagResourceInput {
6    /// <p>The resource's Amazon Resource Name (ARN).</p>
7    pub resource_arn: ::std::option::Option<::std::string::String>,
8    /// <p>A list of tags to apply to the resource.</p>
9    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
10}
11impl TagResourceInput {
12    /// <p>The resource's Amazon Resource Name (ARN).</p>
13    pub fn resource_arn(&self) -> ::std::option::Option<&str> {
14        self.resource_arn.as_deref()
15    }
16    /// <p>A list of tags to apply to the resource.</p>
17    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
18        self.tags.as_ref()
19    }
20}
21impl TagResourceInput {
22    /// Creates a new builder-style object to manufacture [`TagResourceInput`](crate::operation::tag_resource::TagResourceInput).
23    pub fn builder() -> crate::operation::tag_resource::builders::TagResourceInputBuilder {
24        crate::operation::tag_resource::builders::TagResourceInputBuilder::default()
25    }
26}
27
28/// A builder for [`TagResourceInput`](crate::operation::tag_resource::TagResourceInput).
29#[non_exhaustive]
30#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
31pub struct TagResourceInputBuilder {
32    pub(crate) resource_arn: ::std::option::Option<::std::string::String>,
33    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
34}
35impl TagResourceInputBuilder {
36    /// <p>The resource's Amazon Resource Name (ARN).</p>
37    /// This field is required.
38    pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
39        self.resource_arn = ::std::option::Option::Some(input.into());
40        self
41    }
42    /// <p>The resource's Amazon Resource Name (ARN).</p>
43    pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
44        self.resource_arn = input;
45        self
46    }
47    /// <p>The resource's Amazon Resource Name (ARN).</p>
48    pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
49        &self.resource_arn
50    }
51    /// Adds a key-value pair to `tags`.
52    ///
53    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
54    ///
55    /// <p>A list of tags to apply to the resource.</p>
56    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
57        let mut hash_map = self.tags.unwrap_or_default();
58        hash_map.insert(k.into(), v.into());
59        self.tags = ::std::option::Option::Some(hash_map);
60        self
61    }
62    /// <p>A list of tags to apply to the resource.</p>
63    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
64        self.tags = input;
65        self
66    }
67    /// <p>A list of tags to apply to the resource.</p>
68    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
69        &self.tags
70    }
71    /// Consumes the builder and constructs a [`TagResourceInput`](crate::operation::tag_resource::TagResourceInput).
72    pub fn build(self) -> ::std::result::Result<crate::operation::tag_resource::TagResourceInput, ::aws_smithy_types::error::operation::BuildError> {
73        ::std::result::Result::Ok(crate::operation::tag_resource::TagResourceInput {
74            resource_arn: self.resource_arn,
75            tags: self.tags,
76        })
77    }
78}