aws_sdk_appmesh/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 Amazon Resource Name (ARN) of the resource to add tags to.</p>
7 pub resource_arn: ::std::option::Option<::std::string::String>,
8 /// <p>The tags to add to the resource. A tag is an array of key-value pairs. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.</p>
9 pub tags: ::std::option::Option<::std::vec::Vec<crate::types::TagRef>>,
10}
11impl TagResourceInput {
12 /// <p>The Amazon Resource Name (ARN) of the resource to add tags to.</p>
13 pub fn resource_arn(&self) -> ::std::option::Option<&str> {
14 self.resource_arn.as_deref()
15 }
16 /// <p>The tags to add to the resource. A tag is an array of key-value pairs. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.</p>
17 ///
18 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
19 pub fn tags(&self) -> &[crate::types::TagRef] {
20 self.tags.as_deref().unwrap_or_default()
21 }
22}
23impl TagResourceInput {
24 /// Creates a new builder-style object to manufacture [`TagResourceInput`](crate::operation::tag_resource::TagResourceInput).
25 pub fn builder() -> crate::operation::tag_resource::builders::TagResourceInputBuilder {
26 crate::operation::tag_resource::builders::TagResourceInputBuilder::default()
27 }
28}
29
30/// A builder for [`TagResourceInput`](crate::operation::tag_resource::TagResourceInput).
31#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
32#[non_exhaustive]
33pub struct TagResourceInputBuilder {
34 pub(crate) resource_arn: ::std::option::Option<::std::string::String>,
35 pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::TagRef>>,
36}
37impl TagResourceInputBuilder {
38 /// <p>The Amazon Resource Name (ARN) of the resource to add tags to.</p>
39 /// This field is required.
40 pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
41 self.resource_arn = ::std::option::Option::Some(input.into());
42 self
43 }
44 /// <p>The Amazon Resource Name (ARN) of the resource to add tags to.</p>
45 pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
46 self.resource_arn = input;
47 self
48 }
49 /// <p>The Amazon Resource Name (ARN) of the resource to add tags to.</p>
50 pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
51 &self.resource_arn
52 }
53 /// Appends an item to `tags`.
54 ///
55 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
56 ///
57 /// <p>The tags to add to the resource. A tag is an array of key-value pairs. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.</p>
58 pub fn tags(mut self, input: crate::types::TagRef) -> Self {
59 let mut v = self.tags.unwrap_or_default();
60 v.push(input);
61 self.tags = ::std::option::Option::Some(v);
62 self
63 }
64 /// <p>The tags to add to the resource. A tag is an array of key-value pairs. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.</p>
65 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagRef>>) -> Self {
66 self.tags = input;
67 self
68 }
69 /// <p>The tags to add to the resource. A tag is an array of key-value pairs. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.</p>
70 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagRef>> {
71 &self.tags
72 }
73 /// Consumes the builder and constructs a [`TagResourceInput`](crate::operation::tag_resource::TagResourceInput).
74 pub fn build(self) -> ::std::result::Result<crate::operation::tag_resource::TagResourceInput, ::aws_smithy_types::error::operation::BuildError> {
75 ::std::result::Result::Ok(crate::operation::tag_resource::TagResourceInput {
76 resource_arn: self.resource_arn,
77 tags: self.tags,
78 })
79 }
80}