# Cheatsheets

## AclToken

Holds properties of Acl token

Name | Type | Description
`id` | `String` | Set ID of token
`name` | `String` | Set name of token
`rules` | `String` | Set rules for token
`type` | `AclTokenType` | Set type of token

## BlockingQueryOptions

Options used to perform blocking query that used to wait for a potential change using long polling.

Name | Type | Description
`index` | `Number (long)` | Set index indicating that the client wishes to wait for any changes subsequent to that index.
`wait` | `String` | Specifying a maximum duration for the blocking request. This is limited to 10 minutes. If not set, the wait time defaults to 5 minutes. This value can be specified in the form of "10s" or "5m" (i.e., 10 seconds or 5 minutes, respectively).

## Check

Holds check properties

Name | Type | Description
`id` | `String` | Set the ID of check
`name` | `String` | Set the name of check
`nodeName` | `String` | Set the name of node
`notes` | `String` | Set the human-readable note of check
`output` | `String` | Set the output of check
`serviceId` | `String` | Set the ID of service with which this check associated
`serviceName` | `String` | Set the name of service with which this check associated
`status` | `CheckStatus` | Set the status of check

## CheckOptions

Options used to register checks in Consul.

Name | Type | Description
`http` | `String` | Set HTTP address to check. Also you should set checking interval
`id` | `String` | Set check ID
`interval` | `String` | Set checking interval
`name` | `String` | Set check name. This is mandatory field
`notes` | `String` | Set check notes
`script` | `String` | Set path to checking script. Also you should set checking interval
`serviceId` | `String` | Set the service ID to associate the registered check with an existing service provided by the agent.
`status` | `CheckStatus` | Set the check status to specify the initial state of the health check.
`tcp` | `String` | Set TCP address to check. Also you should set checking interval
`ttl` | `String` | Set Time to Live of check.

## ConsulClientOptions

Options used to create Consul client.

Name | Type | Description
`aclToken` | `String` | Set the ACL token. When provided, the client will use this token when making requests to the Consul by providing the "?token" query parameter. When not provided, the empty token, which maps to the 'anonymous' ACL policy, is used.
`dc` | `String` | Set the datacenter name. When provided, the client will use it when making requests to the Consul by providing the "?dc" query parameter. When not provided, the datacenter of the consul agent is queried.
`host` | `String` | Set Consul host. Defaults to `localhost`
`pemTrustOptions` | `PemTrustOptions` | Set the trust options.
`port` | `Number (int)` | Set Consul HTTP API port. Defaults to `8500`
`ssl` | `Boolean` | Set whether SSL/TLS is enabled
`timeoutMs` | `Number (long)` | Sets the amount of time (in milliseconds) after which if the request does not return any data within the timeout period an failure will be passed to the handler and the request will be closed.
`trustAll` | `Boolean` | Set whether all server certificates should be trusted

## Coordinate

Holds network coordinates of node

Name | Type | Description
`adj` | `Number (float)` | Set adjustment
`err` | `Number (float)` | Set error
`height` | `Number (float)` | Set height
`node` | `String` | Set name of node
`vec` | `Array of Number (Float)` | Set vector

## CoordinateList

Holds result of network coordinates query

Name | Type | Description
`index` | `Number (long)` | Set Consul index, a unique identifier representing the current state of the requested coordinates
`list` | `Array of Coordinate` | Set list of coordinates

## DcCoordinates

Holds coordinates of servers in datacenter

Name | Type | Description
`datacenter` | `String` | Set datacenter
`servers` | `Array of Coordinate` | Set list of servers in datacenter

## Event

Holds properties of Consul event

Name | Type | Description
`id` | `String` | Set ID of event
`lTime` | `Number (int)` | Set the Lamport clock time
`name` | `String` | Set name of event
`node` | `String` | Set regular expression to filter by node name
`payload` | `String` | Set payload of event
`service` | `String` | Set regular expression to filter by service
`tag` | `String` | Set regular expression to filter by tag
`version` | `Number (int)` | Set version

## EventList

Holds result of events query

Name | Type | Description
`index` | `Number (long)` | Set Consul index, a unique identifier representing the current state of the requested events
`list` | `Array of Event` | Set list of events

## EventOptions

Options used to trigger a new user event.

Name | Type | Description
`node` | `String` | Set regular expression to filter by node name
`payload` | `String` | Set payload of event
`service` | `String` | Set regular expression to filter by service
`tag` | `String` | Set regular expression to filter by tag

## KeyValue

Represents key/value pair stored in Consul

Name | Type | Description
`createIndex` | `Number (long)` | Set the internal index value that represents when the entry was created.
`flags` | `Number (long)` | Set the flags attached to this entry. Clients can choose to use this however makes sense for their application.
`key` | `String` | Set the key
`lockIndex` | `Number (long)` | Set the number of times this key has successfully been acquired in a lock.
`modifyIndex` | `Number (long)` | Set the last index that modified this key.
`session` | `String` | Set the session that owns the lock
`value` | `String` | Set the value

## KeyValueList

Holds result of key/value pairs query

Name | Type | Description
`index` | `Number (long)` | Set Consul index
`list` | `Array of KeyValue` | Set list of key/value pairs

## KeyValueOptions

Options used to put key/value pair to Consul.

