aws_sdk_computeoptimizer/operation/export_ec2_instance_recommendations/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::export_ec2_instance_recommendations::_export_ec2_instance_recommendations_output::ExportEc2InstanceRecommendationsOutputBuilder;
3
4pub use crate::operation::export_ec2_instance_recommendations::_export_ec2_instance_recommendations_input::ExportEc2InstanceRecommendationsInputBuilder;
5
6impl crate::operation::export_ec2_instance_recommendations::builders::ExportEc2InstanceRecommendationsInputBuilder {
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_ec2_instance_recommendations::ExportEc2InstanceRecommendationsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::export_ec2_instance_recommendations::ExportEC2InstanceRecommendationsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.export_ec2_instance_recommendations();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ExportEC2InstanceRecommendations`.
24///
25/// <p>Exports optimization recommendations for Amazon EC2 instances.</p>
26/// <p>Recommendations are exported in a comma-separated values (.csv) file, and its metadata in a JavaScript Object Notation (JSON) (.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 Amazon EC2 instance export job in progress per Amazon Web Services Region.</p>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct ExportEC2InstanceRecommendationsFluentBuilder {
30    handle: ::std::sync::Arc<crate::client::Handle>,
31    inner: crate::operation::export_ec2_instance_recommendations::builders::ExportEc2InstanceRecommendationsInputBuilder,
32    config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35    crate::client::customize::internal::CustomizableSend<
36        crate::operation::export_ec2_instance_recommendations::ExportEc2InstanceRecommendationsOutput,
37        crate::operation::export_ec2_instance_recommendations::ExportEC2InstanceRecommendationsError,
38    > for ExportEC2InstanceRecommendationsFluentBuilder
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_ec2_instance_recommendations::ExportEc2InstanceRecommendationsOutput,
46            crate::operation::export_ec2_instance_recommendations::ExportEC2InstanceRecommendationsError,
47        >,
48    > {
49        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50    }
51}
52impl ExportEC2InstanceRecommendationsFluentBuilder {
53    /// Creates a new `ExportEC2InstanceRecommendationsFluentBuilder`.
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 ExportEC2InstanceRecommendations as a reference.
62    pub fn as_input(&self) -> &crate::operation::export_ec2_instance_recommendations::builders::ExportEc2InstanceRecommendationsInputBuilder {
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_ec2_instance_recommendations::ExportEc2InstanceRecommendationsOutput,
77        ::aws_smithy_runtime_api::client::result::SdkError<
78            crate::operation::export_ec2_instance_recommendations::ExportEC2InstanceRecommendationsError,
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_ec2_instance_recommendations::ExportEC2InstanceRecommendations::operation_runtime_plugins(
87            self.handle.runtime_plugins.clone(),
88            &self.handle.conf,
89            self.config_override,
90        );
91        crate::operation::export_ec2_instance_recommendations::ExportEC2InstanceRecommendations::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_ec2_instance_recommendations::ExportEc2InstanceRecommendationsOutput,
99        crate::operation::export_ec2_instance_recommendations::ExportEC2InstanceRecommendationsError,
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 IDs of the Amazon Web Services accounts for which to export instance recommendations.</p>
119    /// <p>If your account is the management account of an organization, use this parameter to specify the member account for which you want to export recommendations.</p>
120    /// <p>This parameter cannot be specified together with the include member accounts parameter. The parameters are mutually exclusive.</p>
121    /// <p>Recommendations for member accounts are not included in the export if this parameter, or the include member accounts parameter, is omitted.</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 IDs of the Amazon Web Services accounts for which to export instance recommendations.</p>
128    /// <p>If your account is the management account of an organization, use this parameter to specify the member account for which you want to export recommendations.</p>
129    /// <p>This parameter cannot be specified together with the include member accounts parameter. The parameters are mutually exclusive.</p>
130    /// <p>Recommendations for member accounts are not included in the export if this parameter, or the include member accounts parameter, is omitted.</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 IDs of the Amazon Web Services accounts for which to export instance recommendations.</p>
137    /// <p>If your account is the management account of an organization, use this parameter to specify the member account for which you want to export recommendations.</p>
138    /// <p>This parameter cannot be specified together with the include member accounts parameter. The parameters are mutually exclusive.</p>
139    /// <p>Recommendations for member accounts are not included in the export if this parameter, or the include member accounts parameter, is omitted.</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 instance recommendations.</p>
150    pub fn filters(mut self, input: crate::types::Filter) -> 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 instance recommendations.</p>
155    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> 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 instance recommendations.</p>
160    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
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::ExportableInstanceField) -> 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::ExportableInstanceField>>) -> 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::ExportableInstanceField>> {
180        self.inner.get_fields_to_export()
181    }
182    /// <p>An object to specify the destination Amazon Simple Storage Service (Amazon S3) bucket name and key prefix for the 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 permissions 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>An object to specify the destination Amazon Simple Storage Service (Amazon S3) bucket name and key prefix for the 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 permissions 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>An object to specify the destination Amazon Simple Storage Service (Amazon S3) bucket name and key prefix for the 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 permissions 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.</p>
200    /// <p>The only export file format currently supported is <code>Csv</code>.</p>
201    pub fn file_format(mut self, input: crate::types::FileFormat) -> Self {
202        self.inner = self.inner.file_format(input);
203        self
204    }
205    /// <p>The format of the export file.</p>
206    /// <p>The only export file format currently supported is <code>Csv</code>.</p>
207    pub fn set_file_format(mut self, input: ::std::option::Option<crate::types::FileFormat>) -> Self {
208        self.inner = self.inner.set_file_format(input);
209        self
210    }
211    /// <p>The format of the export file.</p>
212    /// <p>The only export file format currently supported is <code>Csv</code>.</p>
213    pub fn get_file_format(&self) -> &::std::option::Option<crate::types::FileFormat> {
214        self.inner.get_file_format()
215    }
216    /// <p>Indicates whether to include recommendations for resources in all member accounts of the organization if your account is the management account of an organization.</p>
217    /// <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>
218    /// <p>Recommendations for member accounts of the organization are not included in the export file if this parameter is omitted.</p>
219    /// <p>Recommendations for member accounts are not included in the export if this parameter, or the account IDs parameter, is omitted.</p>
220    pub fn include_member_accounts(mut self, input: bool) -> Self {
221        self.inner = self.inner.include_member_accounts(input);
222        self
223    }
224    /// <p>Indicates whether to include recommendations for resources in all member accounts of the organization if your account is the management account of an organization.</p>
225    /// <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>
226    /// <p>Recommendations for member accounts of the organization are not included in the export file if this parameter is omitted.</p>
227    /// <p>Recommendations for member accounts are not included in the export if this parameter, or the account IDs parameter, is omitted.</p>
228    pub fn set_include_member_accounts(mut self, input: ::std::option::Option<bool>) -> Self {
229        self.inner = self.inner.set_include_member_accounts(input);
230        self
231    }
232    /// <p>Indicates whether to include recommendations for resources in all member accounts of the organization if your account is the management account of an organization.</p>
233    /// <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>
234    /// <p>Recommendations for member accounts of the organization are not included in the export file if this parameter is omitted.</p>
235    /// <p>Recommendations for member accounts are not included in the export if this parameter, or the account IDs parameter, is omitted.</p>
236    pub fn get_include_member_accounts(&self) -> &::std::option::Option<bool> {
237        self.inner.get_include_member_accounts()
238    }
239    /// <p>An object to specify the preferences for the Amazon EC2 instance recommendations to export.</p>
240    pub fn recommendation_preferences(mut self, input: crate::types::RecommendationPreferences) -> Self {
241        self.inner = self.inner.recommendation_preferences(input);
242        self
243    }
244    /// <p>An object to specify the preferences for the Amazon EC2 instance recommendations to export.</p>
245    pub fn set_recommendation_preferences(mut self, input: ::std::option::Option<crate::types::RecommendationPreferences>) -> Self {
246        self.inner = self.inner.set_recommendation_preferences(input);
247        self
248    }
249    /// <p>An object to specify the preferences for the Amazon EC2 instance recommendations to export.</p>
250    pub fn get_recommendation_preferences(&self) -> &::std::option::Option<crate::types::RecommendationPreferences> {
251        self.inner.get_recommendation_preferences()
252    }
253}