Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PreparedQueryDefinition

Defines a prepared query.

Hierarchy

  • PreparedQueryDefinition

Index

Constructors

constructor

Methods

getDcs

  • getDcs(): string[]
  • Specifies a fixed list of remote datacenters to forward the query to if there are no healthy nodes in the local datacenter. Datacenters are queried in the order given in the list. If this option is combined with NearestN, then the NearestN queries will be performed first, followed by the list given by Datacenters. A given datacenter will only be queried one time during a failover, even if it is selected by both NearestN and is listed in Datacenters.

    Returns string[]

getDnsTtl

  • getDnsTtl(): string
  • Set the TTL duration when query results are served over DNS. If this is specified, it will take precedence over any Consul agent-specific configuration.

    Returns string

getId

  • getId(): string
  • Set ID of the query, always generated by Consul

    Returns string

getMeta

  • getMeta(): {}
  • Set a list of user-defined key/value pairs that will be used for filtering the query results to nodes with the given metadata values present.

    Returns {}

    • [key: string]: string

getName

  • getName(): string
  • Set an optional friendly name that can be used to execute a query instead of using its ID

    Returns string

getNearestN

  • getNearestN(): number
  • Specifies that the query will be forwarded to up to NearestN other datacenters based on their estimated network round trip time using Network Coordinates from the WAN gossip pool. The median round trip time from the server handling the query to the servers in the remote datacenter is used to determine the priority.

    Returns number

getPassing

  • getPassing(): boolean
  • Specifies the behavior of the query's health check filtering. If this is set to false, the results will include nodes with checks in the passing as well as the warning states. If this is set to true, only nodes with checks in the passing state will be returned.

    Returns boolean

getService

  • getService(): string
  • Set the name of the service to query

    Returns string

getSession

  • getSession(): string
  • Set the ID of an existing session. This provides a way to automatically remove a prepared query when the given session is invalidated. If not given the prepared query must be manually removed when no longer needed.

    Returns string

getTags

  • getTags(): string[]
  • Set a list of service tags to filter the query results. For a service to pass the tag filter it must have all of the required tags, and none of the excluded tags (prefixed with !).

    Returns string[]

getTemplateRegexp

  • getTemplateRegexp(): string
  • Set regular expression which is used to extract fields from the entire name, once this template is selected.

    Returns string

getTemplateType

  • getTemplateType(): string
  • The template type, which must be name_prefix_match. This means that the template will apply to any query lookup with a name whose prefix matches the Name field of the template.

    Returns string

getToken

  • getToken(): string
  • Set the ACL token to use each time the query is executed. This allows queries to be executed by clients with lesser or even no ACL Token, so this should be used with care.

    Returns string

setDcs

  • Specifies a fixed list of remote datacenters to forward the query to if there are no healthy nodes in the local datacenter. Datacenters are queried in the order given in the list. If this option is combined with NearestN, then the NearestN queries will be performed first, followed by the list given by Datacenters. A given datacenter will only be queried one time during a failover, even if it is selected by both NearestN and is listed in Datacenters.

    Parameters

    • dcs: string[]

    Returns PreparedQueryDefinition

setDnsTtl

  • Set the TTL duration when query results are served over DNS. If this is specified, it will take precedence over any Consul agent-specific configuration.

    Parameters

    • dnsTtl: string

    Returns PreparedQueryDefinition

setId

  • Set ID of the query, always generated by Consul

    Parameters

    • id: string

    Returns PreparedQueryDefinition

setMeta

  • Set a list of user-defined key/value pairs that will be used for filtering the query results to nodes with the given metadata values present.

    Parameters

    • meta: {}
      • [key: string]: string

    Returns PreparedQueryDefinition

setName

  • Set an optional friendly name that can be used to execute a query instead of using its ID

    Parameters

    • name: string

    Returns PreparedQueryDefinition

setNearestN

  • Specifies that the query will be forwarded to up to NearestN other datacenters based on their estimated network round trip time using Network Coordinates from the WAN gossip pool. The median round trip time from the server handling the query to the servers in the remote datacenter is used to determine the priority.

    Parameters

    • nearestN: number

    Returns PreparedQueryDefinition

setPassing

  • Specifies the behavior of the query's health check filtering. If this is set to false, the results will include nodes with checks in the passing as well as the warning states. If this is set to true, only nodes with checks in the passing state will be returned.

    Parameters

    • passing: boolean

    Returns PreparedQueryDefinition

setService

  • Set the name of the service to query

    Parameters

    • service: string

    Returns PreparedQueryDefinition

setSession

  • Set the ID of an existing session. This provides a way to automatically remove a prepared query when the given session is invalidated. If not given the prepared query must be manually removed when no longer needed.

    Parameters

    • session: string

    Returns PreparedQueryDefinition

setTags

  • Set a list of service tags to filter the query results. For a service to pass the tag filter it must have all of the required tags, and none of the excluded tags (prefixed with !).

    Parameters

    • tags: string[]

    Returns PreparedQueryDefinition

setTemplateRegexp

  • Set regular expression which is used to extract fields from the entire name, once this template is selected.

    Parameters

    • templateRegexp: string

    Returns PreparedQueryDefinition

setTemplateType

  • The template type, which must be name_prefix_match. This means that the template will apply to any query lookup with a name whose prefix matches the Name field of the template.

    Parameters

    • templateType: string

    Returns PreparedQueryDefinition

setToken

  • Set the ACL token to use each time the query is executed. This allows queries to be executed by clients with lesser or even no ACL Token, so this should be used with care.

    Parameters

    • token: string

    Returns PreparedQueryDefinition

toJson

  • toJson(): {}
  • Returns {}

    • [key: string]: any

Generated using TypeDoc