Skip to main content

aws_sdk_ssm/operation/create_ops_metadata/
_create_ops_metadata_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 CreateOpsMetadataInput {
6    /// <p>A resource ID for a new Application Manager application.</p>
7    pub resource_id: ::std::option::Option<::std::string::String>,
8    /// <p>Metadata for a new Application Manager application.</p>
9    pub metadata: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::MetadataValue>>,
10    /// <p>Optional metadata that you assign to a resource. You can specify a maximum of five tags for an OpsMetadata object. Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag an OpsMetadata object to identify an environment or target Amazon Web Services Region. In this case, you could specify the following key-value pairs:</p>
11    /// <ul>
12    /// <li>
13    /// <p><code>Key=Environment,Value=Production</code></p></li>
14    /// <li>
15    /// <p><code>Key=Region,Value=us-east-2</code></p></li>
16    /// </ul>
17    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
18}
19impl CreateOpsMetadataInput {
20    /// <p>A resource ID for a new Application Manager application.</p>
21    pub fn resource_id(&self) -> ::std::option::Option<&str> {
22        self.resource_id.as_deref()
23    }
24    /// <p>Metadata for a new Application Manager application.</p>
25    pub fn metadata(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::MetadataValue>> {
26        self.metadata.as_ref()
27    }
28    /// <p>Optional metadata that you assign to a resource. You can specify a maximum of five tags for an OpsMetadata object. Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag an OpsMetadata object to identify an environment or target Amazon Web Services Region. In this case, you could specify the following key-value pairs:</p>
29    /// <ul>
30    /// <li>
31    /// <p><code>Key=Environment,Value=Production</code></p></li>
32    /// <li>
33    /// <p><code>Key=Region,Value=us-east-2</code></p></li>
34    /// </ul>
35    ///
36    /// 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()`.
37    pub fn tags(&self) -> &[crate::types::Tag] {
38        self.tags.as_deref().unwrap_or_default()
39    }
40}
41impl CreateOpsMetadataInput {
42    /// Creates a new builder-style object to manufacture [`CreateOpsMetadataInput`](crate::operation::create_ops_metadata::CreateOpsMetadataInput).
43    pub fn builder() -> crate::operation::create_ops_metadata::builders::CreateOpsMetadataInputBuilder {
44        crate::operation::create_ops_metadata::builders::CreateOpsMetadataInputBuilder::default()
45    }
46}
47
48/// A builder for [`CreateOpsMetadataInput`](crate::operation::create_ops_metadata::CreateOpsMetadataInput).
49#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
50#[non_exhaustive]
51pub struct CreateOpsMetadataInputBuilder {
52    pub(crate) resource_id: ::std::option::Option<::std::string::String>,
53    pub(crate) metadata: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::MetadataValue>>,
54    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
55}
56impl CreateOpsMetadataInputBuilder {
57    /// <p>A resource ID for a new Application Manager application.</p>
58    /// This field is required.
59    pub fn resource_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
60        self.resource_id = ::std::option::Option::Some(input.into());
61        self
62    }
63    /// <p>A resource ID for a new Application Manager application.</p>
64    pub fn set_resource_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
65        self.resource_id = input;
66        self
67    }
68    /// <p>A resource ID for a new Application Manager application.</p>
69    pub fn get_resource_id(&self) -> &::std::option::Option<::std::string::String> {
70        &self.resource_id
71    }
72    /// Adds a key-value pair to `metadata`.
73    ///
74    /// To override the contents of this collection use [`set_metadata`](Self::set_metadata).
75    ///
76    /// <p>Metadata for a new Application Manager application.</p>
77    pub fn metadata(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::MetadataValue) -> Self {
78        let mut hash_map = self.metadata.unwrap_or_default();
79        hash_map.insert(k.into(), v);
80        self.metadata = ::std::option::Option::Some(hash_map);
81        self
82    }
83    /// <p>Metadata for a new Application Manager application.</p>
84    pub fn set_metadata(
85        mut self,
86        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::MetadataValue>>,
87    ) -> Self {
88        self.metadata = input;
89        self
90    }
91    /// <p>Metadata for a new Application Manager application.</p>
92    pub fn get_metadata(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::MetadataValue>> {
93        &self.metadata
94    }
95    /// Appends an item to `tags`.
96    ///
97    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
98    ///
99    /// <p>Optional metadata that you assign to a resource. You can specify a maximum of five tags for an OpsMetadata object. Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag an OpsMetadata object to identify an environment or target Amazon Web Services Region. In this case, you could specify the following key-value pairs:</p>
100    /// <ul>
101    /// <li>
102    /// <p><code>Key=Environment,Value=Production</code></p></li>
103    /// <li>
104    /// <p><code>Key=Region,Value=us-east-2</code></p></li>
105    /// </ul>
106    pub fn tags(mut self, input: crate::types::Tag) -> Self {
107        let mut v = self.tags.unwrap_or_default();
108        v.push(input);
109        self.tags = ::std::option::Option::Some(v);
110        self
111    }
112    /// <p>Optional metadata that you assign to a resource. You can specify a maximum of five tags for an OpsMetadata object. Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag an OpsMetadata object to identify an environment or target Amazon Web Services Region. In this case, you could specify the following key-value pairs:</p>
113    /// <ul>
114    /// <li>
115    /// <p><code>Key=Environment,Value=Production</code></p></li>
116    /// <li>
117    /// <p><code>Key=Region,Value=us-east-2</code></p></li>
118    /// </ul>
119    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
120        self.tags = input;
121        self
122    }
123    /// <p>Optional metadata that you assign to a resource. You can specify a maximum of five tags for an OpsMetadata object. Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag an OpsMetadata object to identify an environment or target Amazon Web Services Region. In this case, you could specify the following key-value pairs:</p>
124    /// <ul>
125    /// <li>
126    /// <p><code>Key=Environment,Value=Production</code></p></li>
127    /// <li>
128    /// <p><code>Key=Region,Value=us-east-2</code></p></li>
129    /// </ul>
130    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
131        &self.tags
132    }
133    /// Consumes the builder and constructs a [`CreateOpsMetadataInput`](crate::operation::create_ops_metadata::CreateOpsMetadataInput).
134    pub fn build(
135        self,
136    ) -> ::std::result::Result<crate::operation::create_ops_metadata::CreateOpsMetadataInput, ::aws_smithy_types::error::operation::BuildError> {
137        ::std::result::Result::Ok(crate::operation::create_ops_metadata::CreateOpsMetadataInput {
138            resource_id: self.resource_id,
139            metadata: self.metadata,
140            tags: self.tags,
141        })
142    }
143}