-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Serve cache on transient errors (#34)
STSGetCallerIdentity, DescribeSecret and GetSecretValue requests may fail because of common network errors like Sdkerror::Timeout and server-side errors like Sdkerror::ServiceError<Box, HttpResponse>. This cr adds a new configurable parameter ignore_transient_errors. With that enabled, the agent will return the cached secret when running into common transient errors like the above. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. --------- Co-authored-by: Kai Zhu <kaizuu@amazon.com> Co-authored-by: Simon Marty <martysi@amazon.com> Co-authored-by: Simon Marty <simon.marty0@gmail.com>
- Loading branch information
1 parent
c604b4b
commit d753a25
Showing
15 changed files
with
408 additions
and
307 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use aws_smithy_runtime_api::client::{orchestrator::HttpResponse, result::SdkError}; | ||
|
||
/// Helper function to determine transient errors. Transient errors include any timeout error, | ||
/// unparseable response error, dispatch error due to timeout or IO, and 5xx server-side error. | ||
/// | ||
/// # Arguments | ||
/// * `e` - An SDK error | ||
/// | ||
/// # Returns | ||
/// * true if transient error, false if not | ||
pub fn is_transient_error<S>(e: &SdkError<S, HttpResponse>) -> bool | ||
where | ||
S: std::error::Error + 'static, | ||
{ | ||
match e { | ||
SdkError::TimeoutError(_) => true, | ||
SdkError::ResponseError(_) => true, | ||
SdkError::DispatchFailure(derr) if derr.is_timeout() || derr.is_io() => true, | ||
SdkError::ServiceError(serr) if serr.raw().status().is_server_error() => true, | ||
_ => false, | ||
} | ||
} |
Oops, something went wrong.