pub struct ServiceEndpointsBuilder { /* private fields */ }
Expand description
Used for configuring the SDKs service URLs.
The default behavior, if you do not change any of these properties, is that the SDK will connect to the standard endpoints in the LaunchDarkly production service. There are several use cases for changing these properties:
-
You are using the LaunchDarkly Relay Proxy. In this case, use ServiceEndpointsBuilder::relay_proxy with the URL of the relay proxy instance.
-
You are connecting to a private instance of LaunchDarkly, rather than the standard production services. In this case, there will be custom base URIs for each service. You need to configure each endpoint with ServiceEndpointsBuilder::polling_base_url, ServiceEndpointsBuilder::streaming_base_url, and ServiceEndpointsBuilder::events_base_url.
-
You are connecting to a test fixture that simulates the service endpoints. In this case, you may set the base URLs to whatever you want, although the SDK will still set the URL paths to the expected paths for LaunchDarkly services.
Examples
Configure for a Relay Proxy instance.
ConfigBuilder::new("sdk-key").service_endpoints(ServiceEndpointsBuilder::new()
.relay_proxy("http://my-relay-hostname:8080"));
Configure for a private LaunchDarkly instance.
ConfigBuilder::new("sdk-key").service_endpoints(ServiceEndpointsBuilder::new()
.polling_base_url("https://sdk.my-private-instance.com")
.streaming_base_url("https://stream.my-private-instance.com")
.events_base_url("https://events.my-private-instance.com"));
Implementations
sourceimpl ServiceEndpointsBuilder
impl ServiceEndpointsBuilder
sourcepub fn new() -> ServiceEndpointsBuilder
pub fn new() -> ServiceEndpointsBuilder
Create a new instance of ServiceEndpointsBuilder with no URLs specified.
sourcepub fn polling_base_url(&mut self, url: &str) -> &mut Self
pub fn polling_base_url(&mut self, url: &str) -> &mut Self
Sets a custom base URL for the polling service.
sourcepub fn streaming_base_url(&mut self, url: &str) -> &mut Self
pub fn streaming_base_url(&mut self, url: &str) -> &mut Self
Sets a custom base URL for the streaming service.
sourcepub fn events_base_url(&mut self, url: &str) -> &mut Self
pub fn events_base_url(&mut self, url: &str) -> &mut Self
Sets a custom base URI for the events service.
sourcepub fn relay_proxy(&mut self, url: &str) -> &mut Self
pub fn relay_proxy(&mut self, url: &str) -> &mut Self
Specifies a single base URL for a Relay Proxy instance.
sourcepub fn build(&self) -> Result<ServiceEndpoints, BuildError>
pub fn build(&self) -> Result<ServiceEndpoints, BuildError>
Called internally by the SDK to create a configuration instance. Applications do not need to call this method.
Errors
When using custom endpoints it is important that all of the URLs are set. If some URLs are set, but others are not, then this will return an error. If no URLs are set, then the default values will be used. This prevents a combination of custom and default values from being used.
Trait Implementations
sourceimpl Clone for ServiceEndpointsBuilder
impl Clone for ServiceEndpointsBuilder
sourcefn clone(&self) -> ServiceEndpointsBuilder
fn clone(&self) -> ServiceEndpointsBuilder
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for ServiceEndpointsBuilder
impl Send for ServiceEndpointsBuilder
impl Sync for ServiceEndpointsBuilder
impl Unpin for ServiceEndpointsBuilder
impl UnwindSafe for ServiceEndpointsBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more