Documentation ¶
Index ¶
- Constants
- Variables
- type BlockingQuery
- type ByName
- type ByNode
- type ByNodeThenID
- type ByService
- type CatalogDatacentersQuery
- func (d *CatalogDatacentersQuery) CanShare() bool
- func (CatalogDatacentersQuery) Consul()
- func (d *CatalogDatacentersQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
- func (d *CatalogDatacentersQuery) ID() string
- func (d *CatalogDatacentersQuery) SetOptions(opts QueryOptions)
- func (d *CatalogDatacentersQuery) Stop()
- func (d *CatalogDatacentersQuery) String() string
- type CatalogNodeQuery
- func (d *CatalogNodeQuery) CanShare() bool
- func (CatalogNodeQuery) Consul()
- func (d *CatalogNodeQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
- func (d *CatalogNodeQuery) ID() string
- func (d *CatalogNodeQuery) SetOptions(opts QueryOptions)
- func (d *CatalogNodeQuery) Stop()
- func (d *CatalogNodeQuery) String() string
- type CatalogNodesQuery
- func (d *CatalogNodesQuery) CanShare() bool
- func (CatalogNodesQuery) Consul()
- func (d *CatalogNodesQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
- func (d *CatalogNodesQuery) ID() string
- func (d *CatalogNodesQuery) SetOptions(opts QueryOptions)
- func (d *CatalogNodesQuery) Stop()
- func (d *CatalogNodesQuery) String() string
- type CatalogService
- type CatalogServiceQuery
- func (d *CatalogServiceQuery) CanShare() bool
- func (CatalogServiceQuery) Consul()
- func (d *CatalogServiceQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
- func (d *CatalogServiceQuery) ID() string
- func (d *CatalogServiceQuery) SetOptions(opts QueryOptions)
- func (d *CatalogServiceQuery) Stop()
- func (d *CatalogServiceQuery) String() string
- type CatalogServicesQuery
- func (d *CatalogServicesQuery) CanShare() bool
- func (CatalogServicesQuery) Consul()
- func (d *CatalogServicesQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
- func (d *CatalogServicesQuery) ID() string
- func (d *CatalogServicesQuery) SetOptions(opts QueryOptions)
- func (d *CatalogServicesQuery) Stop()
- func (d *CatalogServicesQuery) String() string
- type ClientSet
- type ConnectCAQuery
- func (d *ConnectCAQuery) CanShare() bool
- func (ConnectCAQuery) Consul()
- func (d *ConnectCAQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
- func (d *ConnectCAQuery) ID() string
- func (d *ConnectCAQuery) SetOptions(opts QueryOptions)
- func (d *ConnectCAQuery) Stop()
- func (d *ConnectCAQuery) String() string
- type ConnectLeafQuery
- func (d *ConnectLeafQuery) CanShare() bool
- func (ConnectLeafQuery) Consul()
- func (d *ConnectLeafQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
- func (d *ConnectLeafQuery) ID() string
- func (d *ConnectLeafQuery) SetOptions(opts QueryOptions)
- func (d *ConnectLeafQuery) Stop()
- func (d *ConnectLeafQuery) String() string
- type ConsulType
- type CreateClientInput
- type FakeDep
- func (d *FakeDep) CanShare() bool
- func (FakeDep) Consul()
- func (d *FakeDep) Fetch(dep.Clients) (interface{}, *dep.ResponseMetadata, error)
- func (d *FakeDep) GetOptions() QueryOptions
- func (d *FakeDep) ID() string
- func (d *FakeDep) SetOptions(opts QueryOptions)
- func (d *FakeDep) Stop()
- func (d *FakeDep) String() string
- type FakeDepBlockingQuery
- type FakeDepFetchError
- type FakeDepRetry
- type FakeDepSameIndex
- type FakeDepStale
- type FakeListDep
- type FileQuery
- type HealthServiceQuery
- func (d *HealthServiceQuery) CanShare() bool
- func (HealthServiceQuery) Consul()
- func (d *HealthServiceQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
- func (d *HealthServiceQuery) ID() string
- func (d *HealthServiceQuery) SetOptions(opts QueryOptions)
- func (d *HealthServiceQuery) Stop()
- func (d *HealthServiceQuery) String() string
- type KVExistsGetQuery
- func (d *KVExistsGetQuery) CanShare() bool
- func (KVExistsGetQuery) Consul()
- func (d *KVExistsGetQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
- func (d *KVExistsGetQuery) ID() string
- func (d *KVExistsGetQuery) SetOptions(opts QueryOptions)
- func (d *KVExistsGetQuery) Stop()
- func (d *KVExistsGetQuery) String() string
- type KVExistsQuery
- func (d *KVExistsQuery) CanShare() bool
- func (KVExistsQuery) Consul()
- func (d *KVExistsQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
- func (d *KVExistsQuery) ID() string
- func (d *KVExistsQuery) SetOptions(opts QueryOptions)
- func (d *KVExistsQuery) Stop()
- func (d *KVExistsQuery) String() string
- type KVGetQuery
- func (d *KVGetQuery) CanShare() bool
- func (KVGetQuery) Consul()
- func (d *KVGetQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
- func (d *KVGetQuery) ID() string
- func (d *KVGetQuery) SetOptions(opts QueryOptions)
- func (d *KVGetQuery) Stop()
- func (d *KVGetQuery) String() string
- type KVKeysQuery
- func (d *KVKeysQuery) CanShare() bool
- func (KVKeysQuery) Consul()
- func (d *KVKeysQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
- func (d *KVKeysQuery) ID() string
- func (d *KVKeysQuery) SetOptions(opts QueryOptions)
- func (d *KVKeysQuery) Stop()
- func (d *KVKeysQuery) String() string
- type KVListQuery
- func (d *KVListQuery) CanShare() bool
- func (KVListQuery) Consul()
- func (d *KVListQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
- func (d *KVListQuery) ID() string
- func (d *KVListQuery) SetOptions(opts QueryOptions)
- func (d *KVListQuery) Stop()
- func (d *KVListQuery) String() string
- type QueryOptions
- type QueryOptionsSetter
- type ResponseMetadata
- type TransportDialer
- type VaultAgentTokenQuery
- func (d *VaultAgentTokenQuery) CanShare() bool
- func (d *VaultAgentTokenQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
- func (d *VaultAgentTokenQuery) ID() string
- func (d *VaultAgentTokenQuery) SetOptions(opts QueryOptions)
- func (d *VaultAgentTokenQuery) Stop()
- func (d *VaultAgentTokenQuery) String() string
- func (VaultAgentTokenQuery) Vault()
- type VaultListQuery
- func (d *VaultListQuery) CanShare() bool
- func (d *VaultListQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
- func (d *VaultListQuery) ID() string
- func (d *VaultListQuery) SetOptions(opts QueryOptions)
- func (d *VaultListQuery) Stop()
- func (d *VaultListQuery) String() string
- func (VaultListQuery) Vault()
- type VaultReadQuery
- func (d *VaultReadQuery) CanShare() bool
- func (d *VaultReadQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
- func (d *VaultReadQuery) ID() string
- func (d *VaultReadQuery) SetOptions(opts QueryOptions)
- func (d *VaultReadQuery) Stop()
- func (d *VaultReadQuery) String() string
- func (VaultReadQuery) Vault()
- type VaultTokenQuery
- func (d *VaultTokenQuery) CanShare() bool
- func (d *VaultTokenQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
- func (d *VaultTokenQuery) ID() string
- func (d *VaultTokenQuery) SetOptions(opts QueryOptions)
- func (d *VaultTokenQuery) Stop()
- func (d *VaultTokenQuery) String() string
- func (VaultTokenQuery) Vault()
- type VaultType
- type VaultWriteQuery
- func (d *VaultWriteQuery) CanShare() bool
- func (d *VaultWriteQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
- func (d *VaultWriteQuery) ID() string
- func (d *VaultWriteQuery) SetOptions(opts QueryOptions)
- func (d *VaultWriteQuery) Stop()
- func (d *VaultWriteQuery) String() string
- func (VaultWriteQuery) Vault()
Constants ¶
const ( HealthAny = "any" HealthPassing = "passing" HealthWarning = "warning" HealthCritical = "critical" HealthMaint = "maintenance" NodeMaint = "_node_maintenance" ServiceMaint = "_service_maintenance:" )
const ( // VaultAgentTokenSleepTime is the amount of time to sleep between queries, since // the fsnotify library is not compatible with solaris and other OSes yet. VaultAgentTokenSleepTime = 15 * time.Second )
Variables ¶
var ( // CatalogDatacentersQuerySleepTime is the amount of time to sleep between // queries, since the endpoint does not support blocking queries. CatalogDatacentersQuerySleepTime = 15 * time.Second )
var ( // CatalogNodeQueryRe is the regular expression to use. CatalogNodeQueryRe = regexp.MustCompile(`\A` + nodeNameRe + dcRe + `\z`) )
var ( // CatalogNodesQueryRe is the regular expression to use. CatalogNodesQueryRe = regexp.MustCompile(`\A` + dcRe + nearRe + `\z`) )
var ( // CatalogServiceQueryRe is the regular expression to use. CatalogServiceQueryRe = regexp.MustCompile(`\A` + tagRe + serviceNameRe + dcRe + nearRe + `\z`) )
var ( // CatalogServicesQueryRe is the regular expression to use for CatalogNodesQuery. CatalogServicesQueryRe = regexp.MustCompile(`\A` + dcRe + `\z`) )
var ErrContinue = errors.New("dependency continue")
ErrContinue is a special error which says to continue (retry) on error.
var ErrLeaseExpired = errors.New("lease expired or is not renewable")
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.
var ( // FileQuerySleepTime is the amount of time to sleep between queries, since // the fsnotify library is not compatible with solaris and other OSes yet. FileQuerySleepTime = 2 * time.Second )
var ( // HealthServiceQueryRe is the regular expression to use. HealthServiceQueryRe = regexp.MustCompile(`\A` + tagRe + serviceNameRe + dcRe + nearRe + filterRe + `\z`) )
var ( // KVExistsQueryRe is the regular expression to use. KVExistsQueryRe = regexp.MustCompile(`\A` + keyRe + dcRe + `\z`) )
var ( // KVGetQueryRe is the regular expression to use. KVGetQueryRe = regexp.MustCompile(`\A` + keyRe + dcRe + `\z`) )
var ( // KVKeysQueryRe is the regular expression to use. KVKeysQueryRe = regexp.MustCompile(`\A` + prefixRe + dcRe + `\z`) )
var ( // KVListQueryRe is the regular expression to use. KVListQueryRe = regexp.MustCompile(`\A` + prefixRe + dcRe + `\z`) )
Functions ¶
This section is empty.
Types ¶
type BlockingQuery ¶
type BlockingQuery interface {
// contains filtered or unexported methods
}
Using interfaces for type annotations see hashicat/dep/ for interface definitions.
type ByName ¶
type ByName []*dep.CatalogSnippet
ByName is a sortable slice of CatalogService structs.
type ByNodeThenID ¶
type ByNodeThenID []*dep.HealthService
ByNodeThenID is a sortable slice of Service
func (ByNodeThenID) Len ¶
func (s ByNodeThenID) Len() int
Len, Swap, and Less are used to implement the sort.Sort interface.
func (ByNodeThenID) Less ¶
func (s ByNodeThenID) Less(i, j int) bool
func (ByNodeThenID) Swap ¶
func (s ByNodeThenID) Swap(i, j int)
type ByService ¶
type ByService []*dep.CatalogNodeService
ByService is a sorter of node services by their service name and then ID.
type CatalogDatacentersQuery ¶
type CatalogDatacentersQuery struct {
// contains filtered or unexported fields
}
CatalogDatacentersQuery is the dependency to query all datacenters
func NewCatalogDatacentersQuery ¶
func NewCatalogDatacentersQuery(ignoreFailing bool) (*CatalogDatacentersQuery, error)
NewCatalogDatacentersQuery creates a new datacenter dependency.
func (*CatalogDatacentersQuery) CanShare ¶
func (d *CatalogDatacentersQuery) CanShare() bool
CanShare returns if this dependency is shareable.
func (*CatalogDatacentersQuery) Fetch ¶
func (d *CatalogDatacentersQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
Fetch queries the Consul API defined by the given client and returns a slice of strings representing the datacenters
func (*CatalogDatacentersQuery) ID ¶
func (d *CatalogDatacentersQuery) ID() string
ID returns the human-friendly version of this dependency.
func (*CatalogDatacentersQuery) SetOptions ¶
func (d *CatalogDatacentersQuery) SetOptions(opts QueryOptions)
func (*CatalogDatacentersQuery) Stop ¶
func (d *CatalogDatacentersQuery) Stop()
Stop terminates this dependency's fetch.
func (*CatalogDatacentersQuery) String ¶
func (d *CatalogDatacentersQuery) String() string
Stringer interface reuses ID
type CatalogNodeQuery ¶
type CatalogNodeQuery struct {
// contains filtered or unexported fields
}
CatalogNodeQuery represents a single node from the Consul catalog.
func NewCatalogNodeQuery ¶
func NewCatalogNodeQuery(s string) (*CatalogNodeQuery, error)
NewCatalogNodeQuery parses the given string into a dependency. If the name is empty then the name of the local agent is used.
func (*CatalogNodeQuery) CanShare ¶
func (d *CatalogNodeQuery) CanShare() bool
CanShare returns a boolean if this dependency is shareable.
func (*CatalogNodeQuery) Fetch ¶
func (d *CatalogNodeQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
Fetch queries the Consul API defined by the given client and returns a of CatalogNode object.
func (*CatalogNodeQuery) ID ¶
func (d *CatalogNodeQuery) ID() string
ID returns the human-friendly version of this dependency.
func (*CatalogNodeQuery) SetOptions ¶
func (d *CatalogNodeQuery) SetOptions(opts QueryOptions)
func (*CatalogNodeQuery) Stop ¶
func (d *CatalogNodeQuery) Stop()
Stop halts the dependency's fetch function.
func (*CatalogNodeQuery) String ¶
func (d *CatalogNodeQuery) String() string
Stringer interface reuses ID
type CatalogNodesQuery ¶
type CatalogNodesQuery struct {
// contains filtered or unexported fields
}
CatalogNodesQuery is the representation of all registered nodes in Consul.
func NewCatalogNodesQuery ¶
func NewCatalogNodesQuery(s string) (*CatalogNodesQuery, error)
NewCatalogNodesQuery parses the given string into a dependency. If the name is empty then the name of the local agent is used.
func (*CatalogNodesQuery) CanShare ¶
func (d *CatalogNodesQuery) CanShare() bool
CanShare returns a boolean if this dependency is shareable.
func (*CatalogNodesQuery) Fetch ¶
func (d *CatalogNodesQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
Fetch queries the Consul API defined by the given client and returns a slice of Node objects
func (*CatalogNodesQuery) ID ¶
func (d *CatalogNodesQuery) ID() string
ID returns the human-friendly version of this dependency.
func (*CatalogNodesQuery) SetOptions ¶
func (d *CatalogNodesQuery) SetOptions(opts QueryOptions)
func (*CatalogNodesQuery) Stop ¶
func (d *CatalogNodesQuery) Stop()
Stop halts the dependency's fetch function.
func (*CatalogNodesQuery) String ¶
func (d *CatalogNodesQuery) String() string
Stringer interface reuses ID
type CatalogService ¶
type CatalogService struct { ID string Node string Address string Datacenter string TaggedAddresses map[string]string NodeMeta map[string]string ServiceID string ServiceName string ServiceAddress string ServiceTags dep.ServiceTags ServiceMeta map[string]string ServicePort int Namespace string }
CatalogService is a catalog entry in Consul.
type CatalogServiceQuery ¶
type CatalogServiceQuery struct {
// contains filtered or unexported fields
}
CatalogServiceQuery is the representation of a requested catalog services dependency from inside a template.
func NewCatalogServiceQuery ¶
func NewCatalogServiceQuery(s string) (*CatalogServiceQuery, error)
NewCatalogServiceQuery parses a string into a CatalogServiceQuery.
func (*CatalogServiceQuery) CanShare ¶
func (d *CatalogServiceQuery) CanShare() bool
CanShare returns a boolean if this dependency is shareable.
func (*CatalogServiceQuery) Fetch ¶
func (d *CatalogServiceQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
Fetch queries the Consul API defined by the given client and returns a slice of CatalogService objects.
func (*CatalogServiceQuery) ID ¶
func (d *CatalogServiceQuery) ID() string
ID returns the human-friendly version of this dependency.
func (*CatalogServiceQuery) SetOptions ¶
func (d *CatalogServiceQuery) SetOptions(opts QueryOptions)
func (*CatalogServiceQuery) Stop ¶
func (d *CatalogServiceQuery) Stop()
Stop halts the dependency's fetch function.
func (*CatalogServiceQuery) String ¶
func (d *CatalogServiceQuery) String() string
Stringer interface reuses ID
type CatalogServicesQuery ¶
type CatalogServicesQuery struct {
// contains filtered or unexported fields
}
CatalogServicesQuery is the representation of a requested catalog service dependency from inside a template.
func NewCatalogServicesQuery ¶
func NewCatalogServicesQuery(s string) (*CatalogServicesQuery, error)
NewCatalogServicesQuery parses a string of the format @dc.
func NewCatalogServicesQueryV1 ¶
func NewCatalogServicesQueryV1(opts []string) (*CatalogServicesQuery, error)
NewCatalogServicesQueryV1 processes options in the format of "key=value" e.g. "dc=dc1"
func (*CatalogServicesQuery) CanShare ¶
func (d *CatalogServicesQuery) CanShare() bool
CanShare returns a boolean if this dependency is shareable.
func (*CatalogServicesQuery) Fetch ¶
func (d *CatalogServicesQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
Fetch queries the Consul API defined by the given client and returns a slice of CatalogService objects.
func (*CatalogServicesQuery) ID ¶
func (d *CatalogServicesQuery) ID() string
ID returns the human-friendly version of this dependency.
func (*CatalogServicesQuery) SetOptions ¶
func (d *CatalogServicesQuery) SetOptions(opts QueryOptions)
func (*CatalogServicesQuery) Stop ¶
func (d *CatalogServicesQuery) Stop()
Stop halts the dependency's fetch function.
func (*CatalogServicesQuery) String ¶
func (d *CatalogServicesQuery) String() string
Stringer interface reuses ID
type ClientSet ¶
ClientSet is a collection of clients that dependencies use to communicate with remote services like Consul or Vault.
func NewClientSet ¶
func NewClientSet() *ClientSet
NewClientSet creates a new client set that is ready to accept clients.
func (*ClientSet) CreateConsulClient ¶
func (c *ClientSet) CreateConsulClient(i *CreateClientInput) error
CreateConsulClient creates a new Consul API client from the given input.
func (*ClientSet) CreateVaultClient ¶
func (c *ClientSet) CreateVaultClient(i *CreateClientInput) error
type ConnectCAQuery ¶
type ConnectCAQuery struct {
// contains filtered or unexported fields
}
func NewConnectCAQuery ¶
func NewConnectCAQuery() *ConnectCAQuery
func (*ConnectCAQuery) CanShare ¶
func (d *ConnectCAQuery) CanShare() bool
func (*ConnectCAQuery) Fetch ¶
func (d *ConnectCAQuery) Fetch(clients dep.Clients) ( interface{}, *dep.ResponseMetadata, error, )
func (*ConnectCAQuery) ID ¶
func (d *ConnectCAQuery) ID() string
ID returns the human-friendly version of this dependency.
func (*ConnectCAQuery) SetOptions ¶
func (d *ConnectCAQuery) SetOptions(opts QueryOptions)
func (*ConnectCAQuery) Stop ¶
func (d *ConnectCAQuery) Stop()
func (*ConnectCAQuery) String ¶
func (d *ConnectCAQuery) String() string
Stringer interface reuses ID
type ConnectLeafQuery ¶
type ConnectLeafQuery struct {
// contains filtered or unexported fields
}
func NewConnectLeafQuery ¶
func NewConnectLeafQuery(service string) *ConnectLeafQuery
func (*ConnectLeafQuery) CanShare ¶
func (d *ConnectLeafQuery) CanShare() bool
func (*ConnectLeafQuery) Fetch ¶
func (d *ConnectLeafQuery) Fetch(clients dep.Clients) ( interface{}, *dep.ResponseMetadata, error, )
func (*ConnectLeafQuery) ID ¶
func (d *ConnectLeafQuery) ID() string
ID returns the human-friendly version of this dependency.
func (*ConnectLeafQuery) SetOptions ¶
func (d *ConnectLeafQuery) SetOptions(opts QueryOptions)
func (*ConnectLeafQuery) Stop ¶
func (d *ConnectLeafQuery) Stop()
func (*ConnectLeafQuery) String ¶
func (d *ConnectLeafQuery) String() string
Stringer interface reuses ID
type ConsulType ¶
type ConsulType interface {
Consul()
}
type CreateClientInput ¶
type CreateClientInput struct { Address string Namespace string Token string // vault only UnwrapToken bool // consul only AuthEnabled bool AuthUsername string AuthPassword string // Transport/TLS SSLEnabled bool SSLVerify bool SSLCert string SSLKey string SSLCACert string SSLCAPath string ServerName string TransportCustomDialer TransportDialer // Deprecated: use TransportCustomDialer TransportDialKeepAlive time.Duration // Deprecated: use TransportCustomDialer TransportDialTimeout time.Duration TransportDisableKeepAlives bool TransportIdleConnTimeout time.Duration TransportMaxIdleConns int TransportMaxIdleConnsPerHost int TransportTLSHandshakeTimeout time.Duration // optional, principally for testing HttpClient *http.Client }
CreateClientInput is used as input to the CreateClient functions.
type FakeDep ¶
type FakeDep struct { Name string Opts QueryOptions // contains filtered or unexported fields }
////////// FakeDep is a fake dependency that does not actually speaks to a server.
func (*FakeDep) GetOptions ¶
func (d *FakeDep) GetOptions() QueryOptions
func (*FakeDep) SetOptions ¶
func (d *FakeDep) SetOptions(opts QueryOptions)
type FakeDepBlockingQuery ¶
type FakeDepBlockingQuery struct { FakeDep Name string Data interface{} BlockDuration time.Duration Ctx context.Context // contains filtered or unexported fields }
FakeDepBlockingQuery is a fake dependency that blocks on Fetch for a duration to resemble Consul blocking queries.
func (*FakeDepBlockingQuery) Fetch ¶
func (d *FakeDepBlockingQuery) Fetch(dep.Clients) (interface{}, *dep.ResponseMetadata, error)
func (*FakeDepBlockingQuery) ID ¶
func (d *FakeDepBlockingQuery) ID() string
func (*FakeDepBlockingQuery) Stop ¶
func (d *FakeDepBlockingQuery) Stop()
func (*FakeDepBlockingQuery) String ¶
func (d *FakeDepBlockingQuery) String() string
type FakeDepFetchError ¶
////////// FakeDepFetchError is a fake dependency that returns an error while fetching.
func (*FakeDepFetchError) Fetch ¶
func (d *FakeDepFetchError) Fetch(dep.Clients) (interface{}, *dep.ResponseMetadata, error)
func (*FakeDepFetchError) ID ¶
func (d *FakeDepFetchError) ID() string
func (*FakeDepFetchError) String ¶
func (d *FakeDepFetchError) String() string
type FakeDepRetry ¶
type FakeDepRetry struct { FakeDep sync.Mutex Name string // contains filtered or unexported fields }
////////// FakeDepRetry is a fake dependency that errors on the first fetch and succeeds on subsequent fetches.
func (*FakeDepRetry) Fetch ¶
func (d *FakeDepRetry) Fetch(dep.Clients) (interface{}, *dep.ResponseMetadata, error)
func (*FakeDepRetry) ID ¶
func (d *FakeDepRetry) ID() string
func (*FakeDepRetry) String ¶
func (d *FakeDepRetry) String() string
type FakeDepSameIndex ¶
type FakeDepSameIndex struct {
FakeDep
}
func (*FakeDepSameIndex) Fetch ¶
func (d *FakeDepSameIndex) Fetch(dep.Clients) (interface{}, *dep.ResponseMetadata, error)
func (*FakeDepSameIndex) ID ¶
func (d *FakeDepSameIndex) ID() string
func (*FakeDepSameIndex) String ¶
func (d *FakeDepSameIndex) String() string
type FakeDepStale ¶
////////// FakeDepStale is a fake dependency that can be used to test what happens when stale data is permitted.
func (*FakeDepStale) Fetch ¶
func (d *FakeDepStale) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
Fetch is used to implement the dependency interface.
func (*FakeDepStale) ID ¶
func (d *FakeDepStale) ID() string
func (*FakeDepStale) String ¶
func (d *FakeDepStale) String() string
type FakeListDep ¶
////////// FakeListDep is a fake dependency that does not actually speaks to a server. Returns a list, to allow for multi-pass template tests
func (*FakeListDep) Fetch ¶
func (d *FakeListDep) Fetch(dep.Clients) (interface{}, *dep.ResponseMetadata, error)
func (*FakeListDep) ID ¶
func (d *FakeListDep) ID() string
func (*FakeListDep) String ¶
func (d *FakeListDep) String() string
type FileQuery ¶
type FileQuery struct {
// contains filtered or unexported fields
}
FileQuery represents a local file dependency.
func NewFileQuery ¶
NewFileQuery creates a file dependency from the given path.
func (*FileQuery) Fetch ¶
Fetch retrieves this dependency and returns the result or any errors that occur in the process.
func (*FileQuery) SetOptions ¶
func (d *FileQuery) SetOptions(opts QueryOptions)
type HealthServiceQuery ¶
type HealthServiceQuery struct {
// contains filtered or unexported fields
}
HealthServiceQuery is the representation of all a service query in Consul.
func NewHealthConnectQuery ¶
func NewHealthConnectQuery(s string) (*HealthServiceQuery, error)
NewHealthConnect Query processes the strings to build a connect dependency.
func NewHealthConnectQueryV1 ¶
func NewHealthConnectQueryV1(s string, opts []string) (*HealthServiceQuery, error)
NewHealthConnectQueryV1 Query processes the strings to build a connect dependency.
func NewHealthServiceQuery ¶
func NewHealthServiceQuery(s string) (*HealthServiceQuery, error)
NewHealthServiceQuery processes the strings to build a service dependency.
func NewHealthServiceQueryV1 ¶
func NewHealthServiceQueryV1(s string, opts []string) (*HealthServiceQuery, error)
NewHealthServiceQueryV1 processes the strings to build a service dependency.
func (*HealthServiceQuery) CanShare ¶
func (d *HealthServiceQuery) CanShare() bool
CanShare returns a boolean if this dependency is shareable.
func (*HealthServiceQuery) Fetch ¶
func (d *HealthServiceQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
Fetch queries the Consul API defined by the given client and returns a slice of HealthService objects.
func (*HealthServiceQuery) ID ¶
func (d *HealthServiceQuery) ID() string
ID returns the human-friendly version of this dependency.
func (*HealthServiceQuery) SetOptions ¶
func (d *HealthServiceQuery) SetOptions(opts QueryOptions)
func (*HealthServiceQuery) Stop ¶
func (d *HealthServiceQuery) Stop()
Stop halts the dependency's fetch function.
func (*HealthServiceQuery) String ¶
func (d *HealthServiceQuery) String() string
Stringer interface reuses ID
type KVExistsGetQuery ¶
type KVExistsGetQuery struct { BlockingQuery KVExistsQuery }
KVExistsGetQuery uses a non-blocking query to lookup a single key in the KV store. The query returns whether the key exists and the value of the key if it exists.
func NewKVExistsGetQueryV1 ¶
func NewKVExistsGetQueryV1(key string, opts []string) (*KVExistsGetQuery, error)
NewKVExistsGetQueryV1 processes options in the format of "key key=value" e.g. "my/key dc=dc1"
func (*KVExistsGetQuery) CanShare ¶
func (d *KVExistsGetQuery) CanShare() bool
CanShare returns a boolean if this dependency is shareable.
func (*KVExistsGetQuery) Fetch ¶
func (d *KVExistsGetQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
Fetch queries the Consul API defined by the given client.
func (*KVExistsGetQuery) ID ¶
func (d *KVExistsGetQuery) ID() string
ID returns the human-friendly version of this dependency.
func (*KVExistsGetQuery) SetOptions ¶
func (d *KVExistsGetQuery) SetOptions(opts QueryOptions)
func (*KVExistsGetQuery) Stop ¶
func (d *KVExistsGetQuery) Stop()
Stop halts the dependency's fetch function.
func (*KVExistsGetQuery) String ¶
func (d *KVExistsGetQuery) String() string
Stringer interface reuses ID
type KVExistsQuery ¶
type KVExistsQuery struct {
// contains filtered or unexported fields
}
KVExistsQuery uses a non-blocking query with the KV store for key lookup.
func NewKVExistsQuery ¶
func NewKVExistsQuery(s string) (*KVExistsQuery, error)
NewKVExistsQuery parses a string into a KV lookup.
func NewKVExistsQueryV1 ¶
func NewKVExistsQueryV1(key string, opts []string) (*KVExistsQuery, error)
NewKVExistsQueryV1 processes options in the format of "key key=value" e.g. "my/key dc=dc1"
func (*KVExistsQuery) CanShare ¶
func (d *KVExistsQuery) CanShare() bool
CanShare returns a boolean if this dependency is shareable.
func (*KVExistsQuery) Fetch ¶
func (d *KVExistsQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
Fetch queries the Consul API defined by the given client.
func (*KVExistsQuery) ID ¶
func (d *KVExistsQuery) ID() string
ID returns the human-friendly version of this dependency.
func (*KVExistsQuery) SetOptions ¶
func (d *KVExistsQuery) SetOptions(opts QueryOptions)
func (*KVExistsQuery) Stop ¶
func (d *KVExistsQuery) Stop()
Stop halts the dependency's fetch function.
type KVGetQuery ¶
type KVGetQuery struct { KVExistsQuery // contains filtered or unexported fields }
KVGetQuery queries the KV store for a single key.
func NewKVGetQuery ¶
func NewKVGetQuery(s string) (*KVGetQuery, error)
NewKVGetQuery parses a string into a (non-blocking) KV lookup.
func NewKVGetQueryV1 ¶
func NewKVGetQueryV1(key string, opts []string) (*KVGetQuery, error)
NewKVGetQueryV1 processes options in the format of "key key=value" e.g. "my/key dc=dc1"
func (*KVGetQuery) CanShare ¶
func (d *KVGetQuery) CanShare() bool
CanShare returns a boolean if this dependency is shareable.
func (*KVGetQuery) Fetch ¶
func (d *KVGetQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
Fetch queries the Consul API defined by the given client.
func (*KVGetQuery) ID ¶
func (d *KVGetQuery) ID() string
ID returns the human-friendly version of this dependency.
func (*KVGetQuery) SetOptions ¶
func (d *KVGetQuery) SetOptions(opts QueryOptions)
type KVKeysQuery ¶
type KVKeysQuery struct {
// contains filtered or unexported fields
}
KVKeysQuery queries the KV store for a single key.
func NewKVKeysQuery ¶
func NewKVKeysQuery(s string) (*KVKeysQuery, error)
NewKVKeysQuery parses a string into a dependency.
func (*KVKeysQuery) CanShare ¶
func (d *KVKeysQuery) CanShare() bool
CanShare returns a boolean if this dependency is shareable.
func (*KVKeysQuery) Fetch ¶
func (d *KVKeysQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
Fetch queries the Consul API defined by the given client.
func (*KVKeysQuery) ID ¶
func (d *KVKeysQuery) ID() string
ID returns the human-friendly version of this dependency.
func (*KVKeysQuery) SetOptions ¶
func (d *KVKeysQuery) SetOptions(opts QueryOptions)
type KVListQuery ¶
type KVListQuery struct {
// contains filtered or unexported fields
}
KVListQuery queries the KV store for a single key.
func NewKVListQuery ¶
func NewKVListQuery(s string) (*KVListQuery, error)
NewKVListQuery parses a string into a dependency.
func NewKVListQueryV1 ¶
func NewKVListQueryV1(prefix string, opts []string) (*KVListQuery, error)
NewKVListQuery processes options in the format of "prefix key=value" e.g. "key_prefix dc=dc1"
func (*KVListQuery) CanShare ¶
func (d *KVListQuery) CanShare() bool
CanShare returns a boolean if this dependency is shareable.
func (*KVListQuery) Fetch ¶
func (d *KVListQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
Fetch queries the Consul API defined by the given client.
func (*KVListQuery) ID ¶
func (d *KVListQuery) ID() string
ID returns the human-friendly version of this dependency.
func (*KVListQuery) SetOptions ¶
func (d *KVListQuery) SetOptions(opts QueryOptions)
type QueryOptions ¶
type QueryOptions struct { AllowStale bool Datacenter string Filter string Namespace string Near string RequireConsistent bool VaultGrace time.Duration WaitIndex uint64 WaitTime time.Duration DefaultLease time.Duration // contains filtered or unexported fields }
QueryOptions is a list of options to send with the query. These options are client-agnostic, and the dependency determines which, if any, of the options to use.
func (*QueryOptions) Merge ¶
func (q *QueryOptions) Merge(o *QueryOptions) *QueryOptions
func (*QueryOptions) SetContext ¶
func (q *QueryOptions) SetContext(ctx context.Context) QueryOptions
func (*QueryOptions) String ¶
func (q *QueryOptions) String() string
func (*QueryOptions) ToConsulOpts ¶
func (q *QueryOptions) ToConsulOpts() *consulapi.QueryOptions
type QueryOptionsSetter ¶
type QueryOptionsSetter interface {
SetOptions(QueryOptions)
}
used to help shoehorn the dependency setup into hashicat until I get a chance to rework it Used to assert/access option setting
type ResponseMetadata ¶
type ResponseMetadata = dep.ResponseMetadata
Type aliases to simplify things as we refactor type QueryOptions = dep.QueryOptions
type TransportDialer ¶ added in v0.2.0
type TransportDialer interface {
DialContext(ctx context.Context, network, address string) (net.Conn, error)
}
TransportDialer is an interface that allows passing a custom dialer function to an HTTP client's transport config Intended to match https://pkg.go.dev/net#Dialer.DialContext
type VaultAgentTokenQuery ¶
type VaultAgentTokenQuery struct {
// contains filtered or unexported fields
}
VaultAgentTokenQuery is the dependency to Vault Agent token
func NewVaultAgentTokenQuery ¶
func NewVaultAgentTokenQuery(path string) (*VaultAgentTokenQuery, error)
NewVaultAgentTokenQuery creates a new dependency.
func (*VaultAgentTokenQuery) CanShare ¶
func (d *VaultAgentTokenQuery) CanShare() bool
CanShare returns if this dependency is sharable.
func (*VaultAgentTokenQuery) Fetch ¶
func (d *VaultAgentTokenQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
Fetch retrieves this dependency and returns the result or any errors that occur in the process.
func (*VaultAgentTokenQuery) ID ¶
func (d *VaultAgentTokenQuery) ID() string
ID returns the human-friendly version of this dependency.
func (*VaultAgentTokenQuery) SetOptions ¶
func (d *VaultAgentTokenQuery) SetOptions(opts QueryOptions)
func (*VaultAgentTokenQuery) Stop ¶
func (d *VaultAgentTokenQuery) Stop()
Stop halts the dependency's fetch function.
func (*VaultAgentTokenQuery) String ¶
func (d *VaultAgentTokenQuery) String() string
Stringer interface reuses ID
type VaultListQuery ¶
type VaultListQuery struct {
// contains filtered or unexported fields
}
VaultListQuery is the dependency to Vault for a secret
func NewVaultListQuery ¶
func NewVaultListQuery(s string) (*VaultListQuery, error)
NewVaultListQuery creates a new datacenter dependency.
func (*VaultListQuery) CanShare ¶
func (d *VaultListQuery) CanShare() bool
CanShare returns if this dependency is shareable.
func (*VaultListQuery) Fetch ¶
func (d *VaultListQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
Fetch queries the Vault API
func (*VaultListQuery) ID ¶
func (d *VaultListQuery) ID() string
ID returns the human-friendly version of this dependency.
func (*VaultListQuery) SetOptions ¶
func (d *VaultListQuery) SetOptions(opts QueryOptions)
func (*VaultListQuery) Stop ¶
func (d *VaultListQuery) Stop()
Stop halts the given dependency's fetch.
func (*VaultListQuery) String ¶
func (d *VaultListQuery) String() string
Stringer interface reuses ID
type VaultReadQuery ¶
type VaultReadQuery struct {
// contains filtered or unexported fields
}
VaultReadQuery is the dependency to Vault for a secret
func NewVaultReadQuery ¶
func NewVaultReadQuery(s string) (*VaultReadQuery, error)
NewVaultReadQuery creates a new datacenter dependency.
func (*VaultReadQuery) CanShare ¶
func (d *VaultReadQuery) CanShare() bool
CanShare returns if this dependency is shareable.
func (*VaultReadQuery) Fetch ¶
func (d *VaultReadQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
Fetch queries the Vault API
func (*VaultReadQuery) ID ¶
func (d *VaultReadQuery) ID() string
ID returns the human-friendly version of this dependency.
func (*VaultReadQuery) SetOptions ¶
func (d *VaultReadQuery) SetOptions(opts QueryOptions)
func (*VaultReadQuery) Stop ¶
func (d *VaultReadQuery) Stop()
Stop halts the given dependency's fetch.
func (*VaultReadQuery) String ¶
func (d *VaultReadQuery) String() string
Stringer interface reuses ID
type VaultTokenQuery ¶
type VaultTokenQuery struct {
// contains filtered or unexported fields
}
VaultTokenQuery is the dependency to Vault for a secret
func NewVaultTokenQuery ¶
func NewVaultTokenQuery(token string) (*VaultTokenQuery, error)
NewVaultTokenQuery creates a new dependency.
func (*VaultTokenQuery) CanShare ¶
func (d *VaultTokenQuery) CanShare() bool
CanShare returns if this dependency is shareable.
func (*VaultTokenQuery) Fetch ¶
func (d *VaultTokenQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
Fetch queries the Vault API
func (*VaultTokenQuery) ID ¶
func (d *VaultTokenQuery) ID() string
ID returns the human-friendly version of this dependency.
func (*VaultTokenQuery) SetOptions ¶
func (d *VaultTokenQuery) SetOptions(opts QueryOptions)
func (*VaultTokenQuery) Stop ¶
func (d *VaultTokenQuery) Stop()
Stop halts the dependency's fetch function.
func (*VaultTokenQuery) String ¶
func (d *VaultTokenQuery) String() string
Stringer interface reuses ID
type VaultWriteQuery ¶
type VaultWriteQuery struct {
// contains filtered or unexported fields
}
VaultWriteQuery is the dependency to Vault for a secret
func NewVaultWriteQuery ¶
func NewVaultWriteQuery(s string, d map[string]interface{}) (*VaultWriteQuery, error)
NewVaultWriteQuery creates a new datacenter dependency.
func (*VaultWriteQuery) CanShare ¶
func (d *VaultWriteQuery) CanShare() bool
CanShare returns if this dependency is shareable.
func (*VaultWriteQuery) Fetch ¶
func (d *VaultWriteQuery) Fetch(clients dep.Clients) (interface{}, *dep.ResponseMetadata, error)
Fetch queries the Vault API
func (*VaultWriteQuery) ID ¶
func (d *VaultWriteQuery) ID() string
ID returns the human-friendly version of this dependency.
func (*VaultWriteQuery) SetOptions ¶
func (d *VaultWriteQuery) SetOptions(opts QueryOptions)
func (*VaultWriteQuery) Stop ¶
func (d *VaultWriteQuery) Stop()
Stop halts the given dependency's fetch.
func (*VaultWriteQuery) String ¶
func (d *VaultWriteQuery) String() string
Stringer interface reuses ID
Source Files ¶
- catalog_datacenters.go
- catalog_node.go
- catalog_nodes.go
- catalog_service.go
- catalog_services.go
- client_set.go
- connect_ca.go
- connect_leaf.go
- dependency.go
- errors.go
- fakedep.go
- file.go
- health_service.go
- kv_exists.go
- kv_exists_get.go
- kv_get.go
- kv_keys.go
- kv_list.go
- vault_agent_token.go
- vault_common.go
- vault_list.go
- vault_read.go
- vault_token.go
- vault_write.go