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