pub trait HttpClient: Send + Sync {
type Error: Send + Error;
// Required methods
fn get<T>(
&self,
url: Url,
credentials: &BmcCredentials,
etag: Option<ODataETag>,
custom_headers: &HeaderMap,
) -> impl Future<Output = Result<T, Self::Error>> + Send
where T: DeserializeOwned + Send + Sync;
fn post<B, T>(
&self,
url: Url,
body: &B,
credentials: &BmcCredentials,
custom_headers: &HeaderMap,
) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send
where B: Serialize + Send + Sync,
T: DeserializeOwned + Send + Sync;
fn post_session<B, T>(
&self,
url: Url,
body: &B,
custom_headers: &HeaderMap,
) -> impl Future<Output = Result<SessionCreateResponse<T>, Self::Error>> + Send
where B: Serialize + Send + Sync,
T: DeserializeOwned + Send + Sync;
fn post_multipart_update<U, V, T>(
&self,
url: Url,
request: MultipartUpdateRequest<'_, U, V>,
credentials: &BmcCredentials,
custom_headers: &HeaderMap,
) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send
where U: UploadReader,
T: DeserializeOwned + Send + Sync,
V: Serialize + Send + Sync;
fn post_http_push_uri_update<U, T>(
&self,
url: Url,
request: HttpPushUriUpdateRequest<U>,
credentials: &BmcCredentials,
custom_headers: &HeaderMap,
) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send
where U: UploadReader,
T: DeserializeOwned + Send + Sync;
fn patch<B, T>(
&self,
url: Url,
etag: ODataETag,
body: &B,
credentials: &BmcCredentials,
custom_headers: &HeaderMap,
) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send
where B: Serialize + Send + Sync,
T: DeserializeOwned + Send + Sync;
fn delete<T>(
&self,
url: Url,
credentials: &BmcCredentials,
custom_headers: &HeaderMap,
) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send
where T: DeserializeOwned + Send + Sync;
fn sse<T>(
&self,
url: Url,
credentials: &BmcCredentials,
custom_headers: &HeaderMap,
) -> impl Future<Output = Result<Pin<Box<dyn TryStream<Ok = T, Item = Result<T, Self::Error>, Error = Self::Error> + Send>>, Self::Error>> + Send
where T: for<'de> Deserialize<'de> + Send;
}Expand description
HTTP Client trait.
nv-redfish-bmc-http supports any HTTP implementation that
implements this HttpClient trait.
Required Associated Types§
Required Methods§
Sourcefn get<T>(
&self,
url: Url,
credentials: &BmcCredentials,
etag: Option<ODataETag>,
custom_headers: &HeaderMap,
) -> impl Future<Output = Result<T, Self::Error>> + Send
fn get<T>( &self, url: Url, credentials: &BmcCredentials, etag: Option<ODataETag>, custom_headers: &HeaderMap, ) -> impl Future<Output = Result<T, Self::Error>> + Send
Perform an HTTP GET request with optional conditional headers.
Sourcefn post<B, T>(
&self,
url: Url,
body: &B,
credentials: &BmcCredentials,
custom_headers: &HeaderMap,
) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send
fn post<B, T>( &self, url: Url, body: &B, credentials: &BmcCredentials, custom_headers: &HeaderMap, ) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send
Perform an HTTP POST request.
Sourcefn post_session<B, T>(
&self,
url: Url,
body: &B,
custom_headers: &HeaderMap,
) -> impl Future<Output = Result<SessionCreateResponse<T>, Self::Error>> + Send
fn post_session<B, T>( &self, url: Url, body: &B, custom_headers: &HeaderMap, ) -> impl Future<Output = Result<SessionCreateResponse<T>, Self::Error>> + Send
Perform a Redfish session creation POST request.
Sourcefn post_multipart_update<U, V, T>(
&self,
url: Url,
request: MultipartUpdateRequest<'_, U, V>,
credentials: &BmcCredentials,
custom_headers: &HeaderMap,
) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send
fn post_multipart_update<U, V, T>( &self, url: Url, request: MultipartUpdateRequest<'_, U, V>, credentials: &BmcCredentials, custom_headers: &HeaderMap, ) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send
Performs an UpdateService multipart upload with credentials and headers.
The request carries UpdateParameters, UpdateFile, and optional OEM
multipart parts.
Sourcefn post_http_push_uri_update<U, T>(
&self,
url: Url,
request: HttpPushUriUpdateRequest<U>,
credentials: &BmcCredentials,
custom_headers: &HeaderMap,
) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send
fn post_http_push_uri_update<U, T>( &self, url: Url, request: HttpPushUriUpdateRequest<U>, credentials: &BmcCredentials, custom_headers: &HeaderMap, ) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send
Performs a deprecated UpdateService raw HttpPushUri upload with
credentials and headers.
This supports the deprecated HttpPushUri update path that exists in
the Redfish spec. Prefer multipart update for BMCs that support
MultipartHttpPushUri.
Sourcefn patch<B, T>(
&self,
url: Url,
etag: ODataETag,
body: &B,
credentials: &BmcCredentials,
custom_headers: &HeaderMap,
) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send
fn patch<B, T>( &self, url: Url, etag: ODataETag, body: &B, credentials: &BmcCredentials, custom_headers: &HeaderMap, ) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send
Perform an HTTP PATCH request.
Sourcefn delete<T>(
&self,
url: Url,
credentials: &BmcCredentials,
custom_headers: &HeaderMap,
) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send
fn delete<T>( &self, url: Url, credentials: &BmcCredentials, custom_headers: &HeaderMap, ) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send
Perform an HTTP DELETE request.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".