Class ServiceHostConfiguration
A class representing a configuration for the service environment for the application.
Inherited Members
Namespace: Unity.Cloud.Common
Syntax
[Obsolete("Use ServiceHostResolver instead.")]
public sealed class ServiceHostConfiguration : IServiceHostResolver
Fields
k_DefaultEnvironment
Declaration
public const ServiceEnvironment k_DefaultEnvironment = ServiceEnvironment.Production
Field Value
| Type | Description |
|---|---|
| ServiceEnvironment |
Properties
SystemOverrideEnvironmentVariableName
The environment variable key for the service environment override.
Declaration
public static string SystemOverrideEnvironmentVariableName { get; }
Property Value
| Type | Description |
|---|---|
| String |
SystemOverrideProviderVariableName
The environment variable key for the service domain provider override.
Declaration
public static string SystemOverrideProviderVariableName { get; }
Property Value
| Type | Description |
|---|---|
| String |
Methods
GetResolvedAddress(ServiceProtocol)
Returns the service address for the specified inputs.
Declaration
public string GetResolvedAddress(ServiceProtocol protocol = ServiceProtocol.Http)
Parameters
| Type | Name | Description |
|---|---|---|
| ServiceProtocol | protocol | The web protocol. |
Returns
| Type | Description |
|---|---|
| String | The service address. |
Implements
GetResolvedDomainProvider()
Gets the resolved the ServiceDomainProvider.
Declaration
public ServiceDomainProvider GetResolvedDomainProvider()
Returns
| Type | Description |
|---|---|
| ServiceDomainProvider | The resolved service domain provider. |
Implements
GetResolvedEnvironment()
Gets the resolved ServiceEnvironment.
Declaration
public ServiceEnvironment GetResolvedEnvironment()
Returns
| Type | Description |
|---|---|
| ServiceEnvironment | The resolved environment. |
Implements
GetResolvedRequestUri(String, ServiceProtocol)
Resolves and returns the request URI for the specified path and protocol.
Declaration
public string GetResolvedRequestUri(string path, ServiceProtocol protocol = ServiceProtocol.Http)
Parameters
| Type | Name | Description |
|---|---|---|
| String | path | The request path. |
| ServiceProtocol | protocol | The web protocol. |
Returns
| Type | Description |
|---|---|
| String | The Uri string. |
Implements
GetServiceAddress(ServiceEnvironment, ServiceDomainProvider, String, Int32, ServiceProtocol, String)
Returns the service address for the specified inputs.
Declaration
public string GetServiceAddress(ServiceEnvironment environmentOverride, ServiceDomainProvider serviceDomainProviderOverride, string subdomain, int port, ServiceProtocol protocol, string serviceName)
Parameters
| Type | Name | Description |
|---|---|---|
| ServiceEnvironment | environmentOverride | The service environment override. |
| ServiceDomainProvider | serviceDomainProviderOverride | The service domain provider. |
| String | subdomain | The service subdomain. |
| Int32 | port | The service port. |
| ServiceProtocol | protocol | The web protocol. |
| String | serviceName | The service's name. |
Returns
| Type | Description |
|---|---|
| String | The service address. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
GetServiceAddress(ServiceEnvironment, ServiceDomainProvider, ServiceProtocol, String)
Returns the service address for the specified inputs.
Declaration
public string GetServiceAddress(ServiceEnvironment environmentOverride, ServiceDomainProvider serviceDomainProviderOverride, ServiceProtocol protocol = ServiceProtocol.Http, string serviceName = "project")
Parameters
| Type | Name | Description |
|---|---|---|
| ServiceEnvironment | environmentOverride | The service environment override. |
| ServiceDomainProvider | serviceDomainProviderOverride | The service domain provider. |
| ServiceProtocol | protocol | The web protocol. |
| String | serviceName | The service's name. |
Returns
| Type | Description |
|---|---|
| String | The service address. |
GetServiceAddress(ServiceProtocol, String)
Returns the service address for the specified inputs.
Declaration
public string GetServiceAddress(ServiceProtocol protocol = ServiceProtocol.Http, string serviceName = "project")
Parameters
| Type | Name | Description |
|---|---|---|
| ServiceProtocol | protocol | The web protocol. |
| String | serviceName | The service's name. |
Returns
| Type | Description |
|---|---|
| String | The service address. |
GetServiceDomain()
Will return the domain for the resolved ServiceDomainProvider.
Declaration
public string GetServiceDomain()
Returns
| Type | Description |
|---|---|
| String | The domain for the specified provider. |
GetServiceDomain(ServiceDomainProvider)
Will return the domain for a given ServiceDomainProvider.
Declaration
public string GetServiceDomain(ServiceDomainProvider serviceDomainProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| ServiceDomainProvider | serviceDomainProvider | The service domain provider. |
Returns
| Type | Description |
|---|---|
| String | The domain for the specified provider. |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if the ServiceDomainProvider is not mapped to a domain. |
ResolveEnvironment(Nullable<ServiceEnvironment>)
Resolves the ServiceEnvironment, prioritizing the override set via the Environment Variable.
Declaration
public (ServiceEnvironment environment, string url) ResolveEnvironment(ServiceEnvironment? environmentOverride = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Nullable<ServiceEnvironment> | environmentOverride | The service environment override. |
Returns
| Type | Description |
|---|---|
| (T1, T2)<ServiceEnvironment, String> | The resolved environment and url. |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException |
ResolveProvider(Nullable<ServiceDomainProvider>)
Resolves the ServiceDomainProvider, prioritizing the override set via the Environment Variable.
Declaration
public ServiceDomainProvider ResolveProvider(ServiceDomainProvider? providerOverride = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Nullable<ServiceDomainProvider> | providerOverride | The service environment override. |
Returns
| Type | Description |
|---|---|
| ServiceDomainProvider | The resolved environment and url. |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException |