aws_sdk_opensearchserverless/operation/create_collection/
_create_collection_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateCollectionInput {
6    /// <p>Name of the collection.</p>
7    pub name: ::std::option::Option<::std::string::String>,
8    /// <p>The type of collection.</p>
9    pub r#type: ::std::option::Option<crate::types::CollectionType>,
10    /// <p>Description of the collection.</p>
11    pub description: ::std::option::Option<::std::string::String>,
12    /// <p>An arbitrary set of tags (key–value pairs) to associate with the OpenSearch Serverless collection.</p>
13    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
14    /// <p>Indicates whether standby replicas should be used for a collection.</p>
15    pub standby_replicas: ::std::option::Option<crate::types::StandbyReplicas>,
16    /// <p>Configuration options for vector search capabilities in the collection.</p>
17    pub vector_options: ::std::option::Option<crate::types::VectorOptions>,
18    /// <p>Unique, case-sensitive identifier to ensure idempotency of the request.</p>
19    pub client_token: ::std::option::Option<::std::string::String>,
20}
21impl CreateCollectionInput {
22    /// <p>Name of the collection.</p>
23    pub fn name(&self) -> ::std::option::Option<&str> {
24        self.name.as_deref()
25    }
26    /// <p>The type of collection.</p>
27    pub fn r#type(&self) -> ::std::option::Option<&crate::types::CollectionType> {
28        self.r#type.as_ref()
29    }
30    /// <p>Description of the collection.</p>
31    pub fn description(&self) -> ::std::option::Option<&str> {
32        self.description.as_deref()
33    }
34    /// <p>An arbitrary set of tags (key–value pairs) to associate with the OpenSearch Serverless collection.</p>
35    ///
36    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
37    pub fn tags(&self) -> &[crate::types::Tag] {
38        self.tags.as_deref().unwrap_or_default()
39    }
40    /// <p>Indicates whether standby replicas should be used for a collection.</p>
41    pub fn standby_replicas(&self) -> ::std::option::Option<&crate::types::StandbyReplicas> {
42        self.standby_replicas.as_ref()
43    }
44    /// <p>Configuration options for vector search capabilities in the collection.</p>
45    pub fn vector_options(&self) -> ::std::option::Option<&crate::types::VectorOptions> {
46        self.vector_options.as_ref()
47    }
48    /// <p>Unique, case-sensitive identifier to ensure idempotency of the request.</p>
49    pub fn client_token(&self) -> ::std::option::Option<&str> {
50        self.client_token.as_deref()
51    }
52}
53impl CreateCollectionInput {
54    /// Creates a new builder-style object to manufacture [`CreateCollectionInput`](crate::operation::create_collection::CreateCollectionInput).
55    pub fn builder() -> crate::operation::create_collection::builders::CreateCollectionInputBuilder {
56        crate::operation::create_collection::builders::CreateCollectionInputBuilder::default()
57    }
58}
59
60/// A builder for [`CreateCollectionInput`](crate::operation::create_collection::CreateCollectionInput).
61#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
62#[non_exhaustive]
63pub struct CreateCollectionInputBuilder {
64    pub(crate) name: ::std::option::Option<::std::string::String>,
65    pub(crate) r#type: ::std::option::Option<crate::types::CollectionType>,
66    pub(crate) description: ::std::option::Option<::std::string::String>,
67    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
68    pub(crate) standby_replicas: ::std::option::Option<crate::types::StandbyReplicas>,
69    pub(crate) vector_options: ::std::option::Option<crate::types::VectorOptions>,
70    pub(crate) client_token: ::std::option::Option<::std::string::String>,
71}
72impl CreateCollectionInputBuilder {
73    /// <p>Name of the collection.</p>
74    /// This field is required.
75    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
76        self.name = ::std::option::Option::Some(input.into());
77        self
78    }
79    /// <p>Name of the collection.</p>
80    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
81        self.name = input;
82        self
83    }
84    /// <p>Name of the collection.</p>
85    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
86        &self.name
87    }
88    /// <p>The type of collection.</p>
89    pub fn r#type(mut self, input: crate::types::CollectionType) -> Self {
90        self.r#type = ::std::option::Option::Some(input);
91        self
92    }
93    /// <p>The type of collection.</p>
94    pub fn set_type(mut self, input: ::std::option::Option<crate::types::CollectionType>) -> Self {
95        self.r#type = input;
96        self
97    }
98    /// <p>The type of collection.</p>
99    pub fn get_type(&self) -> &::std::option::Option<crate::types::CollectionType> {
100        &self.r#type
101    }
102    /// <p>Description of the collection.</p>
103    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
104        self.description = ::std::option::Option::Some(input.into());
105        self
106    }
107    /// <p>Description of the collection.</p>
108    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
109        self.description = input;
110        self
111    }
112    /// <p>Description of the collection.</p>
113    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
114        &self.description
115    }
116    /// Appends an item to `tags`.
117    ///
118    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
119    ///
120    /// <p>An arbitrary set of tags (key–value pairs) to associate with the OpenSearch Serverless collection.</p>
121    pub fn tags(mut self, input: crate::types::Tag) -> Self {
122        let mut v = self.tags.unwrap_or_default();
123        v.push(input);
124        self.tags = ::std::option::Option::Some(v);
125        self
126    }
127    /// <p>An arbitrary set of tags (key–value pairs) to associate with the OpenSearch Serverless collection.</p>
128    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
129        self.tags = input;
130        self
131    }
132    /// <p>An arbitrary set of tags (key–value pairs) to associate with the OpenSearch Serverless collection.</p>
133    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
134        &self.tags
135    }
136    /// <p>Indicates whether standby replicas should be used for a collection.</p>
137    pub fn standby_replicas(mut self, input: crate::types::StandbyReplicas) -> Self {
138        self.standby_replicas = ::std::option::Option::Some(input);
139        self
140    }
141    /// <p>Indicates whether standby replicas should be used for a collection.</p>
142    pub fn set_standby_replicas(mut self, input: ::std::option::Option<crate::types::StandbyReplicas>) -> Self {
143        self.standby_replicas = input;
144        self
145    }
146    /// <p>Indicates whether standby replicas should be used for a collection.</p>
147    pub fn get_standby_replicas(&self) -> &::std::option::Option<crate::types::StandbyReplicas> {
148        &self.standby_replicas
149    }
150    /// <p>Configuration options for vector search capabilities in the collection.</p>
151    pub fn vector_options(mut self, input: crate::types::VectorOptions) -> Self {
152        self.vector_options = ::std::option::Option::Some(input);
153        self
154    }
155    /// <p>Configuration options for vector search capabilities in the collection.</p>
156    pub fn set_vector_options(mut self, input: ::std::option::Option<crate::types::VectorOptions>) -> Self {
157        self.vector_options = input;
158        self
159    }
160    /// <p>Configuration options for vector search capabilities in the collection.</p>
161    pub fn get_vector_options(&self) -> &::std::option::Option<crate::types::VectorOptions> {
162        &self.vector_options
163    }
164    /// <p>Unique, case-sensitive identifier to ensure idempotency of the request.</p>
165    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
166        self.client_token = ::std::option::Option::Some(input.into());
167        self
168    }
169    /// <p>Unique, case-sensitive identifier to ensure idempotency of the request.</p>
170    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
171        self.client_token = input;
172        self
173    }
174    /// <p>Unique, case-sensitive identifier to ensure idempotency of the request.</p>
175    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
176        &self.client_token
177    }
178    /// Consumes the builder and constructs a [`CreateCollectionInput`](crate::operation::create_collection::CreateCollectionInput).
179    pub fn build(
180        self,
181    ) -> ::std::result::Result<crate::operation::create_collection::CreateCollectionInput, ::aws_smithy_types::error::operation::BuildError> {
182        ::std::result::Result::Ok(crate::operation::create_collection::CreateCollectionInput {
183            name: self.name,
184            r#type: self.r#type,
185            description: self.description,
186            tags: self.tags,
187            standby_replicas: self.standby_replicas,
188            vector_options: self.vector_options,
189            client_token: self.client_token,
190        })
191    }
192}