aws_sdk_cognitosync/operation/update_records/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_records::_update_records_output::UpdateRecordsOutputBuilder;
3
4pub use crate::operation::update_records::_update_records_input::UpdateRecordsInputBuilder;
5
6impl crate::operation::update_records::builders::UpdateRecordsInputBuilder {
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::update_records::UpdateRecordsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::update_records::UpdateRecordsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.update_records();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `UpdateRecords`.
24///
25/// <p>Posts updates to records and adds and deletes records for a dataset and user.</p>
26/// <p>The sync count in the record patch is your last known sync count for that record. The server will reject an UpdateRecords request with a ResourceConflictException if you try to patch a record with a new value but a stale sync count.</p>
27/// <p>For example, if the sync count on the server is 5 for a key called highScore and you try and submit a new highScore with sync count of 4, the request will be rejected. To obtain the current sync count for a record, call ListRecords. On a successful update of the record, the response returns the new sync count for that record. You should present that sync count the next time you try to update that same record. When the record does not exist, specify the sync count as 0.</p>
28/// <p>This API can be called with temporary user credentials provided by Cognito Identity or with developer credentials.</p>
29#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct UpdateRecordsFluentBuilder {
31    handle: ::std::sync::Arc<crate::client::Handle>,
32    inner: crate::operation::update_records::builders::UpdateRecordsInputBuilder,
33    config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36    crate::client::customize::internal::CustomizableSend<
37        crate::operation::update_records::UpdateRecordsOutput,
38        crate::operation::update_records::UpdateRecordsError,
39    > for UpdateRecordsFluentBuilder
40{
41    fn send(
42        self,
43        config_override: crate::config::Builder,
44    ) -> crate::client::customize::internal::BoxFuture<
45        crate::client::customize::internal::SendResult<
46            crate::operation::update_records::UpdateRecordsOutput,
47            crate::operation::update_records::UpdateRecordsError,
48        >,
49    > {
50        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51    }
52}
53impl UpdateRecordsFluentBuilder {
54    /// Creates a new `UpdateRecordsFluentBuilder`.
55    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
56        Self {
57            handle,
58            inner: ::std::default::Default::default(),
59            config_override: ::std::option::Option::None,
60        }
61    }
62    /// Access the UpdateRecords as a reference.
63    pub fn as_input(&self) -> &crate::operation::update_records::builders::UpdateRecordsInputBuilder {
64        &self.inner
65    }
66    /// Sends the request and returns the response.
67    ///
68    /// If an error occurs, an `SdkError` will be returned with additional details that
69    /// can be matched against.
70    ///
71    /// By default, any retryable failures will be retried twice. Retry behavior
72    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
73    /// set when configuring the client.
74    pub async fn send(
75        self,
76    ) -> ::std::result::Result<
77        crate::operation::update_records::UpdateRecordsOutput,
78        ::aws_smithy_runtime_api::client::result::SdkError<
79            crate::operation::update_records::UpdateRecordsError,
80            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
81        >,
82    > {
83        let input = self
84            .inner
85            .build()
86            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
87        let runtime_plugins = crate::operation::update_records::UpdateRecords::operation_runtime_plugins(
88            self.handle.runtime_plugins.clone(),
89            &self.handle.conf,
90            self.config_override,
91        );
92        crate::operation::update_records::UpdateRecords::orchestrate(&runtime_plugins, input).await
93    }
94
95    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
96    pub fn customize(
97        self,
98    ) -> crate::client::customize::CustomizableOperation<
99        crate::operation::update_records::UpdateRecordsOutput,
100        crate::operation::update_records::UpdateRecordsError,
101        Self,
102    > {
103        crate::client::customize::CustomizableOperation::new(self)
104    }
105    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
106        self.set_config_override(::std::option::Option::Some(config_override.into()));
107        self
108    }
109
110    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
111        self.config_override = config_override;
112        self
113    }
114    /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
115    pub fn identity_pool_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116        self.inner = self.inner.identity_pool_id(input.into());
117        self
118    }
119    /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
120    pub fn set_identity_pool_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
121        self.inner = self.inner.set_identity_pool_id(input);
122        self
123    }
124    /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
125    pub fn get_identity_pool_id(&self) -> &::std::option::Option<::std::string::String> {
126        self.inner.get_identity_pool_id()
127    }
128    /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
129    pub fn identity_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130        self.inner = self.inner.identity_id(input.into());
131        self
132    }
133    /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
134    pub fn set_identity_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135        self.inner = self.inner.set_identity_id(input);
136        self
137    }
138    /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
139    pub fn get_identity_id(&self) -> &::std::option::Option<::std::string::String> {
140        self.inner.get_identity_id()
141    }
142    /// A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
143    pub fn dataset_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
144        self.inner = self.inner.dataset_name(input.into());
145        self
146    }
147    /// A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
148    pub fn set_dataset_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
149        self.inner = self.inner.set_dataset_name(input);
150        self
151    }
152    /// A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
153    pub fn get_dataset_name(&self) -> &::std::option::Option<::std::string::String> {
154        self.inner.get_dataset_name()
155    }
156    /// <p>The unique ID generated for this device by Cognito.</p>
157    pub fn device_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
158        self.inner = self.inner.device_id(input.into());
159        self
160    }
161    /// <p>The unique ID generated for this device by Cognito.</p>
162    pub fn set_device_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
163        self.inner = self.inner.set_device_id(input);
164        self
165    }
166    /// <p>The unique ID generated for this device by Cognito.</p>
167    pub fn get_device_id(&self) -> &::std::option::Option<::std::string::String> {
168        self.inner.get_device_id()
169    }
170    ///
171    /// Appends an item to `RecordPatches`.
172    ///
173    /// To override the contents of this collection use [`set_record_patches`](Self::set_record_patches).
174    ///
175    /// A list of patch operations.
176    pub fn record_patches(mut self, input: crate::types::RecordPatch) -> Self {
177        self.inner = self.inner.record_patches(input);
178        self
179    }
180    /// A list of patch operations.
181    pub fn set_record_patches(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RecordPatch>>) -> Self {
182        self.inner = self.inner.set_record_patches(input);
183        self
184    }
185    /// A list of patch operations.
186    pub fn get_record_patches(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RecordPatch>> {
187        self.inner.get_record_patches()
188    }
189    /// The SyncSessionToken returned by a previous call to ListRecords for this dataset and identity.
190    pub fn sync_session_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
191        self.inner = self.inner.sync_session_token(input.into());
192        self
193    }
194    /// The SyncSessionToken returned by a previous call to ListRecords for this dataset and identity.
195    pub fn set_sync_session_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
196        self.inner = self.inner.set_sync_session_token(input);
197        self
198    }
199    /// The SyncSessionToken returned by a previous call to ListRecords for this dataset and identity.
200    pub fn get_sync_session_token(&self) -> &::std::option::Option<::std::string::String> {
201        self.inner.get_sync_session_token()
202    }
203    /// Intended to supply a device ID that will populate the lastModifiedBy field referenced in other methods. The ClientContext field is not yet implemented.
204    pub fn client_context(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
205        self.inner = self.inner.client_context(input.into());
206        self
207    }
208    /// Intended to supply a device ID that will populate the lastModifiedBy field referenced in other methods. The ClientContext field is not yet implemented.
209    pub fn set_client_context(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
210        self.inner = self.inner.set_client_context(input);
211        self
212    }
213    /// Intended to supply a device ID that will populate the lastModifiedBy field referenced in other methods. The ClientContext field is not yet implemented.
214    pub fn get_client_context(&self) -> &::std::option::Option<::std::string::String> {
215        self.inner.get_client_context()
216    }
217}