aws_sdk_inspector2/operation/enable/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::enable::_enable_output::EnableOutputBuilder;
3
4pub use crate::operation::enable::_enable_input::EnableInputBuilder;
5
6impl crate::operation::enable::builders::EnableInputBuilder {
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::enable::EnableOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::enable::EnableError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.enable();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `Enable`.
24///
25/// <p>Enables Amazon Inspector scans for one or more Amazon Web Services accounts.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct EnableFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::enable::builders::EnableInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl crate::client::customize::internal::CustomizableSend<crate::operation::enable::EnableOutput, crate::operation::enable::EnableError>
33    for EnableFluentBuilder
34{
35    fn send(
36        self,
37        config_override: crate::config::Builder,
38    ) -> crate::client::customize::internal::BoxFuture<
39        crate::client::customize::internal::SendResult<crate::operation::enable::EnableOutput, crate::operation::enable::EnableError>,
40    > {
41        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
42    }
43}
44impl EnableFluentBuilder {
45    /// Creates a new `EnableFluentBuilder`.
46    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
47        Self {
48            handle,
49            inner: ::std::default::Default::default(),
50            config_override: ::std::option::Option::None,
51        }
52    }
53    /// Access the Enable as a reference.
54    pub fn as_input(&self) -> &crate::operation::enable::builders::EnableInputBuilder {
55        &self.inner
56    }
57    /// Sends the request and returns the response.
58    ///
59    /// If an error occurs, an `SdkError` will be returned with additional details that
60    /// can be matched against.
61    ///
62    /// By default, any retryable failures will be retried twice. Retry behavior
63    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
64    /// set when configuring the client.
65    pub async fn send(
66        self,
67    ) -> ::std::result::Result<
68        crate::operation::enable::EnableOutput,
69        ::aws_smithy_runtime_api::client::result::SdkError<
70            crate::operation::enable::EnableError,
71            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
72        >,
73    > {
74        let input = self
75            .inner
76            .build()
77            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
78        let runtime_plugins =
79            crate::operation::enable::Enable::operation_runtime_plugins(self.handle.runtime_plugins.clone(), &self.handle.conf, self.config_override);
80        crate::operation::enable::Enable::orchestrate(&runtime_plugins, input).await
81    }
82
83    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
84    pub fn customize(
85        self,
86    ) -> crate::client::customize::CustomizableOperation<crate::operation::enable::EnableOutput, crate::operation::enable::EnableError, Self> {
87        crate::client::customize::CustomizableOperation::new(self)
88    }
89    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
90        self.set_config_override(::std::option::Option::Some(config_override.into()));
91        self
92    }
93
94    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
95        self.config_override = config_override;
96        self
97    }
98    ///
99    /// Appends an item to `accountIds`.
100    ///
101    /// To override the contents of this collection use [`set_account_ids`](Self::set_account_ids).
102    ///
103    /// <p>A list of account IDs you want to enable Amazon Inspector scans for.</p>
104    pub fn account_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
105        self.inner = self.inner.account_ids(input.into());
106        self
107    }
108    /// <p>A list of account IDs you want to enable Amazon Inspector scans for.</p>
109    pub fn set_account_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
110        self.inner = self.inner.set_account_ids(input);
111        self
112    }
113    /// <p>A list of account IDs you want to enable Amazon Inspector scans for.</p>
114    pub fn get_account_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
115        self.inner.get_account_ids()
116    }
117    ///
118    /// Appends an item to `resourceTypes`.
119    ///
120    /// To override the contents of this collection use [`set_resource_types`](Self::set_resource_types).
121    ///
122    /// <p>The resource scan types you want to enable.</p>
123    pub fn resource_types(mut self, input: crate::types::ResourceScanType) -> Self {
124        self.inner = self.inner.resource_types(input);
125        self
126    }
127    /// <p>The resource scan types you want to enable.</p>
128    pub fn set_resource_types(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ResourceScanType>>) -> Self {
129        self.inner = self.inner.set_resource_types(input);
130        self
131    }
132    /// <p>The resource scan types you want to enable.</p>
133    pub fn get_resource_types(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ResourceScanType>> {
134        self.inner.get_resource_types()
135    }
136    /// <p>The idempotency token for the request.</p>
137    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
138        self.inner = self.inner.client_token(input.into());
139        self
140    }
141    /// <p>The idempotency token for the request.</p>
142    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
143        self.inner = self.inner.set_client_token(input);
144        self
145    }
146    /// <p>The idempotency token for the request.</p>
147    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
148        self.inner.get_client_token()
149    }
150}