github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/daemon/config/opts.go (about) 1 package config // import "github.com/demonoid81/moby/daemon/config" 2 3 import ( 4 "github.com/demonoid81/moby/api/types/swarm" 5 "github.com/demonoid81/moby/daemon/cluster/convert" 6 "github.com/docker/swarmkit/api/genericresource" 7 ) 8 9 // ParseGenericResources parses and validates the specified string as a list of GenericResource 10 func ParseGenericResources(value []string) ([]swarm.GenericResource, error) { 11 if len(value) == 0 { 12 return nil, nil 13 } 14 15 resources, err := genericresource.Parse(value) 16 if err != nil { 17 return nil, err 18 } 19 20 obj := convert.GenericResourcesFromGRPC(resources) 21 return obj, nil 22 }