Class ServiceEndpoint
Describes a network endpoint for remote service.
Namespace: Neon.Service
Assembly: Neon.Common.dll
Syntax
public class ServiceEndpoint
Constructors
ServiceEndpoint()
Constructor.
Declaration
public ServiceEndpoint()
Properties
ApiInfo
ASP.NET services, this can be set to the metadata used for Swagger documentation
generation related purposes. This defaults to null
.
Declaration
public ServiceApiInfo ApiInfo { get; set; }
Property Value
Type | Description |
---|---|
ServiceApiInfo |
FullUri
Returns the URI for the endpoint. For HTTP and HTTPS endpoints, this will include the service hostname returned by the parent ServiceDescription, along with the port and path prefix. For TCP and UDP protocols, this will use the tcp:// or udp:// scheme along with the hostname and just the port. The path prefix is ignored for TCP and UDP.
When Port is zero for HTTP or HTTPS endpoints, the URL returned will use the default port for thbe protocol (80/443). For TCP and UDP protocols, the port must be a valid non-zero network port.
note
For production, this property returns the partially qualified hostname for the host, including the cluster domain (e.g. cluster.local. Use Uri if you need the relative qualified URI.
Declaration
public Uri FullUri { get; }
Property Value
Type | Description |
---|---|
Uri |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when Port is not valid for the endpoint protocol. |
Name
The endpoint name. This defaults to the empty string.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
string |
PathPrefix
This specifies the path prefix to prepended to URIs accessing this service. This defaults to an empty string. This has meaning only for the HTTP and HTTPS protocols.
Declaration
public string PathPrefix { get; set; }
Property Value
Type | Description |
---|---|
string |
Remarks
note
Any leading forward slash character will be stripped when setting this.
Port
This specifies the network port to be used for URIs accessing this service. This defaults to -1 which indicates that HTTP and HTTPS based endpoints will be initialized to their default ports 80 and 443 so you don't need to specify and explicit ports for these. You will need to set this to a valid port for TCP and UDP protocols.
note
CAUTION: It's best not to rely on this value when setting up your service network endpoints and reference the port from Uri instead because that will always be a valid TCP port number.
Declaration
public int Port { get; set; }
Property Value
Type | Description |
---|---|
int |
Protocol
Specifies the network protocol implemented by this endpoint. This defaults to Http.
Declaration
public ServiceEndpointProtocol Protocol { get; set; }
Property Value
Type | Description |
---|---|
ServiceEndpointProtocol |
ServiceDescription
The parent ServiceDescription.
note
This must be initialized before attempting to reference the endpoint.
Declaration
public ServiceDescription ServiceDescription { get; set; }
Property Value
Type | Description |
---|---|
ServiceDescription |
Uri
Returns the URI for the endpoint. For HTTP and HTTPS endpoints, this will include the service hostname returned by the parent ServiceDescription, along with the port and path prefix. For TCP and UDP protocols, this will use the tcp:// or udp:// scheme along with the hostname and just the port. The path prefix is ignored for TCP and UDP.
When Port is -1 for HTTP or HTTPS endpoints, the URL returned will use the default port for thbe protocol (80/443). For TCP and UDP protocols, the port must be a valid (non-negative) network port.
note
For production, this property returns the partially qualified hostname for the host, omitting the cluster domain (e.g. cluster.local). Use FullUri if you need the fully qualified URI.
Declaration
public Uri Uri { get; }
Property Value
Type | Description |
---|---|
Uri |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when Port is not valid for the endpoint protocol. |