agent

package
v1.8.11-beta1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2021 License: MPL-2.0 Imports: 106 Imported by: 170

Documentation

Index

Constants

View Source
const (
	ConfigSourceLocal configSource = iota
	ConfigSourceRemote
)
View Source
const (
	SerfLANKeyring = "serf/local.keyring"
	SerfWANKeyring = "serf/remote.keyring"
)
View Source
const (
	TestDefaultMasterToken      = "d9f05e83-a7ae-47ce-839e-c0d53a68c00a"
	TestDefaultAgentMasterToken = "bca580d4-db07-4074-b766-48acc9676955'"
)
View Source
const ConfigEntryNotFoundErr string = "Config entry not found"
View Source
const (
	// Limit the size of a watch handlers's output to the
	// last WatchBufSize. Prevents an enormous buffer
	// from being captured
	WatchBufSize = 4 * 1024 // 4KB
)

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func ConfigSourceFromName added in v1.6.2

func ConfigSourceFromName(name string) (configSource, bool)

ConfigSourceFromName will unmarshal the string form of a configSource.

func ForwardSignals added in v1.0.0

func ForwardSignals(cmd *exec.Cmd, logFn func(error), shutdownCh <-chan struct{})

ForwardSignals will fire up a goroutine to forward signals to the given subprocess until the shutdown channel is closed.

func GetDNSConfig added in v1.0.0

func GetDNSConfig(conf *config.RuntimeConfig) (*dnsConfig, error)

GetDNSConfig takes global config and creates the config used by DNS server

func LocalConfig added in v1.0.1

func LocalConfig(cfg *config.RuntimeConfig) local.Config

LocalConfig takes a config.RuntimeConfig and maps the fields to a local.Config

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func NewDurationFixer added in v1.0.1

func NewDurationFixer(fields ...string) durationFixer

func NodeID added in v1.0.0

func NodeID() string

func ParseRelayFactor

func ParseRelayFactor(n int) (uint8, error)

ParseRelayFactor validates and converts the given relay factor to uint8

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

func TestACLConfig

func TestACLConfig() string

TestACLConfig returns a default configuration for testing an agent with ACLs.

func TestACLConfigNew added in v1.5.0

func TestACLConfigNew() string

func TestACLConfigWithParams added in v1.7.0

func TestACLConfigWithParams(params *TestACLConfigParams) string

func TestConfig

func TestConfig(logger hclog.Logger, sources ...config.Source) *config.RuntimeConfig

TestConfig returns a unique default configuration for testing an agent.

func TestConfigHCL added in v1.8.1

func TestConfigHCL(nodeID string) string

func ValidateLocalOnly added in v1.6.0

func ValidateLocalOnly(local bool, list bool) error

ValidateLocalOnly validates the local-only flag, requiring that it only be set for list requests.

Types

type Agent

type Agent struct {

	// In-memory sink used for collecting metrics
	MemSink MetricsHandler

	// state stores a local representation of the node,
	// services and checks. Used for anti-entropy.
	State *local.State
	// contains filtered or unexported fields
}

Agent is the long running process that is run on every machine. It exposes an RPC interface that is used by the CLI to control the agent. The agent runs the query interfaces like HTTP, DNS, and RPC. However, it can run in either a client, or server mode. In server mode, it runs a full Consul server. In client-only mode, it only forwards requests to other Consul servers.

func New

func New(bd BaseDeps) (*Agent, error)

New process the desired options and creates a new Agent. This process will

  • parse the config given the config Flags
  • setup logging
  • using predefined logger given in an option OR
  • initialize a new logger from the configuration including setting up gRPC logging
  • initialize telemetry
  • create a TLS Configurator
  • build a shared connection pool
  • create the ServiceManager
  • setup the NodeID if one isn't provided in the configuration
  • create the AutoConfig object for future use in fully resolving the configuration

func (*Agent) AddCheck

func (a *Agent) AddCheck(check *structs.HealthCheck, chkType *structs.CheckType, persist bool, token string, source configSource) error

AddCheck is used to add a health check to the agent. This entry is persistent and the agent will make a best effort to ensure it is registered. The Check may include a CheckType which is used to automatically update the check status

func (*Agent) AddService

func (a *Agent) AddService(service *structs.NodeService, chkTypes []*structs.CheckType, persist bool, token string, source configSource) error

AddService is used to add a service entry. This entry is persistent and the agent will make a best effort to ensure it is registered

func (*Agent) AddServiceAndReplaceChecks added in v1.6.1

func (a *Agent) AddServiceAndReplaceChecks(service *structs.NodeService, chkTypes []*structs.CheckType, persist bool, token string, source configSource) error

AddServiceAndReplaceChecks is used to add a service entry and its check. Any check for this service missing from chkTypes will be deleted. This entry is persistent and the agent will make a best effort to ensure it is registered

func (*Agent) AdvertiseAddrLAN added in v1.6.2

func (a *Agent) AdvertiseAddrLAN() string

AdvertiseAddrLAN returns the AdvertiseAddrLAN config value

func (*Agent) ConnectAuthorize added in v1.3.0

func (a *Agent) ConnectAuthorize(token string,
	req *structs.ConnectAuthorizeRequest) (allowed bool, reason string, m *cache.ResultMeta, err error)

ConnectAuthorize implements the core authorization logic for Connect. It's in a separate agent method here because we need to re-use this both in our own HTTP API authz endpoint and in the gRPX xDS/ext_authz API for envoy.

The ACL token and the auth request are provided and the auth decision (true means authorized) and reason string are returned.

If the request input is invalid the error returned will be a BadRequestError, if the token doesn't grant necessary access then an acl.ErrPermissionDenied error is returned, otherwise error indicates an unexpected server failure. If access is denied, no error is returned but the first return value is false.

func (*Agent) DisableNodeMaintenance

func (a *Agent) DisableNodeMaintenance()

DisableNodeMaintenance removes a node from maintenance mode

func (*Agent) DisableServiceMaintenance

func (a *Agent) DisableServiceMaintenance(serviceID structs.ServiceID) error

DisableServiceMaintenance will deregister the fake maintenance mode check if the service has been marked as in maintenance.

func (*Agent) EnableNodeMaintenance

func (a *Agent) EnableNodeMaintenance(reason, token string)

EnableNodeMaintenance places a node into maintenance mode.

func (*Agent) EnableServiceMaintenance

func (a *Agent) EnableServiceMaintenance(serviceID structs.ServiceID, reason, token string) error

EnableServiceMaintenance will register a false health check against the given service ID with critical status. This will exclude the service from queries.

func (*Agent) ForceLeave

func (a *Agent) ForceLeave(node string, prune bool) (err error)

ForceLeave is used to remove a failed node from the cluster

func (*Agent) GetConfig added in v1.8.1

func (a *Agent) GetConfig() *config.RuntimeConfig

