consul

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2021 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDefaultAddress

func SetDefaultAddress(val string)

func SetDefaultAgentAddress

func SetDefaultAgentAddress(val string)

func SetDefaultAgentEnableTagOverride

func SetDefaultAgentEnableTagOverride(val bool)

func SetDefaultAgentID

func SetDefaultAgentID(val string)

func SetDefaultAgentKind

func SetDefaultAgentKind(val string)

func SetDefaultAgentMeta

func SetDefaultAgentMeta(val map[string]string)

func SetDefaultAgentName

func SetDefaultAgentName(val string)

func SetDefaultAgentNamespace

func SetDefaultAgentNamespace(val string)

func SetDefaultAgentPort

func SetDefaultAgentPort(val int)

func SetDefaultAgentTags

func SetDefaultAgentTags(val []string)

func SetDefaultAuthPassword

func SetDefaultAuthPassword(val string)

func SetDefaultAuthUsername

func SetDefaultAuthUsername(val string)

func SetDefaultClientFlagsPrefix

func SetDefaultClientFlagsPrefix(val string)

func SetDefaultDatacenter

func SetDefaultDatacenter(val string)

func SetDefaultNamespace

func SetDefaultNamespace(val string)

func SetDefaultScheme

func SetDefaultScheme(val string)

func SetDefaultTLSAddress

func SetDefaultTLSAddress(val string)

func SetDefaultTLSCAFile

func SetDefaultTLSCAFile(val string)

func SetDefaultTLSCAPath

func SetDefaultTLSCAPath(val string)

func SetDefaultTLSCertFile

func SetDefaultTLSCertFile(val string)

func SetDefaultTLSFlagsPrefix

func SetDefaultTLSFlagsPrefix(val string)

func SetDefaultTLSInsecureSkipVerify

func SetDefaultTLSInsecureSkipVerify(val bool)

func SetDefaultTLSKeyFile

func SetDefaultTLSKeyFile(val string)

func SetDefaultToken

func SetDefaultToken(val string)

func SetDefaultTokenFile

func SetDefaultTokenFile(val string)

func SetDefaultWaitTime

func SetDefaultWaitTime(val time.Duration)

Types

type AgentCheck

type AgentCheck struct {
	Node        string
	CheckID     string
	Name        string
	Status      string
	Notes       string
	Output      string
	ServiceID   string
	ServiceName string
	Type        string
	Definition  HealthCheckDefinition
	Namespace   string `json:",omitempty"`
}

AgentCheck represents a check known to the agent

type AgentServiceCheck

type AgentServiceCheck struct {
}

type AgentServiceRegistration

