1use std::error::Error;
14use std::fmt;
15
16use async_trait::async_trait;
17use rusoto_core::credential::ProvideAwsCredentials;
18use rusoto_core::region;
19use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
20use rusoto_core::{Client, RusotoError};
21
22use rusoto_core::param::{Params, ServiceParams};
23use rusoto_core::proto;
24use rusoto_core::signature::SignedRequest;
25#[allow(unused_imports)]
26use serde::{Deserialize, Serialize};
27use serde_json;
28#[derive(Clone, Debug, Default, PartialEq, Serialize)]
30#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
31pub struct CallInstructionsMessageType {
32 #[serde(rename = "Text")]
34 #[serde(skip_serializing_if = "Option::is_none")]
35 pub text: Option<String>,
36}
37
38#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
40pub struct CloudWatchLogsDestination {
41 #[serde(rename = "IamRoleArn")]
43 #[serde(skip_serializing_if = "Option::is_none")]
44 pub iam_role_arn: Option<String>,
45 #[serde(rename = "LogGroupArn")]
47 #[serde(skip_serializing_if = "Option::is_none")]
48 pub log_group_arn: Option<String>,
49}
50
51#[derive(Clone, Debug, Default, PartialEq, Serialize)]
53#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
54pub struct CreateConfigurationSetEventDestinationRequest {
55 #[serde(rename = "ConfigurationSetName")]
57 pub configuration_set_name: String,
58 #[serde(rename = "EventDestination")]
59 #[serde(skip_serializing_if = "Option::is_none")]
60 pub event_destination: Option<EventDestinationDefinition>,
61 #[serde(rename = "EventDestinationName")]
63 #[serde(skip_serializing_if = "Option::is_none")]
64 pub event_destination_name: Option<String>,
65}
66
67#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
69#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
70pub struct CreateConfigurationSetEventDestinationResponse {}
71
72#[derive(Clone, Debug, Default, PartialEq, Serialize)]
74#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
75pub struct CreateConfigurationSetRequest {
76 #[serde(rename = "ConfigurationSetName")]
78 #[serde(skip_serializing_if = "Option::is_none")]
79 pub configuration_set_name: Option<String>,
80}
81
82#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
84#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
85pub struct CreateConfigurationSetResponse {}
86
87#[derive(Clone, Debug, Default, PartialEq, Serialize)]
88#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
89pub struct DeleteConfigurationSetEventDestinationRequest {
90 #[serde(rename = "ConfigurationSetName")]
92 pub configuration_set_name: String,
93 #[serde(rename = "EventDestinationName")]
95 pub event_destination_name: String,
96}
97
98#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
100#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
101pub struct DeleteConfigurationSetEventDestinationResponse {}
102
103#[derive(Clone, Debug, Default, PartialEq, Serialize)]
104#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
105pub struct DeleteConfigurationSetRequest {
106 #[serde(rename = "ConfigurationSetName")]
108 pub configuration_set_name: String,
109}
110
111#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
113#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
114pub struct DeleteConfigurationSetResponse {}
115
116#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
118#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
119pub struct EventDestination {
120 #[serde(rename = "CloudWatchLogsDestination")]
121 #[serde(skip_serializing_if = "Option::is_none")]
122 pub cloud_watch_logs_destination: Option<CloudWatchLogsDestination>,
123 #[serde(rename = "Enabled")]
125 #[serde(skip_serializing_if = "Option::is_none")]
126 pub enabled: Option<bool>,
127 #[serde(rename = "KinesisFirehoseDestination")]
128 #[serde(skip_serializing_if = "Option::is_none")]
129 pub kinesis_firehose_destination: Option<KinesisFirehoseDestination>,
130 #[serde(rename = "MatchingEventTypes")]
131 #[serde(skip_serializing_if = "Option::is_none")]
132 pub matching_event_types: Option<Vec<String>>,
133 #[serde(rename = "Name")]
135 #[serde(skip_serializing_if = "Option::is_none")]
136 pub name: Option<String>,
137 #[serde(rename = "SnsDestination")]
138 #[serde(skip_serializing_if = "Option::is_none")]
139 pub sns_destination: Option<SnsDestination>,
140}
141
142#[derive(Clone, Debug, Default, PartialEq, Serialize)]
144#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
145pub struct EventDestinationDefinition {
146 #[serde(rename = "CloudWatchLogsDestination")]
147 #[serde(skip_serializing_if = "Option::is_none")]
148 pub cloud_watch_logs_destination: Option<CloudWatchLogsDestination>,
149 #[serde(rename = "Enabled")]
151 #[serde(skip_serializing_if = "Option::is_none")]
152 pub enabled: Option<bool>,
153 #[serde(rename = "KinesisFirehoseDestination")]
154 #[serde(skip_serializing_if = "Option::is_none")]
155 pub kinesis_firehose_destination: Option<KinesisFirehoseDestination>,
156 #[serde(rename = "MatchingEventTypes")]
157 #[serde(skip_serializing_if = "Option::is_none")]
158 pub matching_event_types: Option<Vec<String>>,
159 #[serde(rename = "SnsDestination")]
160 #[serde(skip_serializing_if = "Option::is_none")]
161 pub sns_destination: Option<SnsDestination>,
162}
163
164#[derive(Clone, Debug, Default, PartialEq, Serialize)]
165#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
166pub struct GetConfigurationSetEventDestinationsRequest {
167 #[serde(rename = "ConfigurationSetName")]
169 pub configuration_set_name: String,
170}
171
172#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
174#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
175pub struct GetConfigurationSetEventDestinationsResponse {
176 #[serde(rename = "EventDestinations")]
177 #[serde(skip_serializing_if = "Option::is_none")]
178 pub event_destinations: Option<Vec<EventDestination>>,
179}
180
181#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
183pub struct KinesisFirehoseDestination {
184 #[serde(rename = "DeliveryStreamArn")]
186 #[serde(skip_serializing_if = "Option::is_none")]
187 pub delivery_stream_arn: Option<String>,
188 #[serde(rename = "IamRoleArn")]
190 #[serde(skip_serializing_if = "Option::is_none")]
191 pub iam_role_arn: Option<String>,
192}
193
194#[derive(Clone, Debug, Default, PartialEq, Serialize)]
195#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
196pub struct ListConfigurationSetsRequest {
197 #[serde(rename = "NextToken")]
199 #[serde(skip_serializing_if = "Option::is_none")]
200 pub next_token: Option<String>,
201 #[serde(rename = "PageSize")]
203 #[serde(skip_serializing_if = "Option::is_none")]
204 pub page_size: Option<String>,
205}
206
207#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
209#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
210pub struct ListConfigurationSetsResponse {
211 #[serde(rename = "ConfigurationSets")]
213 #[serde(skip_serializing_if = "Option::is_none")]
214 pub configuration_sets: Option<Vec<String>>,
215 #[serde(rename = "NextToken")]
217 #[serde(skip_serializing_if = "Option::is_none")]
218 pub next_token: Option<String>,
219}
220
221#[derive(Clone, Debug, Default, PartialEq, Serialize)]
223#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
224pub struct PlainTextMessageType {
225 #[serde(rename = "LanguageCode")]
227 #[serde(skip_serializing_if = "Option::is_none")]
228 pub language_code: Option<String>,
229 #[serde(rename = "Text")]
231 #[serde(skip_serializing_if = "Option::is_none")]
232 pub text: Option<String>,
233 #[serde(rename = "VoiceId")]
235 #[serde(skip_serializing_if = "Option::is_none")]
236 pub voice_id: Option<String>,
237}
238
239#[derive(Clone, Debug, Default, PartialEq, Serialize)]
241#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
242pub struct SSMLMessageType {
243 #[serde(rename = "LanguageCode")]
245 #[serde(skip_serializing_if = "Option::is_none")]
246 pub language_code: Option<String>,
247 #[serde(rename = "Text")]
249 #[serde(skip_serializing_if = "Option::is_none")]
250 pub text: Option<String>,
251 #[serde(rename = "VoiceId")]
253 #[serde(skip_serializing_if = "Option::is_none")]
254 pub voice_id: Option<String>,
255}
256
257#[derive(Clone, Debug, Default, PartialEq, Serialize)]
259#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
260pub struct SendVoiceMessageRequest {
261 #[serde(rename = "CallerId")]
263 #[serde(skip_serializing_if = "Option::is_none")]
264 pub caller_id: Option<String>,
265 #[serde(rename = "ConfigurationSetName")]
267 #[serde(skip_serializing_if = "Option::is_none")]
268 pub configuration_set_name: Option<String>,
269 #[serde(rename = "Content")]
270 #[serde(skip_serializing_if = "Option::is_none")]
271 pub content: Option<VoiceMessageContent>,
272 #[serde(rename = "DestinationPhoneNumber")]
274 #[serde(skip_serializing_if = "Option::is_none")]
275 pub destination_phone_number: Option<String>,
276 #[serde(rename = "OriginationPhoneNumber")]
278 #[serde(skip_serializing_if = "Option::is_none")]
279 pub origination_phone_number: Option<String>,
280}
281
282#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
284#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
285pub struct SendVoiceMessageResponse {
286 #[serde(rename = "MessageId")]
288 #[serde(skip_serializing_if = "Option::is_none")]
289 pub message_id: Option<String>,
290}
291
292#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
294pub struct SnsDestination {
295 #[serde(rename = "TopicArn")]
297 #[serde(skip_serializing_if = "Option::is_none")]
298 pub topic_arn: Option<String>,
299}
300
301#[derive(Clone, Debug, Default, PartialEq, Serialize)]
303#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
304pub struct UpdateConfigurationSetEventDestinationRequest {
305 #[serde(rename = "ConfigurationSetName")]
307 pub configuration_set_name: String,
308 #[serde(rename = "EventDestination")]
309 #[serde(skip_serializing_if = "Option::is_none")]
310 pub event_destination: Option<EventDestinationDefinition>,
311 #[serde(rename = "EventDestinationName")]
313 pub event_destination_name: String,
314}
315
316#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
318#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
319pub struct UpdateConfigurationSetEventDestinationResponse {}
320
321#[derive(Clone, Debug, Default, PartialEq, Serialize)]
323#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
324pub struct VoiceMessageContent {
325 #[serde(rename = "CallInstructionsMessage")]
326 #[serde(skip_serializing_if = "Option::is_none")]
327 pub call_instructions_message: Option<CallInstructionsMessageType>,
328 #[serde(rename = "PlainTextMessage")]
329 #[serde(skip_serializing_if = "Option::is_none")]
330 pub plain_text_message: Option<PlainTextMessageType>,
331 #[serde(rename = "SSMLMessage")]
332 #[serde(skip_serializing_if = "Option::is_none")]
333 pub ssml_message: Option<SSMLMessageType>,
334}
335
336#[derive(Debug, PartialEq)]
338pub enum CreateConfigurationSetError {
339 AlreadyExists(String),
341 BadRequest(String),
343 InternalServiceError(String),
345 LimitExceeded(String),
347 TooManyRequests(String),
349}
350
351impl CreateConfigurationSetError {
352 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<CreateConfigurationSetError> {
353 if let Some(err) = proto::json::Error::parse_rest(&res) {
354 match err.typ.as_str() {
355 "AlreadyExistsException" => {
356 return RusotoError::Service(CreateConfigurationSetError::AlreadyExists(
357 err.msg,
358 ))
359 }
360 "BadRequestException" => {
361 return RusotoError::Service(CreateConfigurationSetError::BadRequest(err.msg))
362 }
363 "InternalServiceErrorException" => {
364 return RusotoError::Service(CreateConfigurationSetError::InternalServiceError(
365 err.msg,
366 ))
367 }
368 "LimitExceededException" => {
369 return RusotoError::Service(CreateConfigurationSetError::LimitExceeded(
370 err.msg,
371 ))
372 }
373 "TooManyRequestsException" => {
374 return RusotoError::Service(CreateConfigurationSetError::TooManyRequests(
375 err.msg,
376 ))
377 }
378 "ValidationException" => return RusotoError::Validation(err.msg),
379 _ => {}
380 }
381 }
382 RusotoError::Unknown(res)
383 }
384}
385impl fmt::Display for CreateConfigurationSetError {
386 #[allow(unused_variables)]
387 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
388 match *self {
389 CreateConfigurationSetError::AlreadyExists(ref cause) => write!(f, "{}", cause),
390 CreateConfigurationSetError::BadRequest(ref cause) => write!(f, "{}", cause),
391 CreateConfigurationSetError::InternalServiceError(ref cause) => write!(f, "{}", cause),
392 CreateConfigurationSetError::LimitExceeded(ref cause) => write!(f, "{}", cause),
393 CreateConfigurationSetError::TooManyRequests(ref cause) => write!(f, "{}", cause),
394 }
395 }
396}
397impl Error for CreateConfigurationSetError {}
398#[derive(Debug, PartialEq)]
400pub enum CreateConfigurationSetEventDestinationError {
401 AlreadyExists(String),
403 BadRequest(String),
405 InternalServiceError(String),
407 LimitExceeded(String),
409 NotFound(String),
411 TooManyRequests(String),
413}
414
415impl CreateConfigurationSetEventDestinationError {
416 pub fn from_response(
417 res: BufferedHttpResponse,
418 ) -> RusotoError<CreateConfigurationSetEventDestinationError> {
419 if let Some(err) = proto::json::Error::parse_rest(&res) {
420 match err.typ.as_str() {
421 "AlreadyExistsException" => {
422 return RusotoError::Service(
423 CreateConfigurationSetEventDestinationError::AlreadyExists(err.msg),
424 )
425 }
426 "BadRequestException" => {
427 return RusotoError::Service(
428 CreateConfigurationSetEventDestinationError::BadRequest(err.msg),
429 )
430 }
431 "InternalServiceErrorException" => {
432 return RusotoError::Service(
433 CreateConfigurationSetEventDestinationError::InternalServiceError(err.msg),
434 )
435 }
436 "LimitExceededException" => {
437 return RusotoError::Service(
438 CreateConfigurationSetEventDestinationError::LimitExceeded(err.msg),
439 )
440 }
441 "NotFoundException" => {
442 return RusotoError::Service(
443 CreateConfigurationSetEventDestinationError::NotFound(err.msg),
444 )
445 }
446 "TooManyRequestsException" => {
447 return RusotoError::Service(
448 CreateConfigurationSetEventDestinationError::TooManyRequests(err.msg),
449 )
450 }
451 "ValidationException" => return RusotoError::Validation(err.msg),
452 _ => {}
453 }
454 }
455 RusotoError::Unknown(res)
456 }
457}
458impl fmt::Display for CreateConfigurationSetEventDestinationError {
459 #[allow(unused_variables)]
460 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
461 match *self {
462 CreateConfigurationSetEventDestinationError::AlreadyExists(ref cause) => {
463 write!(f, "{}", cause)
464 }
465 CreateConfigurationSetEventDestinationError::BadRequest(ref cause) => {
466 write!(f, "{}", cause)
467 }
468 CreateConfigurationSetEventDestinationError::InternalServiceError(ref cause) => {
469 write!(f, "{}", cause)
470 }
471 CreateConfigurationSetEventDestinationError::LimitExceeded(ref cause) => {
472 write!(f, "{}", cause)
473 }
474 CreateConfigurationSetEventDestinationError::NotFound(ref cause) => {
475 write!(f, "{}", cause)
476 }
477 CreateConfigurationSetEventDestinationError::TooManyRequests(ref cause) => {
478 write!(f, "{}", cause)
479 }
480 }
481 }
482}
483impl Error for CreateConfigurationSetEventDestinationError {}
484#[derive(Debug, PartialEq)]
486pub enum DeleteConfigurationSetError {
487 BadRequest(String),
489 InternalServiceError(String),
491 NotFound(String),
493 TooManyRequests(String),
495}
496
497impl DeleteConfigurationSetError {
498 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteConfigurationSetError> {
499 if let Some(err) = proto::json::Error::parse_rest(&res) {
500 match err.typ.as_str() {
501 "BadRequestException" => {
502 return RusotoError::Service(DeleteConfigurationSetError::BadRequest(err.msg))
503 }
504 "InternalServiceErrorException" => {
505 return RusotoError::Service(DeleteConfigurationSetError::InternalServiceError(
506 err.msg,
507 ))
508 }
509 "NotFoundException" => {
510 return RusotoError::Service(DeleteConfigurationSetError::NotFound(err.msg))
511 }
512 "TooManyRequestsException" => {
513 return RusotoError::Service(DeleteConfigurationSetError::TooManyRequests(
514 err.msg,
515 ))
516 }
517 "ValidationException" => return RusotoError::Validation(err.msg),
518 _ => {}
519 }
520 }
521 RusotoError::Unknown(res)
522 }
523}
524impl fmt::Display for DeleteConfigurationSetError {
525 #[allow(unused_variables)]
526 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
527 match *self {
528 DeleteConfigurationSetError::BadRequest(ref cause) => write!(f, "{}", cause),
529 DeleteConfigurationSetError::InternalServiceError(ref cause) => write!(f, "{}", cause),
530 DeleteConfigurationSetError::NotFound(ref cause) => write!(f, "{}", cause),
531 DeleteConfigurationSetError::TooManyRequests(ref cause) => write!(f, "{}", cause),
532 }
533 }
534}
535impl Error for DeleteConfigurationSetError {}
536#[derive(Debug, PartialEq)]
538pub enum DeleteConfigurationSetEventDestinationError {
539 BadRequest(String),
541 InternalServiceError(String),
543 NotFound(String),
545 TooManyRequests(String),
547}
548
549impl DeleteConfigurationSetEventDestinationError {
550 pub fn from_response(
551 res: BufferedHttpResponse,
552 ) -> RusotoError<DeleteConfigurationSetEventDestinationError> {
553 if let Some(err) = proto::json::Error::parse_rest(&res) {
554 match err.typ.as_str() {
555 "BadRequestException" => {
556 return RusotoError::Service(
557 DeleteConfigurationSetEventDestinationError::BadRequest(err.msg),
558 )
559 }
560 "InternalServiceErrorException" => {
561 return RusotoError::Service(
562 DeleteConfigurationSetEventDestinationError::InternalServiceError(err.msg),
563 )
564 }
565 "NotFoundException" => {
566 return RusotoError::Service(
567 DeleteConfigurationSetEventDestinationError::NotFound(err.msg),
568 )
569 }
570 "TooManyRequestsException" => {
571 return RusotoError::Service(
572 DeleteConfigurationSetEventDestinationError::TooManyRequests(err.msg),
573 )
574 }
575 "ValidationException" => return RusotoError::Validation(err.msg),
576 _ => {}
577 }
578 }
579 RusotoError::Unknown(res)
580 }
581}
582impl fmt::Display for DeleteConfigurationSetEventDestinationError {
583 #[allow(unused_variables)]
584 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
585 match *self {
586 DeleteConfigurationSetEventDestinationError::BadRequest(ref cause) => {
587 write!(f, "{}", cause)
588 }
589 DeleteConfigurationSetEventDestinationError::InternalServiceError(ref cause) => {
590 write!(f, "{}", cause)
591 }
592 DeleteConfigurationSetEventDestinationError::NotFound(ref cause) => {
593 write!(f, "{}", cause)
594 }
595 DeleteConfigurationSetEventDestinationError::TooManyRequests(ref cause) => {
596 write!(f, "{}", cause)
597 }
598 }
599 }
600}
601impl Error for DeleteConfigurationSetEventDestinationError {}
602#[derive(Debug, PartialEq)]
604pub enum GetConfigurationSetEventDestinationsError {
605 BadRequest(String),
607 InternalServiceError(String),
609 NotFound(String),
611 TooManyRequests(String),
613}
614
615impl GetConfigurationSetEventDestinationsError {
616 pub fn from_response(
617 res: BufferedHttpResponse,
618 ) -> RusotoError<GetConfigurationSetEventDestinationsError> {
619 if let Some(err) = proto::json::Error::parse_rest(&res) {
620 match err.typ.as_str() {
621 "BadRequestException" => {
622 return RusotoError::Service(
623 GetConfigurationSetEventDestinationsError::BadRequest(err.msg),
624 )
625 }
626 "InternalServiceErrorException" => {
627 return RusotoError::Service(
628 GetConfigurationSetEventDestinationsError::InternalServiceError(err.msg),
629 )
630 }
631 "NotFoundException" => {
632 return RusotoError::Service(
633 GetConfigurationSetEventDestinationsError::NotFound(err.msg),
634 )
635 }
636 "TooManyRequestsException" => {
637 return RusotoError::Service(
638 GetConfigurationSetEventDestinationsError::TooManyRequests(err.msg),
639 )
640 }
641 "ValidationException" => return RusotoError::Validation(err.msg),
642 _ => {}
643 }
644 }
645 RusotoError::Unknown(res)
646 }
647}
648impl fmt::Display for GetConfigurationSetEventDestinationsError {
649 #[allow(unused_variables)]
650 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
651 match *self {
652 GetConfigurationSetEventDestinationsError::BadRequest(ref cause) => {
653 write!(f, "{}", cause)
654 }
655 GetConfigurationSetEventDestinationsError::InternalServiceError(ref cause) => {
656 write!(f, "{}", cause)
657 }
658 GetConfigurationSetEventDestinationsError::NotFound(ref cause) => {
659 write!(f, "{}", cause)
660 }
661 GetConfigurationSetEventDestinationsError::TooManyRequests(ref cause) => {
662 write!(f, "{}", cause)
663 }
664 }
665 }
666}
667impl Error for GetConfigurationSetEventDestinationsError {}
668#[derive(Debug, PartialEq)]
670pub enum ListConfigurationSetsError {
671 BadRequest(String),
673 InternalServiceError(String),
675 TooManyRequests(String),
677}
678
679impl ListConfigurationSetsError {
680 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListConfigurationSetsError> {
681 if let Some(err) = proto::json::Error::parse_rest(&res) {
682 match err.typ.as_str() {
683 "BadRequestException" => {
684 return RusotoError::Service(ListConfigurationSetsError::BadRequest(err.msg))
685 }
686 "InternalServiceErrorException" => {
687 return RusotoError::Service(ListConfigurationSetsError::InternalServiceError(
688 err.msg,
689 ))
690 }
691 "TooManyRequestsException" => {
692 return RusotoError::Service(ListConfigurationSetsError::TooManyRequests(
693 err.msg,
694 ))
695 }
696 "ValidationException" => return RusotoError::Validation(err.msg),
697 _ => {}
698 }
699 }
700 RusotoError::Unknown(res)
701 }
702}
703impl fmt::Display for ListConfigurationSetsError {
704 #[allow(unused_variables)]
705 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
706 match *self {
707 ListConfigurationSetsError::BadRequest(ref cause) => write!(f, "{}", cause),
708 ListConfigurationSetsError::InternalServiceError(ref cause) => write!(f, "{}", cause),
709 ListConfigurationSetsError::TooManyRequests(ref cause) => write!(f, "{}", cause),
710 }
711 }
712}
713impl Error for ListConfigurationSetsError {}
714#[derive(Debug, PartialEq)]
716pub enum SendVoiceMessageError {
717 BadRequest(String),
719 InternalServiceError(String),
721 TooManyRequests(String),
723}
724
725impl SendVoiceMessageError {
726 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<SendVoiceMessageError> {
727 if let Some(err) = proto::json::Error::parse_rest(&res) {
728 match err.typ.as_str() {
729 "BadRequestException" => {
730 return RusotoError::Service(SendVoiceMessageError::BadRequest(err.msg))
731 }
732 "InternalServiceErrorException" => {
733 return RusotoError::Service(SendVoiceMessageError::InternalServiceError(
734 err.msg,
735 ))
736 }
737 "TooManyRequestsException" => {
738 return RusotoError::Service(SendVoiceMessageError::TooManyRequests(err.msg))
739 }
740 "ValidationException" => return RusotoError::Validation(err.msg),
741 _ => {}
742 }
743 }
744 RusotoError::Unknown(res)
745 }
746}
747impl fmt::Display for SendVoiceMessageError {
748 #[allow(unused_variables)]
749 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
750 match *self {
751 SendVoiceMessageError::BadRequest(ref cause) => write!(f, "{}", cause),
752 SendVoiceMessageError::InternalServiceError(ref cause) => write!(f, "{}", cause),
753 SendVoiceMessageError::TooManyRequests(ref cause) => write!(f, "{}", cause),
754 }
755 }
756}
757impl Error for SendVoiceMessageError {}
758#[derive(Debug, PartialEq)]
760pub enum UpdateConfigurationSetEventDestinationError {
761 BadRequest(String),
763 InternalServiceError(String),
765 NotFound(String),
767 TooManyRequests(String),
769}
770
771impl UpdateConfigurationSetEventDestinationError {
772 pub fn from_response(
773 res: BufferedHttpResponse,
774 ) -> RusotoError<UpdateConfigurationSetEventDestinationError> {
775 if let Some(err) = proto::json::Error::parse_rest(&res) {
776 match err.typ.as_str() {
777 "BadRequestException" => {
778 return RusotoError::Service(
779 UpdateConfigurationSetEventDestinationError::BadRequest(err.msg),
780 )
781 }
782 "InternalServiceErrorException" => {
783 return RusotoError::Service(
784 UpdateConfigurationSetEventDestinationError::InternalServiceError(err.msg),
785 )
786 }
787 "NotFoundException" => {
788 return RusotoError::Service(
789 UpdateConfigurationSetEventDestinationError::NotFound(err.msg),
790 )
791 }
792 "TooManyRequestsException" => {
793 return RusotoError::Service(
794 UpdateConfigurationSetEventDestinationError::TooManyRequests(err.msg),
795 )
796 }
797 "ValidationException" => return RusotoError::Validation(err.msg),
798 _ => {}
799 }
800 }
801 RusotoError::Unknown(res)
802 }
803}
804impl fmt::Display for UpdateConfigurationSetEventDestinationError {
805 #[allow(unused_variables)]
806 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
807 match *self {
808 UpdateConfigurationSetEventDestinationError::BadRequest(ref cause) => {
809 write!(f, "{}", cause)
810 }
811 UpdateConfigurationSetEventDestinationError::InternalServiceError(ref cause) => {
812 write!(f, "{}", cause)
813 }
814 UpdateConfigurationSetEventDestinationError::NotFound(ref cause) => {
815 write!(f, "{}", cause)
816 }
817 UpdateConfigurationSetEventDestinationError::TooManyRequests(ref cause) => {
818 write!(f, "{}", cause)
819 }
820 }
821 }
822}
823impl Error for UpdateConfigurationSetEventDestinationError {}
824#[async_trait]
826pub trait SmsVoice {
827 async fn create_configuration_set(
829 &self,
830 input: CreateConfigurationSetRequest,
831 ) -> Result<CreateConfigurationSetResponse, RusotoError<CreateConfigurationSetError>>;
832
833 async fn create_configuration_set_event_destination(
835 &self,
836 input: CreateConfigurationSetEventDestinationRequest,
837 ) -> Result<
838 CreateConfigurationSetEventDestinationResponse,
839 RusotoError<CreateConfigurationSetEventDestinationError>,
840 >;
841
842 async fn delete_configuration_set(
844 &self,
845 input: DeleteConfigurationSetRequest,
846 ) -> Result<DeleteConfigurationSetResponse, RusotoError<DeleteConfigurationSetError>>;
847
848 async fn delete_configuration_set_event_destination(
850 &self,
851 input: DeleteConfigurationSetEventDestinationRequest,
852 ) -> Result<
853 DeleteConfigurationSetEventDestinationResponse,
854 RusotoError<DeleteConfigurationSetEventDestinationError>,
855 >;
856
857 async fn get_configuration_set_event_destinations(
859 &self,
860 input: GetConfigurationSetEventDestinationsRequest,
861 ) -> Result<
862 GetConfigurationSetEventDestinationsResponse,
863 RusotoError<GetConfigurationSetEventDestinationsError>,
864 >;
865
866 async fn list_configuration_sets(
868 &self,
869 input: ListConfigurationSetsRequest,
870 ) -> Result<ListConfigurationSetsResponse, RusotoError<ListConfigurationSetsError>>;
871
872 async fn send_voice_message(
874 &self,
875 input: SendVoiceMessageRequest,
876 ) -> Result<SendVoiceMessageResponse, RusotoError<SendVoiceMessageError>>;
877
878 async fn update_configuration_set_event_destination(
880 &self,
881 input: UpdateConfigurationSetEventDestinationRequest,
882 ) -> Result<
883 UpdateConfigurationSetEventDestinationResponse,
884 RusotoError<UpdateConfigurationSetEventDestinationError>,
885 >;
886}
887#[derive(Clone)]
889pub struct SmsVoiceClient {
890 client: Client,
891 region: region::Region,
892}
893
894impl SmsVoiceClient {
895 pub fn new(region: region::Region) -> SmsVoiceClient {
899 SmsVoiceClient {
900 client: Client::shared(),
901 region,
902 }
903 }
904
905 pub fn new_with<P, D>(
906 request_dispatcher: D,
907 credentials_provider: P,
908 region: region::Region,
909 ) -> SmsVoiceClient
910 where
911 P: ProvideAwsCredentials + Send + Sync + 'static,
912 D: DispatchSignedRequest + Send + Sync + 'static,
913 {
914 SmsVoiceClient {
915 client: Client::new_with(credentials_provider, request_dispatcher),
916 region,
917 }
918 }
919
920 pub fn new_with_client(client: Client, region: region::Region) -> SmsVoiceClient {
921 SmsVoiceClient { client, region }
922 }
923}
924
925#[async_trait]
926impl SmsVoice for SmsVoiceClient {
927 #[allow(unused_mut)]
929 async fn create_configuration_set(
930 &self,
931 input: CreateConfigurationSetRequest,
932 ) -> Result<CreateConfigurationSetResponse, RusotoError<CreateConfigurationSetError>> {
933 let request_uri = "/v1/sms-voice/configuration-sets";
934
935 let mut request = SignedRequest::new("POST", "sms-voice", &self.region, &request_uri);
936 request.set_content_type("application/x-amz-json-1.1".to_owned());
937
938 request.set_endpoint_prefix("sms-voice.pinpoint".to_string());
939 let encoded = Some(serde_json::to_vec(&input).unwrap());
940 request.set_payload(encoded);
941
942 let mut response = self
943 .client
944 .sign_and_dispatch(request)
945 .await
946 .map_err(RusotoError::from)?;
947 if response.status.as_u16() == 200 {
948 let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
949 let result = proto::json::ResponsePayload::new(&response)
950 .deserialize::<CreateConfigurationSetResponse, _>()?;
951
952 Ok(result)
953 } else {
954 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
955 Err(CreateConfigurationSetError::from_response(response))
956 }
957 }
958
959 #[allow(unused_mut)]
961 async fn create_configuration_set_event_destination(
962 &self,
963 input: CreateConfigurationSetEventDestinationRequest,
964 ) -> Result<
965 CreateConfigurationSetEventDestinationResponse,
966 RusotoError<CreateConfigurationSetEventDestinationError>,
967 > {
968 let request_uri = format!(
969 "/v1/sms-voice/configuration-sets/{configuration_set_name}/event-destinations",
970 configuration_set_name = input.configuration_set_name
971 );
972
973 let mut request = SignedRequest::new("POST", "sms-voice", &self.region, &request_uri);
974 request.set_content_type("application/x-amz-json-1.1".to_owned());
975
976 request.set_endpoint_prefix("sms-voice.pinpoint".to_string());
977 let encoded = Some(serde_json::to_vec(&input).unwrap());
978 request.set_payload(encoded);
979
980 let mut response = self
981 .client
982 .sign_and_dispatch(request)
983 .await
984 .map_err(RusotoError::from)?;
985 if response.status.as_u16() == 200 {
986 let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
987 let result = proto::json::ResponsePayload::new(&response)
988 .deserialize::<CreateConfigurationSetEventDestinationResponse, _>()?;
989
990 Ok(result)
991 } else {
992 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
993 Err(CreateConfigurationSetEventDestinationError::from_response(
994 response,
995 ))
996 }
997 }
998
999 #[allow(unused_mut)]
1001 async fn delete_configuration_set(
1002 &self,
1003 input: DeleteConfigurationSetRequest,
1004 ) -> Result<DeleteConfigurationSetResponse, RusotoError<DeleteConfigurationSetError>> {
1005 let request_uri = format!(
1006 "/v1/sms-voice/configuration-sets/{configuration_set_name}",
1007 configuration_set_name = input.configuration_set_name
1008 );
1009
1010 let mut request = SignedRequest::new("DELETE", "sms-voice", &self.region, &request_uri);
1011 request.set_content_type("application/x-amz-json-1.1".to_owned());
1012
1013 request.set_endpoint_prefix("sms-voice.pinpoint".to_string());
1014
1015 let mut response = self
1016 .client
1017 .sign_and_dispatch(request)
1018 .await
1019 .map_err(RusotoError::from)?;
1020 if response.status.as_u16() == 200 {
1021 let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1022 let result = proto::json::ResponsePayload::new(&response)
1023 .deserialize::<DeleteConfigurationSetResponse, _>()?;
1024
1025 Ok(result)
1026 } else {
1027 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1028 Err(DeleteConfigurationSetError::from_response(response))
1029 }
1030 }
1031
1032 #[allow(unused_mut)]
1034 async fn delete_configuration_set_event_destination(
1035 &self,
1036 input: DeleteConfigurationSetEventDestinationRequest,
1037 ) -> Result<
1038 DeleteConfigurationSetEventDestinationResponse,
1039 RusotoError<DeleteConfigurationSetEventDestinationError>,
1040 > {
1041 let request_uri = format!("/v1/sms-voice/configuration-sets/{configuration_set_name}/event-destinations/{event_destination_name}", configuration_set_name = input.configuration_set_name, event_destination_name = input.event_destination_name);
1042
1043 let mut request = SignedRequest::new("DELETE", "sms-voice", &self.region, &request_uri);
1044 request.set_content_type("application/x-amz-json-1.1".to_owned());
1045
1046 request.set_endpoint_prefix("sms-voice.pinpoint".to_string());
1047
1048 let mut response = self
1049 .client
1050 .sign_and_dispatch(request)
1051 .await
1052 .map_err(RusotoError::from)?;
1053 if response.status.as_u16() == 200 {
1054 let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1055 let result = proto::json::ResponsePayload::new(&response)
1056 .deserialize::<DeleteConfigurationSetEventDestinationResponse, _>()?;
1057
1058 Ok(result)
1059 } else {
1060 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1061 Err(DeleteConfigurationSetEventDestinationError::from_response(
1062 response,
1063 ))
1064 }
1065 }
1066
1067 #[allow(unused_mut)]
1069 async fn get_configuration_set_event_destinations(
1070 &self,
1071 input: GetConfigurationSetEventDestinationsRequest,
1072 ) -> Result<
1073 GetConfigurationSetEventDestinationsResponse,
1074 RusotoError<GetConfigurationSetEventDestinationsError>,
1075 > {
1076 let request_uri = format!(
1077 "/v1/sms-voice/configuration-sets/{configuration_set_name}/event-destinations",
1078 configuration_set_name = input.configuration_set_name
1079 );
1080
1081 let mut request = SignedRequest::new("GET", "sms-voice", &self.region, &request_uri);
1082 request.set_content_type("application/x-amz-json-1.1".to_owned());
1083
1084 request.set_endpoint_prefix("sms-voice.pinpoint".to_string());
1085
1086 let mut response = self
1087 .client
1088 .sign_and_dispatch(request)
1089 .await
1090 .map_err(RusotoError::from)?;
1091 if response.status.as_u16() == 200 {
1092 let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1093 let result = proto::json::ResponsePayload::new(&response)
1094 .deserialize::<GetConfigurationSetEventDestinationsResponse, _>()?;
1095
1096 Ok(result)
1097 } else {
1098 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1099 Err(GetConfigurationSetEventDestinationsError::from_response(
1100 response,
1101 ))
1102 }
1103 }
1104
1105 #[allow(unused_mut)]
1107 async fn list_configuration_sets(
1108 &self,
1109 input: ListConfigurationSetsRequest,
1110 ) -> Result<ListConfigurationSetsResponse, RusotoError<ListConfigurationSetsError>> {
1111 let request_uri = "/v1/sms-voice/configuration-sets";
1112
1113 let mut request = SignedRequest::new("GET", "sms-voice", &self.region, &request_uri);
1114 request.set_content_type("application/x-amz-json-1.1".to_owned());
1115
1116 request.set_endpoint_prefix("sms-voice.pinpoint".to_string());
1117
1118 let mut params = Params::new();
1119 if let Some(ref x) = input.next_token {
1120 params.put("NextToken", x);
1121 }
1122 if let Some(ref x) = input.page_size {
1123 params.put("PageSize", x);
1124 }
1125 request.set_params(params);
1126
1127 let mut response = self
1128 .client
1129 .sign_and_dispatch(request)
1130 .await
1131 .map_err(RusotoError::from)?;
1132 if response.status.as_u16() == 200 {
1133 let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1134 let result = proto::json::ResponsePayload::new(&response)
1135 .deserialize::<ListConfigurationSetsResponse, _>()?;
1136
1137 Ok(result)
1138 } else {
1139 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1140 Err(ListConfigurationSetsError::from_response(response))
1141 }
1142 }
1143
1144 #[allow(unused_mut)]
1146 async fn send_voice_message(
1147 &self,
1148 input: SendVoiceMessageRequest,
1149 ) -> Result<SendVoiceMessageResponse, RusotoError<SendVoiceMessageError>> {
1150 let request_uri = "/v1/sms-voice/voice/message";
1151
1152 let mut request = SignedRequest::new("POST", "sms-voice", &self.region, &request_uri);
1153 request.set_content_type("application/x-amz-json-1.1".to_owned());
1154
1155 request.set_endpoint_prefix("sms-voice.pinpoint".to_string());
1156 let encoded = Some(serde_json::to_vec(&input).unwrap());
1157 request.set_payload(encoded);
1158
1159 let mut response = self
1160 .client
1161 .sign_and_dispatch(request)
1162 .await
1163 .map_err(RusotoError::from)?;
1164 if response.status.as_u16() == 200 {
1165 let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1166 let result = proto::json::ResponsePayload::new(&response)
1167 .deserialize::<SendVoiceMessageResponse, _>()?;
1168
1169 Ok(result)
1170 } else {
1171 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1172 Err(SendVoiceMessageError::from_response(response))
1173 }
1174 }
1175
1176 #[allow(unused_mut)]
1178 async fn update_configuration_set_event_destination(
1179 &self,
1180 input: UpdateConfigurationSetEventDestinationRequest,
1181 ) -> Result<
1182 UpdateConfigurationSetEventDestinationResponse,
1183 RusotoError<UpdateConfigurationSetEventDestinationError>,
1184 > {
1185 let request_uri = format!("/v1/sms-voice/configuration-sets/{configuration_set_name}/event-destinations/{event_destination_name}", configuration_set_name = input.configuration_set_name, event_destination_name = input.event_destination_name);
1186
1187 let mut request = SignedRequest::new("PUT", "sms-voice", &self.region, &request_uri);
1188 request.set_content_type("application/x-amz-json-1.1".to_owned());
1189
1190 request.set_endpoint_prefix("sms-voice.pinpoint".to_string());
1191 let encoded = Some(serde_json::to_vec(&input).unwrap());
1192 request.set_payload(encoded);
1193
1194 let mut response = self
1195 .client
1196 .sign_and_dispatch(request)
1197 .await
1198 .map_err(RusotoError::from)?;
1199 if response.status.as_u16() == 200 {
1200 let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1201 let result = proto::json::ResponsePayload::new(&response)
1202 .deserialize::<UpdateConfigurationSetEventDestinationResponse, _>()?;
1203
1204 Ok(result)
1205 } else {
1206 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1207 Err(UpdateConfigurationSetEventDestinationError::from_response(
1208 response,
1209 ))
1210 }
1211 }
1212}