aws_sdk_dynamodbstreams/types/error/
_trimmed_data_access_exception.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The operation attempted to read past the oldest stream record in a shard.</p>
4/// <p>In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records whose age exceeds this limit are subject to removal (trimming) from the stream. You might receive a TrimmedDataAccessException if:</p>
5/// <ul>
6/// <li>
7/// <p>You request a shard iterator with a sequence number older than the trim point (24 hours).</p></li>
8/// <li>
9/// <p>You obtain a shard iterator, but before you use the iterator in a <code>GetRecords</code> request, a stream record in the shard exceeds the 24 hour period and is trimmed. This causes the iterator to access a record that no longer exists.</p></li>
10/// </ul>
11#[non_exhaustive]
12#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
13pub struct TrimmedDataAccessException {
14    /// <p>"The data you are trying to access has been trimmed.</p>
15    pub message: ::std::option::Option<::std::string::String>,
16    pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
17}
18impl TrimmedDataAccessException {
19    /// Returns the error message.
20    pub fn message(&self) -> ::std::option::Option<&str> {
21        self.message.as_deref()
22    }
23}
24impl ::std::fmt::Display for TrimmedDataAccessException {
25    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26        ::std::write!(f, "TrimmedDataAccessException")?;
27        if let ::std::option::Option::Some(inner_1) = &self.message {
28            {
29                ::std::write!(f, ": {}", inner_1)?;
30            }
31        }
32        Ok(())
33    }
34}
35impl ::std::error::Error for TrimmedDataAccessException {}
36impl ::aws_types::request_id::RequestId for crate::types::error::TrimmedDataAccessException {
37    fn request_id(&self) -> Option<&str> {
38        use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
39        self.meta().request_id()
40    }
41}
42impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for TrimmedDataAccessException {
43    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
44        &self.meta
45    }
46}
47impl TrimmedDataAccessException {
48    /// Creates a new builder-style object to manufacture [`TrimmedDataAccessException`](crate::types::error::TrimmedDataAccessException).
49    pub fn builder() -> crate::types::error::builders::TrimmedDataAccessExceptionBuilder {
50        crate::types::error::builders::TrimmedDataAccessExceptionBuilder::default()
51    }
52}
53
54/// A builder for [`TrimmedDataAccessException`](crate::types::error::TrimmedDataAccessException).
55#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
56#[non_exhaustive]
57pub struct TrimmedDataAccessExceptionBuilder {
58    pub(crate) message: ::std::option::Option<::std::string::String>,
59    meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
60}
61impl TrimmedDataAccessExceptionBuilder {
62    /// <p>"The data you are trying to access has been trimmed.</p>
63    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
64        self.message = ::std::option::Option::Some(input.into());
65        self
66    }
67    /// <p>"The data you are trying to access has been trimmed.</p>
68    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
69        self.message = input;
70        self
71    }
72    /// <p>"The data you are trying to access has been trimmed.</p>
73    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
74        &self.message
75    }
76    /// Sets error metadata
77    pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
78        self.meta = Some(meta);
79        self
80    }
81
82    /// Sets error metadata
83    pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
84        self.meta = meta;
85        self
86    }
87    /// Consumes the builder and constructs a [`TrimmedDataAccessException`](crate::types::error::TrimmedDataAccessException).
88    pub fn build(self) -> crate::types::error::TrimmedDataAccessException {
89        crate::types::error::TrimmedDataAccessException {
90            message: self.message,
91            meta: self.meta.unwrap_or_default(),
92        }
93    }
94}