pub struct HttpRpcProtocol<C> { /* private fields */ }Expand description
An HTTP protocol for RPC-style APIs that put everything in the body.
This protocol ignores HTTP binding traits and serializes the entire input
into the request body using the provided codec. Used by protocols like
awsJson1_0, awsJson1_1, and rpcv2Cbor.
§Type parameters
C— the payload codec (ex:JsonCodec,CborCodec)
Implementations§
Source§impl<C: Codec> HttpRpcProtocol<C>
impl<C: Codec> HttpRpcProtocol<C>
Sourcepub fn new(
protocol_id: ShapeId<'static>,
codec: C,
content_type: &'static str,
) -> Self
pub fn new( protocol_id: ShapeId<'static>, codec: C, content_type: &'static str, ) -> Self
Creates a new HTTP RPC protocol.
Sourcepub fn codec(&self) -> &C
pub fn codec(&self) -> &C
Returns a reference to the body codec. Used by wrapper protocols
that need to read the codec’s settings before rebuilding it via
Self::with_codec.
Sourcepub fn content_type(&self) -> &'static str
pub fn content_type(&self) -> &'static str
Returns the Content-Type string this protocol stamps onto the
outgoing request. Used by wrapper protocols that rebuild the
inner HttpRpcProtocol when reconfiguring the codec.
Sourcepub fn with_codec(self, codec: C) -> Self
pub fn with_codec(self, codec: C) -> Self
Replaces the body codec, returning a new protocol instance with all other fields preserved. Used by wrapper protocols (e.g. AWS JSON RPC) that need to swap in a reconfigured codec.
Trait Implementations§
Source§impl<C> ClientProtocolInner for HttpRpcProtocol<C>
impl<C> ClientProtocolInner for HttpRpcProtocol<C>
Source§fn protocol_id(&self) -> &ShapeId<'static>
fn protocol_id(&self) -> &ShapeId<'static>
Source§fn serialize_request(
&self,
input: &dyn SerializableStruct,
input_schema: &Schema<'_>,
endpoint: &str,
cfg: &ConfigBag,
) -> Result<Request, SerdeError>
fn serialize_request( &self, input: &dyn SerializableStruct, input_schema: &Schema<'_>, endpoint: &str, cfg: &ConfigBag, ) -> Result<Request, SerdeError>
Source§fn deserialize_response<'a>(
&self,
response: &'a Response,
_output_schema: &Schema<'_>,
_cfg: &'a ConfigBag,
) -> Result<Box<dyn ShapeDeserializer + 'a>, SerdeError>
fn deserialize_response<'a>( &self, response: &'a Response, _output_schema: &Schema<'_>, _cfg: &'a ConfigBag, ) -> Result<Box<dyn ShapeDeserializer + 'a>, SerdeError>
ShapeDeserializer that supplies
every member of output_schema this protocol carries in the response. Read moreSource§fn payload_codec(&self) -> Option<&dyn DynCodec>
fn payload_codec(&self) -> Option<&dyn DynCodec>
Source§fn update_endpoint(
&self,
request: &mut Request,
endpoint: &Endpoint,
cfg: &ConfigBag,
) -> Result<(), SerdeError>
fn update_endpoint( &self, request: &mut Request, endpoint: &Endpoint, cfg: &ConfigBag, ) -> Result<(), SerdeError>
Source§fn parse_error_metadata(
&self,
response: &Self::Response,
cfg: &ConfigBag,
) -> Result<ErrorMetadataBuilder, SerdeError>
fn parse_error_metadata( &self, response: &Self::Response, cfg: &ConfigBag, ) -> Result<ErrorMetadataBuilder, SerdeError>
Source§fn deserialize_error_response<'a>(
&self,
response: &'a Self::Response,
cfg: &'a ConfigBag,
) -> Result<Box<dyn ShapeDeserializer + 'a>, SerdeError>
fn deserialize_error_response<'a>( &self, response: &'a Self::Response, cfg: &'a ConfigBag, ) -> Result<Box<dyn ShapeDeserializer + 'a>, SerdeError>
ShapeDeserializer positioned at the body of an error
response — inside the protocol’s error envelope, where applicable. Read moreSource§fn event_stream_media_type(&self) -> Option<&str>
fn event_stream_media_type(&self) -> Option<&str>
application/cbor or
application/json. Read moreSource§fn parse_event_stream_error_metadata(
&self,
payload: &[u8],
) -> Result<ErrorMetadataBuilder, SerdeError>
fn parse_event_stream_error_metadata( &self, payload: &[u8], ) -> Result<ErrorMetadataBuilder, SerdeError>
exception frame. Read moreAuto Trait Implementations§
impl<C> Freeze for HttpRpcProtocol<C>where
C: Freeze,
impl<C> RefUnwindSafe for HttpRpcProtocol<C>where
C: RefUnwindSafe,
impl<C> Send for HttpRpcProtocol<C>where
C: Send,
impl<C> Sync for HttpRpcProtocol<C>where
C: Sync,
impl<C> Unpin for HttpRpcProtocol<C>where
C: Unpin,
impl<C> UnsafeUnpin for HttpRpcProtocol<C>where
C: UnsafeUnpin,
impl<C> UnwindSafe for HttpRpcProtocol<C>where
C: UnwindSafe,
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
Source§impl<P> ClientProtocol<<P as ClientProtocolInner>::Request, <P as ClientProtocolInner>::Response> for Pwhere
P: ClientProtocolInner,
impl<P> ClientProtocol<<P as ClientProtocolInner>::Request, <P as ClientProtocolInner>::Response> for Pwhere
P: ClientProtocolInner,
Source§fn protocol_id(&self) -> &ShapeId<'static>
fn protocol_id(&self) -> &ShapeId<'static>
Source§fn serialize_request(
&self,
input: &dyn SerializableStruct,
input_schema: &Schema<'_>,
endpoint: &str,
cfg: &ConfigBag,
) -> Result<<P as ClientProtocolInner>::Request, SerdeError>
fn serialize_request( &self, input: &dyn SerializableStruct, input_schema: &Schema<'_>, endpoint: &str, cfg: &ConfigBag, ) -> Result<<P as ClientProtocolInner>::Request, SerdeError>
Source§fn deserialize_response<'a>(
&self,
response: &'a <P as ClientProtocolInner>::Response,
output_schema: &Schema<'_>,
cfg: &'a ConfigBag,
) -> Result<Box<dyn ShapeDeserializer + 'a>, SerdeError>
fn deserialize_response<'a>( &self, response: &'a <P as ClientProtocolInner>::Response, output_schema: &Schema<'_>, cfg: &'a ConfigBag, ) -> Result<Box<dyn ShapeDeserializer + 'a>, SerdeError>
ShapeDeserializer.Source§fn parse_error_metadata(
&self,
response: &<P as ClientProtocolInner>::Response,
cfg: &ConfigBag,
) -> Result<Builder, SerdeError>
fn parse_error_metadata( &self, response: &<P as ClientProtocolInner>::Response, cfg: &ConfigBag, ) -> Result<Builder, SerdeError>
Source§fn deserialize_error_response<'a>(
&self,
response: &'a <P as ClientProtocolInner>::Response,
cfg: &'a ConfigBag,
) -> Result<Box<dyn ShapeDeserializer + 'a>, SerdeError>
fn deserialize_error_response<'a>( &self, response: &'a <P as ClientProtocolInner>::Response, cfg: &'a ConfigBag, ) -> Result<Box<dyn ShapeDeserializer + 'a>, SerdeError>
ShapeDeserializer positioned at the body of an error
response — inside the protocol’s error envelope, where applicable. Read moreSource§fn update_endpoint(
&self,
request: &mut <P as ClientProtocolInner>::Request,
endpoint: &Endpoint,
cfg: &ConfigBag,
) -> Result<(), SerdeError>
fn update_endpoint( &self, request: &mut <P as ClientProtocolInner>::Request, endpoint: &Endpoint, cfg: &ConfigBag, ) -> Result<(), SerdeError>
Source§fn payload_codec(&self) -> Option<&dyn DynCodec>
fn payload_codec(&self) -> Option<&dyn DynCodec>
Source§fn event_stream_media_type(&self) -> Option<&str>
fn event_stream_media_type(&self) -> Option<&str>
Source§fn parse_event_stream_error_metadata(
&self,
payload: &[u8],
) -> Result<Builder, SerdeError>
fn parse_event_stream_error_metadata( &self, payload: &[u8], ) -> Result<Builder, SerdeError>
exception frame’s
payload. Read moreSource§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