-
Notifications
You must be signed in to change notification settings - Fork 196
/
Copy pathmod.rs
41 lines (33 loc) · 1.49 KB
/
mod.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
//! The combination of [HTTP binding traits] and the [sensitive trait] require us to redact
//! portions of the HTTP requests/responses during logging.
//!
//! [HTTP binding traits]: https://awslabs.github.io/smithy/1.0/spec/core/http-traits.html
//! [sensitive trait]: https://awslabs.github.io/smithy/1.0/spec/core/documentation-traits.html?highlight=sensitive#sensitive-trait
pub mod headers;
mod request;
mod response;
mod sensitive;
pub mod uri;
use http::{HeaderMap, StatusCode, Uri};
pub use request::*;
pub use response::*;
pub use sensitive::*;
use super::{MakeDebug, MakeDisplay};
/// The string placeholder for redacted data.
pub const REDACTED: &str = "{redacted}";
/// An interface for providing [`MakeDebug`] and [`MakeDisplay`] for [`Request`](http::Request) and
/// [`Response`](http::Response).
pub trait Sensitivity {
/// The [`MakeDebug`] and [`MakeDisplay`] for the request [`HeaderMap`] and [`Uri`].
type RequestFmt: for<'a> MakeDebug<&'a HeaderMap> + for<'a> MakeDisplay<&'a Uri>;
/// The [`MakeDebug`] and [`MakeDisplay`] for the response [`HeaderMap`] and [`StatusCode`].
type ResponseFmt: for<'a> MakeDebug<&'a HeaderMap> + MakeDisplay<StatusCode>;
/// Returns the [`RequestFmt`](Sensitivity::RequestFmt).
fn request_fmt() -> Self::RequestFmt;
/// Returns the [`ResponseFmt`](Sensitivity::ResponseFmt).
fn response_fmt() -> Self::ResponseFmt;
}