pub struct PresignedRequest {
pub backend: PresignedRequestBackend,
pub expiration: DateTime<Utc>,
pub operation: PresignedOperation,
pub path: String,
}Expand description
A presigned request that can be serialized, stored, and executed later. Hides implementation details for different storage backends.
Fields§
§backend: PresignedRequestBackendThe storage backend this request targets
expiration: DateTime<Utc>When this presigned request expires
operation: PresignedOperationThe operation this request performs
path: StringThe path this request operates on
Implementations§
Source§impl PresignedRequest
impl PresignedRequest
Sourcepub fn new_http(
url: String,
method: String,
headers: HashMap<String, String>,
operation: PresignedOperation,
path: String,
expiration: DateTime<Utc>,
) -> PresignedRequest
pub fn new_http( url: String, method: String, headers: HashMap<String, String>, operation: PresignedOperation, path: String, expiration: DateTime<Utc>, ) -> PresignedRequest
Create a new HTTP-based presigned request
Sourcepub fn new_local(
file_path: String,
operation: PresignedOperation,
path: String,
expiration: DateTime<Utc>,
) -> PresignedRequest
pub fn new_local( file_path: String, operation: PresignedOperation, path: String, expiration: DateTime<Utc>, ) -> PresignedRequest
Create a new local filesystem presigned request
Sourcepub async fn execute(
&self,
body: Option<Bytes>,
) -> Result<PresignedResponse, AlienError<ErrorData>>
pub async fn execute( &self, body: Option<Bytes>, ) -> Result<PresignedResponse, AlienError<ErrorData>>
Execute this presigned request with optional body data. For PUT operations, body should contain the data to upload. For GET/DELETE operations, body is typically None.
Sourcepub async fn execute_with_client(
&self,
client: &Client,
body: Option<Bytes>,
) -> Result<PresignedResponse, AlienError<ErrorData>>
pub async fn execute_with_client( &self, client: &Client, body: Option<Bytes>, ) -> Result<PresignedResponse, AlienError<ErrorData>>
Execute this presigned request with a caller-owned HTTP client.
Multi-step protocols should use this form so retries and adjacent HTTP operations share one connection pool. Local requests ignore the client.
Sourcepub fn url(&self) -> String
pub fn url(&self) -> String
Get a URL representation of this presigned request. For local storage, returns a local:// URL. For cloud storage, returns the actual presigned URL.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if this presigned request has expired
Trait Implementations§
Source§impl Clone for PresignedRequest
impl Clone for PresignedRequest
Source§fn clone(&self) -> PresignedRequest
fn clone(&self) -> PresignedRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PresignedRequest
impl Debug for PresignedRequest
Source§impl<'de> Deserialize<'de> for PresignedRequest
impl<'de> Deserialize<'de> for PresignedRequest
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PresignedRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PresignedRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for PresignedRequest
Source§impl PartialEq for PresignedRequest
impl PartialEq for PresignedRequest
Source§impl Serialize for PresignedRequest
impl Serialize for PresignedRequest
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for PresignedRequest
Auto Trait Implementations§
impl Freeze for PresignedRequest
impl RefUnwindSafe for PresignedRequest
impl Send for PresignedRequest
impl Sync for PresignedRequest
impl Unpin for PresignedRequest
impl UnsafeUnpin for PresignedRequest
impl UnwindSafe for PresignedRequest
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<K, Q> Comparable<Q> for K
impl<K, Q> Comparable<Q> for K
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
Source§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FromBase64 for Twhere
T: for<'de> Deserialize<'de>,
impl<T> FromBase64 for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more