Add docker prune command and ACI implementation

Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
This commit is contained in:
Guillaume Tardif 2020-10-14 16:06:45 +02:00
parent 7cf7b00584
commit a5e34323e2
9 changed files with 169 additions and 14 deletions

View file

@ -21,6 +21,7 @@ import (
"github.com/docker/compose-cli/api/compose"
"github.com/docker/compose-cli/api/containers"
"github.com/docker/compose-cli/api/resources"
"github.com/docker/compose-cli/api/secrets"
"github.com/docker/compose-cli/api/volumes"
"github.com/docker/compose-cli/backend"
@ -107,3 +108,12 @@ func (c *Client) VolumeService() volumes.Service {
return &volumeService{}
}
// ResourceService returns the backend service for the current context
func (c *Client) ResourceService() resources.Service {
if vs := c.bs.ResourceService(); vs != nil {
return vs
}
return &resourceService{}
}

32
api/client/resources.go Normal file
View file

@ -0,0 +1,32 @@
/*
Copyright 2020 Docker Compose CLI authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package client
import (
"context"
"github.com/docker/compose-cli/api/resources"
"github.com/docker/compose-cli/errdefs"
)
type resourceService struct {
}
// Prune prune resources
func (c *resourceService) Prune(ctx context.Context, request resources.PruneRequest) ([]string, error) {
return nil, errdefs.ErrNotImplemented
}