aws_sdk_connectcampaigns/types/
_dial_request.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// A dial request for a campaign.
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
6pub struct DialRequest {
7    /// Client provided parameter used for idempotency. Its value must be unique for each request.
8    pub client_token: ::std::string::String,
9    /// The phone number of the customer, in E.164 format.
10    pub phone_number: ::std::string::String,
11    /// Timestamp with no UTC offset or timezone
12    pub expiration_time: ::aws_smithy_types::DateTime,
13    /// A custom key-value pair using an attribute map. The attributes are standard Amazon Connect attributes, and can be accessed in contact flows just like any other contact attributes.
14    pub attributes: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
15}
16impl DialRequest {
17    /// Client provided parameter used for idempotency. Its value must be unique for each request.
18    pub fn client_token(&self) -> &str {
19        use std::ops::Deref;
20        self.client_token.deref()
21    }
22    /// The phone number of the customer, in E.164 format.
23    pub fn phone_number(&self) -> &str {
24        use std::ops::Deref;
25        self.phone_number.deref()
26    }
27    /// Timestamp with no UTC offset or timezone
28    pub fn expiration_time(&self) -> &::aws_smithy_types::DateTime {
29        &self.expiration_time
30    }
31    /// A custom key-value pair using an attribute map. The attributes are standard Amazon Connect attributes, and can be accessed in contact flows just like any other contact attributes.
32    pub fn attributes(&self) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> {
33        &self.attributes
34    }
35}
36impl ::std::fmt::Debug for DialRequest {
37    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
38        let mut formatter = f.debug_struct("DialRequest");
39        formatter.field("client_token", &self.client_token);
40        formatter.field("phone_number", &"*** Sensitive Data Redacted ***");
41        formatter.field("expiration_time", &self.expiration_time);
42        formatter.field("attributes", &"*** Sensitive Data Redacted ***");
43        formatter.finish()
44    }
45}
46impl DialRequest {
47    /// Creates a new builder-style object to manufacture [`DialRequest`](crate::types::DialRequest).
48    pub fn builder() -> crate::types::builders::DialRequestBuilder {
49        crate::types::builders::DialRequestBuilder::default()
50    }
51}
52
53/// A builder for [`DialRequest`](crate::types::DialRequest).
54#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
55#[non_exhaustive]
56pub struct DialRequestBuilder {
57    pub(crate) client_token: ::std::option::Option<::std::string::String>,
58    pub(crate) phone_number: ::std::option::Option<::std::string::String>,
59    pub(crate) expiration_time: ::std::option::Option<::aws_smithy_types::DateTime>,
60    pub(crate) attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
61}
62impl DialRequestBuilder {
63    /// Client provided parameter used for idempotency. Its value must be unique for each request.
64    /// This field is required.
65    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
66        self.client_token = ::std::option::Option::Some(input.into());
67        self
68    }
69    /// Client provided parameter used for idempotency. Its value must be unique for each request.
70    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
71        self.client_token = input;
72        self
73    }
74    /// Client provided parameter used for idempotency. Its value must be unique for each request.
75    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
76        &self.client_token
77    }
78    /// The phone number of the customer, in E.164 format.
79    /// This field is required.
80    pub fn phone_number(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
81        self.phone_number = ::std::option::Option::Some(input.into());
82        self
83    }
84    /// The phone number of the customer, in E.164 format.
85    pub fn set_phone_number(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
86        self.phone_number = input;
87        self
88    }
89    /// The phone number of the customer, in E.164 format.
90    pub fn get_phone_number(&self) -> &::std::option::Option<::std::string::String> {
91        &self.phone_number
92    }
93    /// Timestamp with no UTC offset or timezone
94    /// This field is required.
95    pub fn expiration_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
96        self.expiration_time = ::std::option::Option::Some(input);
97        self
98    }
99    /// Timestamp with no UTC offset or timezone
100    pub fn set_expiration_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
101        self.expiration_time = input;
102        self
103    }
104    /// Timestamp with no UTC offset or timezone
105    pub fn get_expiration_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
106        &self.expiration_time
107    }
108    /// Adds a key-value pair to `attributes`.
109    ///
110    /// To override the contents of this collection use [`set_attributes`](Self::set_attributes).
111    ///
112    /// A custom key-value pair using an attribute map. The attributes are standard Amazon Connect attributes, and can be accessed in contact flows just like any other contact attributes.
113    pub fn attributes(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
114        let mut hash_map = self.attributes.unwrap_or_default();
115        hash_map.insert(k.into(), v.into());
116        self.attributes = ::std::option::Option::Some(hash_map);
117        self
118    }
119    /// A custom key-value pair using an attribute map. The attributes are standard Amazon Connect attributes, and can be accessed in contact flows just like any other contact attributes.
120    pub fn set_attributes(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
121        self.attributes = input;
122        self
123    }
124    /// A custom key-value pair using an attribute map. The attributes are standard Amazon Connect attributes, and can be accessed in contact flows just like any other contact attributes.
125    pub fn get_attributes(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
126        &self.attributes
127    }
128    /// Consumes the builder and constructs a [`DialRequest`](crate::types::DialRequest).
129    /// This method will fail if any of the following fields are not set:
130    /// - [`client_token`](crate::types::builders::DialRequestBuilder::client_token)
131    /// - [`phone_number`](crate::types::builders::DialRequestBuilder::phone_number)
132    /// - [`expiration_time`](crate::types::builders::DialRequestBuilder::expiration_time)
133    /// - [`attributes`](crate::types::builders::DialRequestBuilder::attributes)
134    pub fn build(self) -> ::std::result::Result<crate::types::DialRequest, ::aws_smithy_types::error::operation::BuildError> {
135        ::std::result::Result::Ok(crate::types::DialRequest {
136            client_token: self.client_token.ok_or_else(|| {
137                ::aws_smithy_types::error::operation::BuildError::missing_field(
138                    "client_token",
139                    "client_token was not specified but it is required when building DialRequest",
140                )
141            })?,
142            phone_number: self.phone_number.ok_or_else(|| {
143                ::aws_smithy_types::error::operation::BuildError::missing_field(
144                    "phone_number",
145                    "phone_number was not specified but it is required when building DialRequest",
146                )
147            })?,
148            expiration_time: self.expiration_time.ok_or_else(|| {
149                ::aws_smithy_types::error::operation::BuildError::missing_field(
150                    "expiration_time",
151                    "expiration_time was not specified but it is required when building DialRequest",
152                )
153            })?,
154            attributes: self.attributes.ok_or_else(|| {
155                ::aws_smithy_types::error::operation::BuildError::missing_field(
156                    "attributes",
157                    "attributes was not specified but it is required when building DialRequest",
158                )
159            })?,
160        })
161    }
162}
163impl ::std::fmt::Debug for DialRequestBuilder {
164    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
165        let mut formatter = f.debug_struct("DialRequestBuilder");
166        formatter.field("client_token", &self.client_token);
167        formatter.field("phone_number", &"*** Sensitive Data Redacted ***");
168        formatter.field("expiration_time", &self.expiration_time);
169        formatter.field("attributes", &"*** Sensitive Data Redacted ***");
170        formatter.finish()
171    }
172}