GetConfig retrieves the agents config TODO make export the config field and get rid of this method This is here for now to simplify the work I am doing and make reviewing the final PR easier.

func (*Agent) GetLANCoordinate

func (a *Agent) GetLANCoordinate() (lib.CoordinateSet, error)

GetLANCoordinate returns the coordinates of this node in the local pools (assumes coordinates are enabled, so check that before calling).

func (*Agent) InstallKey

func (a *Agent) InstallKey(key, token string, relayFactor uint8) (*structs.KeyringResponses, error)

InstallKey installs a new gossip encryption key

func (*Agent) IsMember added in v1.7.0

func (a *Agent) IsMember(nodeName string) bool

IsMember is used to check if a node with the given nodeName is a member

func (*Agent) JoinLAN

func (a *Agent) JoinLAN(addrs []string) (n int, err error)

JoinLAN is used to have the agent join a LAN cluster

func (*Agent) JoinWAN

func (a *Agent) JoinWAN(addrs []string) (n int, err error)

JoinWAN is used to have the agent join a WAN cluster

func (*Agent) LANMembers

func (a *Agent) LANMembers() []serf.Member

LANMembers is used to retrieve the LAN members

func (*Agent) LastUserEvent

func (a *Agent) LastUserEvent() *UserEvent

LastUserEvent is used to return the last user event. This will return nil if there is no recent event.

func (*Agent) Leave

func (a *Agent) Leave() error

Leave is used to prepare the agent for a graceful shutdown

func (*Agent) ListKeys

func (a *Agent) ListKeys(token string, localOnly bool, relayFactor uint8) (*structs.KeyringResponses, error)

ListKeys lists out all keys installed on the collective Consul cluster. This includes both servers and clients in all DC's.

func (*Agent) LocalBlockingQuery added in v1.6.2

func (a *Agent) LocalBlockingQuery(alwaysBlock bool, hash string, wait time.Duration,
	fn func(ws memdb.WatchSet) (string, interface{}, error)) (string, interface{}, error)

LocalBlockingQuery performs a blocking query in a generic way against local agent state that has no RPC or raft to back it. It uses `hash` parameter instead of an `index`. `alwaysBlock` determines whether we block if the provided hash is empty. Callers like the AgentService endpoint will want to return the current result if a hash isn't provided. On the other hand, for cache notifications we always want to block. This avoids an empty first response.

func (*Agent) LocalMember

func (a *Agent) LocalMember() serf.Member

LocalMember is used to return the local node

func (*Agent) LocalState added in v1.6.2

func (a *Agent) LocalState() *local.State

LocalState returns the agent's local state

func (*Agent) PauseSync

func (a *Agent) PauseSync()

PauseSync is used to pause anti-entropy while bulk changes are made. It also sets state that agent-local watches use to "ride out" config reloads and bulk updates which might spuriously unload state and reload it again.

func (*Agent) PickRandomMeshGatewaySuitableForDialing added in v1.8.0

func (a *Agent) PickRandomMeshGatewaySuitableForDialing(dc string) string

PickRandomMeshGatewaySuitableForDialing is a convenience function used for writing tests.

func (*Agent) PrimaryMeshGatewayAddressesReadyCh added in v1.8.0

func (a *Agent) PrimaryMeshGatewayAddressesReadyCh() <-chan struct{}

PrimaryMeshGatewayAddressesReadyCh returns a channel that will be closed when federation state replication ships back at least one primary mesh gateway (not via fallback config).

func (*Agent) RPC

func (a *Agent) RPC(method string, args interface{}, reply interface{}) error

RPC is used to make an RPC call to the Consul servers This allows the agent to implement the Consul.Interface

func (*Agent) RefreshPrimaryGatewayFallbackAddresses added in v1.8.0

func (a *Agent) RefreshPrimaryGatewayFallbackAddresses(addrs []string) error

RefreshPrimaryGatewayFallbackAddresses is used to update the list of current fallback addresses for locating mesh gateways in the primary datacenter.

func (*Agent) ReloadConfig

func (a *Agent) ReloadConfig() error

ReloadConfig will atomically reload all configuration, including all services, checks, tokens, metadata, dnsServer configs, etc. It will also reload all ongoing watches.

func (*Agent) RemoveCheck

func (a *Agent) RemoveCheck(checkID structs.CheckID, persist bool) error

RemoveCheck is used to remove a health check. The agent will make a best effort to ensure it is deregistered

func (*Agent) RemoveKey

func (a *Agent) RemoveKey(key, token string, relayFactor uint8) (*structs.KeyringResponses, error)

RemoveKey will remove a gossip encryption key from the keyring

func (*Agent) RemoveService

func (a *Agent) RemoveService(serviceID structs.ServiceID) error

RemoveService is used to remove a service entry. The agent will make a best effort to ensure it is deregistered

func (*Agent) ResumeSync

func (a *Agent) ResumeSync()

ResumeSync is used to unpause anti-entropy after bulk changes are make

func (*Agent) RetryJoinCh

func (a *Agent) RetryJoinCh() <-chan error

RetryJoinCh is a channel that transports errors from the retry join process.

func (*Agent) ServiceHTTPBasedChecks added in v1.6.2

func (a *Agent) ServiceHTTPBasedChecks(serviceID structs.ServiceID) []structs.CheckType

ServiceHTTPBasedChecks returns HTTP and GRPC based Checks for the given serviceID

func (*Agent) ShutdownAgent

func (a *Agent) ShutdownAgent() error

ShutdownAgent is used to hard stop the agent. Should be preceded by Leave to do it gracefully. Should be followed by ShutdownEndpoints to terminate the HTTP and DNS servers as well.

func (*Agent) ShutdownCh

func (a *Agent) ShutdownCh() <-chan struct{}

ShutdownCh is used to return a channel that can be selected to wait for the agent to perform a shutdown.

func (*Agent) ShutdownEndpoints

func (a *Agent) ShutdownEndpoints()

ShutdownEndpoints terminates the HTTP and DNS servers. Should be preceded by ShutdownAgent.

func (*Agent) Start

func (a *Agent) Start(ctx context.Context) error

Start verifies its configuration and runs an agent's various subprocesses.

func (*Agent) StartSync

func (a *Agent) StartSync()

StartSync is called once Services and Checks are registered. This is called to prevent a race between clients and the anti-entropy routines

func (*Agent) Stats

func (a *Agent) Stats() map[string]map[string]string

Stats is used to get various debugging state from the sub-systems

func (*Agent) SyncPausedCh added in v1.6.2

func (a *Agent) SyncPausedCh() <-chan struct{}

SyncPausedCh returns either a channel or nil. If nil sync is not paused. If non-nil, the channel will be closed when sync resumes.

func (*Agent) TranslateAddress added in v0.9.0

func (a *Agent) TranslateAddress(dc string, addr string, taggedAddresses map[string]string, accept TranslateAddressAccept) string

