aws_sdk_amp/operation/create_scraper/_create_scraper_input.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Represents the input of a <code>CreateScraper</code> operation.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CreateScraperInput {
7 /// <p>(optional) An alias to associate with the scraper. This is for your use, and does not need to be unique.</p>
8 pub alias: ::std::option::Option<::std::string::String>,
9 /// <p>The configuration file to use in the new scraper. For more information, see <a href="https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-collector-how-to.html#AMP-collector-configuration">Scraper configuration</a> in the <i>Amazon Managed Service for Prometheus User Guide</i>.</p>
10 pub scrape_configuration: ::std::option::Option<crate::types::ScrapeConfiguration>,
11 /// <p>The Amazon EKS cluster from which the scraper will collect metrics.</p>
12 pub source: ::std::option::Option<crate::types::Source>,
13 /// <p>The Amazon Managed Service for Prometheus workspace to send metrics to.</p>
14 pub destination: ::std::option::Option<crate::types::Destination>,
15 /// <p>Use this structure to enable cross-account access, so that you can use a target account to access Prometheus metrics from source accounts.</p>
16 pub role_configuration: ::std::option::Option<crate::types::RoleConfiguration>,
17 /// <p>(Optional) A unique, case-sensitive identifier that you can provide to ensure the idempotency of the request.</p>
18 pub client_token: ::std::option::Option<::std::string::String>,
19 /// <p>(Optional) The list of tag keys and values to associate with the scraper.</p>
20 pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
21}
22impl CreateScraperInput {
23 /// <p>(optional) An alias to associate with the scraper. This is for your use, and does not need to be unique.</p>
24 pub fn alias(&self) -> ::std::option::Option<&str> {
25 self.alias.as_deref()
26 }
27 /// <p>The configuration file to use in the new scraper. For more information, see <a href="https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-collector-how-to.html#AMP-collector-configuration">Scraper configuration</a> in the <i>Amazon Managed Service for Prometheus User Guide</i>.</p>
28 pub fn scrape_configuration(&self) -> ::std::option::Option<&crate::types::ScrapeConfiguration> {
29 self.scrape_configuration.as_ref()
30 }
31 /// <p>The Amazon EKS cluster from which the scraper will collect metrics.</p>
32 pub fn source(&self) -> ::std::option::Option<&crate::types::Source> {
33 self.source.as_ref()
34 }
35 /// <p>The Amazon Managed Service for Prometheus workspace to send metrics to.</p>
36 pub fn destination(&self) -> ::std::option::Option<&crate::types::Destination> {
37 self.destination.as_ref()
38 }
39 /// <p>Use this structure to enable cross-account access, so that you can use a target account to access Prometheus metrics from source accounts.</p>
40 pub fn role_configuration(&self) -> ::std::option::Option<&crate::types::RoleConfiguration> {
41 self.role_configuration.as_ref()
42 }
43 /// <p>(Optional) A unique, case-sensitive identifier that you can provide to ensure the idempotency of the request.</p>
44 pub fn client_token(&self) -> ::std::option::Option<&str> {
45 self.client_token.as_deref()
46 }
47 /// <p>(Optional) The list of tag keys and values to associate with the scraper.</p>
48 pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
49 self.tags.as_ref()
50 }
51}
52impl CreateScraperInput {
53 /// Creates a new builder-style object to manufacture [`CreateScraperInput`](crate::operation::create_scraper::CreateScraperInput).
54 pub fn builder() -> crate::operation::create_scraper::builders::CreateScraperInputBuilder {
55 crate::operation::create_scraper::builders::CreateScraperInputBuilder::default()
56 }
57}
58
59/// A builder for [`CreateScraperInput`](crate::operation::create_scraper::CreateScraperInput).
60#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
61#[non_exhaustive]
62pub struct CreateScraperInputBuilder {
63 pub(crate) alias: ::std::option::Option<::std::string::String>,
64 pub(crate) scrape_configuration: ::std::option::Option<crate::types::ScrapeConfiguration>,
65 pub(crate) source: ::std::option::Option<crate::types::Source>,
66 pub(crate) destination: ::std::option::Option<crate::types::Destination>,
67 pub(crate) role_configuration: ::std::option::Option<crate::types::RoleConfiguration>,
68 pub(crate) client_token: ::std::option::Option<::std::string::String>,
69 pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
70}
71impl CreateScraperInputBuilder {
72 /// <p>(optional) An alias to associate with the scraper. This is for your use, and does not need to be unique.</p>
73 pub fn alias(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
74 self.alias = ::std::option::Option::Some(input.into());
75 self
76 }
77 /// <p>(optional) An alias to associate with the scraper. This is for your use, and does not need to be unique.</p>
78 pub fn set_alias(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
79 self.alias = input;
80 self
81 }
82 /// <p>(optional) An alias to associate with the scraper. This is for your use, and does not need to be unique.</p>
83 pub fn get_alias(&self) -> &::std::option::Option<::std::string::String> {
84 &self.alias
85 }
86 /// <p>The configuration file to use in the new scraper. For more information, see <a href="https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-collector-how-to.html#AMP-collector-configuration">Scraper configuration</a> in the <i>Amazon Managed Service for Prometheus User Guide</i>.</p>
87 /// This field is required.
88 pub fn scrape_configuration(mut self, input: crate::types::ScrapeConfiguration) -> Self {
89 self.scrape_configuration = ::std::option::Option::Some(input);
90 self
91 }
92 /// <p>The configuration file to use in the new scraper. For more information, see <a href="https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-collector-how-to.html#AMP-collector-configuration">Scraper configuration</a> in the <i>Amazon Managed Service for Prometheus User Guide</i>.</p>
93 pub fn set_scrape_configuration(mut self, input: ::std::option::Option<crate::types::ScrapeConfiguration>) -> Self {
94 self.scrape_configuration = input;
95 self
96 }
97 /// <p>The configuration file to use in the new scraper. For more information, see <a href="https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-collector-how-to.html#AMP-collector-configuration">Scraper configuration</a> in the <i>Amazon Managed Service for Prometheus User Guide</i>.</p>
98 pub fn get_scrape_configuration(&self) -> &::std::option::Option<crate::types::ScrapeConfiguration> {
99 &self.scrape_configuration
100 }
101 /// <p>The Amazon EKS cluster from which the scraper will collect metrics.</p>
102 /// This field is required.
103 pub fn source(mut self, input: crate::types::Source) -> Self {
104 self.source = ::std::option::Option::Some(input);
105 self
106 }
107 /// <p>The Amazon EKS cluster from which the scraper will collect metrics.</p>
108 pub fn set_source(mut self, input: ::std::option::Option<crate::types::Source>) -> Self {
109 self.source = input;
110 self
111 }
112 /// <p>The Amazon EKS cluster from which the scraper will collect metrics.</p>
113 pub fn get_source(&self) -> &::std::option::Option<crate::types::Source> {
114 &self.source
115 }
116 /// <p>The Amazon Managed Service for Prometheus workspace to send metrics to.</p>
117 /// This field is required.
118 pub fn destination(mut self, input: crate::types::Destination) -> Self {
119 self.destination = ::std::option::Option::Some(input);
120 self
121 }
122 /// <p>The Amazon Managed Service for Prometheus workspace to send metrics to.</p>
123 pub fn set_destination(mut self, input: ::std::option::Option<crate::types::Destination>) -> Self {
124 self.destination = input;
125 self
126 }
127 /// <p>The Amazon Managed Service for Prometheus workspace to send metrics to.</p>
128 pub fn get_destination(&self) -> &::std::option::Option<crate::types::Destination> {
129 &self.destination
130 }
131 /// <p>Use this structure to enable cross-account access, so that you can use a target account to access Prometheus metrics from source accounts.</p>
132 pub fn role_configuration(mut self, input: crate::types::RoleConfiguration) -> Self {
133 self.role_configuration = ::std::option::Option::Some(input);
134 self
135 }
136 /// <p>Use this structure to enable cross-account access, so that you can use a target account to access Prometheus metrics from source accounts.</p>
137 pub fn set_role_configuration(mut self, input: ::std::option::Option<crate::types::RoleConfiguration>) -> Self {
138 self.role_configuration = input;
139 self
140 }
141 /// <p>Use this structure to enable cross-account access, so that you can use a target account to access Prometheus metrics from source accounts.</p>
142 pub fn get_role_configuration(&self) -> &::std::option::Option<crate::types::RoleConfiguration> {
143 &self.role_configuration
144 }
145 /// <p>(Optional) A unique, case-sensitive identifier that you can provide to ensure the idempotency of the request.</p>
146 pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
147 self.client_token = ::std::option::Option::Some(input.into());
148 self
149 }
150 /// <p>(Optional) A unique, case-sensitive identifier that you can provide to ensure the idempotency of the request.</p>
151 pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152 self.client_token = input;
153 self
154 }
155 /// <p>(Optional) A unique, case-sensitive identifier that you can provide to ensure the idempotency of the request.</p>
156 pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
157 &self.client_token
158 }
159 /// Adds a key-value pair to `tags`.
160 ///
161 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
162 ///
163 /// <p>(Optional) The list of tag keys and values to associate with the scraper.</p>
164 pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
165 let mut hash_map = self.tags.unwrap_or_default();
166 hash_map.insert(k.into(), v.into());
167 self.tags = ::std::option::Option::Some(hash_map);
168 self
169 }
170 /// <p>(Optional) The list of tag keys and values to associate with the scraper.</p>
171 pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
172 self.tags = input;
173 self
174 }
175 /// <p>(Optional) The list of tag keys and values to associate with the scraper.</p>
176 pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
177 &self.tags
178 }
179 /// Consumes the builder and constructs a [`CreateScraperInput`](crate::operation::create_scraper::CreateScraperInput).
180 pub fn build(
181 self,
182 ) -> ::std::result::Result<crate::operation::create_scraper::CreateScraperInput, ::aws_smithy_types::error::operation::BuildError> {
183 ::std::result::Result::Ok(crate::operation::create_scraper::CreateScraperInput {
184 alias: self.alias,
185 scrape_configuration: self.scrape_configuration,
186 source: self.source,
187 destination: self.destination,
188 role_configuration: self.role_configuration,
189 client_token: self.client_token,
190 tags: self.tags,
191 })
192 }
193}