Skip to main content

Class Health

Namespace: Consul
Assembly: Consul.dll

Health can be used to query the Health endpoints

public class Health : IHealthEndpoint

Inheritance

objectHealth

Implements

IHealthEndpoint

Inherited Members

object.Equals(object) , object.Equals(object, object) , object.GetHashCode() , object.GetType() , object.MemberwiseClone() , object.ReferenceEquals(object, object) , object.ToString()

Methods

Checks(string, CancellationToken)

Checks is used to return the checks associated with a service

public Task<QueryResult<HealthCheck[]>> Checks(string service, CancellationToken ct = default)

Parameters

service string

The service ID

ct CancellationToken

The cancellation token

Returns

Task <QueryResult <HealthCheck []>>

A query result containing the health checks matching the provided service ID, or a query result with a null response if no service matched the provided ID

Checks(string, QueryOptions, CancellationToken)

Checks is used to return the checks associated with a service

public Task<QueryResult<HealthCheck[]>> Checks(string service, QueryOptions q, CancellationToken ct = default)

Parameters

service string

The service ID

q QueryOptions

Customized query options

ct CancellationToken

Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing

Returns

Task <QueryResult <HealthCheck []>>

A query result containing the health checks matching the provided service ID, or a query result with a null response if no service matched the provided ID

Connect(string, string, bool, QueryOptions, Filter, CancellationToken)

Connect is equivalent to Service, except that it will only return services which are Connect-enabled

public Task<QueryResult<ServiceEntry[]>> Connect(string service, string tag, bool passingOnly, QueryOptions q, Filter filter, CancellationToken ct = default)

Parameters

service string

The service ID

tag string

The service member tag

passingOnly bool

Only return if the health check is in the Passing state

q QueryOptions

Customized query options

filter Filter

Specifies the expression used to filter the queries results prior to returning the data

ct CancellationToken

Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing

Returns

Task <QueryResult <ServiceEntry []>>

This endpoint returns the connection address for Connect client's to use which may be a proxy in front of the named service

Connect(string, string, bool, QueryOptions, CancellationToken)

Service is used to query health information along with service info for a given service. It can optionally do server-side filtering on a tag or nodes with passing health checks only.

public Task<QueryResult<ServiceEntry[]>> Connect(string service, string tag, bool passingOnly, QueryOptions q, CancellationToken ct = default)

Parameters

service string

The service ID

tag string

The service member tag

passingOnly bool

Only return if the health check is in the Passing state

q QueryOptions

Customized query options

ct CancellationToken

Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing

Returns

Task <QueryResult <ServiceEntry []>>

This endpoint returns the nodes providing a Connect-capable service in a given datacenter, or a query result with a null response

Ingress(string, string, bool, QueryOptions, Filter, CancellationToken)

Ingress is equivalent to Service and Connect, except that it will only return ingress services

public Task<QueryResult<ServiceEntry[]>> Ingress(string service, string tag, bool passingOnly, QueryOptions q, Filter filter, CancellationToken ct = default)

Parameters

service string

The service ID

tag string

The service member tag

passingOnly bool

Only return if the health check is in the Passing state

q QueryOptions

Customized query options

filter Filter

Specifies the expression used to filter the queries results prior to returning the data

ct CancellationToken

Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing

Returns

Task <QueryResult <ServiceEntry []>>

This endpoint returns the nodes providing an ingress service in a given datacenter, or a query result with a null response

Ingress(string, string, bool, QueryOptions, CancellationToken)

Ingress is equivalent to Service and Connect, except that it will only return ingress services

public Task<QueryResult<ServiceEntry[]>> Ingress(string service, string tag, bool passingOnly, QueryOptions q, CancellationToken ct = default)

Parameters

service string

The service ID

tag string

The service member tag

passingOnly bool

Only return if the health check is in the Passing state

q QueryOptions

Customized query options

ct CancellationToken

Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing

Returns

Task <QueryResult <ServiceEntry []>>

This endpoint returns the nodes providing an ingress service in a given datacenter, or a query result with a null response

Ingress(string, string, bool, CancellationToken)

Ingress is equivalent to Service and Connect, except that it will only return ingress services

public Task<QueryResult<ServiceEntry[]>> Ingress(string service, string tag, bool passingOnly, CancellationToken ct = default)

Parameters

service string

The service ID

tag string

The service member tag

passingOnly bool

Only return if the health check is in the Passing state

ct CancellationToken

Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing

Returns

Task <QueryResult <ServiceEntry []>>

This endpoint returns the nodes providing an ingress service in a given datacenter, or a query result with a null response

Node(string, CancellationToken)

Node is used to query for checks belonging to a given node

public Task<QueryResult<HealthCheck[]>> Node(string node, CancellationToken ct = default)

Parameters

node string

The node name

ct CancellationToken

The cancellation token

Returns

Task <QueryResult <HealthCheck []>>

A query result containing the health checks matching the provided node ID, or a query result with a null response if no node matched the provided ID

Node(string, QueryOptions, CancellationToken)

Node is used to query for checks belonging to a given node

public Task<QueryResult<HealthCheck[]>> Node(string node, QueryOptions q, CancellationToken ct = default)

Parameters

node string

The node name

q QueryOptions

Customized query options

