aws_sdk_cognitosync/operation/subscribe_to_dataset/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::subscribe_to_dataset::_subscribe_to_dataset_output::SubscribeToDatasetOutputBuilder;
3
4pub use crate::operation::subscribe_to_dataset::_subscribe_to_dataset_input::SubscribeToDatasetInputBuilder;
5
6impl crate::operation::subscribe_to_dataset::builders::SubscribeToDatasetInputBuilder {
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::subscribe_to_dataset::SubscribeToDatasetOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::subscribe_to_dataset::SubscribeToDatasetError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.subscribe_to_dataset();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `SubscribeToDataset`.
24///
25/// <p>Subscribes to receive notifications when a dataset is modified by another device.</p>
26/// <p>This API can only be called with temporary credentials provided by Cognito Identity. You cannot call this API with developer credentials.</p><examples>
27/// <example>
28/// <name>
29/// SubscribeToDataset
30/// </name>
31/// <description>
32/// The following examples have been edited for readability.
33/// </description>
34/// <request>
35/// POST / HTTP/1.1 CONTENT-TYPE: application/json X-AMZN-REQUESTID: 8b9932b7-201d-4418-a960-0a470e11de9f X-AMZ-TARGET: com.amazonaws.cognito.sync.model.AWSCognitoSyncService.SubscribeToDataset HOST: cognito-sync.us-east-1.amazonaws.com X-AMZ-DATE: 20141004T195350Z X-AMZ-SECURITY-TOKEN:
36/// <securitytoken>
37/// AUTHORIZATION: AWS4-HMAC-SHA256 Credential=
38/// <credential>
39/// , SignedHeaders=content-type;content-length;host;x-amz-date;x-amz-target, Signature=
40/// <signature>
41/// { "Operation": "com.amazonaws.cognito.sync.model#SubscribeToDataset", "Service": "com.amazonaws.cognito.sync.model#AWSCognitoSyncService", "Input": { "IdentityPoolId": "ID_POOL_ID", "IdentityId": "IDENTITY_ID", "DatasetName": "Rufus", "DeviceId": "5cd28fbe-dd83-47ab-9f83-19093a5fb014" } }
42/// </signature>
43/// </credential>
44/// </securitytoken>
45/// </request>
46/// <response>
47/// 1.1 200 OK x-amzn-requestid: 8b9932b7-201d-4418-a960-0a470e11de9f date: Sat, 04 Oct 2014 19:53:50 GMT content-type: application/json content-length: 99 { "Output": { "__type": "com.amazonaws.cognito.sync.model#SubscribeToDatasetResponse" }, "Version": "1.0" }
48/// </response>
49/// </example>
50/// </examples>
51#[derive(::std::clone::Clone, ::std::fmt::Debug)]
52pub struct SubscribeToDatasetFluentBuilder {
53    handle: ::std::sync::Arc<crate::client::Handle>,
54    inner: crate::operation::subscribe_to_dataset::builders::SubscribeToDatasetInputBuilder,
55    config_override: ::std::option::Option<crate::config::Builder>,
56}
57impl
58    crate::client::customize::internal::CustomizableSend<
59        crate::operation::subscribe_to_dataset::SubscribeToDatasetOutput,
60        crate::operation::subscribe_to_dataset::SubscribeToDatasetError,
61    > for SubscribeToDatasetFluentBuilder
62{
63    fn send(
64        self,
65        config_override: crate::config::Builder,
66    ) -> crate::client::customize::internal::BoxFuture<
67        crate::client::customize::internal::SendResult<
68            crate::operation::subscribe_to_dataset::SubscribeToDatasetOutput,
69            crate::operation::subscribe_to_dataset::SubscribeToDatasetError,
70        >,
71    > {
72        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
73    }
74}
75impl SubscribeToDatasetFluentBuilder {
76    /// Creates a new `SubscribeToDatasetFluentBuilder`.
77    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
78        Self {
79            handle,
80            inner: ::std::default::Default::default(),
81            config_override: ::std::option::Option::None,
82        }
83    }
84    /// Access the SubscribeToDataset as a reference.
85    pub fn as_input(&self) -> &crate::operation::subscribe_to_dataset::builders::SubscribeToDatasetInputBuilder {
86        &self.inner
87    }
88    /// Sends the request and returns the response.
89    ///
90    /// If an error occurs, an `SdkError` will be returned with additional details that
91    /// can be matched against.
92    ///
93    /// By default, any retryable failures will be retried twice. Retry behavior
94    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
95    /// set when configuring the client.
96    pub async fn send(
97        self,
98    ) -> ::std::result::Result<
99        crate::operation::subscribe_to_dataset::SubscribeToDatasetOutput,
100        ::aws_smithy_runtime_api::client::result::SdkError<
101            crate::operation::subscribe_to_dataset::SubscribeToDatasetError,
102            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
103        >,
104    > {
105        let input = self
106            .inner
107            .build()
108            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
109        let runtime_plugins = crate::operation::subscribe_to_dataset::SubscribeToDataset::operation_runtime_plugins(
110            self.handle.runtime_plugins.clone(),
111            &self.handle.conf,
112            self.config_override,
113        );
114        crate::operation::subscribe_to_dataset::SubscribeToDataset::orchestrate(&runtime_plugins, input).await
115    }
116
117    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
118    pub fn customize(
119        self,
120    ) -> crate::client::customize::CustomizableOperation<
121        crate::operation::subscribe_to_dataset::SubscribeToDatasetOutput,
122        crate::operation::subscribe_to_dataset::SubscribeToDatasetError,
123        Self,
124    > {
125        crate::client::customize::CustomizableOperation::new(self)
126    }
127    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
128        self.set_config_override(::std::option::Option::Some(config_override.into()));
129        self
130    }
131
132    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
133        self.config_override = config_override;
134        self
135    }
136    /// <p>A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. The ID of the pool to which the identity belongs.</p>
137    pub fn identity_pool_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
138        self.inner = self.inner.identity_pool_id(input.into());
139        self
140    }
141    /// <p>A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. The ID of the pool to which the identity belongs.</p>
142    pub fn set_identity_pool_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
143        self.inner = self.inner.set_identity_pool_id(input);
144        self
145    }
146    /// <p>A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. The ID of the pool to which the identity belongs.</p>
147    pub fn get_identity_pool_id(&self) -> &::std::option::Option<::std::string::String> {
148        self.inner.get_identity_pool_id()
149    }
150    /// <p>Unique ID for this identity.</p>
151    pub fn identity_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
152        self.inner = self.inner.identity_id(input.into());
153        self
154    }
155    /// <p>Unique ID for this identity.</p>
156    pub fn set_identity_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
157        self.inner = self.inner.set_identity_id(input);
158        self
159    }
160    /// <p>Unique ID for this identity.</p>
161    pub fn get_identity_id(&self) -> &::std::option::Option<::std::string::String> {
162        self.inner.get_identity_id()
163    }
164    /// <p>The name of the dataset to subcribe to.</p>
165    pub fn dataset_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
166        self.inner = self.inner.dataset_name(input.into());
167        self
168    }
169    /// <p>The name of the dataset to subcribe to.</p>
170    pub fn set_dataset_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
171        self.inner = self.inner.set_dataset_name(input);
172        self
173    }
174    /// <p>The name of the dataset to subcribe to.</p>
175    pub fn get_dataset_name(&self) -> &::std::option::Option<::std::string::String> {
176        self.inner.get_dataset_name()
177    }
178    /// <p>The unique ID generated for this device by Cognito.</p>
179    pub fn device_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
180        self.inner = self.inner.device_id(input.into());
181        self
182    }
183    /// <p>The unique ID generated for this device by Cognito.</p>
184    pub fn set_device_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
185        self.inner = self.inner.set_device_id(input);
186        self
187    }
188    /// <p>The unique ID generated for this device by Cognito.</p>
189    pub fn get_device_id(&self) -> &::std::option::Option<::std::string::String> {
190        self.inner.get_device_id()
191    }
192}