TranslateAddress is used to provide the final, translated address for a node, depending on how the agent and the other node are configured. The dc parameter is the dc the datacenter this node is from.

func (*Agent) TranslateAddresses added in v0.9.0

func (a *Agent) TranslateAddresses(dc string, subj interface{}, accept TranslateAddressAccept)

TranslateAddresses translates addresses in the given structure into the final, translated address, depending on how the agent and the other node are configured. The dc parameter is the datacenter this structure is from.

func (*Agent) TranslateServiceAddress added in v1.6.0

func (a *Agent) TranslateServiceAddress(dc string, addr string, taggedAddresses map[string]structs.ServiceAddress, accept TranslateAddressAccept) string

TranslateServiceAddress is used to provide the final, translated address for a node, depending on how the agent and the other node are configured. The dc parameter is the dc the datacenter this node is from.

func (*Agent) TranslateServicePort added in v1.6.0

func (a *Agent) TranslateServicePort(dc string, port int, taggedAddresses map[string]structs.ServiceAddress) int

TranslateServicePort is used to provide the final, translated port for a service, depending on how the agent and the other node are configured. The dc parameter is the dc the datacenter this node is from.

func (*Agent) UseKey

func (a *Agent) UseKey(key, token string, relayFactor uint8) (*structs.KeyringResponses, error)

UseKey changes the primary encryption key used to encrypt messages

func (*Agent) UserEvent

func (a *Agent) UserEvent(dc, token string, params *UserEvent) error

UserEvent is used to fire an event via the Serf layer on the LAN

func (*Agent) UserEvents

func (a *Agent) UserEvents() []*UserEvent

UserEvents is used to return a slice of the most recent user events.

func (*Agent) WANMembers

func (a *Agent) WANMembers() []serf.Member

WANMembers is used to retrieve the WAN members

func (*Agent) WriteEvent added in v1.8.0

func (a *Agent) WriteEvent(eventType string, payload interface{})

WriteEvent is a noop stub for the func defined agent_ent.go

type BadRequestError added in v1.2.0

type BadRequestError struct {
	Reason string
}

BadRequestError should be returned by a handler when parameters or the payload are not valid

func (BadRequestError) Error added in v1.2.0

func (e BadRequestError) Error() string

type BaseDeps added in v1.8.4

type BaseDeps struct {
	Logger          hclog.InterceptLogger
	TLSConfigurator *tlsutil.Configurator // TODO: use an interface
	MetricsHandler  MetricsHandler
	RuntimeConfig   *config.RuntimeConfig
	Tokens          *token.Store
	Cache           *cache.Cache
	AutoConfig      *autoconf.AutoConfig // TODO: use an interface
	ConnPool        *pool.ConnPool       // TODO: use an interface
	Router          *router.Router
}

TODO: BaseDeps should be renamed in the future once more of Agent.Start has been moved out in front of Agent.New, and we can better see the setup dependencies.

func NewBaseDeps added in v1.8.4

func NewBaseDeps(configLoader ConfigLoader, logOut io.Writer) (BaseDeps, error)

type CodeWithPayloadError added in v1.4.1

type CodeWithPayloadError struct {
	Reason      string
	StatusCode  int
	ContentType string
}

CodeWithPayloadError allow returning non HTTP 200 Error codes while not returning PlainText payload

func (CodeWithPayloadError) Error added in v1.4.1

func (e CodeWithPayloadError) Error() string

type ConfigLoader added in v1.8.4

type ConfigLoader func(source config.Source) (cfg *config.RuntimeConfig, warnings []string, err error)

type DNSServer

type DNSServer struct {
	*dns.Server
	// contains filtered or unexported fields
}

DNSServer is used to wrap an Agent and expose various service discovery endpoints using a DNS interface.

func NewDNSServer

func NewDNSServer(a *Agent) (*DNSServer, error)

func (*DNSServer) ListenAndServe

func (d *DNSServer) ListenAndServe(network, addr string, notif func()) error

func (*DNSServer) ReloadConfig added in v1.5.0

func (d *DNSServer) ReloadConfig(newCfg *config.RuntimeConfig) error

ReloadConfig hot-reloads the server config with new parameters under config.RuntimeConfig.DNS*

type Denylist added in v1.8.0

type Denylist struct {
	// contains filtered or unexported fields
}

Denylist implements an HTTP endpoint denylist based on a list of endpoint prefixes which should be blocked.

func NewDenylist added in v1.8.0

func NewDenylist(prefixes []string) *Denylist

NewDenylist returns a denylist for the given list of prefixes.

func (*Denylist) Block added in v1.8.0

func (d *Denylist) Block(path string) bool

Block will return true if the given path is included among any of the blocked prefixes.

type ForbiddenError added in v1.4.1

type ForbiddenError struct {
}

func (ForbiddenError) Error added in v1.4.1

func (e ForbiddenError) Error() string

type GatewayConfig added in v1.8.0

type GatewayConfig struct {
	Addresses []string `json:",omitempty"`
	// contains filtered or unexported fields
}

type HTTPServer

type HTTPServer struct {
	*http.Server
	// contains filtered or unexported fields
}

HTTPServer provides an HTTP api for an agent.

func (*HTTPServer) ACLAuthMethodCRUD added in v1.5.0

