pub struct S3HeadersBuilder<'a> {
pub datetime: S3DateTime,
pub access_key: &'a str,
pub secret_key: &'a str,
pub region: &'a str,
pub service: &'a str,
pub url: &'a Url,
pub method: &'a str,
pub headers: &'a [(&'static str, String)],
pub payload_hash: Cow<'a, str>,
pub range: Option<(u64, Option<u64>)>,
}Expand description
Builder for S3 headers. Main entry point for this crate. Used to build the headers necessary to make a request to a AWS compatible service.
The returned headers are just strings and can be used with any HTTP client.
§Example
use common_s3_headers::S3HeadersBuilder;
use url::Url;
let url = Url::parse("https://jsonlog.s3.amazonaws.com/test/test.json").unwrap();
let headers: Vec<(&str, String)> = S3HeadersBuilder::new(&url)
.set_access_key("access_key")
.set_secret_key("secret_key")
.set_region("us-east-1")
.set_method("GET")
.set_service("s3")
.build();Fields§
§datetime: S3DateTime§access_key: &'a str§secret_key: &'a str§region: &'a str§service: &'a str§url: &'a Url§method: &'a str§headers: &'a [(&'static str, String)]§payload_hash: Cow<'a, str>§range: Option<(u64, Option<u64>)>Implementations§
Source§impl<'a> S3HeadersBuilder<'a>
impl<'a> S3HeadersBuilder<'a>
pub fn new(url: &'a Url) -> Self
pub fn set_access_key(self, value: &'a str) -> Self
pub fn set_secret_key(self, value: &'a str) -> Self
pub fn set_region(self, value: &'a str) -> Self
pub fn set_datetime(self, value: S3DateTime) -> Self
pub fn set_payload_hash(self, value: &'a str) -> Self
pub fn set_payload_hash_with_content(self, content: &[u8]) -> Self
pub fn set_method(self, value: &'a str) -> Self
pub fn set_service(self, value: &'a str) -> Self
pub fn set_url(self, url: &'a Url) -> Self
pub fn set_range(self, start: u64, end: Option<u64>) -> Self
pub fn set_headers(self, headers: &'a [(&'static str, String)]) -> Self
pub fn build(self) -> Vec<(&'static str, String)>
Trait Implementations§
Source§impl<'a> Clone for S3HeadersBuilder<'a>
impl<'a> Clone for S3HeadersBuilder<'a>
Source§fn clone(&self) -> S3HeadersBuilder<'a>
fn clone(&self) -> S3HeadersBuilder<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for S3HeadersBuilder<'a>
impl<'a> RefUnwindSafe for S3HeadersBuilder<'a>
impl<'a> Send for S3HeadersBuilder<'a>
impl<'a> Sync for S3HeadersBuilder<'a>
impl<'a> Unpin for S3HeadersBuilder<'a>
impl<'a> UnwindSafe for S3HeadersBuilder<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more