aws_sdk_codeguruprofiler/operation/configure_agent/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::configure_agent::_configure_agent_output::ConfigureAgentOutputBuilder;
3
4pub use crate::operation::configure_agent::_configure_agent_input::ConfigureAgentInputBuilder;
5
6impl crate::operation::configure_agent::builders::ConfigureAgentInputBuilder {
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::configure_agent::ConfigureAgentOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::configure_agent::ConfigureAgentError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.configure_agent();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ConfigureAgent`.
24///
25/// <p>Used by profiler agents to report their current state and to receive remote configuration updates. For example, <code>ConfigureAgent</code> can be used to tell an agent whether to profile or not and for how long to return profiling data.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct ConfigureAgentFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::configure_agent::builders::ConfigureAgentInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::configure_agent::ConfigureAgentOutput,
35        crate::operation::configure_agent::ConfigureAgentError,
36    > for ConfigureAgentFluentBuilder
37{
38    fn send(
39        self,
40        config_override: crate::config::Builder,
41    ) -> crate::client::customize::internal::BoxFuture<
42        crate::client::customize::internal::SendResult<
43            crate::operation::configure_agent::ConfigureAgentOutput,
44            crate::operation::configure_agent::ConfigureAgentError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl ConfigureAgentFluentBuilder {
51    /// Creates a new `ConfigureAgentFluentBuilder`.
52    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53        Self {
54            handle,
55            inner: ::std::default::Default::default(),
56            config_override: ::std::option::Option::None,
57        }
58    }
59    /// Access the ConfigureAgent as a reference.
60    pub fn as_input(&self) -> &crate::operation::configure_agent::builders::ConfigureAgentInputBuilder {
61        &self.inner
62    }
63    /// Sends the request and returns the response.
64    ///
65    /// If an error occurs, an `SdkError` will be returned with additional details that
66    /// can be matched against.
67    ///
68    /// By default, any retryable failures will be retried twice. Retry behavior
69    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70    /// set when configuring the client.
71    pub async fn send(
72        self,
73    ) -> ::std::result::Result<
74        crate::operation::configure_agent::ConfigureAgentOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::configure_agent::ConfigureAgentError,
77            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78        >,
79    > {
80        let input = self
81            .inner
82            .build()
83            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84        let runtime_plugins = crate::operation::configure_agent::ConfigureAgent::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::configure_agent::ConfigureAgent::orchestrate(&runtime_plugins, input).await
90    }
91
92    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93    pub fn customize(
94        self,
95    ) -> crate::client::customize::CustomizableOperation<
96        crate::operation::configure_agent::ConfigureAgentOutput,
97        crate::operation::configure_agent::ConfigureAgentError,
98        Self,
99    > {
100        crate::client::customize::CustomizableOperation::new(self)
101    }
102    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103        self.set_config_override(::std::option::Option::Some(config_override.into()));
104        self
105    }
106
107    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108        self.config_override = config_override;
109        self
110    }
111    /// <p>The name of the profiling group for which the configured agent is collecting profiling data.</p>
112    pub fn profiling_group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.inner = self.inner.profiling_group_name(input.into());
114        self
115    }
116    /// <p>The name of the profiling group for which the configured agent is collecting profiling data.</p>
117    pub fn set_profiling_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118        self.inner = self.inner.set_profiling_group_name(input);
119        self
120    }
121    /// <p>The name of the profiling group for which the configured agent is collecting profiling data.</p>
122    pub fn get_profiling_group_name(&self) -> &::std::option::Option<::std::string::String> {
123        self.inner.get_profiling_group_name()
124    }
125    /// <p>A universally unique identifier (UUID) for a profiling instance. For example, if the profiling instance is an Amazon EC2 instance, it is the instance ID. If it is an AWS Fargate container, it is the container's task ID.</p>
126    pub fn fleet_instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127        self.inner = self.inner.fleet_instance_id(input.into());
128        self
129    }
130    /// <p>A universally unique identifier (UUID) for a profiling instance. For example, if the profiling instance is an Amazon EC2 instance, it is the instance ID. If it is an AWS Fargate container, it is the container's task ID.</p>
131    pub fn set_fleet_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
132        self.inner = self.inner.set_fleet_instance_id(input);
133        self
134    }
135    /// <p>A universally unique identifier (UUID) for a profiling instance. For example, if the profiling instance is an Amazon EC2 instance, it is the instance ID. If it is an AWS Fargate container, it is the container's task ID.</p>
136    pub fn get_fleet_instance_id(&self) -> &::std::option::Option<::std::string::String> {
137        self.inner.get_fleet_instance_id()
138    }
139    ///
140    /// Adds a key-value pair to `metadata`.
141    ///
142    /// To override the contents of this collection use [`set_metadata`](Self::set_metadata).
143    ///
144    /// <p>Metadata captured about the compute platform the agent is running on. It includes information about sampling and reporting. The valid fields are:</p>
145    /// <ul>
146    /// <li>
147    /// <p><code>COMPUTE_PLATFORM</code> - The compute platform on which the agent is running</p></li>
148    /// <li>
149    /// <p><code>AGENT_ID</code> - The ID for an agent instance.</p></li>
150    /// <li>
151    /// <p><code>AWS_REQUEST_ID</code> - The AWS request ID of a Lambda invocation.</p></li>
152    /// <li>
153    /// <p><code>EXECUTION_ENVIRONMENT</code> - The execution environment a Lambda function is running on.</p></li>
154    /// <li>
155    /// <p><code>LAMBDA_FUNCTION_ARN</code> - The Amazon Resource Name (ARN) that is used to invoke a Lambda function.</p></li>
156    /// <li>
157    /// <p><code>LAMBDA_MEMORY_LIMIT_IN_MB</code> - The memory allocated to a Lambda function.</p></li>
158    /// <li>
159    /// <p><code>LAMBDA_REMAINING_TIME_IN_MILLISECONDS</code> - The time in milliseconds before execution of a Lambda function times out.</p></li>
160    /// <li>
161    /// <p><code>LAMBDA_TIME_GAP_BETWEEN_INVOKES_IN_MILLISECONDS</code> - The time in milliseconds between two invocations of a Lambda function.</p></li>
162    /// <li>
163    /// <p><code>LAMBDA_PREVIOUS_EXECUTION_TIME_IN_MILLISECONDS</code> - The time in milliseconds for the previous Lambda invocation.</p></li>
164    /// </ul>
165    pub fn metadata(mut self, k: crate::types::MetadataField, v: impl ::std::convert::Into<::std::string::String>) -> Self {
166        self.inner = self.inner.metadata(k, v.into());
167        self
168    }
169    /// <p>Metadata captured about the compute platform the agent is running on. It includes information about sampling and reporting. The valid fields are:</p>
170    /// <ul>
171    /// <li>
172    /// <p><code>COMPUTE_PLATFORM</code> - The compute platform on which the agent is running</p></li>
173    /// <li>
174    /// <p><code>AGENT_ID</code> - The ID for an agent instance.</p></li>
175    /// <li>
176    /// <p><code>AWS_REQUEST_ID</code> - The AWS request ID of a Lambda invocation.</p></li>
177    /// <li>
178    /// <p><code>EXECUTION_ENVIRONMENT</code> - The execution environment a Lambda function is running on.</p></li>
179    /// <li>
180    /// <p><code>LAMBDA_FUNCTION_ARN</code> - The Amazon Resource Name (ARN) that is used to invoke a Lambda function.</p></li>
181    /// <li>
182    /// <p><code>LAMBDA_MEMORY_LIMIT_IN_MB</code> - The memory allocated to a Lambda function.</p></li>
183    /// <li>
184    /// <p><code>LAMBDA_REMAINING_TIME_IN_MILLISECONDS</code> - The time in milliseconds before execution of a Lambda function times out.</p></li>
185    /// <li>
186    /// <p><code>LAMBDA_TIME_GAP_BETWEEN_INVOKES_IN_MILLISECONDS</code> - The time in milliseconds between two invocations of a Lambda function.</p></li>
187    /// <li>
188    /// <p><code>LAMBDA_PREVIOUS_EXECUTION_TIME_IN_MILLISECONDS</code> - The time in milliseconds for the previous Lambda invocation.</p></li>
189    /// </ul>
190    pub fn set_metadata(
191        mut self,
192        input: ::std::option::Option<::std::collections::HashMap<crate::types::MetadataField, ::std::string::String>>,
193    ) -> Self {
194        self.inner = self.inner.set_metadata(input);
195        self
196    }
197    /// <p>Metadata captured about the compute platform the agent is running on. It includes information about sampling and reporting. The valid fields are:</p>
198    /// <ul>
199    /// <li>
200    /// <p><code>COMPUTE_PLATFORM</code> - The compute platform on which the agent is running</p></li>
201    /// <li>
202    /// <p><code>AGENT_ID</code> - The ID for an agent instance.</p></li>
203    /// <li>
204    /// <p><code>AWS_REQUEST_ID</code> - The AWS request ID of a Lambda invocation.</p></li>
205    /// <li>
206    /// <p><code>EXECUTION_ENVIRONMENT</code> - The execution environment a Lambda function is running on.</p></li>
207    /// <li>
208    /// <p><code>LAMBDA_FUNCTION_ARN</code> - The Amazon Resource Name (ARN) that is used to invoke a Lambda function.</p></li>
209    /// <li>
210    /// <p><code>LAMBDA_MEMORY_LIMIT_IN_MB</code> - The memory allocated to a Lambda function.</p></li>
211    /// <li>
212    /// <p><code>LAMBDA_REMAINING_TIME_IN_MILLISECONDS</code> - The time in milliseconds before execution of a Lambda function times out.</p></li>
213    /// <li>
214    /// <p><code>LAMBDA_TIME_GAP_BETWEEN_INVOKES_IN_MILLISECONDS</code> - The time in milliseconds between two invocations of a Lambda function.</p></li>
215    /// <li>
216    /// <p><code>LAMBDA_PREVIOUS_EXECUTION_TIME_IN_MILLISECONDS</code> - The time in milliseconds for the previous Lambda invocation.</p></li>
217    /// </ul>
218    pub fn get_metadata(&self) -> &::std::option::Option<::std::collections::HashMap<crate::types::MetadataField, ::std::string::String>> {
219        self.inner.get_metadata()
220    }
221}