Documentation
¶
Index ¶
- func AddrFromPeer(remote *peer.Peer) (peerHost string)
- func FilterMessages(resp interface{}, err error) (interface{}, error)
- func ReadStream(stream MachineStream) (io.ReadCloser, <-chan error, error)
- func RemotePeer(ctx context.Context) (peerHost string)
- func WithNodes(ctx context.Context, nodes ...string) context.Context
- type Client
- func (c *Client) Bootstrap(ctx context.Context) (err error)
- func (c *Client) Close() error
- func (c *Client) Containers(ctx context.Context, namespace string, driver common.ContainerDriver, ...) (resp *osapi.ContainersResponse, err error)
- func (c *Client) Copy(ctx context.Context, rootPath string) (io.ReadCloser, <-chan error, error)
- func (c *Client) Dmesg(ctx context.Context, follow, tail bool) (osapi.OSService_DmesgClient, error)
- func (c *Client) Events(ctx context.Context) (stream machineapi.MachineService_EventsClient, err error)
- func (c *Client) EventsWatch(ctx context.Context, watchFunc func(<-chan Event)) error
- func (c *Client) Interfaces(ctx context.Context, callOptions ...grpc.CallOption) (resp *networkapi.InterfacesResponse, err error)
- func (c *Client) Kubeconfig(ctx context.Context) ([]byte, error)
- func (c *Client) KubeconfigRaw(ctx context.Context) (io.ReadCloser, <-chan error, error)
- func (c *Client) LS(ctx context.Context, req machineapi.ListRequest) (stream machineapi.MachineService_ListClient, err error)
- func (c *Client) Logs(ctx context.Context, namespace string, driver common.ContainerDriver, ...) (stream machineapi.MachineService_LogsClient, err error)
- func (c *Client) Memory(ctx context.Context, callOptions ...grpc.CallOption) (resp *osapi.MemoryResponse, err error)
- func (c *Client) Mounts(ctx context.Context, callOptions ...grpc.CallOption) (resp *machineapi.MountsResponse, err error)
- func (c *Client) Processes(ctx context.Context, callOptions ...grpc.CallOption) (resp *osapi.ProcessesResponse, err error)
- func (c *Client) Read(ctx context.Context, path string) (io.ReadCloser, <-chan error, error)
- func (c *Client) Reboot(ctx context.Context) (err error)
- func (c *Client) Recover(ctx context.Context, source machineapi.RecoverRequest_Source) (err error)
- func (c *Client) Reset(ctx context.Context, graceful, reboot bool) (err error)
- func (c *Client) Restart(ctx context.Context, namespace string, driver common.ContainerDriver, ...) (err error)
- func (c *Client) Routes(ctx context.Context, callOptions ...grpc.CallOption) (resp *networkapi.RoutesResponse, err error)
- func (c *Client) ServiceInfo(ctx context.Context, id string, callOptions ...grpc.CallOption) (services []ServiceInfo, err error)
- func (c *Client) ServiceList(ctx context.Context, callOptions ...grpc.CallOption) (resp *machineapi.ServiceListResponse, err error)
- func (c *Client) ServiceRestart(ctx context.Context, id string, callOptions ...grpc.CallOption) (resp *machineapi.ServiceRestartResponse, err error)
- func (c *Client) ServiceStart(ctx context.Context, id string, callOptions ...grpc.CallOption) (resp *machineapi.ServiceStartResponse, err error)
- func (c *Client) ServiceStop(ctx context.Context, id string, callOptions ...grpc.CallOption) (resp *machineapi.ServiceStopResponse, err error)
- func (c *Client) Shutdown(ctx context.Context) (err error)
- func (c *Client) Stats(ctx context.Context, namespace string, driver common.ContainerDriver, ...) (resp *osapi.StatsResponse, err error)
- func (c *Client) Time(ctx context.Context, callOptions ...grpc.CallOption) (resp *timeapi.TimeResponse, err error)
- func (c *Client) TimeCheck(ctx context.Context, server string, callOptions ...grpc.CallOption) (resp *timeapi.TimeResponse, err error)
- func (c *Client) Upgrade(ctx context.Context, image string, preserve bool, ...) (resp *machineapi.UpgradeResponse, err error)
- func (c *Client) Version(ctx context.Context, callOptions ...grpc.CallOption) (resp *machineapi.VersionResponse, err error)
- type Credentials
- func CredentialsFromConfigContext(context *config.Context) (*Credentials, error)
- func NewClientContextAndCredentialsFromConfig(p string, ctx string) (context *config.Context, creds *Credentials, err error)deprecated
- func NewClientContextAndCredentialsFromParsedConfig(c *config.Config, ctx string) (context *config.Context, creds *Credentials, err error)deprecated
- type Event
- type MachineStream
- type NodeError
- type OptionFunc
- func WithConfig(cfg *config.Config) OptionFunc
- func WithConfigContext(cfg *config.Context) OptionFunc
- func WithConfigFromFile(fn string) OptionFunc
- func WithContextName(name string) OptionFunc
- func WithDefaultConfig() OptionFunc
- func WithEndpoints(endpoints ...string) OptionFunc
- func WithGRPCDialOptions(opts ...grpc.DialOption) OptionFunc
- func WithTLSConfig(tlsConfig *tls.Config) OptionFunc
- type Options
- type ServiceInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddrFromPeer ¶ added in v0.6.0
AddrFromPeer extracts peer address from grpc Peer.
func FilterMessages ¶
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 RemotePeer ¶ added in v0.6.0
RemotePeer parses remote peer address from grpc stream context.
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 (*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) 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) EventsWatch ¶ added in v0.6.0
EventsWatch wraps Events by providing more simple interface.
nolint: gocyclo
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 ¶
Kubeconfig returns K8s client config (kubeconfig).
func (*Client) KubeconfigRaw ¶
KubeconfigRaw returns K8s client config (kubeconfig).
func (*Client) LS ¶
func (c *Client) LS(ctx context.Context, req machineapi.ListRequest) (stream machineapi.MachineService_ListClient, err error)
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) 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) 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) 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 NewClientContextAndCredentialsFromParsedConfig
deprecated
type MachineStream ¶
type MachineStream interface { Recv() (*common.Data, error) grpc.ClientStream }
MachineStream is a common interface for streams returned by streaming APIs.
type OptionFunc ¶ added in v0.5.0
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