Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyDefaultProxySettings(c *api.Client) (bool, error)
- func BoolToPointer(b bool) *bool
- func DefaultToEmpty(name string) string
- func DockerExec(args []string, stdout io.Writer) error
- func DockerImage(image, version string) string
- func Dump(v any) string
- func GenerateKey() (pub, priv string, err error)
- func GetLatestImageName() string
- func GetTargetImageName() string
- func IntToPointer(i int) *int
- func IsEnterprise() bool
- func JQFilter(config, filter string) ([]string, error)
- func NamespaceOrDefault(name string) string
- func NewJWKS(pubKey string) (*jose.JSONWebKeySet, error)
- func PartitionOrDefault(name string) string
- func PartitionQueryOptions(partition string) *api.QueryOptions
- func RandName(name string) string
- func SideCarVersion(agentVersion string) string
- func SignJWT(privKey string, claims jwt.Claims, privateClaims interface{}) (string, error)
- func StringToPointer(s string) *string
- func VersionGTE(a, b string) bool
- func VersionLT(a, b string) bool
- type ResettableDefer
- type Waiter
Constants ¶
const ( DefaultImageNameOSS = "hashicorp/consul" DefaultImageNameENT = "hashicorp/consul-enterprise" ImageVersionSuffixENT = "-ent" )
const (
ImageVersionSuffix = ""
)
Variables ¶
var ( TargetVersion string LatestImageName string LatestVersion string FollowLog bool Debug bool Version_1_14, _ = version.NewVersion("1.14") )
Functions ¶
func BoolToPointer ¶
func DefaultToEmpty ¶
func DockerExec ¶
DockerExec simply shell out to the docker CLI binary on your host.
func DockerImage ¶
func GenerateKey ¶
Generates a private and public key pair that is for signing JWT.
func GetLatestImageName ¶
func GetLatestImageName() string
func GetTargetImageName ¶
func GetTargetImageName() string
func IntToPointer ¶
func IsEnterprise ¶
func IsEnterprise() bool
func JQFilter ¶
JQFilter uses the provided "jq" filter to parse json. Matching results are returned as a slice of strings.
func NamespaceOrDefault ¶
func NewJWKS ¶
func NewJWKS(pubKey string) (*jose.JSONWebKeySet, error)
newJWKS converts a pem-encoded public key into JWKS data suitable for a verification endpoint response
func PartitionOrDefault ¶
func PartitionQueryOptions ¶
func PartitionQueryOptions(partition string) *api.QueryOptions
PartitionQueryOptions returns an *api.QueryOptions with the given partition field set only if the partition is non-default. This helps when writing tests for joint use in OSS and ENT.
func SideCarVersion ¶
SideCarVersion returns version based on the agent version in the test: if agent has local, the sidecar version is target-version; otherwise use "latest-version"
func SignJWT ¶
SignJWT will bundle the provided claims into a signed JWT. The provided key is assumed to be ECDSA.
If no private key is provided, it will generate a private key. These can be retrieved via the SigningKeys() method.
func StringToPointer ¶
Types ¶
type ResettableDefer ¶
type ResettableDefer struct {
// contains filtered or unexported fields
}
ResettableDefer is a way to capture a series of cleanup functions and bulk-cancel them. Ideal to use in a long constructor function before the overall Close/Stop/Terminate method is ready to use to tear down all of the portions properly.
func (*ResettableDefer) Add ¶
func (d *ResettableDefer) Add(f func())
Add registers another function to call at Execute time.
func (*ResettableDefer) Execute ¶
func (d *ResettableDefer) Execute()
Execute actually executes the functions registered by Add in the reverse order of their call order (like normal defer blocks).
func (*ResettableDefer) Reset ¶
func (d *ResettableDefer) Reset()
Reset clears the pending defer work.
type Waiter ¶
type Waiter struct {
// MinFailures before exponential backoff starts. Any failures before
// MinFailures is reached will wait MinWait time.
MinFailures uint
// MinWait time. Returned after the first failure.
MinWait time.Duration
// MaxWait time.
MaxWait time.Duration
// Factor is the multiplier to use when calculating the delay. Defaults to
// 1 second.
Factor time.Duration
// contains filtered or unexported fields
}
Waiter records the number of failures and performs exponential backoff when when there are consecutive failures.