dep

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: MPL-2.0 Imports: 5 Imported by: 3

Documentation

Overview

Public Dependency type information.

This sub-package contains all the required types needed to implement an external dependency as used by this library.

It is a sub-package as all the current dependency implentations are contained in an internal/ package as it needs some significant refactoring that shouldn't interfere with the initial release.

Index

Constants

This section is empty.

Variables

View Source
var ErrContinue = errors.New("dependency continue")

ErrContinue is a special error which says to continue (retry) on error.

View Source
var ErrLeaseExpired = errors.New("lease expired or is not renewable")
View Source
var ErrStopped = errors.New("dependency stopped")

ErrStopped is a special error that is returned when a dependency is prematurely stopped, usually due to a configuration reload or a process interrupt.

Functions

This section is empty.

Types

type CatalogNode

type CatalogNode struct {
	Node     *Node
	Services []*CatalogNodeService
}

CatalogNode is a wrapper around the node and its services.

type CatalogNodeService

type CatalogNodeService struct {
	ID                string
	Service           string
	Tags              ServiceTags
	Meta              map[string]string
	Port              int
	Address           string
	EnableTagOverride bool
}

CatalogNodeService is a service on a single node.

type CatalogSnippet

type CatalogSnippet struct {
	Name string
	Tags ServiceTags
}

CatalogSnippet is a catalog entry in Consul.

type Clients

type Clients interface {
	Consul() *consulapi.Client
	Vault() *vaultapi.Client
}

Clients interface for the API clients used for external dependency calls.

type Dependency

type Dependency interface {
	Fetch(Clients) (interface{}, *ResponseMetadata, error)
	ID() string
	Stop()
	fmt.Stringer
}

Dependency is an interface for an external dependency to be monitored.

type HealthService

type HealthService struct {
	Node                   string
	NodeID                 string
	NodeAddress            string
	NodeDatacenter         string
	NodeTaggedAddresses    map[string]string
	NodeMeta               map[string]string
	ServiceMeta            map[string]string
	Address                string
	ServiceTaggedAddresses map[string]api.ServiceAddress
	ID                     string
	Name                   string
	Kind                   string
	Tags                   ServiceTags
	Checks                 api.HealthChecks
	Status                 string
	Port                   int
	Weights                api.AgentWeights
	Namespace              string
}

HealthService is a service entry in Consul.

type KVExists

type KVExists bool

type KeyPair

type KeyPair struct {
	Path   string
	Key    string
	Value  string
	Exists bool

	// Lesser-used, but still valuable keys from api.KV
	CreateIndex uint64
	ModifyIndex uint64
	LockIndex   uint64
	Flags       uint64
	Session     string
}

KeyPair is a simple Key-Value pair

type KvValue

type KvValue string

KvValue is here to type the KV return string

type Node

type Node struct {
	ID              string
	Node            string
	Address         string
	Datacenter      string
	TaggedAddresses map[string]string
	Meta            map[string]string
}

Node is a node entry in Consul

type ResponseMetadata

type ResponseMetadata struct {
	LastIndex   uint64
	LastContact time.Duration
}

Metadata returned by external dependency Fetch-ing. LastIndex is used with the Consul backend. Needed to track changes. LastContact is used to help calculate staleness of records.

type Secret

type Secret struct {
	// The request ID that generated this response
	RequestID string

	LeaseID       string
	LeaseDuration int
	Renewable     bool

	// Data is the actual contents of the secret. The format of the data
	// is arbitrary and up to the secret backend.
	Data map[string]interface{}

	// Warnings contains any warnings related to the operation. These
	// are not issues that caused the command to fail, but that the
	// client should be aware of.
	Warnings []string

	// Auth, if non-nil, means that there was authentication information
	// attached to this response.
	Auth *SecretAuth

	// WrapInfo, if non-nil, means that the initial response was wrapped in the
	// cubbyhole of the given token (which has a TTL of the given number of
	// seconds)
	WrapInfo *SecretWrapInfo
}

Secret is the structure returned for every secret within Vault.

type SecretAuth

type SecretAuth struct {
	ClientToken string
	Accessor    string
	Policies    []string
	Metadata    map[string]string

	LeaseDuration int
	Renewable     bool
}

SecretAuth is the structure containing auth information if we have it.

type SecretWrapInfo

type SecretWrapInfo struct {
	Token           string
	TTL             int
	CreationTime    time.Time
	WrappedAccessor string
}

SecretWrapInfo contains wrapping information if we have it. If what is contained is an authentication token, the accessor for the token will be available in WrappedAccessor.

type ServiceTags

type ServiceTags []string

ServiceTags is a slice of tags assigned to a Service

Jump to

Keyboard shortcuts

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