aws_sdk_resourceexplorer2/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)]
5pub struct TagResourceInput {
6    /// <p>The Amazon Resource Name (ARN) of the view or index that you want to attach tags to.</p>
7    pub resource_arn: ::std::option::Option<::std::string::String>,
8    /// <p>A list of tag key and value pairs that you want to attach to the specified view or index.</p>
9    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
10}
11impl TagResourceInput {
12    /// <p>The Amazon Resource Name (ARN) of the view or index that you want to attach tags to.</p>
13    pub fn resource_arn(&self) -> ::std::option::Option<&str> {
14        self.resource_arn.as_deref()
15    }
16    /// <p>A list of tag key and value pairs that you want to attach to the specified view or index.</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 ::std::fmt::Debug for TagResourceInput {
22    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
23        let mut formatter = f.debug_struct("TagResourceInput");
24        formatter.field("resource_arn", &self.resource_arn);
25        formatter.field("tags", &"*** Sensitive Data Redacted ***");
26        formatter.finish()
27    }
28}
29impl TagResourceInput {
30    /// Creates a new builder-style object to manufacture [`TagResourceInput`](crate::operation::tag_resource::TagResourceInput).
31    pub fn builder() -> crate::operation::tag_resource::builders::TagResourceInputBuilder {
32        crate::operation::tag_resource::builders::TagResourceInputBuilder::default()
33    }
34}
35
36/// A builder for [`TagResourceInput`](crate::operation::tag_resource::TagResourceInput).
37#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
38#[non_exhaustive]
39pub struct TagResourceInputBuilder {
40    pub(crate) resource_arn: ::std::option::Option<::std::string::String>,
41    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
42}
43impl TagResourceInputBuilder {
44    /// <p>The Amazon Resource Name (ARN) of the view or index that you want to attach tags to.</p>
45    /// This field is required.
46    pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
47        self.resource_arn = ::std::option::Option::Some(input.into());
48        self
49    }
50    /// <p>The Amazon Resource Name (ARN) of the view or index that you want to attach tags to.</p>
51    pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
52        self.resource_arn = input;
53        self
54    }
55    /// <p>The Amazon Resource Name (ARN) of the view or index that you want to attach tags to.</p>
56    pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
57        &self.resource_arn
58    }
59    /// Adds a key-value pair to `tags`.
60    ///
61    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
62    ///
63    /// <p>A list of tag key and value pairs that you want to attach to the specified view or index.</p>
64    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
65        let mut hash_map = self.tags.unwrap_or_default();
66        hash_map.insert(k.into(), v.into());
67        self.tags = ::std::option::Option::Some(hash_map);
68        self
69    }
70    /// <p>A list of tag key and value pairs that you want to attach to the specified view or index.</p>
71    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
72        self.tags = input;
73        self
74    }
75    /// <p>A list of tag key and value pairs that you want to attach to the specified view or index.</p>
76    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
77        &self.tags
78    }
79    /// Consumes the builder and constructs a [`TagResourceInput`](crate::operation::tag_resource::TagResourceInput).
80    pub fn build(self) -> ::std::result::Result<crate::operation::tag_resource::TagResourceInput, ::aws_smithy_types::error::operation::BuildError> {
81        ::std::result::Result::Ok(crate::operation::tag_resource::TagResourceInput {
82            resource_arn: self.resource_arn,
83            tags: self.tags,
84        })
85    }
86}
87impl ::std::fmt::Debug for TagResourceInputBuilder {
88    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
89        let mut formatter = f.debug_struct("TagResourceInputBuilder");
90        formatter.field("resource_arn", &self.resource_arn);
91        formatter.field("tags", &"*** Sensitive Data Redacted ***");
92        formatter.finish()
93    }
94}