github.com/skanehira/moby@v17.12.1-ce-rc2+incompatible/daemon/config/opts.go (about)

     1  package config
     2  
     3  import (
     4  	"github.com/docker/docker/api/types/swarm"
     5  	"github.com/docker/docker/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  }