pub struct InterceptorContext<I = Input, O = Output, E = Error>where
E: Debug,{ /* private fields */ }Expand description
A container for the data currently available to an interceptor.
Different context is available based on which phase the operation is currently in. For example,
context in the Phase::BeforeSerialization phase won’t have a request yet since the input hasn’t been
serialized at that point. But once it gets into the Phase::BeforeTransmit phase, the request will be set.
Implementations§
source§impl InterceptorContext<Input, Output, Error>
impl InterceptorContext<Input, Output, Error>
sourcepub fn new(input: Input) -> InterceptorContext<Input, Output, Error>
pub fn new(input: Input) -> InterceptorContext<Input, Output, Error>
Creates a new interceptor context in the Phase::BeforeSerialization phase.
source§impl<I, O, E> InterceptorContext<I, O, E>where
E: Debug,
impl<I, O, E> InterceptorContext<I, O, E>where E: Debug,
pub fn finalize(self) -> Result<O, SdkError<E, HttpResponse>>
sourcepub fn take_input(&mut self) -> Option<I>
pub fn take_input(&mut self) -> Option<I>
Takes ownership of the input.
sourcepub fn set_request(&mut self, request: HttpRequest)
pub fn set_request(&mut self, request: HttpRequest)
Set the request for the operation being invoked.
sourcepub fn request(&self) -> &HttpRequest
pub fn request(&self) -> &HttpRequest
Retrieve the transmittable request for the operation being invoked. This will only be available once request marshalling has completed.
sourcepub fn request_mut(&mut self) -> &mut HttpRequest
pub fn request_mut(&mut self) -> &mut HttpRequest
Retrieve the transmittable request for the operation being invoked. This will only be available once request marshalling has completed.
sourcepub fn take_request(&mut self) -> HttpRequest
pub fn take_request(&mut self) -> HttpRequest
Takes ownership of the request.
sourcepub fn set_response(&mut self, response: HttpResponse)
pub fn set_response(&mut self, response: HttpResponse)
Set the response for the operation being invoked.
sourcepub fn response(&self) -> &HttpResponse
pub fn response(&self) -> &HttpResponse
Returns the response.
sourcepub fn response_mut(&mut self) -> &mut HttpResponse
pub fn response_mut(&mut self) -> &mut HttpResponse
Returns a mutable reference to the response.
sourcepub fn set_output_or_error(&mut self, output: Result<O, OrchestratorError<E>>)
pub fn set_output_or_error(&mut self, output: Result<O, OrchestratorError<E>>)
Set the output or error for the operation being invoked.
sourcepub fn output_or_error(&self) -> Result<&O, &OrchestratorError<E>>
pub fn output_or_error(&self) -> Result<&O, &OrchestratorError<E>>
Returns the deserialized output or error.
sourcepub fn output_or_error_mut(&mut self) -> &mut Result<O, OrchestratorError<E>>
pub fn output_or_error_mut(&mut self) -> &mut Result<O, OrchestratorError<E>>
Returns the mutable reference to the deserialized output or error.
pub fn rewind(&mut self, _cfg: &mut ConfigBag) -> bool
sourcepub fn fail(&mut self, error: OrchestratorError<E>)
pub fn fail(&mut self, error: OrchestratorError<E>)
Mark this context as failed due to errors during the operation. Any errors already contained by the context will be replaced by the given error.