pub struct ClientBuilder { /* private fields */ }Expand description
Builder for Client connection, authentication, and TLS options.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn new(endpoint: impl Into<String>) -> Self
pub fn new(endpoint: impl Into<String>) -> Self
Creates a builder for the supplied server endpoint.
Sourcepub fn with_stream_endpoint(self, stream_endpoint: impl Into<String>) -> Self
pub fn with_stream_endpoint(self, stream_endpoint: impl Into<String>) -> Self
Configures the WebSocket event-stream endpoint used by subscribe
operations: the full URL of the server’s /events/stream route, e.g.
ws://127.0.0.1:8080/events/stream (http/https URLs are accepted
and protocol-mapped to ws/wss).
There is no default and nothing is derived: the gRPC endpoint and the
HTTP/WebSocket listener are separate addresses. Subscribing without
this option returns ClientError::InvalidArgument with a precise
message.
Sourcepub fn with_auth(self, auth: ClientAuth) -> Self
pub fn with_auth(self, auth: ClientAuth) -> Self
Configures the credential attached to every request.
Sourcepub fn with_tls(self, tls: TlsOptions) -> Self
pub fn with_tls(self, tls: TlsOptions) -> Self
Configures TLS options for the tonic channel.
Sourcepub fn with_namespace(self, namespace: impl Into<String>) -> Self
pub fn with_namespace(self, namespace: impl Into<String>) -> Self
Configures the namespace used by operations unless an operation option overrides it.
Sourcepub fn with_subject(self, subject: impl Into<String>) -> Self
pub fn with_subject(self, subject: impl Into<String>) -> Self
Configures the caller subject metadata sent to the server.
Configures the namespaces advertised in auth metadata.
Sourcepub async fn build(self) -> Result<Client, ClientError>
pub async fn build(self) -> Result<Client, ClientError>
Connects once and returns a cheaply cloneable Client.
§Errors
Returns ClientError::Unavailable for malformed endpoints and failed
channel/TLS handshakes. Server-side credential rejection is surfaced as
ClientError::Unauthenticated when AW returns gRPC Unauthenticated.
Trait Implementations§
Source§impl Clone for ClientBuilder
impl Clone for ClientBuilder
Source§fn clone(&self) -> ClientBuilder
fn clone(&self) -> ClientBuilder
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 ClientBuilder
impl Debug for ClientBuilder
Source§impl From<ClientBuilder> for ClientConfig
impl From<ClientBuilder> for ClientConfig
Source§fn from(builder: ClientBuilder) -> Self
fn from(builder: ClientBuilder) -> Self
Auto Trait Implementations§
impl Freeze for ClientBuilder
impl RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl UnsafeUnpin for ClientBuilder
impl UnwindSafe for ClientBuilder
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<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