aws_sdk_lexmodelbuilding/operation/start_import/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::start_import::_start_import_output::StartImportOutputBuilder;
3
4pub use crate::operation::start_import::_start_import_input::StartImportInputBuilder;
5
6impl crate::operation::start_import::builders::StartImportInputBuilder {
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_import::StartImportOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::start_import::StartImportError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.start_import();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `StartImport`.
24///
25/// <p>Starts a job to import a resource to Amazon Lex.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct StartImportFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::start_import::builders::StartImportInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::start_import::StartImportOutput,
35        crate::operation::start_import::StartImportError,
36    > for StartImportFluentBuilder
37{
38    fn send(
39        self,
40        config_override: crate::config::Builder,
41    ) -> crate::client::customize::internal::BoxFuture<
42        crate::client::customize::internal::SendResult<
43            crate::operation::start_import::StartImportOutput,
44            crate::operation::start_import::StartImportError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl StartImportFluentBuilder {
51    /// Creates a new `StartImportFluentBuilder`.
52    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53        Self {
54            handle,
55            inner: ::std::default::Default::default(),
56            config_override: ::std::option::Option::None,
57        }
58    }
59    /// Access the StartImport as a reference.
60    pub fn as_input(&self) -> &crate::operation::start_import::builders::StartImportInputBuilder {
61        &self.inner
62    }
63    /// Sends the request and returns the response.
64    ///
65    /// If an error occurs, an `SdkError` will be returned with additional details that
66    /// can be matched against.
67    ///
68    /// By default, any retryable failures will be retried twice. Retry behavior
69    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70    /// set when configuring the client.
71    pub async fn send(
72        self,
73    ) -> ::std::result::Result<
74        crate::operation::start_import::StartImportOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::start_import::StartImportError,
77            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78        >,
79    > {
80        let input = self
81            .inner
82            .build()
83            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84        let runtime_plugins = crate::operation::start_import::StartImport::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::start_import::StartImport::orchestrate(&runtime_plugins, input).await
90    }
91
92    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93    pub fn customize(
94        self,
95    ) -> crate::client::customize::CustomizableOperation<
96        crate::operation::start_import::StartImportOutput,
97        crate::operation::start_import::StartImportError,
98        Self,
99    > {
100        crate::client::customize::CustomizableOperation::new(self)
101    }
102    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103        self.set_config_override(::std::option::Option::Some(config_override.into()));
104        self
105    }
106
107    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108        self.config_override = config_override;
109        self
110    }
111    /// <p>A zip archive in binary format. The archive should contain one file, a JSON file containing the resource to import. The resource should match the type specified in the <code>resourceType</code> field.</p>
112    pub fn payload(mut self, input: ::aws_smithy_types::Blob) -> Self {
113        self.inner = self.inner.payload(input);
114        self
115    }
116    /// <p>A zip archive in binary format. The archive should contain one file, a JSON file containing the resource to import. The resource should match the type specified in the <code>resourceType</code> field.</p>
117    pub fn set_payload(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
118        self.inner = self.inner.set_payload(input);
119        self
120    }
121    /// <p>A zip archive in binary format. The archive should contain one file, a JSON file containing the resource to import. The resource should match the type specified in the <code>resourceType</code> field.</p>
122    pub fn get_payload(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
123        self.inner.get_payload()
124    }
125    /// <p>Specifies the type of resource to export. Each resource also exports any resources that it depends on.</p>
126    /// <ul>
127    /// <li>
128    /// <p>A bot exports dependent intents.</p></li>
129    /// <li>
130    /// <p>An intent exports dependent slot types.</p></li>
131    /// </ul>
132    pub fn resource_type(mut self, input: crate::types::ResourceType) -> Self {
133        self.inner = self.inner.resource_type(input);
134        self
135    }
136    /// <p>Specifies the type of resource to export. Each resource also exports any resources that it depends on.</p>
137    /// <ul>
138    /// <li>
139    /// <p>A bot exports dependent intents.</p></li>
140    /// <li>
141    /// <p>An intent exports dependent slot types.</p></li>
142    /// </ul>
143    pub fn set_resource_type(mut self, input: ::std::option::Option<crate::types::ResourceType>) -> Self {
144        self.inner = self.inner.set_resource_type(input);
145        self
146    }
147    /// <p>Specifies the type of resource to export. Each resource also exports any resources that it depends on.</p>
148    /// <ul>
149    /// <li>
150    /// <p>A bot exports dependent intents.</p></li>
151    /// <li>
152    /// <p>An intent exports dependent slot types.</p></li>
153    /// </ul>
154    pub fn get_resource_type(&self) -> &::std::option::Option<crate::types::ResourceType> {
155        self.inner.get_resource_type()
156    }
157    /// <p>Specifies the action that the <code>StartImport</code> operation should take when there is an existing resource with the same name.</p>
158    /// <ul>
159    /// <li>
160    /// <p>FAIL_ON_CONFLICT - The import operation is stopped on the first conflict between a resource in the import file and an existing resource. The name of the resource causing the conflict is in the <code>failureReason</code> field of the response to the <code>GetImport</code> operation.</p>
161    /// <p>OVERWRITE_LATEST - The import operation proceeds even if there is a conflict with an existing resource. The $LASTEST version of the existing resource is overwritten with the data from the import file.</p></li>
162    /// </ul>
163    pub fn merge_strategy(mut self, input: crate::types::MergeStrategy) -> Self {
164        self.inner = self.inner.merge_strategy(input);
165        self
166    }
167    /// <p>Specifies the action that the <code>StartImport</code> operation should take when there is an existing resource with the same name.</p>
168    /// <ul>
169    /// <li>
170    /// <p>FAIL_ON_CONFLICT - The import operation is stopped on the first conflict between a resource in the import file and an existing resource. The name of the resource causing the conflict is in the <code>failureReason</code> field of the response to the <code>GetImport</code> operation.</p>
171    /// <p>OVERWRITE_LATEST - The import operation proceeds even if there is a conflict with an existing resource. The $LASTEST version of the existing resource is overwritten with the data from the import file.</p></li>
172    /// </ul>
173    pub fn set_merge_strategy(mut self, input: ::std::option::Option<crate::types::MergeStrategy>) -> Self {
174        self.inner = self.inner.set_merge_strategy(input);
175        self
176    }
177    /// <p>Specifies the action that the <code>StartImport</code> operation should take when there is an existing resource with the same name.</p>
178    /// <ul>
179    /// <li>
180    /// <p>FAIL_ON_CONFLICT - The import operation is stopped on the first conflict between a resource in the import file and an existing resource. The name of the resource causing the conflict is in the <code>failureReason</code> field of the response to the <code>GetImport</code> operation.</p>
181    /// <p>OVERWRITE_LATEST - The import operation proceeds even if there is a conflict with an existing resource. The $LASTEST version of the existing resource is overwritten with the data from the import file.</p></li>
182    /// </ul>
183    pub fn get_merge_strategy(&self) -> &::std::option::Option<crate::types::MergeStrategy> {
184        self.inner.get_merge_strategy()
185    }
186    ///
187    /// Appends an item to `tags`.
188    ///
189    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
190    ///
191    /// <p>A list of tags to add to the imported bot. You can only add tags when you import a bot, you can't add tags to an intent or slot type.</p>
192    pub fn tags(mut self, input: crate::types::Tag) -> Self {
193        self.inner = self.inner.tags(input);
194        self
195    }
196    /// <p>A list of tags to add to the imported bot. You can only add tags when you import a bot, you can't add tags to an intent or slot type.</p>
197    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
198        self.inner = self.inner.set_tags(input);
199        self
200    }
201    /// <p>A list of tags to add to the imported bot. You can only add tags when you import a bot, you can't add tags to an intent or slot type.</p>
202    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
203        self.inner.get_tags()
204    }
205}