consul

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Token      = AuthMethod("token")
	Kubernetes = AuthMethod("kubernetes")
)
View Source
const (
	PropertyPrefix = "cloud.consul"
)

Variables

View Source
var (
	ErrNoInstances = errors.New("no matching service instances found")
)

Functions

This section is empty.

Types

type AuthMethod

type AuthMethod string

func (*AuthMethod) UnmarshalText

func (a *AuthMethod) UnmarshalText(data []byte) error

UnmarshalText encoding.TextUnmarshaler

type ClientAuthentication

type ClientAuthentication interface {
	Login(client *api.Client) (token string, err error)
}

ClientAuthentication TODO review ClientAuthentication and KubernetesClient

type ClientConfig

type ClientConfig struct {
	*api.Config
	Properties *ConnectionProperties
	ClientAuth ClientAuthentication
}

type Connection

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

func New

func New(opts ...Options) (*Connection, error)

func (*Connection) Client

func (c *Connection) Client() *api.Client

func (*Connection) GetKeyValue

func (c *Connection) GetKeyValue(ctx context.Context, path string) (value []byte, err error)

func (*Connection) ListKeyValuePairs

func (c *Connection) ListKeyValuePairs(ctx context.Context, path string) (results map[string]interface{}, err error)

func (*Connection) SetKeyValue

func (c *Connection) SetKeyValue(ctx context.Context, path string, value []byte) error

type ConnectionProperties

type ConnectionProperties struct {
	Host           string           `json:"host"`
	Port           int              `json:"port"`
	Scheme         string           `json:"scheme"`
	SSL            SSLProperties    `json:"ssl"`
	Authentication AuthMethod       `json:"authentication"`
	Kubernetes     KubernetesConfig `json:"kubernetes"`
	Token          string           `json:"token"`
}

func (ConnectionProperties) Address

func (c ConnectionProperties) Address() string

type KubernetesClient

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

func TokenKubernetesAuthentication

func TokenKubernetesAuthentication(kubernetesConfig KubernetesConfig) *KubernetesClient

func (*KubernetesClient) Login

func (c *KubernetesClient) Login(client *api.Client) (string, error)

type KubernetesConfig

type KubernetesConfig struct {
	JWTPath string `json:"jwt-path"`
	Method  string `json:"method"`
}

type Options

type Options func(cfg *ClientConfig) error

func WithProperties

func WithProperties(p ConnectionProperties) Options

type SSLProperties

type SSLProperties struct {
	CaCert     string `json:"ca-cert"`
	ClientCert string `json:"client-cert"`
	ClientKey  string `json:"client-key"`
	Insecure   bool   `json:"insecure"`
}

type TokenClientAuthentication

type TokenClientAuthentication string

func (TokenClientAuthentication) Login

func (d TokenClientAuthentication) Login(_ *api.Client) (token string, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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