add ApplyDefaults method for EndpointOpts
diff --git a/endpoint_search.go b/endpoint_search.go
index 7c80dea..16e170d 100644
--- a/endpoint_search.go
+++ b/endpoint_search.go
@@ -49,3 +49,13 @@
// EndpointLocator is a function that describes how to locate a single endpoint from a service catalog for a specific ProviderClient.
// It should be set during ProviderClient authentication and used to discover related ServiceClients.
type EndpointLocator func(EndpointOpts) (string, error)
+
+// ApplyDefaults sets EndpointOpts fields if not already set. Currently, EndpointOpts.Availability defaults to the public endpoint.
+func (eo *EndpointOpts) ApplyDefaults(t string) {
+ if eo.Type == "" {
+ eo.Type = t
+ }
+ if eo.Availability == "" {
+ eo.Availability = AvailabilityPublic
+ }
+}