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>Unique, case-sensitive identifier to ensure idempotency of the request.</p>
17    pub client_token: ::std::option::Option<::std::string::String>,
18}
19impl CreateCollectionInput {
20    /// <p>Name of the collection.</p>
21    pub fn name(&self) -> ::std::option::Option<&str> {
22        self.name.as_deref()
23    }
24    /// <p>The type of collection.</p>
25    pub fn r#type(&self) -> ::std::option::Option<&crate::types::CollectionType> {
26        self.r#type.as_ref()
27    }
28    /// <p>Description of the collection.</p>
29    pub fn description(&self) -> ::std::option::Option<&str> {
30        self.description.as_deref()
31    }
32    /// <p>An arbitrary set of tags (key–value pairs) to associate with the OpenSearch Serverless collection.</p>
33    ///
34    /// 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()`.
35    pub fn tags(&self) -> &[crate::types::Tag] {
36        self.tags.as_deref().unwrap_or_default()
37    }
38    /// <p>Indicates whether standby replicas should be used for a collection.</p>
39    pub fn standby_replicas(&self) -> ::std::option::Option<&crate::types::StandbyReplicas> {
40        self.standby_replicas.as_ref()
41    }
42    /// <p>Unique, case-sensitive identifier to ensure idempotency of the request.</p>
43    pub fn client_token(&self) -> ::std::option::Option<&str> {
44        self.client_token.as_deref()
45    }
46}
47impl CreateCollectionInput {
48    /// Creates a new builder-style object to manufacture [`CreateCollectionInput`](crate::operation::create_collection::CreateCollectionInput).
49    pub fn builder() -> crate::operation::create_collection::builders::CreateCollectionInputBuilder {
50        crate::operation::create_collection::builders::CreateCollectionInputBuilder::default()
51    }
52}
53
54/// A builder for [`CreateCollectionInput`](crate::operation::create_collection::CreateCollectionInput).
55#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
56#[non_exhaustive]
57pub struct CreateCollectionInputBuilder {
58    pub(crate) name: ::std::option::Option<::std::string::String>,
59    pub(crate) r#type: ::std::option::Option<crate::types::CollectionType>,
60    pub(crate) description: ::std::option::Option<::std::string::String>,
61    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
62    pub(crate) standby_replicas: ::std::option::Option<crate::types::StandbyReplicas>,
63    pub(crate) client_token: ::std::option::Option<::std::string::String>,
64}
65impl CreateCollectionInputBuilder {
66    /// <p>Name of the collection.</p>
67    /// This field is required.
68    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
69        self.name = ::std::option::Option::Some(input.into());
70        self
71    }
72    /// <p>Name of the collection.</p>
73    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
74        self.name = input;
75        self
76    }
77    /// <p>Name of the collection.</p>
78    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
79        &self.name
80    }
81    /// <p>The type of collection.</p>
82    pub fn r#type(mut self, input: crate::types::CollectionType) -> Self {
83        self.r#type = ::std::option::Option::Some(input);
84        self
85    }
86    /// <p>The type of collection.</p>
87    pub fn set_type(mut self, input: ::std::option::Option<crate::types::CollectionType>) -> Self {
88        self.r#type = input;
89        self
90    }
91    /// <p>The type of collection.</p>
92    pub fn get_type(&self) -> &::std::option::Option<crate::types::CollectionType> {
93        &self.r#type
94    }
95    /// <p>Description of the collection.</p>
96    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
97        self.description = ::std::option::Option::Some(input.into());
98        self
99    }
100    /// <p>Description of the collection.</p>
101    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
102        self.description = input;
103        self
104    }
105    /// <p>Description of the collection.</p>
106    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
107        &self.description
108    }
109    /// Appends an item to `tags`.
110    ///
111    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
112    ///
113    /// <p>An arbitrary set of tags (key–value pairs) to associate with the OpenSearch Serverless collection.</p>
114    pub fn tags(mut self, input: crate::types::Tag) -> Self {
115        let mut v = self.tags.unwrap_or_default();
116        v.push(input);
117        self.tags = ::std::option::Option::Some(v);
118        self
119    }
120    /// <p>An arbitrary set of tags (key–value pairs) to associate with the OpenSearch Serverless collection.</p>
121    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
122        self.tags = input;
123        self
124    }
125    /// <p>An arbitrary set of tags (key–value pairs) to associate with the OpenSearch Serverless collection.</p>
126    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
127        &self.tags
128    }
129    /// <p>Indicates whether standby replicas should be used for a collection.</p>
130    pub fn standby_replicas(mut self, input: crate::types::StandbyReplicas) -> Self {
131        self.standby_replicas = ::std::option::Option::Some(input);
132        self
133    }
134    /// <p>Indicates whether standby replicas should be used for a collection.</p>
135    pub fn set_standby_replicas(mut self, input: ::std::option::Option<crate::types::StandbyReplicas>) -> Self {
136        self.standby_replicas = input;
137        self
138    }
139    /// <p>Indicates whether standby replicas should be used for a collection.</p>
140    pub fn get_standby_replicas(&self) -> &::std::option::Option<crate::types::StandbyReplicas> {
141        &self.standby_replicas
142    }
143    /// <p>Unique, case-sensitive identifier to ensure idempotency of the request.</p>
144    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145        self.client_token = ::std::option::Option::Some(input.into());
146        self
147    }
148    /// <p>Unique, case-sensitive identifier to ensure idempotency of the request.</p>
149    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150        self.client_token = input;
151        self
152    }
153    /// <p>Unique, case-sensitive identifier to ensure idempotency of the request.</p>
154    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
155        &self.client_token
156    }
157    /// Consumes the builder and constructs a [`CreateCollectionInput`](crate::operation::create_collection::CreateCollectionInput).
158    pub fn build(
159        self,
160    ) -> ::std::result::Result<crate::operation::create_collection::CreateCollectionInput, ::aws_smithy_types::error::operation::BuildError> {
161        ::std::result::Result::Ok(crate::operation::create_collection::CreateCollectionInput {
162            name: self.name,
163            r#type: self.r#type,
164            description: self.description,
165            tags: self.tags,
166            standby_replicas: self.standby_replicas,
167            client_token: self.client_token,
168        })
169    }
170}