type AgentServiceRegistration struct {
	Kind              string            `json:"kind,omitempty" yaml:"kind,omitempty"`
	ID                string            `json:"id,omitempty" yaml:"id,omitempty"`
	Name              string            `json:"name,omitempty" yaml:"name,omitempty"`
	Tags              []string          `json:"tags,omitempty" yaml:"tags,omitempty"`
	Port              int               `json:"port,omitempty" yaml:"port,omitempty"`
	Address           string            `json:"address,omitempty" yaml:"address,omitempty"`
	EnableTagOverride bool              `json:"enable-tag-override,omitempty" yaml:"enable-tag-override.omitempty"`
	Meta              map[string]string `json:"meta,omitempty" yaml:"meta,omitempty"`

	Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`

	// CustomBindFlagsFunc defines custom bind flags behaviour for structure, if CustomBindFlagsFunc is nil, default  bind flags behaviour will be used
	CustomBindFlagsFunc func(fs *bootflag.FlagSet) `json:"-" yaml:"-"`

	// CustomParseFunc defines custom parse behaviour for structure, if CustomParseFunc is nil, default parse behaviour will be used
	CustomParseFunc func() (err error) `json:"-" yaml:"-"`
}

func (*AgentServiceRegistration) BindFlags

func (asr *AgentServiceRegistration) BindFlags(fs *bootflag.FlagSet)

func (*AgentServiceRegistration) Parse

func (asr *AgentServiceRegistration) Parse() (err error)

func (*AgentServiceRegistration) Standardize

type AgentWeights

type AgentWeights struct {
	Passing int
	Warning int
}

AgentWeights represent optional weights for a service

type ClientConfig

type ClientConfig struct {
	// Address is the address of the Consul server
	Address string `json:"address" yaml:"address"`

	// Scheme is the URI scheme for the Consul server
	Scheme string `json:"scheme" yaml:"scheme"`

	// Datacenter to use. If not provided, the default agent datacenter is used.
	Datacenter string `json:"datacenter" yaml:"datacenter"`

	// HttpAuth is the auth info to use for http access.
	HttpAuth HttpBasicAuth `json:"auth" yaml:"auth"`

	// WaitTime limits how long a Watch will block. If not provided,
	// the agent default values will be used.
	WaitTime time.Duration `json:"wait-time" yaml:"wait-time"`

	// Token is used to provide a per-request ACL token
	// which overrides the agent's default token.
	Token string `json:"token" yaml:"token"`

	// TokenFile is a file containing the current token to use for this client.
	// If provided it is read once at startup and never again.
	TokenFile string `json:"token-file" yaml:"token-file"`

	// Namespace is the name of the namespace to send along for the request
	// when no other Namespace is present in the QueryOptions
	Namespace string `json:"namespace" yaml:"namespace"`

	TLSConfig TLSConfig `json:"tls" yaml:"tls"`

	// CustomBindFlagsFunc defines custom bind flags behaviour for structure, if CustomBindFlagsFunc is nil, default  bind flags behaviour will be used
	CustomBindFlagsFunc func(fs *bootflag.FlagSet) `json:"-" yaml:"-"`

	// CustomParseFunc defines custom parse behaviour for structure, if CustomParseFunc is nil, default parse behaviour will be used
	CustomParseFunc func() (err error) `json:"-" yaml:"-"`
}

ClientConfig is used to configure the creation of a client

func (*ClientConfig) BindFlags

func (c *ClientConfig) BindFlags(fs *bootflag.FlagSet)

func (*ClientConfig) Parse

func (c *ClientConfig) Parse() (err error)

func (*ClientConfig) Standardize

func (c *ClientConfig) Standardize() *api.Config

type Config

type Config struct {
	Client ClientConfig             `json:"client" yaml:"client"`
	Agent  AgentServiceRegistration `json:"agent-service-registration" yaml:"agent-service-registration"`

	// CustomBindFlagsFunc defines custom bind flags behaviour for structure, if CustomBindFlagsFunc is nil, default  bind flags behaviour will be used
	CustomBindFlagsFunc func(fs *bootflag.FlagSet) `json:"-" yaml:"-"`

	// CustomParseFunc defines custom parse behaviour for structure, if CustomParseFunc is nil, default parse behaviour will be used
	CustomParseFunc func() (err error) `json:"-" yaml:"-"`
}

func (*Config) BindFlags

func (c *Config) BindFlags(fs *bootflag.FlagSet)

func (*Config) Parse

func (c *Config) Parse() (err error)

type HealthCheck

type HealthCheck struct {
	Node        string
	CheckID     string
	Name        string
	Status      string
	Notes       string
	Output      string
	ServiceID   string
	ServiceName string
	ServiceTags []string
	Type        string
	Namespace   string `json:",omitempty"`

	Definition HealthCheckDefinition

	CreateIndex uint64
	ModifyIndex uint64
}

HealthCheck is used to represent a single check

type HealthCheckDefinition

type HealthCheckDefinition struct {
	HTTP                                   string
	Header                                 map[string][]string
	Method                                 string
	Body                                   string
	TLSSkipVerify                          bool
	TCP                                    string
	IntervalDuration                       time.Duration `json:"-"`
	TimeoutDuration                        time.Duration `json:"-"`
	DeregisterCriticalServiceAfterDuration time.Duration `json:"-"`
}

HealthCheckDefinition is used to store the details about a health check's execution.

type HttpBasicAuth

type HttpBasicAuth struct {
	// Username to use for HTTP Basic Authentication
	Username string `json:"username" yaml:"username"`

	// Password to use for HTTP Basic Authentication
	Password string `json:"password" yaml:"password"`

	// CustomBindFlagsFunc defines custom bind flags behaviour for structure, if CustomBindFlagsFunc is nil, default  bind flags behaviour will be used
	CustomBindFlagsFunc func(fs *bootflag.FlagSet) `json:"-" yaml:"-"`

	// CustomParseFunc defines custom parse behaviour for structure, if CustomParseFunc is nil, default parse behaviour will be used
	CustomParseFunc func() (err error) `json:"-" yaml:"-"`
}

HttpBasicAuth is used to authenticate http client with HTTP Basic Authentication

func (*HttpBasicAuth) BindFlags

func (hba *HttpBasicAuth) BindFlags(fs *bootflag.FlagSet)

func (*HttpBasicAuth) Parse

func (hba *HttpBasicAuth) Parse() (err error)

func (*HttpBasicAuth) Standardize

func (hba *HttpBasicAuth) Standardize() *api.HttpBasicAuth

type TLSConfig

type TLSConfig struct {
	// Address is the optional address of the Consul server. The port, if any
	// will be removed from here and this will be set to the ServerName of the
	// resulting config.
	Address string `json:"address" yaml:"address"`

	// CAFile is the optional path to the CA certificate used for Consul
	// communication, defaults to the system bundle if not specified.
	CAFile string `json:"ca-file" yaml:"ca-file"`

	// CAPath is the optional path to a directory of CA certificates to use for
	// Consul communication, defaults to the system bundle if not specified.
	CAPath string `json:"ca-path" yaml:"ca-path"`

	// CAPem is the optional PEM-encoded CA certificate used for Consul
	// communication, defaults to the system bundle if not specified.
	CAPem []byte `json:"ca-pem" yaml:"ca-pem"`

	// CertFile is the optional path to the certificate for Consul
	// communication. If this is set then you need to also set KeyFile.
	CertFile string `json:"cert-file" yaml:"cert-file"`

	// CertPEM is the optional PEM-encoded certificate for Consul
	// communication. If this is set then you need to also set KeyPEM.
	CertPEM []byte `json:"cert-pem" yaml:"cert-pem"`

	// KeyFile is the optional path to the private key for Consul communication.
	// If this is set then you need to also set CertFile.
	KeyFile string `json:"key-file" yaml:"key-file"`

	// KeyPEM is the optional PEM-encoded private key for Consul communication.
	// If this is set then you need to also set CertPEM.
	KeyPEM []byte `json:"key-pem" yaml:"key-pem"`

	// InsecureSkipVerify if set to true will disable TLS host verification.
	InsecureSkipVerify bool `json:"insecure-skip-verify" yaml:"insecure-skip-verify"`

	// CustomBindFlagsFunc defines custom bind flags behaviour for structure, if CustomBindFlagsFunc is nil, default  bind flags behaviour will be used
	CustomBindFlagsFunc func(fs *bootflag.FlagSet) `json:"-" yaml:"-"`

	// CustomParseFunc defines custom parse behaviour for structure, if CustomParseFunc is nil, default parse behaviour will be used
	CustomParseFunc func() (err error) `json:"-" yaml:"-"`
}

TLSConfig is used to generate a TLSClientConfig that's useful for talking to Consul using TLS.

func (*TLSConfig) BindFlags

func (c *TLSConfig) BindFlags(fs *bootflag.FlagSet)

func (*TLSConfig) Parse

func (c *TLSConfig) Parse() (err error)

func (*TLSConfig) Standardize

func (c *TLSConfig) Standardize() api.TLSConfig

Jump to

Keyboard shortcuts

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