api

package
v0.2.1-1 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2017 License: MIT Imports: 18 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttachHooks

type AttachHooks func(endpoint config.Endpoint, done <-chan struct{})

AttachHooks is additional process what runs when is attached to container

type AttachIO

type AttachIO struct {
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
}

AttachIO wraps stdin/stdout for attach

func NewAttachIO

func NewAttachIO(stdin io.Reader, stdout, stderr io.Writer) AttachIO

NewAttachIO is wrapper for stdin, stdout and stderr

type Client

type Client interface {
	GetPods() ([]*pods.Pod, error)
	GetPod(podName string) (*pods.Pod, error)
	CreatePod(status chan<- []*progress.ImageFetch, pod *pods.Pod, opts ...PodOpts) error
	StartPod(name string) (*pods.Pod, error)
	DeletePod(pod *pods.Pod) (*pods.Pod, error)
	Attach(containerID string, attachIO AttachIO, hooks ...AttachHooks) (err error)
	Signal(containerID string, signal syscall.Signal) (err error)
}

Client interface for all API clients

type DirectClient

type DirectClient struct {
	Namespace string
	Endpoint  config.Endpoint
	// contains filtered or unexported fields
}

DirectClient connects directly to device RPC API

func NewDirectClient

func NewDirectClient(namespace string, endpoint config.Endpoint) *DirectClient

NewDirectClient creates new RPC server client

func (*DirectClient) Attach

func (c *DirectClient) Attach(containerID string, attachIO AttachIO, hooks ...AttachHooks) (err error)

Attach calls server and fetches pod logs

func (*DirectClient) CreatePod

func (c *DirectClient) CreatePod(status chan<- []*progress.ImageFetch, pod *pods.Pod, opts ...PodOpts) error

CreatePod creates new pod to the target server

func (*DirectClient) DeletePod

func (c *DirectClient) DeletePod(pod *pods.Pod) (*pods.Pod, error)

DeletePod creates new pod to the target server

func (*DirectClient) GetPod

func (c *DirectClient) GetPod(podName string) (*pods.Pod, error)

GetPod return Pod by name

func (*DirectClient) GetPods

func (c *DirectClient) GetPods() ([]*pods.Pod, error)

GetPods calls server and fetches all pods information

func (*DirectClient) Signal

func (c *DirectClient) Signal(containerID string, signal syscall.Signal) (err error)

Signal sends kill signal to container process

func (*DirectClient) StartPod

func (c *DirectClient) StartPod(name string) (*pods.Pod, error)

StartPod creates new pod to the target server

type MultiDirectClient

type MultiDirectClient struct {
	Namespace string
	// contains filtered or unexported fields
}

MultiDirectClient connects directly to multiples devices RPC API

func NewMultiDirectClient

func NewMultiDirectClient(namespace string, endpoints []config.Endpoint) *MultiDirectClient

NewMultiDirectClient creates new client which connects to multiple RPC APIs

func (*MultiDirectClient) Attach

func (c *MultiDirectClient) Attach(containerID string, attachIO AttachIO, hooks ...AttachHooks) (err error)

Attach will return error, because attaching to multiple devices is not yet supported

func (*MultiDirectClient) CreatePod

func (c *MultiDirectClient) CreatePod(updates chan<- []*progress.ImageFetch, pod *pods.Pod, opts ...PodOpts) error

CreatePod will return error, because creating pod to multiple devices is not yet supported

func (*MultiDirectClient) DeletePod

func (c *MultiDirectClient) DeletePod(pod *pods.Pod) (*pods.Pod, error)

DeletePod will return error, because deleting pod in multiple devices is not yet supported

func (*MultiDirectClient) GetPod

func (c *MultiDirectClient) GetPod(podName string) (*pods.Pod, error)

GetPod will return error, because getting pod from multiple devices is not yet supported

func (*MultiDirectClient) GetPods

func (c *MultiDirectClient) GetPods() (result []*pods.Pod, err error)

GetPods calls each device and fetches all pods information

func (*MultiDirectClient) Signal

func (c *MultiDirectClient) Signal(containerID string, signal syscall.Signal) (err error)

Signal will return error, because signaling to multiple devices is not yet supported

func (*MultiDirectClient) StartPod

func (c *MultiDirectClient) StartPod(name string) (*pods.Pod, error)

StartPod will return error, because starting pod in multiple devices is not yet supported

type PodOpts

type PodOpts func(pod *pods.Pod) error

PodOpts adds more information to the Pod going to be created

func WithContainer

func WithContainer(container *containers.Container) PodOpts

WithContainer adds container to the Pod spec

func WithSharedMount

func WithSharedMount(mount *containers.Mount) PodOpts

WithSharedMount adds mount point to each container

func WithWorkingDir

func WithWorkingDir(workDir string) PodOpts

WithWorkingDir sets each container workdir If workdir is already defined, will return error

type Server

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

Server implements the GRPC API for the eli

func NewServer

func NewServer(listen string, client runtime.Client) *Server

NewServer creates new API server

func (*Server) Attach

func (s *Server) Attach(server containers.Containers_AttachServer) error

Attach connects to process in container and streams stdout and stderr outputs to client

func (*Server) Create

func (s *Server) Create(req *pods.CreatePodRequest, server pods.Pods_CreateServer) error

Create is 'pods' service Create implementation

func (*Server) Delete

func (s *Server) Delete(context context.Context, req *pods.DeletePodRequest) (*pods.DeletePodResponse, error)

Delete is 'pods' service Delete implementation

func (*Server) List

func (s *Server) List(context context.Context, req *pods.ListPodsRequest) (*pods.ListPodsResponse, error)

List is 'pods' service List implementation

func (*Server) Serve

func (s *Server) Serve()

Serve starts the server to serve GRPC server

func (*Server) Signal

Signal connects to process in container and send signal to the process

func (*Server) Start

func (s *Server) Start(context context.Context, req *pods.StartPodRequest) (*pods.StartPodResponse, error)

Start is 'pods' service Start implementation

func (*Server) Stop added in v0.2.0

func (s *Server) Stop()

Stop the GRPC server

Directories

Path Synopsis
Package core is a generated protocol buffer package.
Package core is a generated protocol buffer package.
services
containers/v1
Package containers is a generated protocol buffer package.
Package containers is a generated protocol buffer package.
pods/v1
Package pods is a generated protocol buffer package.
Package pods is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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