ct CancellationToken

Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing

Returns

Task <QueryResult <HealthCheck []>>

A query result containing the health checks matching the provided node ID, or a query result with a null response if no node matched the provided ID

Service(string, CancellationToken)

Service is used to query health information along with service info for a given service. It can optionally do server-side filtering on a tag or nodes with passing health checks only.

public Task<QueryResult<ServiceEntry[]>> Service(string service, CancellationToken ct = default)

Parameters

service string

The service ID

ct CancellationToken

The cancellation token

Returns

Task <QueryResult <ServiceEntry []>>

A query result containing the service members matching the provided service ID, or a query result with a null response if no service members matched the filters provided

Service(string, string, CancellationToken)

Service is used to query health information along with service info for a given service. It can optionally do server-side filtering on a tag or nodes with passing health checks only.

public Task<QueryResult<ServiceEntry[]>> Service(string service, string tag, CancellationToken ct = default)

Parameters

service string

The service ID

tag string

The service member tag

ct CancellationToken

The cancellation token

Returns

Task <QueryResult <ServiceEntry []>>

A query result containing the service members matching the provided service ID and tag, or a query result with a null response if no service members matched the filters provided

Service(string, string, bool, CancellationToken)

Service is used to query health information along with service info for a given service. It can optionally do server-side filtering on a tag or nodes with passing health checks only.

public Task<QueryResult<ServiceEntry[]>> Service(string service, string tag, bool passingOnly, CancellationToken ct = default)

Parameters

service string

The service ID

tag string

The service member tag

passingOnly bool

Only return if the health check is in the Passing state

ct CancellationToken

The cancellation token

Returns

Task <QueryResult <ServiceEntry []>>

A query result containing the service members matching the provided service ID, tag, and health status, or a query result with a null response if no service members matched the filters provided

Service(string, string, bool, QueryOptions, CancellationToken)

Service is used to query health information along with service info for a given service. It can optionally do server-side filtering on a tag or nodes with passing health checks only.

public Task<QueryResult<ServiceEntry[]>> Service(string service, string tag, bool passingOnly, QueryOptions q, CancellationToken ct = default)

Parameters

service string

The service ID

tag string

The service member tag

passingOnly bool

Only return if the health check is in the Passing state

q QueryOptions

Customized query options

ct CancellationToken

Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing

Returns

Task <QueryResult <ServiceEntry []>>

A query result containing the service members matching the provided service ID, tag, and health status, or a query result with a null response if no service members matched the filters provided

Service(string, string, bool, QueryOptions, Filter, CancellationToken)

Service is used to query health information along with service info for a given service. It can optionally do server-side filtering on a tag or nodes with passing health checks only.

public Task<QueryResult<ServiceEntry[]>> Service(string service, string tag, bool passingOnly, QueryOptions q, Filter filter, CancellationToken ct = default)

Parameters

service string

The service ID

tag string

The service member tag

passingOnly bool

Only return if the health check is in the Passing state

q QueryOptions

Customized query options

filter Filter

Specifies the expression used to filter the queries results prior to returning the data

ct CancellationToken

Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing

Returns

Task <QueryResult <ServiceEntry []>>

A query result containing the service members matching the provided service ID, tag, and health status, or a query result with a null response if no service members matched the filters provided

State(HealthStatus, CancellationToken)

State is used to retrieve all the checks in a given state. The wildcard "any" state can also be used for all checks.

public Task<QueryResult<HealthCheck[]>> State(HealthStatus status, CancellationToken ct = default)

Parameters

status HealthStatus

The health status to filter for

ct CancellationToken

The cancellation token

Returns

Task <QueryResult <HealthCheck []>>

A query result containing a list of health checks in the specified state, or a query result with a null response if no health checks matched the provided state

State(HealthStatus, QueryOptions, CancellationToken)

// State is used to retrieve all the checks in a given state. The wildcard "any" state can also be used for all checks.

public Task<QueryResult<HealthCheck[]>> State(HealthStatus status, QueryOptions q, CancellationToken ct = default)

Parameters

status HealthStatus

The health status to filter for

q QueryOptions

Customized query options

ct CancellationToken

Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing

Returns

Task <QueryResult <HealthCheck []>>

A query result containing a list of health checks in the specified state, or a query result with a null response if no health checks matched the provided state

  • Methods
    • Checks(string, CancellationToken)
    • Checks(string, QueryOptions, CancellationToken)
    • Connect(string, string, bool, QueryOptions, Filter, CancellationToken)
    • Connect(string, string, bool, QueryOptions, CancellationToken)
    • Ingress(string, string, bool, QueryOptions, Filter, CancellationToken)
    • Ingress(string, string, bool, QueryOptions, CancellationToken)
    • Ingress(string, string, bool, CancellationToken)
    • Node(string, CancellationToken)
    • Node(string, QueryOptions, CancellationToken)
    • Service(string, CancellationToken)
    • Service(string, string, CancellationToken)
    • Service(string, string, bool, CancellationToken)
    • Service(string, string, bool, QueryOptions, CancellationToken)
    • Service(string, string, bool, QueryOptions, Filter, CancellationToken)
    • State(HealthStatus, CancellationToken)
    • State(HealthStatus, QueryOptions, CancellationToken)