aws_sdk_computeoptimizer/operation/export_idle_recommendations/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::export_idle_recommendations::_export_idle_recommendations_output::ExportIdleRecommendationsOutputBuilder;
3
4pub use crate::operation::export_idle_recommendations::_export_idle_recommendations_input::ExportIdleRecommendationsInputBuilder;
5
6impl crate::operation::export_idle_recommendations::builders::ExportIdleRecommendationsInputBuilder {
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::export_idle_recommendations::ExportIdleRecommendationsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::export_idle_recommendations::ExportIdleRecommendationsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.export_idle_recommendations();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ExportIdleRecommendations`.
24///
25/// <p>Export optimization recommendations for your idle resources.</p>
26/// <p>Recommendations are exported in a comma-separated values (CSV) file, and its metadata in a JavaScript Object Notation (JSON) file, to an existing Amazon Simple Storage Service (Amazon S3) bucket that you specify. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/exporting-recommendations.html">Exporting Recommendations</a> in the <i>Compute Optimizer User Guide</i>.</p>
27/// <p>You can have only one idle resource export job in progress per Amazon Web Services Region.</p>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct ExportIdleRecommendationsFluentBuilder {
30    handle: ::std::sync::Arc<crate::client::Handle>,
31    inner: crate::operation::export_idle_recommendations::builders::ExportIdleRecommendationsInputBuilder,
32    config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35    crate::client::customize::internal::CustomizableSend<
36        crate::operation::export_idle_recommendations::ExportIdleRecommendationsOutput,
37        crate::operation::export_idle_recommendations::ExportIdleRecommendationsError,
38    > for ExportIdleRecommendationsFluentBuilder
39{
40    fn send(
41        self,
42        config_override: crate::config::Builder,
43    ) -> crate::client::customize::internal::BoxFuture<
44        crate::client::customize::internal::SendResult<
45            crate::operation::export_idle_recommendations::ExportIdleRecommendationsOutput,
46            crate::operation::export_idle_recommendations::ExportIdleRecommendationsError,
47        >,
48    > {
49        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50    }
51}
52impl ExportIdleRecommendationsFluentBuilder {
53    /// Creates a new `ExportIdleRecommendationsFluentBuilder`.
54    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
55        Self {
56            handle,
57            inner: ::std::default::Default::default(),
58            config_override: ::std::option::Option::None,
59        }
60    }
61    /// Access the ExportIdleRecommendations as a reference.
62    pub fn as_input(&self) -> &crate::operation::export_idle_recommendations::builders::ExportIdleRecommendationsInputBuilder {
63        &self.inner
64    }
65    /// Sends the request and returns the response.
66    ///
67    /// If an error occurs, an `SdkError` will be returned with additional details that
68    /// can be matched against.
69    ///
70    /// By default, any retryable failures will be retried twice. Retry behavior
71    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
72    /// set when configuring the client.
73    pub async fn send(
74        self,
75    ) -> ::std::result::Result<
76        crate::operation::export_idle_recommendations::ExportIdleRecommendationsOutput,
77        ::aws_smithy_runtime_api::client::result::SdkError<
78            crate::operation::export_idle_recommendations::ExportIdleRecommendationsError,
79            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
80        >,
81    > {
82        let input = self
83            .inner
84            .build()
85            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
86        let runtime_plugins = crate::operation::export_idle_recommendations::ExportIdleRecommendations::operation_runtime_plugins(
87            self.handle.runtime_plugins.clone(),
88            &self.handle.conf,
89            self.config_override,
90        );
91        crate::operation::export_idle_recommendations::ExportIdleRecommendations::orchestrate(&runtime_plugins, input).await
92    }
93
94    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
95    pub fn customize(
96        self,
97    ) -> crate::client::customize::CustomizableOperation<
98        crate::operation::export_idle_recommendations::ExportIdleRecommendationsOutput,
99        crate::operation::export_idle_recommendations::ExportIdleRecommendationsError,
100        Self,
101    > {
102        crate::client::customize::CustomizableOperation::new(self)
103    }
104    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
105        self.set_config_override(::std::option::Option::Some(config_override.into()));
106        self
107    }
108
109    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
110        self.config_override = config_override;
111        self
112    }
113    ///
114    /// Appends an item to `accountIds`.
115    ///
116    /// To override the contents of this collection use [`set_account_ids`](Self::set_account_ids).
117    ///
118    /// <p>The Amazon Web Services account IDs for the export idle resource recommendations.</p>
119    /// <p>If your account is the management account or the delegated administrator of an organization, use this parameter to specify the member account you want to export recommendations to.</p>
120    /// <p>This parameter can't be specified together with the include member accounts parameter. The parameters are mutually exclusive.</p>
121    /// <p>If this parameter or the include member accounts parameter is omitted, the recommendations for member accounts aren't included in the export.</p>
122    /// <p>You can specify multiple account IDs per request.</p>
123    pub fn account_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
124        self.inner = self.inner.account_ids(input.into());
125        self
126    }
127    /// <p>The Amazon Web Services account IDs for the export idle resource recommendations.</p>
128    /// <p>If your account is the management account or the delegated administrator of an organization, use this parameter to specify the member account you want to export recommendations to.</p>
129    /// <p>This parameter can't be specified together with the include member accounts parameter. The parameters are mutually exclusive.</p>
130    /// <p>If this parameter or the include member accounts parameter is omitted, the recommendations for member accounts aren't included in the export.</p>
131    /// <p>You can specify multiple account IDs per request.</p>
132    pub fn set_account_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
133        self.inner = self.inner.set_account_ids(input);
134        self
135    }
136    /// <p>The Amazon Web Services account IDs for the export idle resource recommendations.</p>
137    /// <p>If your account is the management account or the delegated administrator of an organization, use this parameter to specify the member account you want to export recommendations to.</p>
138    /// <p>This parameter can't be specified together with the include member accounts parameter. The parameters are mutually exclusive.</p>
139    /// <p>If this parameter or the include member accounts parameter is omitted, the recommendations for member accounts aren't included in the export.</p>
140    /// <p>You can specify multiple account IDs per request.</p>
141    pub fn get_account_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
142        self.inner.get_account_ids()
143    }
144    ///
145    /// Appends an item to `filters`.
146    ///
147    /// To override the contents of this collection use [`set_filters`](Self::set_filters).
148    ///
149    /// <p>An array of objects to specify a filter that exports a more specific set of idle resource recommendations.</p>
150    pub fn filters(mut self, input: crate::types::IdleRecommendationFilter) -> Self {
151        self.inner = self.inner.filters(input);
152        self
153    }
154    /// <p>An array of objects to specify a filter that exports a more specific set of idle resource recommendations.</p>
155    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::IdleRecommendationFilter>>) -> Self {
156        self.inner = self.inner.set_filters(input);
157        self
158    }
159    /// <p>An array of objects to specify a filter that exports a more specific set of idle resource recommendations.</p>
160    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::IdleRecommendationFilter>> {
161        self.inner.get_filters()
162    }
163    ///
164    /// Appends an item to `fieldsToExport`.
165    ///
166    /// To override the contents of this collection use [`set_fields_to_export`](Self::set_fields_to_export).
167    ///
168    /// <p>The recommendations data to include in the export file. For more information about the fields that can be exported, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/exporting-recommendations.html#exported-files">Exported files</a> in the <i>Compute Optimizer User Guide</i>.</p>
169    pub fn fields_to_export(mut self, input: crate::types::ExportableIdleField) -> Self {
170        self.inner = self.inner.fields_to_export(input);
171        self
172    }
173    /// <p>The recommendations data to include in the export file. For more information about the fields that can be exported, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/exporting-recommendations.html#exported-files">Exported files</a> in the <i>Compute Optimizer User Guide</i>.</p>
174    pub fn set_fields_to_export(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ExportableIdleField>>) -> Self {
175        self.inner = self.inner.set_fields_to_export(input);
176        self
177    }
178    /// <p>The recommendations data to include in the export file. For more information about the fields that can be exported, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/exporting-recommendations.html#exported-files">Exported files</a> in the <i>Compute Optimizer User Guide</i>.</p>
179    pub fn get_fields_to_export(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ExportableIdleField>> {
180        self.inner.get_fields_to_export()
181    }
182    /// <p>Describes the destination Amazon Simple Storage Service (Amazon S3) bucket name and key prefix for a recommendations export job.</p>
183    /// <p>You must create the destination Amazon S3 bucket for your recommendations export before you create the export job. Compute Optimizer does not create the S3 bucket for you. After you create the S3 bucket, ensure that it has the required permission policy to allow Compute Optimizer to write the export file to it. If you plan to specify an object prefix when you create the export job, you must include the object prefix in the policy that you add to the S3 bucket. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/create-s3-bucket-policy-for-compute-optimizer.html">Amazon S3 Bucket Policy for Compute Optimizer</a> in the <i>Compute Optimizer User Guide</i>.</p>
184    pub fn s3_destination_config(mut self, input: crate::types::S3DestinationConfig) -> Self {
185        self.inner = self.inner.s3_destination_config(input);
186        self
187    }
188    /// <p>Describes the destination Amazon Simple Storage Service (Amazon S3) bucket name and key prefix for a recommendations export job.</p>
189    /// <p>You must create the destination Amazon S3 bucket for your recommendations export before you create the export job. Compute Optimizer does not create the S3 bucket for you. After you create the S3 bucket, ensure that it has the required permission policy to allow Compute Optimizer to write the export file to it. If you plan to specify an object prefix when you create the export job, you must include the object prefix in the policy that you add to the S3 bucket. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/create-s3-bucket-policy-for-compute-optimizer.html">Amazon S3 Bucket Policy for Compute Optimizer</a> in the <i>Compute Optimizer User Guide</i>.</p>
190    pub fn set_s3_destination_config(mut self, input: ::std::option::Option<crate::types::S3DestinationConfig>) -> Self {
191        self.inner = self.inner.set_s3_destination_config(input);
192        self
193    }
194    /// <p>Describes the destination Amazon Simple Storage Service (Amazon S3) bucket name and key prefix for a recommendations export job.</p>
195    /// <p>You must create the destination Amazon S3 bucket for your recommendations export before you create the export job. Compute Optimizer does not create the S3 bucket for you. After you create the S3 bucket, ensure that it has the required permission policy to allow Compute Optimizer to write the export file to it. If you plan to specify an object prefix when you create the export job, you must include the object prefix in the policy that you add to the S3 bucket. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/create-s3-bucket-policy-for-compute-optimizer.html">Amazon S3 Bucket Policy for Compute Optimizer</a> in the <i>Compute Optimizer User Guide</i>.</p>
196    pub fn get_s3_destination_config(&self) -> &::std::option::Option<crate::types::S3DestinationConfig> {
197        self.inner.get_s3_destination_config()
198    }
199    /// <p>The format of the export file. The CSV file is the only export file format currently supported.</p>
200    pub fn file_format(mut self, input: crate::types::FileFormat) -> Self {
201        self.inner = self.inner.file_format(input);
202        self
203    }
204    /// <p>The format of the export file. The CSV file is the only export file format currently supported.</p>
205    pub fn set_file_format(mut self, input: ::std::option::Option<crate::types::FileFormat>) -> Self {
206        self.inner = self.inner.set_file_format(input);
207        self
208    }
209    /// <p>The format of the export file. The CSV file is the only export file format currently supported.</p>
210    pub fn get_file_format(&self) -> &::std::option::Option<crate::types::FileFormat> {
211        self.inner.get_file_format()
212    }
213    /// <p>If your account is the management account or the delegated administrator of an organization, this parameter indicates whether to include recommendations for resources in all member accounts of the organization.</p>
214    /// <p>The member accounts must also be opted in to Compute Optimizer, and trusted access for Compute Optimizer must be enabled in the organization account. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/security-iam.html#trusted-service-access">Compute Optimizer and Amazon Web Services Organizations trusted access</a> in the <i>Compute Optimizer User Guide</i>.</p>
215    /// <p>If this parameter is omitted, recommendations for member accounts of the organization aren't included in the export file.</p>
216    /// <p>If this parameter or the account ID parameter is omitted, recommendations for member accounts aren't included in the export.</p>
217    pub fn include_member_accounts(mut self, input: bool) -> Self {
218        self.inner = self.inner.include_member_accounts(input);
219        self
220    }
221    /// <p>If your account is the management account or the delegated administrator of an organization, this parameter indicates whether to include recommendations for resources in all member accounts of the organization.</p>
222    /// <p>The member accounts must also be opted in to Compute Optimizer, and trusted access for Compute Optimizer must be enabled in the organization account. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/security-iam.html#trusted-service-access">Compute Optimizer and Amazon Web Services Organizations trusted access</a> in the <i>Compute Optimizer User Guide</i>.</p>
223    /// <p>If this parameter is omitted, recommendations for member accounts of the organization aren't included in the export file.</p>
224    /// <p>If this parameter or the account ID parameter is omitted, recommendations for member accounts aren't included in the export.</p>
225    pub fn set_include_member_accounts(mut self, input: ::std::option::Option<bool>) -> Self {
226        self.inner = self.inner.set_include_member_accounts(input);
227        self
228    }
229    /// <p>If your account is the management account or the delegated administrator of an organization, this parameter indicates whether to include recommendations for resources in all member accounts of the organization.</p>
230    /// <p>The member accounts must also be opted in to Compute Optimizer, and trusted access for Compute Optimizer must be enabled in the organization account. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/security-iam.html#trusted-service-access">Compute Optimizer and Amazon Web Services Organizations trusted access</a> in the <i>Compute Optimizer User Guide</i>.</p>
231    /// <p>If this parameter is omitted, recommendations for member accounts of the organization aren't included in the export file.</p>
232    /// <p>If this parameter or the account ID parameter is omitted, recommendations for member accounts aren't included in the export.</p>
233    pub fn get_include_member_accounts(&self) -> &::std::option::Option<bool> {
234        self.inner.get_include_member_accounts()
235    }
236}