37 lines
902 B
Go
37 lines
902 B
Go
package container
|
|
|
|
import (
|
|
"gitlink.org.cn/JointCloud/pcm-participant-cloud/platform"
|
|
)
|
|
|
|
type Containers []ISpec
|
|
|
|
func NewContainer(container IContainer) *Container {
|
|
return &Container{container: container}
|
|
}
|
|
|
|
type Container struct {
|
|
Platform *platform.Platform `json:"platform,omitempty"`
|
|
Name string `json:"name,omitempty"`
|
|
Image string `json:"image,omitempty"`
|
|
Cpu string `json:"cpu,omitempty"`
|
|
Memory string `json:"memory,omitempty"`
|
|
container IContainer `json:"container,omitempty"`
|
|
}
|
|
|
|
func (containers *Containers) Containers() ([]*Container, error) {
|
|
res := make([]*Container, len(*containers))
|
|
for _, container := range *containers {
|
|
spec, err := container.Spec()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
res = append(res, spec)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
func (c *Container) ContainerCreateParameter() {
|
|
|
|
}
|