S3HeadersBuilder

Struct S3HeadersBuilder 

Source
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>

Source

pub fn new(url: &'a Url) -> Self

Source

pub fn set_access_key(self, value: &'a str) -> Self

Source

pub fn set_secret_key(self, value: &'a str) -> Self

Source

pub fn set_region(self, value: &'a str) -> Self

Source

pub fn set_datetime(self, value: S3DateTime) -> Self

Source

pub fn set_payload_hash(self, value: &'a str) -> Self

Source

pub fn set_payload_hash_with_content(self, content: &[u8]) -> Self

Source

pub fn set_method(self, value: &'a str) -> Self

Source

pub fn set_service(self, value: &'a str) -> Self

Source

pub fn set_url(self, url: &'a Url) -> Self

Source

pub fn set_range(self, start: u64, end: Option<u64>) -> Self

Source

pub fn set_headers(self, headers: &'a [(&'static str, String)]) -> Self

Source

pub fn build(self) -> Vec<(&'static str, String)>

Trait Implementations§

Source§

impl<'a> Clone for S3HeadersBuilder<'a>

Source§

fn clone(&self) -> S3HeadersBuilder<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for S3HeadersBuilder<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.