mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-04 00:10:25 +08:00
feat: 资源操作统一管理&容器操作
This commit is contained in:
55
server/internal/docker/api/form/container.go
Normal file
55
server/internal/docker/api/form/container.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package form
|
||||
|
||||
type ContainerOp struct {
|
||||
Host string `json:"host"`
|
||||
ContainerId string `json:"containerId" binding:"required"`
|
||||
}
|
||||
|
||||
type ContainerCreate struct {
|
||||
Host string `json:"host" binding:"required"`
|
||||
ContainerID string `json:"containerId"`
|
||||
Name string `json:"name" validate:"required"`
|
||||
Image string `json:"image" validate:"required"`
|
||||
ForcePull bool `json:"forcePull"`
|
||||
ExposedPorts []ExposedPort `json:"exposedPorts"`
|
||||
Tty bool `json:"tty"`
|
||||
OpenStdin bool `json:"openStdin"`
|
||||
Cmd []string `json:"cmd"`
|
||||
Entrypoint []string `json:"entrypoint"`
|
||||
CPUShares int64 `json:"cpuShares"`
|
||||
NanoCPUs float64 `json:"nanoCpus"`
|
||||
Memory float64 `json:"memory"`
|
||||
CapAdd []string `json:"capAdd"`
|
||||
ShmSize float64 `json:"shmSize"`
|
||||
NetworkMode string `json:"networkMode"`
|
||||
Privileged bool `json:"privileged"`
|
||||
AutoRemove bool `json:"autoRemove"`
|
||||
RestartPolicy string `json:"restartPolicy"`
|
||||
Volumes []Volume `json:"volumes"`
|
||||
Devices []DeviceRequest `json:"devices"`
|
||||
Runtime string `json:"runtime"`
|
||||
Labels []string `json:"labels"`
|
||||
Envs []string `json:"envs"`
|
||||
}
|
||||
|
||||
type ExposedPort struct {
|
||||
HostIP string `json:"hostIP"`
|
||||
HostPort string `json:"hostPort"`
|
||||
ContainerPort string `json:"containerPort"`
|
||||
Protocol string `json:"protocol"`
|
||||
}
|
||||
|
||||
type Volume struct {
|
||||
Type string `json:"type"`
|
||||
HostDir string `json:"hostDir"`
|
||||
ContainerDir string `json:"containerDir"`
|
||||
Mode string `json:"mode"`
|
||||
}
|
||||
|
||||
type DeviceRequest struct {
|
||||
Driver string `json:"driver"` // Name of device driver
|
||||
Count int `json:"count"` // Number of devices to request (-1 = All)
|
||||
DeviceIDs []string `json:"deviceIds"` // List of device IDs as recognizable by the device driver
|
||||
Capabilities []string `json:"capabilities"` // An OR list of AND lists of device capabilities (e.g. "gpu")
|
||||
Options map[string]string `json:"Options"` // Options to pass onto the device driver
|
||||
}
|
||||
Reference in New Issue
Block a user