aws_sdk_s3vectors/operation/create_index/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_index::_create_index_output::CreateIndexOutputBuilder;
3
4pub use crate::operation::create_index::_create_index_input::CreateIndexInputBuilder;
5
6impl crate::operation::create_index::builders::CreateIndexInputBuilder {
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::create_index::CreateIndexOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_index::CreateIndexError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_index();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateIndex`.
24///
25/// <note>
26/// <p>Amazon S3 Vectors is in preview release for Amazon S3 and is subject to change.</p>
27/// </note>
28/// <p>Creates a vector index within a vector bucket. To specify the vector bucket, you must use either the vector bucket name or the vector bucket Amazon Resource Name (ARN).</p>
29/// <dl>
30/// <dt>
31/// Permissions
32/// </dt>
33/// <dd>
34/// <p>You must have the <code>s3vectors:CreateIndex</code> permission to use this operation.</p>
35/// </dd>
36/// </dl>
37#[derive(::std::clone::Clone, ::std::fmt::Debug)]
38pub struct CreateIndexFluentBuilder {
39    handle: ::std::sync::Arc<crate::client::Handle>,
40    inner: crate::operation::create_index::builders::CreateIndexInputBuilder,
41    config_override: ::std::option::Option<crate::config::Builder>,
42}
43impl
44    crate::client::customize::internal::CustomizableSend<
45        crate::operation::create_index::CreateIndexOutput,
46        crate::operation::create_index::CreateIndexError,
47    > for CreateIndexFluentBuilder
48{
49    fn send(
50        self,
51        config_override: crate::config::Builder,
52    ) -> crate::client::customize::internal::BoxFuture<
53        crate::client::customize::internal::SendResult<
54            crate::operation::create_index::CreateIndexOutput,
55            crate::operation::create_index::CreateIndexError,
56        >,
57    > {
58        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
59    }
60}
61impl CreateIndexFluentBuilder {
62    /// Creates a new `CreateIndexFluentBuilder`.
63    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
64        Self {
65            handle,
66            inner: ::std::default::Default::default(),
67            config_override: ::std::option::Option::None,
68        }
69    }
70    /// Access the CreateIndex as a reference.
71    pub fn as_input(&self) -> &crate::operation::create_index::builders::CreateIndexInputBuilder {
72        &self.inner
73    }
74    /// Sends the request and returns the response.
75    ///
76    /// If an error occurs, an `SdkError` will be returned with additional details that
77    /// can be matched against.
78    ///
79    /// By default, any retryable failures will be retried twice. Retry behavior
80    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
81    /// set when configuring the client.
82    pub async fn send(
83        self,
84    ) -> ::std::result::Result<
85        crate::operation::create_index::CreateIndexOutput,
86        ::aws_smithy_runtime_api::client::result::SdkError<
87            crate::operation::create_index::CreateIndexError,
88            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
89        >,
90    > {
91        let input = self
92            .inner
93            .build()
94            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
95        let runtime_plugins = crate::operation::create_index::CreateIndex::operation_runtime_plugins(
96            self.handle.runtime_plugins.clone(),
97            &self.handle.conf,
98            self.config_override,
99        );
100        crate::operation::create_index::CreateIndex::orchestrate(&runtime_plugins, input).await
101    }
102
103    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
104    pub fn customize(
105        self,
106    ) -> crate::client::customize::CustomizableOperation<
107        crate::operation::create_index::CreateIndexOutput,
108        crate::operation::create_index::CreateIndexError,
109        Self,
110    > {
111        crate::client::customize::CustomizableOperation::new(self)
112    }
113    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
114        self.set_config_override(::std::option::Option::Some(config_override.into()));
115        self
116    }
117
118    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
119        self.config_override = config_override;
120        self
121    }
122    /// <p>The name of the vector bucket to create the vector index in.</p>
123    pub fn vector_bucket_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
124        self.inner = self.inner.vector_bucket_name(input.into());
125        self
126    }
127    /// <p>The name of the vector bucket to create the vector index in.</p>
128    pub fn set_vector_bucket_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
129        self.inner = self.inner.set_vector_bucket_name(input);
130        self
131    }
132    /// <p>The name of the vector bucket to create the vector index in.</p>
133    pub fn get_vector_bucket_name(&self) -> &::std::option::Option<::std::string::String> {
134        self.inner.get_vector_bucket_name()
135    }
136    /// <p>The Amazon Resource Name (ARN) of the vector bucket to create the vector index in.</p>
137    pub fn vector_bucket_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
138        self.inner = self.inner.vector_bucket_arn(input.into());
139        self
140    }
141    /// <p>The Amazon Resource Name (ARN) of the vector bucket to create the vector index in.</p>
142    pub fn set_vector_bucket_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
143        self.inner = self.inner.set_vector_bucket_arn(input);
144        self
145    }
146    /// <p>The Amazon Resource Name (ARN) of the vector bucket to create the vector index in.</p>
147    pub fn get_vector_bucket_arn(&self) -> &::std::option::Option<::std::string::String> {
148        self.inner.get_vector_bucket_arn()
149    }
150    /// <p>The name of the vector index to create.</p>
151    pub fn index_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
152        self.inner = self.inner.index_name(input.into());
153        self
154    }
155    /// <p>The name of the vector index to create.</p>
156    pub fn set_index_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
157        self.inner = self.inner.set_index_name(input);
158        self
159    }
160    /// <p>The name of the vector index to create.</p>
161    pub fn get_index_name(&self) -> &::std::option::Option<::std::string::String> {
162        self.inner.get_index_name()
163    }
164    /// <p>The data type of the vectors to be inserted into the vector index.</p>
165    pub fn data_type(mut self, input: crate::types::DataType) -> Self {
166        self.inner = self.inner.data_type(input);
167        self
168    }
169    /// <p>The data type of the vectors to be inserted into the vector index.</p>
170    pub fn set_data_type(mut self, input: ::std::option::Option<crate::types::DataType>) -> Self {
171        self.inner = self.inner.set_data_type(input);
172        self
173    }
174    /// <p>The data type of the vectors to be inserted into the vector index.</p>
175    pub fn get_data_type(&self) -> &::std::option::Option<crate::types::DataType> {
176        self.inner.get_data_type()
177    }
178    /// <p>The dimensions of the vectors to be inserted into the vector index.</p>
179    pub fn dimension(mut self, input: i32) -> Self {
180        self.inner = self.inner.dimension(input);
181        self
182    }
183    /// <p>The dimensions of the vectors to be inserted into the vector index.</p>
184    pub fn set_dimension(mut self, input: ::std::option::Option<i32>) -> Self {
185        self.inner = self.inner.set_dimension(input);
186        self
187    }
188    /// <p>The dimensions of the vectors to be inserted into the vector index.</p>
189    pub fn get_dimension(&self) -> &::std::option::Option<i32> {
190        self.inner.get_dimension()
191    }
192    /// <p>The distance metric to be used for similarity search.</p>
193    pub fn distance_metric(mut self, input: crate::types::DistanceMetric) -> Self {
194        self.inner = self.inner.distance_metric(input);
195        self
196    }
197    /// <p>The distance metric to be used for similarity search.</p>
198    pub fn set_distance_metric(mut self, input: ::std::option::Option<crate::types::DistanceMetric>) -> Self {
199        self.inner = self.inner.set_distance_metric(input);
200        self
201    }
202    /// <p>The distance metric to be used for similarity search.</p>
203    pub fn get_distance_metric(&self) -> &::std::option::Option<crate::types::DistanceMetric> {
204        self.inner.get_distance_metric()
205    }
206    /// <p>The metadata configuration for the vector index.</p>
207    pub fn metadata_configuration(mut self, input: crate::types::MetadataConfiguration) -> Self {
208        self.inner = self.inner.metadata_configuration(input);
209        self
210    }
211    /// <p>The metadata configuration for the vector index.</p>
212    pub fn set_metadata_configuration(mut self, input: ::std::option::Option<crate::types::MetadataConfiguration>) -> Self {
213        self.inner = self.inner.set_metadata_configuration(input);
214        self
215    }
216    /// <p>The metadata configuration for the vector index.</p>
217    pub fn get_metadata_configuration(&self) -> &::std::option::Option<crate::types::MetadataConfiguration> {
218        self.inner.get_metadata_configuration()
219    }
220}