Skip to main content

aws_sdk_dynamodb/types/error/
_provisioned_throughput_exceeded_exception.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The request was denied due to request throttling. For detailed information about why the request was throttled and the ARN of the impacted resource, find the <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ThrottlingReason.html">ThrottlingReason</a> field in the returned exception. The Amazon Web Services SDKs for DynamoDB automatically retry requests that receive this exception. Your request is eventually successful, unless your retry queue is too large to finish. Reduce the frequency of requests and use exponential backoff. For more information, go to <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Programming.Errors.html#Programming.Errors.RetryAndBackoff">Error Retries and Exponential Backoff</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ProvisionedThroughputExceededException {
7    /// <p>You exceeded your maximum allowed provisioned throughput.</p>
8    pub message: ::std::option::Option<::std::string::String>,
9    /// <p>A list of <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ThrottlingReason.html">ThrottlingReason</a> that provide detailed diagnostic information about why the request was throttled.</p>
10    pub throttling_reasons: ::std::option::Option<::std::vec::Vec<crate::types::ThrottlingReason>>,
11    pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
12}
13impl ProvisionedThroughputExceededException {
14    /// <p>A list of <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ThrottlingReason.html">ThrottlingReason</a> that provide detailed diagnostic information about why the request was throttled.</p>
15    ///
16    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.throttling_reasons.is_none()`.
17    pub fn throttling_reasons(&self) -> &[crate::types::ThrottlingReason] {
18        self.throttling_reasons.as_deref().unwrap_or_default()
19    }
20}
21impl ProvisionedThroughputExceededException {
22    /// Returns the error message.
23    pub fn message(&self) -> ::std::option::Option<&str> {
24        self.message.as_deref()
25    }
26}
27impl ::std::fmt::Display for ProvisionedThroughputExceededException {
28    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29        ::std::write!(f, "ProvisionedThroughputExceededException")?;
30        if let ::std::option::Option::Some(inner_1) = &self.message {
31            {
32                ::std::write!(f, ": {inner_1}")?;
33            }
34        }
35        Ok(())
36    }
37}
38impl ::std::error::Error for ProvisionedThroughputExceededException {}
39impl ::aws_types::request_id::RequestId for crate::types::error::ProvisionedThroughputExceededException {
40    fn request_id(&self) -> Option<&str> {
41        use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
42        self.meta().request_id()
43    }
44}
45impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ProvisionedThroughputExceededException {
46    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
47        &self.meta
48    }
49}
50impl ProvisionedThroughputExceededException {
51    /// Creates a new builder-style object to manufacture [`ProvisionedThroughputExceededException`](crate::types::error::ProvisionedThroughputExceededException).
52    pub fn builder() -> crate::types::error::builders::ProvisionedThroughputExceededExceptionBuilder {
53        crate::types::error::builders::ProvisionedThroughputExceededExceptionBuilder::default()
54    }
55}
56
57/// A builder for [`ProvisionedThroughputExceededException`](crate::types::error::ProvisionedThroughputExceededException).
58#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
59#[non_exhaustive]
60pub struct ProvisionedThroughputExceededExceptionBuilder {
61    pub(crate) message: ::std::option::Option<::std::string::String>,
62    pub(crate) throttling_reasons: ::std::option::Option<::std::vec::Vec<crate::types::ThrottlingReason>>,
63    meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
64}
65impl ProvisionedThroughputExceededExceptionBuilder {
66    /// <p>You exceeded your maximum allowed provisioned throughput.</p>
67    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
68        self.message = ::std::option::Option::Some(input.into());
69        self
70    }
71    /// <p>You exceeded your maximum allowed provisioned throughput.</p>
72    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
73        self.message = input;
74        self
75    }
76    /// <p>You exceeded your maximum allowed provisioned throughput.</p>
77    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
78        &self.message
79    }
80    /// Appends an item to `throttling_reasons`.
81    ///
82    /// To override the contents of this collection use [`set_throttling_reasons`](Self::set_throttling_reasons).
83    ///
84    /// <p>A list of <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ThrottlingReason.html">ThrottlingReason</a> that provide detailed diagnostic information about why the request was throttled.</p>
85    pub fn throttling_reasons(mut self, input: crate::types::ThrottlingReason) -> Self {
86        let mut v = self.throttling_reasons.unwrap_or_default();
87        v.push(input);
88        self.throttling_reasons = ::std::option::Option::Some(v);
89        self
90    }
91    /// <p>A list of <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ThrottlingReason.html">ThrottlingReason</a> that provide detailed diagnostic information about why the request was throttled.</p>
92    pub fn set_throttling_reasons(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ThrottlingReason>>) -> Self {
93        self.throttling_reasons = input;
94        self
95    }
96    /// <p>A list of <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ThrottlingReason.html">ThrottlingReason</a> that provide detailed diagnostic information about why the request was throttled.</p>
97    pub fn get_throttling_reasons(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ThrottlingReason>> {
98        &self.throttling_reasons
99    }
100    /// Sets error metadata
101    pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
102        self.meta = Some(meta);
103        self
104    }
105
106    /// Sets error metadata
107    pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
108        self.meta = meta;
109        self
110    }
111    /// Consumes the builder and constructs a [`ProvisionedThroughputExceededException`](crate::types::error::ProvisionedThroughputExceededException).
112    pub fn build(self) -> crate::types::error::ProvisionedThroughputExceededException {
113        crate::types::error::ProvisionedThroughputExceededException {
114            message: self.message,
115            throttling_reasons: self.throttling_reasons,
116            meta: self.meta.unwrap_or_default(),
117        }
118    }
119}