aws_sdk_mgn/operation/start_test/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::start_test::_start_test_output::StartTestOutputBuilder;
3
4pub use crate::operation::start_test::_start_test_input::StartTestInputBuilder;
5
6impl crate::operation::start_test::builders::StartTestInputBuilder {
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::start_test::StartTestOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::start_test::StartTestError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.start_test();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `StartTest`.
24///
25/// <p>Launches a Test Instance for specific Source Servers. This command starts a LAUNCH job whose initiatedBy property is StartTest and changes the SourceServer.lifeCycle.state property to TESTING.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct StartTestFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::start_test::builders::StartTestInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl crate::client::customize::internal::CustomizableSend<crate::operation::start_test::StartTestOutput, crate::operation::start_test::StartTestError>
33    for StartTestFluentBuilder
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::start_test::StartTestOutput, crate::operation::start_test::StartTestError>,
40    > {
41        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
42    }
43}
44impl StartTestFluentBuilder {
45    /// Creates a new `StartTestFluentBuilder`.
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 StartTest as a reference.
54    pub fn as_input(&self) -> &crate::operation::start_test::builders::StartTestInputBuilder {
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::start_test::StartTestOutput,
69        ::aws_smithy_runtime_api::client::result::SdkError<
70            crate::operation::start_test::StartTestError,
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 = crate::operation::start_test::StartTest::operation_runtime_plugins(
79            self.handle.runtime_plugins.clone(),
80            &self.handle.conf,
81            self.config_override,
82        );
83        crate::operation::start_test::StartTest::orchestrate(&runtime_plugins, input).await
84    }
85
86    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
87    pub fn customize(
88        self,
89    ) -> crate::client::customize::CustomizableOperation<
90        crate::operation::start_test::StartTestOutput,
91        crate::operation::start_test::StartTestError,
92        Self,
93    > {
94        crate::client::customize::CustomizableOperation::new(self)
95    }
96    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
97        self.set_config_override(::std::option::Option::Some(config_override.into()));
98        self
99    }
100
101    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
102        self.config_override = config_override;
103        self
104    }
105    ///
106    /// Appends an item to `sourceServerIDs`.
107    ///
108    /// To override the contents of this collection use [`set_source_server_ids`](Self::set_source_server_ids).
109    ///
110    /// <p>Start Test for Source Server IDs.</p>
111    pub fn source_server_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
112        self.inner = self.inner.source_server_ids(input.into());
113        self
114    }
115    /// <p>Start Test for Source Server IDs.</p>
116    pub fn set_source_server_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
117        self.inner = self.inner.set_source_server_ids(input);
118        self
119    }
120    /// <p>Start Test for Source Server IDs.</p>
121    pub fn get_source_server_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
122        self.inner.get_source_server_ids()
123    }
124    ///
125    /// Adds a key-value pair to `tags`.
126    ///
127    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
128    ///
129    /// <p>Start Test by Tags.</p>
130    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.inner = self.inner.tags(k.into(), v.into());
132        self
133    }
134    /// <p>Start Test by Tags.</p>
135    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
136        self.inner = self.inner.set_tags(input);
137        self
138    }
139    /// <p>Start Test by Tags.</p>
140    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
141        self.inner.get_tags()
142    }
143    /// <p>Start Test for Account ID.</p>
144    pub fn account_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145        self.inner = self.inner.account_id(input.into());
146        self
147    }
148    /// <p>Start Test for Account ID.</p>
149    pub fn set_account_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150        self.inner = self.inner.set_account_id(input);
151        self
152    }
153    /// <p>Start Test for Account ID.</p>
154    pub fn get_account_id(&self) -> &::std::option::Option<::std::string::String> {
155        self.inner.get_account_id()
156    }
157}