client

package
v0.6.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2020 License: MPL-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterMessages

func FilterMessages(resp interface{}, err error) (interface{}, error)

FilterMessages removes error Messagess from resp and builds multierror.

nolint: gocyclo

func ReadStream

func ReadStream(stream MachineStream) (io.ReadCloser, <-chan error, error)

ReadStream converts grpc stream into io.Reader.

func WithNodes

func WithNodes(ctx context.Context, nodes ...string) context.Context

WithNodes wraps the context with metadata to send request to set of nodes.

Types

type Client

type Client struct {
	OSClient      osapi.OSServiceClient
	MachineClient machineapi.MachineServiceClient
	TimeClient    timeapi.TimeServiceClient
	NetworkClient networkapi.NetworkServiceClient
	// contains filtered or unexported fields
}

Client implements the proto.OSClient interface. It serves as the concrete type with the required methods.

func New added in v0.5.0

func New(ctx context.Context, opts ...OptionFunc) (c *Client, err error)

New returns a new Client.

func NewClient deprecated

func NewClient(cfg *tls.Config, endpoints []string, port int, opts ...grpc.DialOption) (c *Client, err error)

NewClient initializes a Client.

Deprecated: use client.NewFromConfigContext() instead

func (*Client) Bootstrap added in v0.5.0

func (c *Client) Bootstrap(ctx context.Context) (err error)

Bootstrap implements the proto.OSClient interface.

func (*Client) Close

func (c *Client) Close() error

Close shuts down client protocol

func (*Client) Containers

func (c *Client) Containers(ctx context.Context, namespace string, driver common.ContainerDriver, callOptions ...grpc.CallOption) (resp *osapi.ContainersResponse, err error)

Containers implements the proto.OSClient interface.

func (*Client) Copy

func (c *Client) Copy(ctx context.Context, rootPath string) (io.ReadCloser, <-chan error, error)

Copy implements the proto.OSClient interface

func (*Client) Dmesg

func (c *Client) Dmesg(ctx context.Context, follow, tail bool) (osapi.OSService_DmesgClient, error)

Dmesg implements the proto.OSClient interface.

func (*Client) Events added in v0.5.0

func (c *Client) Events(ctx context.Context) (stream machineapi.MachineService_EventsClient, err error)

Events implements the proto.OSClient interface.

func (*Client) Interfaces

func (c *Client) Interfaces(ctx context.Context, callOptions ...grpc.CallOption) (resp *networkapi.InterfacesResponse, err error)

Interfaces implements the proto.OSClient interface.

func (*Client) Kubeconfig

func (c *Client) Kubeconfig(ctx context.Context) ([]byte, error)

Kubeconfig returns K8s client config (kubeconfig).

func (*Client) KubeconfigRaw

func (c *Client) KubeconfigRaw(ctx context.Context) (io.ReadCloser, <-chan error, error)

KubeconfigRaw returns K8s client config (kubeconfig).

func (*Client) LS

LS implements the proto.OSClient interface.

func (*Client) Logs

func (c *Client) Logs(ctx context.Context, namespace string, driver common.ContainerDriver, id string, follow bool, tailLines int32) (stream machineapi.MachineService_LogsClient, err error)

Logs implements the proto.OSClient interface.

func (*Client) Memory

func (c *Client) Memory(ctx context.Context, callOptions ...grpc.CallOption) (resp *osapi.MemoryResponse, err error)

Memory implements the proto.OSClient interface.

func (*Client) Mounts

func (c *Client) Mounts(ctx context.Context, callOptions ...grpc.CallOption) (resp *machineapi.MountsResponse, err error)

Mounts implements the proto.OSClient interface.

func (*Client) Processes

func (c *Client) Processes(ctx context.Context, callOptions ...grpc.CallOption) (resp *osapi.ProcessesResponse, err error)

Processes implements the proto.OSClient interface.

func (*Client) Read

func (c *Client) Read(ctx context.Context, path string) (io.ReadCloser, <-chan error, error)

Read reads a file.

func (*Client) Reboot

func (c *Client) Reboot(ctx context.Context) (err error)

Reboot implements the proto.OSClient interface.

func (*Client) Recover added in v0.5.0

func (c *Client) Recover(ctx context.Context, source machineapi.RecoverRequest_Source) (err error)

Recover implements the proto.OSClient interface.

func (*Client) Reset

func (c *Client) Reset(ctx context.Context, graceful, reboot bool) (err error)

Reset implements the proto.OSClient interface.

func (*Client) Restart

func (c *Client) Restart(ctx context.Context, namespace string, driver common.ContainerDriver, id string, callOptions ...grpc.CallOption) (err error)

Restart implements the proto.OSClient interface.

func (*Client) Routes

func (c *Client) Routes(ctx context.Context, callOptions ...grpc.CallOption) (resp *networkapi.RoutesResponse, err error)

Routes implements the networkdproto.NetworkClient interface.

func (*Client) ServiceInfo

func (c *Client) ServiceInfo(ctx context.Context, id string, callOptions ...grpc.CallOption) (services []ServiceInfo, err error)

ServiceInfo returns info about a single service

This is implemented via service list API, as we don't have many services If service with given id is not registered, function returns nil

func (*Client) ServiceList

