aws_sdk_amp/operation/create_scraper/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_scraper::_create_scraper_output::CreateScraperOutputBuilder;
3
4pub use crate::operation::create_scraper::_create_scraper_input::CreateScraperInputBuilder;
5
6impl crate::operation::create_scraper::builders::CreateScraperInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::create_scraper::CreateScraperOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_scraper::CreateScraperError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_scraper();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateScraper`.
24///
25/// <p>The <code>CreateScraper</code> operation creates a scraper to collect metrics. A scraper pulls metrics from Prometheus-compatible sources within an Amazon EKS cluster, and sends them to your Amazon Managed Service for Prometheus workspace. Scrapers are flexible, and can be configured to control what metrics are collected, the frequency of collection, what transformations are applied to the metrics, and more.</p>
26/// <p>An IAM role will be created for you that Amazon Managed Service for Prometheus uses to access the metrics in your cluster. You must configure this role with a policy that allows it to scrape metrics from your cluster. For more information, see <a href="https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-collector-how-to.html#AMP-collector-eks-setup">Configuring your Amazon EKS cluster</a> in the <i>Amazon Managed Service for Prometheus User Guide</i>.</p>
27/// <p>The <code>scrapeConfiguration</code> parameter contains the base-64 encoded YAML configuration for the scraper.</p>
28/// <p>When creating a scraper, the service creates a <code>Network Interface</code> in each <b>Availability Zone</b> that are passed into <code>CreateScraper</code> through subnets. These network interfaces are used to connect to the Amazon EKS cluster within the VPC for scraping metrics.</p><note>
29/// <p>For more information about collectors, including what metrics are collected, and how to configure the scraper, see <a href="https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-collector-how-to.html">Using an Amazon Web Services managed collector</a> in the <i>Amazon Managed Service for Prometheus User Guide</i>.</p>
30/// </note>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct CreateScraperFluentBuilder {
33    handle: ::std::sync::Arc<crate::client::Handle>,
34    inner: crate::operation::create_scraper::builders::CreateScraperInputBuilder,
35    config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38    crate::client::customize::internal::CustomizableSend<
39        crate::operation::create_scraper::CreateScraperOutput,
40        crate::operation::create_scraper::CreateScraperError,
41    > for CreateScraperFluentBuilder
42{
43    fn send(
44        self,
45        config_override: crate::config::Builder,
46    ) -> crate::client::customize::internal::BoxFuture<
47        crate::client::customize::internal::SendResult<
48            crate::operation::create_scraper::CreateScraperOutput,
49            crate::operation::create_scraper::CreateScraperError,
50        >,
51    > {
52        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53    }
54}
55impl CreateScraperFluentBuilder {
56    /// Creates a new `CreateScraperFluentBuilder`.
57    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
58        Self {
59            handle,
60            inner: ::std::default::Default::default(),
61            config_override: ::std::option::Option::None,
62        }
63    }
64    /// Access the CreateScraper as a reference.
65    pub fn as_input(&self) -> &crate::operation::create_scraper::builders::CreateScraperInputBuilder {
66        &self.inner
67    }
68    /// Sends the request and returns the response.
69    ///
70    /// If an error occurs, an `SdkError` will be returned with additional details that
71    /// can be matched against.
72    ///
73    /// By default, any retryable failures will be retried twice. Retry behavior
74    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
75    /// set when configuring the client.
76    pub async fn send(
77        self,
78    ) -> ::std::result::Result<
79        crate::operation::create_scraper::CreateScraperOutput,
80        ::aws_smithy_runtime_api::client::result::SdkError<
81            crate::operation::create_scraper::CreateScraperError,
82            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
83        >,
84    > {
85        let input = self
86            .inner
87            .build()
88            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
89        let runtime_plugins = crate::operation::create_scraper::CreateScraper::operation_runtime_plugins(
90            self.handle.runtime_plugins.clone(),
91            &self.handle.conf,
92            self.config_override,
93        );
94        crate::operation::create_scraper::CreateScraper::orchestrate(&runtime_plugins, input).await
95    }
96
97    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
98    pub fn customize(
99        self,
100    ) -> crate::client::customize::CustomizableOperation<
101        crate::operation::create_scraper::CreateScraperOutput,
102        crate::operation::create_scraper::CreateScraperError,
103        Self,
104    > {
105        crate::client::customize::CustomizableOperation::new(self)
106    }
107    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
108        self.set_config_override(::std::option::Option::Some(config_override.into()));
109        self
110    }
111
112    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
113        self.config_override = config_override;
114        self
115    }
116    /// <p>(optional) An alias to associate with the scraper. This is for your use, and does not need to be unique.</p>
117    pub fn alias(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
118        self.inner = self.inner.alias(input.into());
119        self
120    }
121    /// <p>(optional) An alias to associate with the scraper. This is for your use, and does not need to be unique.</p>
122    pub fn set_alias(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
123        self.inner = self.inner.set_alias(input);
124        self
125    }
126    /// <p>(optional) An alias to associate with the scraper. This is for your use, and does not need to be unique.</p>
127    pub fn get_alias(&self) -> &::std::option::Option<::std::string::String> {
128        self.inner.get_alias()
129    }
130    /// <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>
131    pub fn scrape_configuration(mut self, input: crate::types::ScrapeConfiguration) -> Self {
132        self.inner = self.inner.scrape_configuration(input);
133        self
134    }
135    /// <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>
136    pub fn set_scrape_configuration(mut self, input: ::std::option::Option<crate::types::ScrapeConfiguration>) -> Self {
137        self.inner = self.inner.set_scrape_configuration(input);
138        self
139    }
140    /// <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>
141    pub fn get_scrape_configuration(&self) -> &::std::option::Option<crate::types::ScrapeConfiguration> {
142        self.inner.get_scrape_configuration()
143    }
144    /// <p>The Amazon EKS cluster from which the scraper will collect metrics.</p>
145    pub fn source(mut self, input: crate::types::Source) -> Self {
146        self.inner = self.inner.source(input);
147        self
148    }
149    /// <p>The Amazon EKS cluster from which the scraper will collect metrics.</p>
150    pub fn set_source(mut self, input: ::std::option::Option<crate::types::Source>) -> Self {
151        self.inner = self.inner.set_source(input);
152        self
153    }
154    /// <p>The Amazon EKS cluster from which the scraper will collect metrics.</p>
155    pub fn get_source(&self) -> &::std::option::Option<crate::types::Source> {
156        self.inner.get_source()
157    }
158    /// <p>The Amazon Managed Service for Prometheus workspace to send metrics to.</p>
159    pub fn destination(mut self, input: crate::types::Destination) -> Self {
160        self.inner = self.inner.destination(input);
161        self
162    }
163    /// <p>The Amazon Managed Service for Prometheus workspace to send metrics to.</p>
164    pub fn set_destination(mut self, input: ::std::option::Option<crate::types::Destination>) -> Self {
165        self.inner = self.inner.set_destination(input);
166        self
167    }
168    /// <p>The Amazon Managed Service for Prometheus workspace to send metrics to.</p>
169    pub fn get_destination(&self) -> &::std::option::Option<crate::types::Destination> {
170        self.inner.get_destination()
171    }
172    /// <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>
173    pub fn role_configuration(mut self, input: crate::types::RoleConfiguration) -> Self {
174        self.inner = self.inner.role_configuration(input);
175        self
176    }
177    /// <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>
178    pub fn set_role_configuration(mut self, input: ::std::option::Option<crate::types::RoleConfiguration>) -> Self {
179        self.inner = self.inner.set_role_configuration(input);
180        self
181    }
182    /// <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>
183    pub fn get_role_configuration(&self) -> &::std::option::Option<crate::types::RoleConfiguration> {
184        self.inner.get_role_configuration()
185    }
186    /// <p>(Optional) A unique, case-sensitive identifier that you can provide to ensure the idempotency of the request.</p>
187    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
188        self.inner = self.inner.client_token(input.into());
189        self
190    }
191    /// <p>(Optional) A unique, case-sensitive identifier that you can provide to ensure the idempotency of the request.</p>
192    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
193        self.inner = self.inner.set_client_token(input);
194        self
195    }
196    /// <p>(Optional) A unique, case-sensitive identifier that you can provide to ensure the idempotency of the request.</p>
197    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
198        self.inner.get_client_token()
199    }
200    ///
201    /// Adds a key-value pair to `tags`.
202    ///
203    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
204    ///
205    /// <p>(Optional) The list of tag keys and values to associate with the scraper.</p>
206    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
207        self.inner = self.inner.tags(k.into(), v.into());
208        self
209    }
210    /// <p>(Optional) The list of tag keys and values to associate with the scraper.</p>
211    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
212        self.inner = self.inner.set_tags(input);
213        self
214    }
215    /// <p>(Optional) The list of tag keys and values to associate with the scraper.</p>
216    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
217        self.inner.get_tags()
218    }
219}