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§
source§impl 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§
source§impl Clone for ServiceEndpointsBuilder
impl Clone for ServiceEndpointsBuilder
source§fn clone(&self) -> ServiceEndpointsBuilder
fn clone(&self) -> ServiceEndpointsBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for ServiceEndpointsBuilder
impl RefUnwindSafe for ServiceEndpointsBuilder
impl Send for ServiceEndpointsBuilder
impl Sync for ServiceEndpointsBuilder
impl Unpin for ServiceEndpointsBuilder
impl UnwindSafe for ServiceEndpointsBuilder
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)