aws_sdk_computeoptimizer/operation/update_enrollment_status/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_enrollment_status::_update_enrollment_status_output::UpdateEnrollmentStatusOutputBuilder;
3
4pub use crate::operation::update_enrollment_status::_update_enrollment_status_input::UpdateEnrollmentStatusInputBuilder;
5
6impl crate::operation::update_enrollment_status::builders::UpdateEnrollmentStatusInputBuilder {
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::update_enrollment_status::UpdateEnrollmentStatusOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::update_enrollment_status::UpdateEnrollmentStatusError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.update_enrollment_status();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `UpdateEnrollmentStatus`.
24///
25/// <p>Updates the enrollment (opt in and opt out) status of an account to the Compute Optimizer service.</p>
26/// <p>If the account is a management account of an organization, this action can also be used to enroll member accounts of the organization.</p>
27/// <p>You must have the appropriate permissions to opt in to Compute Optimizer, to view its recommendations, and to opt out. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/security-iam.html">Controlling access with Amazon Web Services Identity and Access Management</a> in the <i>Compute Optimizer User Guide</i>.</p>
28/// <p>When you opt in, Compute Optimizer automatically creates a service-linked role in your account to access its data. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/using-service-linked-roles.html">Using Service-Linked Roles for Compute Optimizer</a> in the <i>Compute Optimizer User Guide</i>.</p>
29#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct UpdateEnrollmentStatusFluentBuilder {
31    handle: ::std::sync::Arc<crate::client::Handle>,
32    inner: crate::operation::update_enrollment_status::builders::UpdateEnrollmentStatusInputBuilder,
33    config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36    crate::client::customize::internal::CustomizableSend<
37        crate::operation::update_enrollment_status::UpdateEnrollmentStatusOutput,
38        crate::operation::update_enrollment_status::UpdateEnrollmentStatusError,
39    > for UpdateEnrollmentStatusFluentBuilder
40{
41    fn send(
42        self,
43        config_override: crate::config::Builder,
44    ) -> crate::client::customize::internal::BoxFuture<
45        crate::client::customize::internal::SendResult<
46            crate::operation::update_enrollment_status::UpdateEnrollmentStatusOutput,
47            crate::operation::update_enrollment_status::UpdateEnrollmentStatusError,
48        >,
49    > {
50        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51    }
52}
53impl UpdateEnrollmentStatusFluentBuilder {
54    /// Creates a new `UpdateEnrollmentStatusFluentBuilder`.
55    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
56        Self {
57            handle,
58            inner: ::std::default::Default::default(),
59            config_override: ::std::option::Option::None,
60        }
61    }
62    /// Access the UpdateEnrollmentStatus as a reference.
63    pub fn as_input(&self) -> &crate::operation::update_enrollment_status::builders::UpdateEnrollmentStatusInputBuilder {
64        &self.inner
65    }
66    /// Sends the request and returns the response.
67    ///
68    /// If an error occurs, an `SdkError` will be returned with additional details that
69    /// can be matched against.
70    ///
71    /// By default, any retryable failures will be retried twice. Retry behavior
72    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
73    /// set when configuring the client.
74    pub async fn send(
75        self,
76    ) -> ::std::result::Result<
77        crate::operation::update_enrollment_status::UpdateEnrollmentStatusOutput,
78        ::aws_smithy_runtime_api::client::result::SdkError<
79            crate::operation::update_enrollment_status::UpdateEnrollmentStatusError,
80            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
81        >,
82    > {
83        let input = self
84            .inner
85            .build()
86            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
87        let runtime_plugins = crate::operation::update_enrollment_status::UpdateEnrollmentStatus::operation_runtime_plugins(
88            self.handle.runtime_plugins.clone(),
89            &self.handle.conf,
90            self.config_override,
91        );
92        crate::operation::update_enrollment_status::UpdateEnrollmentStatus::orchestrate(&runtime_plugins, input).await
93    }
94
95    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
96    pub fn customize(
97        self,
98    ) -> crate::client::customize::CustomizableOperation<
99        crate::operation::update_enrollment_status::UpdateEnrollmentStatusOutput,
100        crate::operation::update_enrollment_status::UpdateEnrollmentStatusError,
101        Self,
102    > {
103        crate::client::customize::CustomizableOperation::new(self)
104    }
105    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
106        self.set_config_override(::std::option::Option::Some(config_override.into()));
107        self
108    }
109
110    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
111        self.config_override = config_override;
112        self
113    }
114    /// <p>The new enrollment status of the account.</p>
115    /// <p>The following status options are available:</p>
116    /// <ul>
117    /// <li>
118    /// <p><code>Active</code> - Opts in your account to the Compute Optimizer service. Compute Optimizer begins analyzing the configuration and utilization metrics of your Amazon Web Services resources after you opt in. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/metrics.html">Metrics analyzed by Compute Optimizer</a> in the <i>Compute Optimizer User Guide</i>.</p></li>
119    /// <li>
120    /// <p><code>Inactive</code> - Opts out your account from the Compute Optimizer service. Your account's recommendations and related metrics data will be deleted from Compute Optimizer after you opt out.</p></li>
121    /// </ul><note>
122    /// <p>The <code>Pending</code> and <code>Failed</code> options cannot be used to update the enrollment status of an account. They are returned in the response of a request to update the enrollment status of an account.</p>
123    /// </note>
124    pub fn status(mut self, input: crate::types::Status) -> Self {
125        self.inner = self.inner.status(input);
126        self
127    }
128    /// <p>The new enrollment status of the account.</p>
129    /// <p>The following status options are available:</p>
130    /// <ul>
131    /// <li>
132    /// <p><code>Active</code> - Opts in your account to the Compute Optimizer service. Compute Optimizer begins analyzing the configuration and utilization metrics of your Amazon Web Services resources after you opt in. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/metrics.html">Metrics analyzed by Compute Optimizer</a> in the <i>Compute Optimizer User Guide</i>.</p></li>
133    /// <li>
134    /// <p><code>Inactive</code> - Opts out your account from the Compute Optimizer service. Your account's recommendations and related metrics data will be deleted from Compute Optimizer after you opt out.</p></li>
135    /// </ul><note>
136    /// <p>The <code>Pending</code> and <code>Failed</code> options cannot be used to update the enrollment status of an account. They are returned in the response of a request to update the enrollment status of an account.</p>
137    /// </note>
138    pub fn set_status(mut self, input: ::std::option::Option<crate::types::Status>) -> Self {
139        self.inner = self.inner.set_status(input);
140        self
141    }
142    /// <p>The new enrollment status of the account.</p>
143    /// <p>The following status options are available:</p>
144    /// <ul>
145    /// <li>
146    /// <p><code>Active</code> - Opts in your account to the Compute Optimizer service. Compute Optimizer begins analyzing the configuration and utilization metrics of your Amazon Web Services resources after you opt in. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/metrics.html">Metrics analyzed by Compute Optimizer</a> in the <i>Compute Optimizer User Guide</i>.</p></li>
147    /// <li>
148    /// <p><code>Inactive</code> - Opts out your account from the Compute Optimizer service. Your account's recommendations and related metrics data will be deleted from Compute Optimizer after you opt out.</p></li>
149    /// </ul><note>
150    /// <p>The <code>Pending</code> and <code>Failed</code> options cannot be used to update the enrollment status of an account. They are returned in the response of a request to update the enrollment status of an account.</p>
151    /// </note>
152    pub fn get_status(&self) -> &::std::option::Option<crate::types::Status> {
153        self.inner.get_status()
154    }
155    /// <p>Indicates whether to enroll member accounts of the organization if the account is the management account of an organization.</p>
156    pub fn include_member_accounts(mut self, input: bool) -> Self {
157        self.inner = self.inner.include_member_accounts(input);
158        self
159    }
160    /// <p>Indicates whether to enroll member accounts of the organization if the account is the management account of an organization.</p>
161    pub fn set_include_member_accounts(mut self, input: ::std::option::Option<bool>) -> Self {
162        self.inner = self.inner.set_include_member_accounts(input);
163        self
164    }
165    /// <p>Indicates whether to enroll member accounts of the organization if the account is the management account of an organization.</p>
166    pub fn get_include_member_accounts(&self) -> &::std::option::Option<bool> {
167        self.inner.get_include_member_accounts()
168    }
169}