Documentation
¶
Index ¶
- func NewContainerServer() (*grpc.Server, func())
- func StartServer(port int, exportTo string) int
- type CommandExecutor
- type ContainerServerImpl
- func (s *ContainerServerImpl) CreateNetwork(ctx context.Context, request *api.CreateNetworkRequest) (*api.CreateNetworkResponse, error)
- func (s *ContainerServerImpl) GetContainer(ctx context.Context, request *api.GetContainerRequest) (*api.GetContainerResponse, error)
- func (s *ContainerServerImpl) GetNetwork(ctx context.Context, request *api.GetNetworkRequest) (*api.GetNetworkResponse, error)
- func (s *ContainerServerImpl) LoginRegistry(ctx context.Context, request *api.LoginRegistryRequest) (*api.LoginRegistryResponse, error)
- func (s *ContainerServerImpl) Shutdown(context.Context, *api.ShutdownRequest) (*api.ShutdownResponse, error)
- func (s *ContainerServerImpl) StackCommands(ctx context.Context, request *api.StackCommandsRequest) (*api.StackCommandsResponse, error)
- func (s *ContainerServerImpl) StartContainer(ctx context.Context, request *api.StartContainerRequest) (*api.StartContainerResponse, error)
- func (s *ContainerServerImpl) StartTemplatedContainer(ctx context.Context, request *api.StartTemplatedContainerRequest) (*api.StartContainerResponse, error)
- type DefaultCommandExecutor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewContainerServer ¶
NewContainerServer returns a new gRPC server for container services.
func StartServer ¶
StartServer starts server on the requested port.
Types ¶
type CommandExecutor ¶
type CommandExecutor interface { // Execute returns the same output as the original command. Execute(context.Context, commands.Command) (string, string, error) }
CommandExecutor proxies command execution to provide an abstraction layer for interception.
type ContainerServerImpl ¶
type ContainerServerImpl struct { api.UnimplementedCrosToolRunnerContainerServiceServer // contains filtered or unexported fields }
ContainerServerImpl implements the gRPC services by running commands and mapping errors to proper gRPC status codes.
func (*ContainerServerImpl) CreateNetwork ¶
func (s *ContainerServerImpl) CreateNetwork(ctx context.Context, request *api.CreateNetworkRequest) (*api.CreateNetworkResponse, error)
CreateNetwork creates a new docker network with the given name.
func (*ContainerServerImpl) GetContainer ¶
func (s *ContainerServerImpl) GetContainer(ctx context.Context, request *api.GetContainerRequest) (*api.GetContainerResponse, error)
GetContainer retrieves information of a container.
func (*ContainerServerImpl) GetNetwork ¶
func (s *ContainerServerImpl) GetNetwork(ctx context.Context, request *api.GetNetworkRequest) (*api.GetNetworkResponse, error)
GetNetwork retrieves information of given docker network.
func (*ContainerServerImpl) LoginRegistry ¶
func (s *ContainerServerImpl) LoginRegistry(ctx context.Context, request *api.LoginRegistryRequest) (*api.LoginRegistryResponse, error)
LoginRegistry logs in a docker image registry server
func (*ContainerServerImpl) Shutdown ¶
func (s *ContainerServerImpl) Shutdown(context.Context, *api.ShutdownRequest) (*api.ShutdownResponse, error)
Shutdown signals to shut down the CTRv2 gRPC server.
func (*ContainerServerImpl) StackCommands ¶
func (s *ContainerServerImpl) StackCommands(ctx context.Context, request *api.StackCommandsRequest) (*api.StackCommandsResponse, error)
StackCommands provides a scripting mechanism to execute a series of commands in order.
func (*ContainerServerImpl) StartContainer ¶
func (s *ContainerServerImpl) StartContainer(ctx context.Context, request *api.StartContainerRequest) (*api.StartContainerResponse, error)
StartContainer pulls image and then calls docker run to start a container.
func (*ContainerServerImpl) StartTemplatedContainer ¶
func (s *ContainerServerImpl) StartTemplatedContainer(ctx context.Context, request *api.StartTemplatedContainerRequest) (*api.StartContainerResponse, error)
StartTemplatedContainer delegates to template processors to populate templates into valid StartContainerRequest, and then passes over to the generic endpoint.
type DefaultCommandExecutor ¶
type DefaultCommandExecutor struct{}
DefaultCommandExecutor enforces rules on stdout so that the commands can only be used in a granular way: retrieve one piece of information at a time. The motivation is to make it easier to support both docker and podman commands which have subtle differences in stdout and data model.