pub struct GrpcPcsAdapter { /* private fields */ }Expand description
Production PcsExternalPort adapter wrapping an ExternalChannel.
Cheap-cloneable (the inner ExternalChannel holds an Arc<Channel>
and the API key is Arc<str>); intended to live in shared application
state.
Implementations§
Source§impl GrpcPcsAdapter
impl GrpcPcsAdapter
Sourcepub async fn connect(
endpoint: &str,
api_key: impl Into<String>,
) -> Result<Self, Error>
pub async fn connect( endpoint: &str, api_key: impl Into<String>, ) -> Result<Self, Error>
Build an adapter from explicit endpoint + API key.
Validates that api_key parses as an HTTP header value (no
CR/LF/NUL) at construction; calls onto the resulting adapter
then never re-validate.
§Errors
Returns Error::InvalidApiKey if api_key contains characters
that cannot be sent as an HTTP Authorization value, plus the
transport-construction errors of connect.
Sourcepub async fn from_env() -> Result<Self, Error>
pub async fn from_env() -> Result<Self, Error>
Default constructor reading PCS_EXTERNAL_ENDPOINT and
PCS_API_KEY from the environment.
Covers the 80% configuration path documented in the workspace
CLAUDE.md Quick Start. Use Self::connect to override.
§Errors
Returns Error::External when either env var is unset, plus
the construction errors of Self::connect.
Sourcepub fn from_parts(
channel: ExternalChannel,
api_key: impl Into<String>,
) -> Result<Self, Error>
pub fn from_parts( channel: ExternalChannel, api_key: impl Into<String>, ) -> Result<Self, Error>
Construct from a pre-built ExternalChannel (advanced — useful
when the caller has already configured the channel via
connect and wants to share it across adapters).
§Errors
Returns Error::InvalidApiKey for invalid header characters.
Trait Implementations§
Source§impl Clone for GrpcPcsAdapter
impl Clone for GrpcPcsAdapter
Source§fn clone(&self) -> GrpcPcsAdapter
fn clone(&self) -> GrpcPcsAdapter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GrpcPcsAdapter
impl Debug for GrpcPcsAdapter
Source§impl PcsExternalPort for GrpcPcsAdapter
impl PcsExternalPort for GrpcPcsAdapter
Source§async fn send_alert(
&self,
template: &TemplateId,
recipients: &RecipientList,
poll: Option<&PollConfig>,
) -> Result<SendOutcome, PcsFailure>
async fn send_alert( &self, template: &TemplateId, recipients: &RecipientList, poll: Option<&PollConfig>, ) -> Result<SendOutcome, PcsFailure>
Source§async fn get_send_status(
&self,
id: &SendRequestId,
) -> Result<SendStatus, PcsFailure>
async fn get_send_status( &self, id: &SendRequestId, ) -> Result<SendStatus, PcsFailure>
Source§fn raw_channel(&self) -> RawPcsChannel<'_>
fn raw_channel(&self) -> RawPcsChannel<'_>
Auto Trait Implementations§
impl Freeze for GrpcPcsAdapter
impl !RefUnwindSafe for GrpcPcsAdapter
impl Send for GrpcPcsAdapter
impl Sync for GrpcPcsAdapter
impl Unpin for GrpcPcsAdapter
impl UnsafeUnpin for GrpcPcsAdapter
impl !UnwindSafe for GrpcPcsAdapter
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request