func (s *HTTPServer) ACLAuthMethodCRUD(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLAuthMethodCreate added in v1.5.0

func (s *HTTPServer) ACLAuthMethodCreate(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLAuthMethodDelete added in v1.5.0

func (s *HTTPServer) ACLAuthMethodDelete(resp http.ResponseWriter, req *http.Request, methodName string) (interface{}, error)

func (*HTTPServer) ACLAuthMethodList added in v1.5.0

func (s *HTTPServer) ACLAuthMethodList(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLAuthMethodRead added in v1.5.0

func (s *HTTPServer) ACLAuthMethodRead(resp http.ResponseWriter, req *http.Request, methodName string) (interface{}, error)

func (*HTTPServer) ACLAuthMethodWrite added in v1.5.0

func (s *HTTPServer) ACLAuthMethodWrite(resp http.ResponseWriter, req *http.Request, methodName string) (interface{}, error)

func (*HTTPServer) ACLAuthorize added in v1.7.0

func (s *HTTPServer) ACLAuthorize(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLBindingRuleCRUD added in v1.5.0

func (s *HTTPServer) ACLBindingRuleCRUD(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLBindingRuleCreate added in v1.5.0

func (s *HTTPServer) ACLBindingRuleCreate(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLBindingRuleDelete added in v1.5.0

func (s *HTTPServer) ACLBindingRuleDelete(resp http.ResponseWriter, req *http.Request, bindingRuleID string) (interface{}, error)

func (*HTTPServer) ACLBindingRuleList added in v1.5.0

func (s *HTTPServer) ACLBindingRuleList(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLBindingRuleRead added in v1.5.0

func (s *HTTPServer) ACLBindingRuleRead(resp http.ResponseWriter, req *http.Request, bindingRuleID string) (interface{}, error)

func (*HTTPServer) ACLBindingRuleWrite added in v1.5.0

func (s *HTTPServer) ACLBindingRuleWrite(resp http.ResponseWriter, req *http.Request, bindingRuleID string) (interface{}, error)

func (*HTTPServer) ACLBootstrap added in v0.9.1

func (s *HTTPServer) ACLBootstrap(resp http.ResponseWriter, req *http.Request) (interface{}, error)

ACLBootstrap is used to perform a one-time ACL bootstrap operation on a cluster to get the first management token.

func (*HTTPServer) ACLClone

func (s *HTTPServer) ACLClone(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLCreate

func (s *HTTPServer) ACLCreate(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLDestroy

func (s *HTTPServer) ACLDestroy(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLGet

func (s *HTTPServer) ACLGet(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLList

func (s *HTTPServer) ACLList(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLLogin added in v1.5.0

func (s *HTTPServer) ACLLogin(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLLogout added in v1.5.0

func (s *HTTPServer) ACLLogout(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLPolicyCRUD added in v1.4.0

func (s *HTTPServer) ACLPolicyCRUD(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLPolicyCreate added in v1.4.0

func (s *HTTPServer) ACLPolicyCreate(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLPolicyDelete added in v1.4.0

func (s *HTTPServer) ACLPolicyDelete(resp http.ResponseWriter, req *http.Request, policyID string) (interface{}, error)

func (*HTTPServer) ACLPolicyList added in v1.4.0

func (s *HTTPServer) ACLPolicyList(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLPolicyRead added in v1.4.0

func (s *HTTPServer) ACLPolicyRead(resp http.ResponseWriter, req *http.Request, policyID, policyName string) (interface{}, error)

func (*HTTPServer) ACLPolicyReadByID added in v1.7.3

func (s *HTTPServer) ACLPolicyReadByID(resp http.ResponseWriter, req *http.Request, policyID string) (interface{}, error)

func (*HTTPServer) ACLPolicyReadByName added in v1.7.3

func (s *HTTPServer) ACLPolicyReadByName(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLPolicyWrite added in v1.4.0

func (s *HTTPServer) ACLPolicyWrite(resp http.ResponseWriter, req *http.Request, policyID string) (interface{}, error)

func (*HTTPServer) ACLReplicationStatus

func (s *HTTPServer) ACLReplicationStatus(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLRoleCRUD added in v1.5.0

func (s *HTTPServer) ACLRoleCRUD(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLRoleCreate added in v1.5.0

func (s *HTTPServer) ACLRoleCreate(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLRoleDelete added in v1.5.0

func (s *HTTPServer) ACLRoleDelete(resp http.ResponseWriter, req *http.Request, roleID string) (interface{}, error)

func (*HTTPServer) ACLRoleList added in v1.5.0

func (s *HTTPServer) ACLRoleList(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLRoleRead added in v1.5.0

func (s *HTTPServer) ACLRoleRead(resp http.ResponseWriter, req *http.Request, roleID, roleName string) (interface{}, error)

func (*HTTPServer) ACLRoleReadByID added in v1.5.0

func (s *HTTPServer) ACLRoleReadByID(resp http.ResponseWriter, req *http.Request, roleID string) (interface{}, error)

func (*HTTPServer) ACLRoleReadByName added in v1.5.0

func (s *HTTPServer) ACLRoleReadByName(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLRoleWrite added in v1.5.0

func (s *HTTPServer) ACLRoleWrite(resp http.ResponseWriter, req *http.Request, roleID string) (interface{}, error)

func (*HTTPServer) ACLRulesTranslate added in v1.4.0

func (s *HTTPServer) ACLRulesTranslate(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLRulesTranslateLegacyToken added in v1.4.0

func (s *HTTPServer) ACLRulesTranslateLegacyToken(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLTokenCRUD added in v1.4.0

func (s *HTTPServer) ACLTokenCRUD(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLTokenClone added in v1.4.0

func (s *HTTPServer) ACLTokenClone(resp http.ResponseWriter, req *http.Request, tokenID string) (interface{}, error)

func (*HTTPServer) ACLTokenCreate added in v1.4.0

func (s *HTTPServer) ACLTokenCreate(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLTokenDelete added in v1.4.0

func (s *HTTPServer) ACLTokenDelete(resp http.ResponseWriter, req *http.Request, tokenID string) (interface{}, error)

func (*HTTPServer) ACLTokenGet added in v1.4.0

func (s *HTTPServer) ACLTokenGet(resp http.ResponseWriter, req *http.Request, tokenID string) (interface{}, error)

func (*HTTPServer) ACLTokenList added in v1.4.0

func (s *HTTPServer) ACLTokenList(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLTokenSelf added in v1.4.0

func (s *HTTPServer) ACLTokenSelf(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) ACLTokenSet added in v1.4.0

func (s *HTTPServer) ACLTokenSet(resp http.ResponseWriter, req *http.Request, tokenID string) (interface{}, error)

func (*HTTPServer) ACLUpdate

func (s *HTTPServer) ACLUpdate(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentCheckFail

func (s *HTTPServer) AgentCheckFail(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentCheckPass

func (s *HTTPServer) AgentCheckPass(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentCheckUpdate

func (s *HTTPServer) AgentCheckUpdate(resp http.ResponseWriter, req *http.Request) (interface{}, error)

AgentCheckUpdate is a PUT-based alternative to the GET-based Pass/Warn/Fail APIs.

func (*HTTPServer) AgentCheckWarn

func (s *HTTPServer) AgentCheckWarn(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentChecks

func (s *HTTPServer) AgentChecks(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentConnectAuthorize added in v1.2.0

func (s *HTTPServer) AgentConnectAuthorize(resp http.ResponseWriter, req *http.Request) (interface{}, error)

AgentConnectAuthorize

POST /v1/agent/connect/authorize

Note: when this logic changes, consider if the Intention.Check RPC method also needs to be updated.

func (*HTTPServer) AgentConnectCALeafCert added in v1.2.0

func (s *HTTPServer) AgentConnectCALeafCert(resp http.ResponseWriter, req *http.Request) (interface{}, error)

AgentConnectCALeafCert returns the certificate bundle for a service instance. This supports blocking queries to update the returned bundle.

func (*HTTPServer) AgentConnectCARoots added in v1.2.0

func (s *HTTPServer) AgentConnectCARoots(resp http.ResponseWriter, req *http.Request) (interface{}, error)

AgentConnectCARoots returns the trusted CA roots.

func (*HTTPServer) AgentDeregisterCheck

func (s *HTTPServer) AgentDeregisterCheck(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentDeregisterService

func (s *HTTPServer) AgentDeregisterService(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentForceLeave

func (s *HTTPServer) AgentForceLeave(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentHealthServiceByID added in v1.4.1

func (s *HTTPServer) AgentHealthServiceByID(resp http.ResponseWriter, req *http.Request) (interface{}, error)

AgentHealthServiceByID return the local Service Health given its ID

func (*HTTPServer) AgentHealthServiceByName added in v1.4.1

func (s *HTTPServer) AgentHealthServiceByName(resp http.ResponseWriter, req *http.Request) (interface{}, error)

AgentHealthServiceByName return the worse status of all the services with given name on an agent

func (*HTTPServer) AgentHost added in v1.4.0

func (s *HTTPServer) AgentHost(resp http.ResponseWriter, req *http.Request) (interface{}, error)

AgentHost

GET /v1/agent/host

Retrieves information about resources available and in-use for the host the agent is running on such as CPU, memory, and disk usage. Requires a operator:read ACL token.

func (*HTTPServer) AgentJoin

func (s *HTTPServer) AgentJoin(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentLeave

func (s *HTTPServer) AgentLeave(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentMembers

func (s *HTTPServer) AgentMembers(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentMetrics added in v0.9.1

func (s *HTTPServer) AgentMetrics(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentMonitor

func (s *HTTPServer) AgentMonitor(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentNodeMaintenance

func (s *HTTPServer) AgentNodeMaintenance(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentRegisterCheck

func (s *HTTPServer) AgentRegisterCheck(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentRegisterService

func (s *HTTPServer) AgentRegisterService(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentReload

func (s *HTTPServer) AgentReload(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentSelf

func (s *HTTPServer) AgentSelf(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentService added in v1.3.0

func (s *HTTPServer) AgentService(resp http.ResponseWriter, req *http.Request) (interface{}, error)

GET /v1/agent/service/:service_id

Returns the service definition for a single local services and allows blocking watch using hash-based blocking.

func (*HTTPServer) AgentServiceMaintenance

func (s *HTTPServer) AgentServiceMaintenance(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentServices

func (s *HTTPServer) AgentServices(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) AgentToken added in v0.9.1

func (s *HTTPServer) AgentToken(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) CatalogConnectServiceNodes added in v1.2.0

func (s *HTTPServer) CatalogConnectServiceNodes(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) CatalogDatacenters

func (s *HTTPServer) CatalogDatacenters(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) CatalogDeregister

func (s *HTTPServer) CatalogDeregister(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) CatalogGatewayServices added in v1.8.0

func (s *HTTPServer) CatalogGatewayServices(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) CatalogNodeServiceList added in v1.7.0

func (s *HTTPServer) CatalogNodeServiceList(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) CatalogNodeServices

func (s *HTTPServer) CatalogNodeServices(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) CatalogNodes

func (s *HTTPServer) CatalogNodes(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) CatalogRegister

func (s *HTTPServer) CatalogRegister(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) CatalogServiceNodes

func (s *HTTPServer) CatalogServiceNodes(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) CatalogServices

func (s *HTTPServer) CatalogServices(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) Config added in v1.5.0

func (s *HTTPServer) Config(resp http.ResponseWriter, req *http.Request) (interface{}, error)

Config switches on the different CRUD operations for config entries.

func (*HTTPServer) ConfigApply added in v1.5.0

func (s *HTTPServer) ConfigApply(resp http.ResponseWriter, req *http.Request) (interface{}, error)

ConfigCreate applies the given config entry update.

func (*HTTPServer) ConnectCAConfiguration added in v1.2.0

func (s *HTTPServer) ConnectCAConfiguration(resp http.ResponseWriter, req *http.Request) (interface{}, error)

/v1/connect/ca/configuration

func (*HTTPServer) ConnectCAConfigurationGet added in v1.2.0

func (s *HTTPServer) ConnectCAConfigurationGet(resp http.ResponseWriter, req *http.Request) (interface{}, error)

GEt /v1/connect/ca/configuration

func (*HTTPServer) ConnectCAConfigurationSet added in v1.2.0

func (s *HTTPServer) ConnectCAConfigurationSet(resp http.ResponseWriter, req *http.Request) (interface{}, error)

PUT /v1/connect/ca/configuration

func (*HTTPServer) ConnectCARoots added in v1.2.0

func (s *HTTPServer) ConnectCARoots(resp http.ResponseWriter, req *http.Request) (interface{}, error)

GET /v1/connect/ca/roots

func (*HTTPServer) CoordinateDatacenters

func (s *HTTPServer) CoordinateDatacenters(resp http.ResponseWriter, req *http.Request) (interface{}, error)

CoordinateDatacenters returns the WAN nodes in each datacenter, along with raw network coordinates.

func (*HTTPServer) CoordinateNode added in v1.0.1

func (s *HTTPServer) CoordinateNode(resp http.ResponseWriter, req *http.Request) (interface{}, error)

CoordinateNode returns the LAN node in the given datacenter, along with raw network coordinates.

func (*HTTPServer) CoordinateNodes

func (s *HTTPServer) CoordinateNodes(resp http.ResponseWriter, req *http.Request) (interface{}, error)

CoordinateNodes returns the LAN nodes in the given datacenter, along with raw network coordinates.

func (*HTTPServer) CoordinateUpdate added in v1.0.1

func (s *HTTPServer) CoordinateUpdate(resp http.ResponseWriter, req *http.Request) (interface{}, error)

CoordinateUpdate inserts or updates the LAN coordinate of a node.

func (*HTTPServer) DiscoveryChainRead added in v1.6.0

func (s *HTTPServer) DiscoveryChainRead(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) EventFire

func (s *HTTPServer) EventFire(resp http.ResponseWriter, req *http.Request) (interface{}, error)

EventFire is used to fire a new event

func (*HTTPServer) EventList

func (s *HTTPServer) EventList(resp http.ResponseWriter, req *http.Request) (interface{}, error)

EventList is used to retrieve the recent list of events

func (*HTTPServer) FederationStateGet added in v1.8.0

func (s *HTTPServer) FederationStateGet(resp http.ResponseWriter, req *http.Request) (interface{}, error)

GET /v1/internal/federation-state/<datacenter>

func (*HTTPServer) FederationStateList added in v1.8.0

func (s *HTTPServer) FederationStateList(resp http.ResponseWriter, req *http.Request) (interface{}, error)

GET /v1/internal/federation-states

func (*HTTPServer) FederationStateListMeshGateways added in v1.8.0

func (s *HTTPServer) FederationStateListMeshGateways(resp http.ResponseWriter, req *http.Request) (interface{}, error)

GET /v1/internal/federation-states/mesh-gateways

func (*HTTPServer) GenerateHTMLTemplateVars added in v1.7.0

func (s *HTTPServer) GenerateHTMLTemplateVars() map[string]interface{}

func (*HTTPServer) HealthChecksInState

func (s *HTTPServer) HealthChecksInState(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) HealthConnectServiceNodes added in v1.2.0

func (s *HTTPServer) HealthConnectServiceNodes(resp http.ResponseWriter, req *http.Request) (interface{}, error)

HealthConnectServiceNodes should return "all healthy connect-enabled endpoints (e.g. could be side car proxies or native instances) for this service so I can connect with mTLS".

func (*HTTPServer) HealthIngressServiceNodes added in v1.8.0

func (s *HTTPServer) HealthIngressServiceNodes(resp http.ResponseWriter, req *http.Request) (interface{}, error)

HealthIngressServiceNodes should return "all the healthy ingress gateway instances that I can use to access this connect-enabled service without mTLS".

func (*HTTPServer) HealthNodeChecks

func (s *HTTPServer) HealthNodeChecks(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) HealthServiceChecks

func (s *HTTPServer) HealthServiceChecks(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) HealthServiceNodes

func (s *HTTPServer) HealthServiceNodes(resp http.ResponseWriter, req *http.Request) (interface{}, error)

HealthServiceNodes should return "all the healthy instances of this service registered so I can connect directly to them".

func (*HTTPServer) Index

func (s *HTTPServer) Index(resp http.ResponseWriter, req *http.Request)

Renders a simple index page

func (*HTTPServer) IntentionCheck added in v1.2.0

func (s *HTTPServer) IntentionCheck(resp http.ResponseWriter, req *http.Request) (interface{}, error)

GET /v1/connect/intentions/check

func (*HTTPServer) IntentionCreate added in v1.2.0

func (s *HTTPServer) IntentionCreate(resp http.ResponseWriter, req *http.Request) (interface{}, error)

POST /v1/connect/intentions

func (*HTTPServer) IntentionEndpoint added in v1.2.0

func (s *HTTPServer) IntentionEndpoint(resp http.ResponseWriter, req *http.Request) (interface{}, error)

/v1/connection/intentions

func (*HTTPServer) IntentionList added in v1.2.0

func (s *HTTPServer) IntentionList(resp http.ResponseWriter, req *http.Request) (interface{}, error)

GET /v1/connect/intentions

func (*HTTPServer) IntentionMatch added in v1.2.0

func (s *HTTPServer) IntentionMatch(resp http.ResponseWriter, req *http.Request) (interface{}, error)

GET /v1/connect/intentions/match

func (*HTTPServer) IntentionSpecific added in v1.2.0

func (s *HTTPServer) IntentionSpecific(resp http.ResponseWriter, req *http.Request) (interface{}, error)

IntentionSpecific handles the endpoint for /v1/connection/intentions/:id

func (*HTTPServer) IntentionSpecificDelete added in v1.2.0

func (s *HTTPServer) IntentionSpecificDelete(id string, resp http.ResponseWriter, req *http.Request) (interface{}, error)

DELETE /v1/connect/intentions/:id

func (*HTTPServer) IntentionSpecificGet added in v1.2.0

func (s *HTTPServer) IntentionSpecificGet(id string, resp http.ResponseWriter, req *http.Request) (interface{}, error)

GET /v1/connect/intentions/:id

func (*HTTPServer) IntentionSpecificUpdate added in v1.2.0

func (s *HTTPServer) IntentionSpecificUpdate(id string, resp http.ResponseWriter, req *http.Request) (interface{}, error)

PUT /v1/connect/intentions/:id

func (*HTTPServer) IsUIEnabled

func (s *HTTPServer) IsUIEnabled() bool

Returns true if the UI is enabled.

func (*HTTPServer) KVSDelete

func (s *HTTPServer) KVSDelete(resp http.ResponseWriter, req *http.Request, args *structs.KeyRequest) (interface{}, error)

KVSPut handles a DELETE request

func (*HTTPServer) KVSEndpoint

func (s *HTTPServer) KVSEndpoint(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) KVSGet

func (s *HTTPServer) KVSGet(resp http.ResponseWriter, req *http.Request, args *structs.KeyRequest) (interface{}, error)

KVSGet handles a GET request

func (*HTTPServer) KVSGetKeys

func (s *HTTPServer) KVSGetKeys(resp http.ResponseWriter, req *http.Request, args *structs.KeyRequest) (interface{}, error)

KVSGetKeys handles a GET request for keys

func (*HTTPServer) KVSPut

func (s *HTTPServer) KVSPut(resp http.ResponseWriter, req *http.Request, args *structs.KeyRequest) (interface{}, error)

KVSPut handles a PUT request

func (*HTTPServer) KeyringInstall

func (s *HTTPServer) KeyringInstall(resp http.ResponseWriter, req *http.Request, args *keyringArgs) (interface{}, error)

KeyringInstall is used to install a new gossip encryption key into the cluster

func (*HTTPServer) KeyringList

func (s *HTTPServer) KeyringList(resp http.ResponseWriter, req *http.Request, args *keyringArgs) (interface{}, error)

KeyringList is used to list the keys installed in the cluster

func (*HTTPServer) KeyringRemove

func (s *HTTPServer) KeyringRemove(resp http.ResponseWriter, req *http.Request, args *keyringArgs) (interface{}, error)

KeyringRemove is used to list the keys installed in the cluster

func (*HTTPServer) KeyringUse

func (s *HTTPServer) KeyringUse(resp http.ResponseWriter, req *http.Request, args *keyringArgs) (interface{}, error)

KeyringUse is used to change the primary gossip encryption key

func (*HTTPServer) OperatorAutopilotConfiguration

func (s *HTTPServer) OperatorAutopilotConfiguration(resp http.ResponseWriter, req *http.Request) (interface{}, error)

OperatorAutopilotConfiguration is used to inspect the current Autopilot configuration. This supports the stale query mode in case the cluster doesn't have a leader.

func (*HTTPServer) OperatorKeyringEndpoint

func (s *HTTPServer) OperatorKeyringEndpoint(resp http.ResponseWriter, req *http.Request) (interface{}, error)

OperatorKeyringEndpoint handles keyring operations (install, list, use, remove)

func (*HTTPServer) OperatorRaftConfiguration

func (s *HTTPServer) OperatorRaftConfiguration(resp http.ResponseWriter, req *http.Request) (interface{}, error)

OperatorRaftConfiguration is used to inspect the current Raft configuration. This supports the stale query mode in case the cluster doesn't have a leader.

func (*HTTPServer) OperatorRaftPeer

func (s *HTTPServer) OperatorRaftPeer(resp http.ResponseWriter, req *http.Request) (interface{}, error)

OperatorRaftPeer supports actions on Raft peers. Currently we only support removing peers by address.

func (*HTTPServer) OperatorServerHealth

func (s *HTTPServer) OperatorServerHealth(resp http.ResponseWriter, req *http.Request) (interface{}, error)

OperatorServerHealth is used to get the health of the servers in the local DC

func (*HTTPServer) PreparedQueryGeneral

func (s *HTTPServer) PreparedQueryGeneral(resp http.ResponseWriter, req *http.Request) (interface{}, error)

PreparedQueryGeneral handles all the general prepared query requests.

func (*HTTPServer) PreparedQuerySpecific

func (s *HTTPServer) PreparedQuerySpecific(resp http.ResponseWriter, req *http.Request) (interface{}, error)

PreparedQuerySpecific handles all the prepared query requests specific to a particular query.

func (*HTTPServer) SessionCreate

func (s *HTTPServer) SessionCreate(resp http.ResponseWriter, req *http.Request) (interface{}, error)

SessionCreate is used to create a new session

func (*HTTPServer) SessionDestroy

func (s *HTTPServer) SessionDestroy(resp http.ResponseWriter, req *http.Request) (interface{}, error)

SessionDestroy is used to destroy an existing session

func (*HTTPServer) SessionGet

func (s *HTTPServer) SessionGet(resp http.ResponseWriter, req *http.Request) (interface{}, error)

SessionGet is used to get info for a particular session

func (*HTTPServer) SessionList

func (s *HTTPServer) SessionList(resp http.ResponseWriter, req *http.Request) (interface{}, error)

SessionList is used to list all the sessions

func (*HTTPServer) SessionRenew

func (s *HTTPServer) SessionRenew(resp http.ResponseWriter, req *http.Request) (interface{}, error)

SessionRenew is used to renew the TTL on an existing TTL session

func (*HTTPServer) SessionsForNode

func (s *HTTPServer) SessionsForNode(resp http.ResponseWriter, req *http.Request) (interface{}, error)

SessionsForNode returns all the nodes belonging to a node

func (*HTTPServer) Snapshot

func (s *HTTPServer) Snapshot(resp http.ResponseWriter, req *http.Request) (interface{}, error)

Snapshot handles requests to take and restore snapshots. This uses a special mechanism to make the RPC since we potentially stream large amounts of data as part of these requests.

func (*HTTPServer) StatusLeader

func (s *HTTPServer) StatusLeader(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) StatusPeers

func (s *HTTPServer) StatusPeers(resp http.ResponseWriter, req *http.Request) (interface{}, error)

func (*HTTPServer) Txn

func (s *HTTPServer) Txn(resp http.ResponseWriter, req *http.Request) (interface{}, error)

Txn handles requests to apply multiple operations in a single, atomic transaction. A transaction consisting of only read operations will be fast- pathed to an endpoint that supports consistency modes (but not blocking), and everything else will be routed through Raft like a normal write.

func (*HTTPServer) UIGatewayServicesNodes added in v1.8.0

func (s *HTTPServer) UIGatewayServicesNodes(resp http.ResponseWriter, req *http.Request) (interface{}, error)

UIGatewayServices is used to query all the nodes for services associated with a gateway along with their gateway config

func (*HTTPServer) UINodeInfo

func (s *HTTPServer) UINodeInfo(resp http.ResponseWriter, req *http.Request) (interface{}, error)

UINodeInfo is used to get info on a single node in a given datacenter. We return a NodeInfo which provides overview information for the node

func (*HTTPServer) UINodes

func (s *HTTPServer) UINodes(resp http.ResponseWriter, req *http.Request) (interface{}, error)

UINodes is used to list the nodes in a given datacenter. We return a NodeDump which provides overview information for all the nodes

func (*HTTPServer) UIServices

func (s *HTTPServer) UIServices(resp http.ResponseWriter, req *http.Request) (interface{}, error)

UIServices is used to list the services in a given datacenter. We return a ServiceSummary which provides overview information for the service

type MethodNotAllowedError added in v1.0.0

type MethodNotAllowedError struct {
	Method string
	Allow  []string
}

MethodNotAllowedError should be returned by a handler when the HTTP method is not allowed.

func (MethodNotAllowedError) Error added in v1.0.0

func (e MethodNotAllowedError) Error() string

type MetricsHandler added in v1.8.4

type MetricsHandler interface {
	DisplayMetrics(resp http.ResponseWriter, req *http.Request) (interface{}, error)
}

MetricsHandler provides an http.Handler for displaying metrics.

type NotFoundError added in v1.5.0

type NotFoundError struct {
	Reason string
}

NotFoundError should be returned by a handler when a resource specified does not exist

func (NotFoundError) Error added in v1.5.0

func (e NotFoundError) Error() string

type NotifyGroup

type NotifyGroup struct {
	// contains filtered or unexported fields
}

NotifyGroup is used to allow a simple notification mechanism. Channels can be marked as waiting, and when notify is invoked, all the waiting channels get a message and are cleared from the notify list.

func (*NotifyGroup) Clear

func (n *NotifyGroup) Clear(ch chan struct{})

Clear removes a channel from the notify group

func (*NotifyGroup) Notify

func (n *NotifyGroup) Notify()

Notify will do a non-blocking send to all waiting channels, and clear the notify list

func (*NotifyGroup) Wait

func (n *NotifyGroup) Wait(ch chan struct{})

Wait adds a channel to the notify group

type Self

type Self struct {
	Config      interface{}
	DebugConfig map[string]interface{}
	Coord       *coordinate.Coordinate
	Member      serf.Member
	Stats       map[string]map[string]string
	Meta        map[string]string
	XDS         *xdsSelf `json:"xDS,omitempty"`
}

type ServiceManager added in v1.5.0

type ServiceManager struct {
	// contains filtered or unexported fields
}

The ServiceManager is a layer for service registration in between the agent and the local state. Any services must be registered with the ServiceManager, which then maintains a long-running watch of any globally-set service or proxy configuration that applies to the service in order to register the final, merged service configuration locally in the agent state.

func NewServiceManager added in v1.5.0

func NewServiceManager(agent *Agent) *ServiceManager

func (*ServiceManager) AddService added in v1.5.0

func (s *ServiceManager) AddService(req *addServiceRequest) error

AddService will (re)create a serviceConfigWatch on the given service. For each call of this function the first registration will happen inline and will read the merged global defaults for the service through the agent cache (regardless of whether or not the service was already registered). This lets validation or authorization related errors bubble back up to the caller's RPC inline with their request. Upon success a goroutine will keep this updated in the background.

If waitForCentralConfig=true is used, the initial registration blocks on fetching the merged global config through the cache. If false, no such RPC occurs and only the previousDefaults are used.

persistServiceConfig controls if the INITIAL registration will result in persisting the service config to disk again. All background updates will always persist.

service, chkTypes, persist, token, replaceExistingChecks, and source are basically pass-through arguments to Agent.addServiceInternal that follow the semantics there. The one key difference is that the service provided will be merged with the global defaults before registration.

NOTE: the caller must hold the Agent.stateLock!

func (*ServiceManager) RemoveService added in v1.5.0

func (s *ServiceManager) RemoveService(serviceID structs.ServiceID)

NOTE: the caller must hold the Agent.stateLock!

func (*ServiceManager) Start added in v1.6.2

func (s *ServiceManager) Start()

Start starts a background worker goroutine that writes back into the Agent state. This only exists to keep the need to lock the agent state lock out of the main AddService/RemoveService codepaths to avoid deadlocks.

func (*ServiceManager) Stop added in v1.6.2

func (s *ServiceManager) Stop()

Stop forces all background goroutines to terminate and blocks until they complete.

NOTE: the caller must NOT hold the Agent.stateLock!

type ServiceSummary

type ServiceSummary struct {
	Kind          structs.ServiceKind `json:",omitempty"`
	Name          string
	Tags          []string
	Nodes         []string
	InstanceCount int
	ProxyFor      []string `json:",omitempty"`

	ChecksPassing   int
	ChecksWarning   int
	ChecksCritical  int
	ExternalSources []string

	GatewayConfig GatewayConfig `json:",omitempty"`

	structs.EnterpriseMeta
	// contains filtered or unexported fields
}

ServiceSummary is used to summarize a service

type TestACLConfigParams added in v1.7.0

type TestACLConfigParams struct {
	PrimaryDatacenter      string
	DefaultPolicy          string
	MasterToken            string
	AgentToken             string
	DefaultToken           string
	AgentMasterToken       string
	ReplicationToken       string
	EnableTokenReplication bool
}

func DefaulTestACLConfigParams added in v1.7.0

func DefaulTestACLConfigParams() *TestACLConfigParams

func (*TestACLConfigParams) HasConfiguredTokens added in v1.7.0

func (p *TestACLConfigParams) HasConfiguredTokens() bool

type TestAgent

type TestAgent struct {
	// Name is an optional name of the agent.
	Name string

	HCL string

	// Config is the agent configuration. If Config is nil then
	// TestConfig() is used. If Config.DataDir is set then it is
	// the callers responsibility to clean up the data directory.
	// Otherwise, a temporary data directory is created and removed
	// when Shutdown() is called.
	Config *config.RuntimeConfig

	// LogOutput is the sink for the logs. If nil, logs are written
	// to os.Stderr.
	LogOutput io.Writer

	// DataDir may be set to a directory which exists. If is it not set,
	// TestAgent.Start will create one and set DataDir to the directory path.
	// In all cases the agent will be configured to use this path as the data directory,
	// and the directory will be removed once the test ends.
	DataDir string

	// UseTLS, if true, will disable the HTTP port and enable the HTTPS
	// one.
	UseTLS bool

	// overrides is an hcl config source to use to override otherwise
	// non-user settable configurations
	Overrides string

	// Agent is the embedded consul agent.
	// It is valid after Start().
	*Agent
	// contains filtered or unexported fields
}

TestAgent encapsulates an Agent with a default configuration and startup procedure suitable for testing. It panics if there are errors during creation or startup instead of returning errors. It manages a temporary data directory which is removed after shutdown.

func NewTestAgent

func NewTestAgent(t *testing.T, hcl string) *TestAgent

NewTestAgent returns a started agent with the given configuration. It fails the test if the Agent could not be started. The caller is responsible for calling Shutdown() to stop the agent and remove temporary directories.

func StartTestAgent added in v1.8.0

func StartTestAgent(t *testing.T, a TestAgent) *TestAgent

StartTestAgent and wait for it to become available. If the agent fails to start the test will be marked failed and execution will stop.

The caller is responsible for calling Shutdown() to stop the agent and remove temporary directories.

func (*TestAgent) Client

func (a *TestAgent) Client() *api.Client

func (*TestAgent) DNSAddr added in v1.0.0

func (a *TestAgent) DNSAddr() string

func (*TestAgent) DNSDisableCompression added in v0.9.0

func (a *TestAgent) DNSDisableCompression(b bool)

DNSDisableCompression disables compression for all started DNS servers.

func (*TestAgent) HTTPAddr

func (a *TestAgent) HTTPAddr() string

func (*TestAgent) SegmentAddr added in v0.9.3

func (a *TestAgent) SegmentAddr(name string) string

func (*TestAgent) Shutdown

func (a *TestAgent) Shutdown() error

Shutdown stops the agent and removes the data directory if it is managed by the test agent.

func (*TestAgent) Start

func (a *TestAgent) Start(t *testing.T) (err error)

Start starts a test agent. It returns an error if the agent could not be started. If no error is returned, the caller must call Shutdown() when finished.

type TranslateAddressAccept added in v1.7.0

type TranslateAddressAccept int
const (
	TranslateAddressAcceptDomain TranslateAddressAccept = 1 << iota
	TranslateAddressAcceptIPv4
	TranslateAddressAcceptIPv6

	TranslateAddressAcceptAny TranslateAddressAccept = ^0
)

type UserEvent

type UserEvent struct {
	// ID of the user event. Automatically generated.
	ID string

	// Name of the event
	Name string `codec:"n"`

	// Optional payload
	Payload []byte `codec:"p,omitempty"`

	// NodeFilter is a regular expression to filter on nodes
	NodeFilter string `codec:"nf,omitempty"`

	// ServiceFilter is a regular expression to filter on services
	ServiceFilter string `codec:"sf,omitempty"`

	// TagFilter is a regular expression to filter on tags of a service,
	// must be provided with ServiceFilter
	TagFilter string `codec:"tf,omitempty"`

	// Version of the user event. Automatically generated.
	Version int `codec:"v"`

	// LTime is the lamport time. Automatically generated.
	LTime uint64 `codec:"-"`
}

UserEventParam is used to parameterize a user event

Directories

Path Synopsis
Package ae provides tools to synchronize state between local and remote consul servers.
Package ae provides tools to synchronize state between local and remote consul servers.
Package cache provides caching features for data from a Consul server.
Package cache provides caching features for data from a Consul server.
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0
ca
The snapshot endpoint is a special non-RPC endpoint that supports streaming for taking and restoring snapshots for disaster recovery.
The snapshot endpoint is a special non-RPC endpoint that supports streaming for taking and restoring snapshots for disaster recovery.
fsm
Package proxycfg provides a component that monitors local agent state for Connect proxy service registrations and maintains the necessary cache state for those proxies locally.
Package proxycfg provides a component that monitors local agent state for Connect proxy service registrations and maintains the necessary cache state for those proxies locally.
Package servers provides a Manager interface for Manager managed metadata.Server objects.
Package servers provides a Manager interface for Manager managed metadata.Server objects.
xds
Package xds provides an implementation of a gRPC service that exports Envoy's xDS API for config discovery.
Package xds provides an implementation of a gRPC service that exports Envoy's xDS API for config discovery.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL