client

package
v0.0.0-...-d2438c5 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client describes a very simple client for connecting to a daemon rest API The client expects that certificates are already existing and you can just pass the values through the constructor. All requests will be made over HTTPS, it's currently not possible to send any requests in an insecure, downgraded manor.

func New

func New(address, serverCert, clientCert, clientKey string, options ...Option) (*Client, error)

New creates a Client using the address and certificates.

func NewUntrusted

func NewUntrusted(address, nonce string, options ...Option) (*Client, error)

NewUntrusted creates a new Client used to connect to hosts in a untrusted manor.

func (*Client) Cluster

func (c *Client) Cluster() *Cluster

Cluster returns an API leaf for interacting with the cluster API

func (*Client) Discovery

func (c *Client) Discovery() *Discovery

Discovery returns an API leaf for interacting with the discovery API

func (*Client) Info

func (c *Client) Info() *Info

Info returns the information result from the daemon API

func (*Client) Query

func (c *Client) Query(method, path string, data interface{}, etag string) (*client.Response, string, error)

Query represents a raw query to the daemon API This method is **deprecated** should not be used, it's here as a way to transition to the new client

func (*Client) RawClient

func (c *Client) RawClient() *client.Client

RawClient returns the underlying client that services this client. This method is **deprecated** should not be used, it's here as a way to transition to the new client

type Cluster

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

Cluster represents a way of interacting with the daemon API, which is responsible for getting the cluster information from the daemon.

func (*Cluster) Enabled

func (c *Cluster) Enabled() (bool, string, error)

Enabled returns if the cluster is enabled or not

func (*Cluster) Info

func (c *Cluster) Info() (ClusterInfo, error)

Info returns the cluster information

func (*Cluster) Join

func (c *Cluster) Join(name, address, etag string, certInfo ClusterCertInfo) error

Join will attempt to join the cluster using the node name

func (*Cluster) Remove

func (c *Cluster) Remove(name string, force bool) error

Remove will attempt to remove the cluster using the node name

type ClusterCertInfo

type ClusterCertInfo struct {
	Certificate string
	Key         string
}

ClusterCertInfo is used for joining a cluster

type ClusterInfo

type ClusterInfo struct {
	ServerName string `json:"server_name" yaml:"server_name"`
	Enabled    bool   `json:"enabled" yaml:"enabled"`
}

ClusterInfo represents high-level information about the cluster.

type Discovery

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

Discovery represents a way of interacting with the daemon API, which is responsible for getting the discovery information from the daemon.

func (*Discovery) Services

func (d *Discovery) Services() *Services

Services returns the service information result from the discovery services API

type Environment

type Environment struct {
	Addresses              []string `json:"addresses" yaml:"addresses"`
	Certificate            string   `json:"certificate" yaml:"certificate"`
	CertificateFingerprint string   `json:"certificate_fingerprint" yaml:"certificate_fingerprint"`
	CertificateKey         string   `json:"certificate_key,omitempty" yaml:"certificate_key,omitempty"`
	Server                 string   `json:"server" yaml:"server"`
	ServerPid              int      `json:"server_pid" yaml:"server_pid"`
	ServerVersion          string   `json:"server_version" yaml:"server_version"`
	ServerClustered        bool     `json:"server_clustered" yaml:"server_clustered"`
	ServerName             string   `json:"server_name" yaml:"server_name"`
}

Environment defines the server environment for the daemon

type Info

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

Info represents a way of interacting with the daemon API, which is responsible for getting the information from the daemon.

func (*Info) Get

func (i *Info) Get() (InfoResult, error)

Get returns the information from the daemon API

type InfoResult

type InfoResult struct {
	Environment Environment            `json:"environment" yaml:"environment"`
	Config      map[string]interface{} `json:"config" yaml:"config"`
}

InfoResult contains the result of querying the daemon information API

type Metadata

type Metadata struct {
	ETag     string
	Duration time.Duration
}

Metadata holds the metadata for each result.

type Option

type Option func(*options)

Option to be passed to Connect to customize the resulting instance.

func WithLogger

func WithLogger(logger log.Logger) Option

WithLogger sets the logger on the option

type ServiceNode

type ServiceNode struct {
	ServerName    string `json:"server_name" yaml:"server_name"`
	ServerAddress string `json:"server_address" yaml:"server_address"`
	DaemonAddress string `json:"daemon_address" yaml:"daemon_address"`
	DaemonNonce   string `json:"daemon_nonce" yaml:"daemon_nonce"`
}

ServiceNode represents a request to update the node for the raft cluster

type ServiceResult

type ServiceResult struct {
	ServiceNode `json:",inline" yaml:",inline"`
	Status      string `json:"status" yaml:"status"`
	Message     string `json:"message" yaml:"message"`
}

ServiceResult represents a node part of the raft cluster

type Services

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

Services represents a way of interacting with the daemon API, which is responsible for getting the discovery service information from the daemon.

func (*Services) Add

func (s *Services) Add(nodes []ServiceNode) error

Add adds a service node to the discovery API

func (*Services) Delete

func (s *Services) Delete(nodes []ServiceNode) error

Delete removes a service node to the discovery API

func (*Services) List

func (s *Services) List() ([]ServiceResult, error)

List all the possible services that are attached to the discovery API

Jump to

Keyboard shortcuts

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