Add Swarm management backend

As described in our ROADMAP.md, introduce new Swarm management API
endpoints relying on swarmkit to deploy services. It currently vendors
docker/engine-api changes.

This PR is fully backward compatible (joining a Swarm is an optional
feature of the Engine, and existing commands are not impacted).

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Victor Vieux <vieux@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
Signed-off-by: Madhu Venugopal <madhu@docker.com>
This commit is contained in:
Tonis Tiigi 2016-06-13 19:52:49 -07:00 committed by Vincent Demeester
parent 662b3de10a
commit 4f87181ba9
1 changed files with 37 additions and 0 deletions

View File

@ -5,6 +5,8 @@ import (
"net" "net"
"regexp" "regexp"
"strings" "strings"
"github.com/docker/engine-api/types/filters"
) )
var ( var (
@ -282,3 +284,38 @@ func ValidateSysctl(val string) (string, error) {
} }
return "", fmt.Errorf("sysctl '%s' is not whitelisted", val) return "", fmt.Errorf("sysctl '%s' is not whitelisted", val)
} }
// FilterOpt is a flag type for validating filters
type FilterOpt struct {
filter filters.Args
}
// NewFilterOpt returns a new FilterOpt
func NewFilterOpt() FilterOpt {
return FilterOpt{filter: filters.NewArgs()}
}
func (o *FilterOpt) String() string {
repr, err := filters.ToParam(o.filter)
if err != nil {
return "invalid filters"
}
return repr
}
// Set sets the value of the opt by parsing the command line value
func (o *FilterOpt) Set(value string) error {
var err error
o.filter, err = filters.ParseFlag(value, o.filter)
return err
}
// Type returns the option type
func (o *FilterOpt) Type() string {
return "filter"
}
// Value returns the value of this option
func (o *FilterOpt) Value() filters.Args {
return o.filter
}