Package mdocker is a mistify subagent that manages guest docker containers, exposed via JSON-RPC over HTTP.
/_mistify_RPC_
* GET - Run a specified method
{
"method": "MDocker.RPC_METHOD",
"params": [
DATA_STRUCT
],
"id": 0
}
Where RPC_METHOD is the desired method and DATA_STRUCTURE is one of the request structs defined in http://godoc.org/github.com/mistifyio/mistify-agent/rpc .
{
"result": {
KEY: RESPONSE_STRUCT
},
"error": null,
"id": 0
}
Where KEY is a string (e.g. "snapshot") and DATA is one of the response structs defined in http://godoc.org/github.com/mistifyio/mistify-agent/rpc .
ListContainers
GetContainer
DeleteContainer
SaveContainer
CreateContainer
StartContainer
StopContainer
RestartContainer
RebootContainer
PauseContainer
UnpauseContainer
ListImages
GetImages
LoadImage
DeleteImage
See the godocs and function signatures for each method's purpose and expected request/response structs.
type ErrorHTTPCode struct {
Expected int
Code int
Source string
}ErrorHTTPCode should be used for errors resulting from an http response code not matching the expected code
func (e ErrorHTTPCode) Error() stringError returns a string error message
type MDocker struct {
}MDocker is the Mistify Docker subagent service
func New(endpoint, imageService, tlsCertPath string) (*MDocker, error)New creates a new MDocker with a docker client
func (md *MDocker) CreateContainer(h *http.Request, request *rpc.GuestRequest, response *rpc.GuestResponse) errorCreateContainer creates a new Docker container
func (md *MDocker) DeleteContainer(h *http.Request, request *rpc.GuestRequest, response *rpc.GuestResponse) errorDeleteContainer deletes a Docker container
func (md *MDocker) DeleteImage(h *http.Request, request *rpc.ImageRequest, response *rpc.ImageResponse) errorDeleteImage deletes a Docker image
func (md *MDocker) GetContainer(h *http.Request, request *rpc.ContainerRequest, response *rpc.ContainerResponse) errorGetContainer retrieves information about a specific Docker container
func (md *MDocker) GetImage(h *http.Request, request *rpc.ImageRequest, response *rpc.ImageResponse) errorGetImage retrieves information about a specific Docker image
func (md *MDocker) GetInfo(h *http.Request, request *struct{}, response *docker.DockerInfo) errorGetInfo provides general information about the system from Docker
func (md *MDocker) ListContainers(h *http.Request, request *rpc.ContainerRequest, response *rpc.ContainerResponse) errorListContainers retrieves a list of Docker containers
func (md *MDocker) ListImages(h *http.Request, request *rpc.ImageRequest, response *rpc.ImageResponse) errorListImages retrieves a list of Docker images
func (md *MDocker) LoadImage(h *http.Request, request *rpc.ImageRequest, response *rpc.ImageResponse) errorLoadImage downloads a new container image from the image service and imports it into Docker
func (md *MDocker) PauseContainer(h *http.Request, request *rpc.GuestRequest, response *rpc.GuestResponse) errorPauseContainer pauses a Docker container
func (md *MDocker) RebootContainer(h *http.Request, request *rpc.GuestRequest, response *rpc.GuestResponse) errorRebootContainer restarts a Docker container
func (md *MDocker) RequestOpts(req RPCRequest, opts interface{}) errorRequestOpts extracts the request opts into an appropriate struct Nested structs stored in interface{} don't convert directly, so use JSON as an intermediate
func (md *MDocker) RestartContainer(h *http.Request, request *rpc.GuestRequest, response *rpc.GuestResponse) errorRestartContainer restarts a Docker container
func (md *MDocker) RunHTTP(port uint) (*graceful.Server, error)RunHTTP creates and runs the RPC HTTP server
func (md *MDocker) SaveContainer(h *http.Request, request *rpc.ContainerRequest, response *rpc.ImageResponse) errorSaveContainer saves a Docker container
func (md *MDocker) StartContainer(h *http.Request, request *rpc.GuestRequest, response *rpc.GuestResponse) errorStartContainer starts a Docker container
func (md *MDocker) StopContainer(h *http.Request, request *rpc.GuestRequest, response *rpc.GuestResponse) errorStopContainer stops a Docker container or kills it after a timeout
func (md *MDocker) UnpauseContainer(h *http.Request, request *rpc.GuestRequest, response *rpc.GuestResponse) errorUnpauseContainer restarts a Docker container
type RPCRequest interface {
GetOpts() interface{}
}RPCRequest is an interface for incoming RPC requests
-- Generated with godocdown