Name | Type | Description
`acquireSession` | `String` | Set session ID for lock acquisition operation.
`casIndex` | `Number (long)` | Set the Check-And-Set index. If the index is `0`, Consul will only put the key if it does not already exist. If the index is non-zero, the key is only set if the index matches the ModifyIndex of that key.
`flags` | `Number (long)` | Set the flags. Flags is an value between `0` and 264-1 that can be attached to each entry. Clients can choose to use this however makes sense for their application.
`releaseSession` | `String` | Set session ID for lock release operation.

## MaintenanceOptions

Options used to placing a given service into "maintenance mode". During maintenance mode, the service will be marked as unavailable and will not be present in DNS or API queries. Maintenance mode is persistent and will be automatically restored on agent restart.

Name | Type | Description
`enable` | `Boolean` | Set maintenance mode to enabled: `true` to enter maintenance mode or `false` to resume normal operation. This flag is required.
`id` | `String` | Set the ID of service. This field is required.
`reason` | `String` | Set the reason message. If provided, its value should be a text string explaining the reason for placing the service into maintenance mode. This is simply to aid human operators.

## Node

Name | Type | Description
`address` | `String` | Set node address
`lanAddress` | `String` | Set node lan address
`name` | `String` | Set node name
`wanAddress` | `String` | Set node wan address

## NodeList

Holds result of nodes query

Name | Type | Description
`index` | `Number (long)` | Set Consul index, a unique identifier representing the current state of the requested list of nodes
`list` | `Array of Node` | Set list of nodes

## NodeQueryOptions

Options used to requesting list of nodes

Name | Type | Description
`blockingOptions` | `BlockingQueryOptions` | Set options for blocking query
`near` | `String` | Set node name for sorting the list in ascending order based on the estimated round trip time from that node.

## Service

Holds properties of service and node that its containing

Name | Type | Description
`address` | `String` | Set service address
`id` | `String` | Set ID of service
`name` | `String` | Set service name
`node` | `String` | Set node name
`nodeAddress` | `String` | Set node address
`port` | `Number (int)` | Set service port
`tags` | `Array of String` | Set list of service tags

## ServiceEntry

Holds properties of service, node and related checks

Name | Type | Description
`checks` | `Array of Check` | Set list of checks
`node` | `Node` | Set node
`service` | `Service` | Set service

## ServiceEntryList

Holds list of services, nodes and related checks

Name | Type | Description
`index` | `Number (long)` | Set Consul index, a unique identifier representing the current state of the requested list of services
`list` | `Array of ServiceEntry` | Set list of services

## ServiceList

Holds result of services query

Name | Type | Description
`index` | `Number (long)` | Set Consul index, a unique identifier representing the current state of the requested list of services
`list` | `Array of Service` | Set list of services

## ServiceOptions

Options used to register service.

Name | Type | Description
`address` | `String` | Set service address
`checkOptions` | `CheckOptions` | Set check options of service
`id` | `String` | Set the ID of session
`name` | `String` | Set service name
`port` | `Number (int)` | Set service port
`tags` | `Array of String` | Set list of tags associated with service

## ServiceQueryOptions

Options used to requesting list of services

Name | Type | Description
`blockingOptions` | `BlockingQueryOptions` | Set options for blocking query
`near` | `String` | Set node name for sorting the list in ascending order based on the estimated round trip time from that node.
`tag` | `String` | Set tag for filtering request results

## Session

Holds properties of Consul sessions

Name | Type | Description
`checks` | `Array of String` | Set the list of associated health checks
`createIndex` | `Number (long)` | Set the create index of session
`id` | `String` | Set the ID of node
`index` | `Number (long)` | Set Consul index
`lockDelay` | `Number (long)` | Set the Lock delay of session
`node` | `String` | Set the ID of node

## SessionList

Holds result of sessions query

Name | Type | Description
`index` | `Number (long)` | Set Consul index, a unique identifier representing the current state of the requested list of sessions
`list` | `Array of Session` | Set list of sessions

## SessionOptions

Options used to create session.

Name | Type | Description
`behavior` | `SessionBehavior` | Set the behavior when a session is invalidated. The release behavior is the default if none is specified.
`checks` | `Array of String` | Set a list of associated health checks. It is highly recommended that, if you override this list, you include the default "serfHealth"
`lockDelay` | `Number (long)` | Set the lock-delay period.
`name` | `String` | Set the human-readable name for the Session
`node` | `String` | Set the node to which the session will be assigned
`ttl` | `Number (long)` | Set the TTL interval. When TTL interval expires without being renewed, the session has expired and an invalidation is triggered. If specified, it must be between 10s and 86400s currently.

## TxnError

Holds information describing which operations failed if the transaction was rolled back.

Name | Type | Description
`opIndex` | `Number (int)` | Set the index of the failed operation in the transaction
`what` | `String` | Set error message about why that operation failed.

## TxnKVOperation

Holds operation to apply to the key/value store inside a transaction

Name | Type | Description
`flags` | `Number (long)` | Set the flags attached to this entry. Clients can choose to use this however makes sense for their application.
`index` | `Number (long)` | Set the index used for locking, unlocking, and check-and-set operations.
`key` | `String` | Set the key
`session` | `String` | Set the session used for locking, unlocking, and check-and-set operations.
`type` | `TxnKVVerb` | Set the type of operation to perform
`value` | `String` | Set the value

## TxnRequest

Holds list of operations in transaction

Name | Type | Description
`operationsSize` | `Number (int)` | Returns the number of operations in this request

## TxnResponse

Holds results of transaction

Name | Type | Description
`errors` | `Array of TxnError` | Adds error to this response
`errorsSize` | `Number (int)` | Returns the number of errors in this response
`resultsSize` | `Number (int)` | Returns the number of results in this response