mirror of
https://github.com/docker/compose.git
synced 2025-11-09 08:19:58 +01:00
67 lines
1.8 KiB
Go
67 lines
1.8 KiB
Go
package proxy
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/docker/api/containers"
|
|
v1 "github.com/docker/api/containers/v1"
|
|
"github.com/golang/protobuf/ptypes/empty"
|
|
)
|
|
|
|
func NewContainerApi(client containers.ContainerService) v1.ContainersServer {
|
|
return &proxyContainerApi{
|
|
client: client,
|
|
}
|
|
}
|
|
|
|
type proxyContainerApi struct {
|
|
client containers.ContainerService
|
|
}
|
|
|
|
func (p *proxyContainerApi) List(ctx context.Context, _ *v1.ListRequest) (*v1.ListResponse, error) {
|
|
c, err := p.client.List(ctx)
|
|
if err != nil {
|
|
return &v1.ListResponse{}, nil
|
|
}
|
|
|
|
response := &v1.ListResponse{
|
|
Containers: []*v1.Container{},
|
|
}
|
|
for _, container := range c {
|
|
response.Containers = append(response.Containers, &v1.Container{
|
|
Id: container.ID,
|
|
Image: container.Image,
|
|
})
|
|
}
|
|
|
|
return response, nil
|
|
}
|
|
|
|
func (p *proxyContainerApi) Create(_ context.Context, _ *v1.CreateRequest) (*v1.CreateResponse, error) {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|
|
|
|
func (p *proxyContainerApi) Start(_ context.Context, _ *v1.StartRequest) (*v1.StartResponse, error) {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|
|
|
|
func (p *proxyContainerApi) Stop(_ context.Context, _ *v1.StopRequest) (*empty.Empty, error) {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|
|
|
|
func (p *proxyContainerApi) Kill(_ context.Context, _ *v1.KillRequest) (*empty.Empty, error) {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|
|
|
|
func (p *proxyContainerApi) Delete(_ context.Context, _ *v1.DeleteRequest) (*empty.Empty, error) {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|
|
|
|
func (p *proxyContainerApi) Update(_ context.Context, _ *v1.UpdateRequest) (*v1.UpdateResponse, error) {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|
|
|
|
func (p *proxyContainerApi) Exec(_ context.Context, _ *v1.ExecRequest) (*v1.ExecResponse, error) {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|