routers

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cors

func Cors() gin.HandlerFunc

func ResponseError

func ResponseError(c *gin.Context, code ResCode)

func ResponseSuccess

func ResponseSuccess(c *gin.Context, data interface{})

Types

type ReplicaSetHandler

type ReplicaSetHandler struct{}

func (*ReplicaSetHandler) Commit

func (rh *ReplicaSetHandler) Commit(c *gin.Context)

Commit the latest version of the container as image. The image name is the default image id, or you can specify a new image name.

func (*ReplicaSetHandler) Continue

func (rh *ReplicaSetHandler) Continue(c *gin.Context)

Continue the latest version of the container just call `docker restart`

func (*ReplicaSetHandler) Delete

func (rh *ReplicaSetHandler) Delete(c *gin.Context)

Delete containers, including historical versions

func (*ReplicaSetHandler) Execute

func (rh *ReplicaSetHandler) Execute(c *gin.Context)

Execute a command in the latest version of the running container and return the output

func (*ReplicaSetHandler) History

func (rh *ReplicaSetHandler) History(c *gin.Context)

func (*ReplicaSetHandler) Info

func (rh *ReplicaSetHandler) Info(c *gin.Context)

func (*ReplicaSetHandler) Patch

func (rh *ReplicaSetHandler) Patch(c *gin.Context)

Patch to change the configuration of the latest version of an existing container. You can change the gpu, volume. If you request body is empty(e.g. {}), it will recreate a container based on the existing configuration. Then the old container will be deleted.

func (*ReplicaSetHandler) Pause

func (rh *ReplicaSetHandler) Pause(c *gin.Context)

Pause the latest version of the container, gpu and port will not be released

func (*ReplicaSetHandler) RegisterRoute

func (rh *ReplicaSetHandler) RegisterRoute(g *gin.RouterGroup)

func (*ReplicaSetHandler) Restart

func (rh *ReplicaSetHandler) Restart(c *gin.Context)

Restart the latest version of the container. It may fail because restart require apply for gpu

func (*ReplicaSetHandler) Rollback

func (rh *ReplicaSetHandler) Rollback(c *gin.Context)

Rollback a container to a specific version

func (*ReplicaSetHandler) Run

func (rh *ReplicaSetHandler) Run(c *gin.Context)

Run a container consists of two parts: create and start

func (*ReplicaSetHandler) Stop

func (rh *ReplicaSetHandler) Stop(c *gin.Context)

Stop the latest version of the container gpu and port will be released

type ResCode

type ResCode int64
const (
	CodeSuccess                                      ResCode = 200
	CodeServeBusy                                    ResCode = 500
	CodeInvalidParams                                ResCode = 1000
	CodeImageNameCannotBeEmpty                       ResCode = 1001
	CodeContainerNameCannotBeEmpty                   ResCode = 1002
	CodeContainerNameCannotContainDash               ResCode = 1003
	CodeContainerRunFailed                           ResCode = 1004
	CodeContainerDeleteFailed                        ResCode = 1005
	CodeContainerExecuteFailed                       ResCode = 1006
	CodeContainerPatchFailed                         ResCode = 1007
	CodeContainerAlreadyExist                        ResCode = 1008
	CodeContainerNoNeedPatch                         ResCode = 1009
	CodeContainerStopFailed                          ResCode = 1010
	CodeContainerRestartFailed                       ResCode = 1011
	CodeGpuCountMustBeGreaterThanOrEqualZero         ResCode = 1012
	CodeContainerGpuNotEnough                        ResCode = 1013
	CodeContainerPortNotEnough                       ResCode = 1014
	CodeContainerCommitFailed                        ResCode = 1015
	CodeContainerGetInfoFailed                       ResCode = 1016
	CodeContainerGetHistoryFailed                    ResCode = 1017
	CodeContainerShutDownFailed                      ResCode = 1018
	CodeContainerStartUpFailed                       ResCode = 1019
	CodeContainerVersionMustBeGreaterThanOrEqualZero ResCode = 1020
	CodeContainerRollbackFailed                      ResCode = 1021
	CodeContainerNoNeedRollback                      ResCode = 1022
	CodeVolumeCreateFailed                           ResCode = 1023
	CodeVolumeNameCannotBeEmpty                      ResCode = 1024
	CodeVolumeDeleteFailed                           ResCode = 1025
	CodeVolumeExisted                                ResCode = 1026
	CodeVolumeNameMustContainVersion                 ResCode = 1027
	CodeVolumeSizeNoNeedPatch                        ResCode = 1028
	CodeVolumeSizeNotSupported                       ResCode = 1029
	CodeVolumeSizeUsedGreaterThanReduce              ResCode = 1030
	CodeVolumeNameNotContainsDash                    ResCode = 1031
	CodeVolumeNameNotBeginWithForwardSlash           ResCode = 1032
	CodeVolumeGetInfoFailed                          ResCode = 1033
	CodeVolumeGetHistoryFailed                       ResCode = 1034
	CodeVolumePatchFailed                            ResCode = 1035
)

func (ResCode) Msg

func (c ResCode) Msg() string

type Resource

type Resource struct{}

func (*Resource) GetGpus

func (gh *Resource) GetGpus(c *gin.Context)

GetGpus 0 means not used, 1 means used.

func (*Resource) GetPorts

func (gh *Resource) GetPorts(c *gin.Context)

func (*Resource) RegisterRoute

func (gh *Resource) RegisterRoute(g *gin.RouterGroup)

type ResponseData

type ResponseData struct {
	Code ResCode     `json:"code"`
	Msg  interface{} `json:"msg"`
	Data interface{} `json:"data"`
}

type VolumeHandler

type VolumeHandler struct{}

func (*VolumeHandler) Create

func (vh *VolumeHandler) Create(c *gin.Context)

Create a volume, you can specify the size and name

func (*VolumeHandler) Delete

func (vh *VolumeHandler) Delete(c *gin.Context)

Delete a volume

func (*VolumeHandler) History

func (vh *VolumeHandler) History(c *gin.Context)

func (*VolumeHandler) Info

func (vh *VolumeHandler) Info(c *gin.Context)

func (*VolumeHandler) Patch

func (vh *VolumeHandler) Patch(c *gin.Context)

Patch the size of the latest version of an existing volume via create a new volume and copy the old volume data to the new volume. Including expand and shrink of two operations, if the size is the same before and after the operation, it will be skipped. If the size already used is larger than the size after shrink, then shrink operation will fail.

func (*VolumeHandler) RegisterRoute

func (vh *VolumeHandler) RegisterRoute(g *gin.RouterGroup)

Jump to

Keyboard shortcuts

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