func (c *Client) ServiceList(ctx context.Context, callOptions ...grpc.CallOption) (resp *machineapi.ServiceListResponse, err error)

ServiceList returns list of services with their state

func (*Client) ServiceRestart

func (c *Client) ServiceRestart(ctx context.Context, id string, callOptions ...grpc.CallOption) (resp *machineapi.ServiceRestartResponse, err error)

ServiceRestart restarts a service.

func (*Client) ServiceStart

func (c *Client) ServiceStart(ctx context.Context, id string, callOptions ...grpc.CallOption) (resp *machineapi.ServiceStartResponse, err error)

ServiceStart starts a service.

func (*Client) ServiceStop

func (c *Client) ServiceStop(ctx context.Context, id string, callOptions ...grpc.CallOption) (resp *machineapi.ServiceStopResponse, err error)

ServiceStop stops a service.

func (*Client) Shutdown

func (c *Client) Shutdown(ctx context.Context) (err error)

Shutdown implements the proto.OSClient interface.

func (*Client) Stats

func (c *Client) Stats(ctx context.Context, namespace string, driver common.ContainerDriver, callOptions ...grpc.CallOption) (resp *osapi.StatsResponse, err error)

Stats implements the proto.OSClient interface.

func (*Client) Time

func (c *Client) Time(ctx context.Context, callOptions ...grpc.CallOption) (resp *timeapi.TimeResponse, err error)

Time returns the time

func (*Client) TimeCheck

func (c *Client) TimeCheck(ctx context.Context, server string, callOptions ...grpc.CallOption) (resp *timeapi.TimeResponse, err error)

TimeCheck returns the time compared to the specified ntp server

func (*Client) Upgrade

func (c *Client) Upgrade(ctx context.Context, image string, preserve bool, callOptions ...grpc.CallOption) (resp *machineapi.UpgradeResponse, err error)

Upgrade initiates a Talos upgrade ... and implements the proto.OSClient interface

func (*Client) Version

func (c *Client) Version(ctx context.Context, callOptions ...grpc.CallOption) (resp *machineapi.VersionResponse, err error)

Version implements the proto.OSClient interface.

type Credentials

type Credentials struct {
	CA  []byte
	Crt tls.Certificate
}

Credentials represents the set of values required to initialize a valid Client.

func CredentialsFromConfigContext added in v0.5.0

func CredentialsFromConfigContext(context *config.Context) (*Credentials, error)

CredentialsFromConfigContext constructs the client Credentials from the given configuration Context.

func NewClientContextAndCredentialsFromConfig deprecated

func NewClientContextAndCredentialsFromConfig(p string, ctx string) (context *config.Context, creds *Credentials, err error)

NewClientContextAndCredentialsFromConfig initializes Credentials from config file.

Deprecated: use Option-based methods for client creation.

func NewClientContextAndCredentialsFromParsedConfig deprecated

func NewClientContextAndCredentialsFromParsedConfig(c *config.Config, ctx string) (context *config.Context, creds *Credentials, err error)

NewClientContextAndCredentialsFromParsedConfig initializes Credentials from parsed configuration.

Deprecated: use Option-based methods for client creation.

type MachineStream

type MachineStream interface {
	Recv() (*common.Data, error)
	grpc.ClientStream
}

MachineStream is a common interface for streams returned by streaming APIs.

type NodeError

type NodeError struct {
	Node string
	Err  string
}

NodeError is RPC error from some node

func (*NodeError) Error

func (ne *NodeError) Error() string

type OptionFunc added in v0.5.0

type OptionFunc func(*Options) error

OptionFunc sets an option for the creation of the Client

func WithConfig added in v0.5.0

func WithConfig(cfg *config.Config) OptionFunc

WithConfig configures the Client with the configuration provided. Additionally use WithContextName to override the default context in the Config.

func WithConfigContext added in v0.5.0

func WithConfigContext(cfg *config.Context) OptionFunc

WithConfigContext configures the Client with the configuration context provided.

func WithConfigFromFile added in v0.5.0

func WithConfigFromFile(fn string) OptionFunc

WithConfigFromFile creates a Client with its configuration extracted from the given file. Additionally use WithContextName to select a context other than the default.

func WithContextName added in v0.5.0

func WithContextName(name string) OptionFunc

WithContextName overrides the default context inside a provided client Config.

func WithDefaultConfig added in v0.5.0

func WithDefaultConfig() OptionFunc

WithDefaultConfig creates a Client with its configuration sourced from the default config file location. Additionally use WithContextName to select a context other than the default.

func WithEndpoints added in v0.5.0

func WithEndpoints(endpoints ...string) OptionFunc

WithEndpoints overrides the default endpoints with the provided list.

func WithGRPCDialOptions added in v0.5.0

func WithGRPCDialOptions(opts ...grpc.DialOption) OptionFunc

WithGRPCDialOptions adds the given grpc.DialOptions to a Client.

func WithTLSConfig added in v0.5.0

func WithTLSConfig(tlsConfig *tls.Config) OptionFunc

WithTLSConfig overrides the default TLS configuration with the one provided.

type Options added in v0.5.0

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

Options contains the set of client configuration options

type ServiceInfo

type ServiceInfo struct {
	Metadata *common.Metadata
	Service  *machineapi.ServiceInfo
}

ServiceInfo provides info about a service and node metadata

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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