These were deprecated in036d3a6baband30774ed1f2, and were originally in the cli/command/stack package, but moved for the (now deprecated) Compose on Kubernetes feature in4d947de292. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
38 lines
1.4 KiB
Go
38 lines
1.4 KiB
Go
package swarm
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/docker/cli/cli/compose/convert"
|
|
"github.com/moby/moby/api/types/filters"
|
|
"github.com/moby/moby/api/types/network"
|
|
"github.com/moby/moby/api/types/swarm"
|
|
"github.com/moby/moby/client"
|
|
)
|
|
|
|
func getStackFilter(namespace string) filters.Args {
|
|
filter := filters.NewArgs()
|
|
filter.Add("label", convert.LabelNamespace+"="+namespace)
|
|
return filter
|
|
}
|
|
|
|
func getStackServices(ctx context.Context, apiclient client.APIClient, namespace string) ([]swarm.Service, error) {
|
|
return apiclient.ServiceList(ctx, client.ServiceListOptions{Filters: getStackFilter(namespace)})
|
|
}
|
|
|
|
func getStackNetworks(ctx context.Context, apiclient client.APIClient, namespace string) ([]network.Summary, error) {
|
|
return apiclient.NetworkList(ctx, client.NetworkListOptions{Filters: getStackFilter(namespace)})
|
|
}
|
|
|
|
func getStackSecrets(ctx context.Context, apiclient client.APIClient, namespace string) ([]swarm.Secret, error) {
|
|
return apiclient.SecretList(ctx, client.SecretListOptions{Filters: getStackFilter(namespace)})
|
|
}
|
|
|
|
func getStackConfigs(ctx context.Context, apiclient client.APIClient, namespace string) ([]swarm.Config, error) {
|
|
return apiclient.ConfigList(ctx, client.ConfigListOptions{Filters: getStackFilter(namespace)})
|
|
}
|
|
|
|
func getStackTasks(ctx context.Context, apiclient client.APIClient, namespace string) ([]swarm.Task, error) {
|
|
return apiclient.TaskList(ctx, client.TaskListOptions{Filters: getStackFilter(namespace)})
|
|
}
|