Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ProxyWriteRegex = regexp.MustCompile(api.SpecProxyWrite + "=([A-Za-z]+),?")
)
Functions ¶
This section is empty.
Types ¶
type SpecHandler ¶
type SpecHandler interface { // SpecOptsFromString parses options from the name and returns in a map. // The input string should have known keys in the following format: // "scale=value;size=value;name=volname" // If the spec was parsed, it returns: // (true, options_map, parsed_name) // If the input string didn't contain the name, it returns: // (false, nil, inputString) SpecOptsFromString(inputString string) ( bool, map[string]string, string, ) // SpecFromString parses options from the name. // If the scheduler was unable to pass in the volume spec via the API, // the spec can be passed in via the name in the format: // "key=value;key=value;name=volname" // source is populated if key parent=<volume_id> is specified. // If the spec was parsed, it returns: // (true, parsed_spec, locator, source, parsed_name) // If the input string didn't contain the string, it returns: // (false, DefaultSpec(), nil, nil, inputString) SpecFromString(inputString string) ( bool, *api.VolumeSpec, *api.VolumeLocator, *api.Source, string, ) // GetTokenFromString parses the token from the name. // If the token is not present in the name, it will // check inside of the docker options passed in. // If the token was parsed, it returns: // (token, true) // If the token wasn't parsed, it returns: // ("", false) GetTokenFromString(str string) (string, bool) // GetTokenSecretContextFromString parses the full token secret request from the name. // If the token secret was parsed, it returns: // (tokenSecretContext, true) // If the token secret wasn't parsed, it returns: // (nil, false) GetTokenSecretContextFromString(str string) (*api.TokenSecretContext, bool) // SpecFromOpts parses in docker options passed in the the docker run // command of the form --opt name=value // source is populated if --opt parent=<volume_id> is specified. // If the options are validated then it returns: // (resultant_VolumeSpec, source, locator, nil) // If the options have invalid values then it returns: // (nil, nil, nil, error) SpecFromOpts(opts map[string]string) ( *api.VolumeSpec, *api.VolumeLocator, *api.Source, error, ) // UpdateSpecFromOpts parses in volume options passed through the opts map and updates given spec, locator & source // If the options are validated then it returns: // (resultant_VolumeSpec, source, locator, nil) // If the options have invalid values then it returns: // (nil, nil, nil, error) UpdateSpecFromOpts(opts map[string]string, spec *api.VolumeSpec, locator *api.VolumeLocator, source *api.Source) ( *api.VolumeSpec, *api.VolumeLocator, *api.Source, error, ) // Returns a default VolumeSpec if no docker options or string encoding // was provided. DefaultSpec() *api.VolumeSpec // RestoreSpecFromOpts parses the provided opaque map of options and populates // the VolumeLocator and RestoreVolumeSpec structs. // If the options are validated then it returns: // (resutlant_RestoreVolumeSpec, locator, nil) // If the options have unsupported values then it will log a warning and only // parse the options that it can understand RestoreSpecFromOpts(opts map[string]string) ( *api.RestoreVolumeSpec, *api.VolumeLocator, error, ) }
SpecHandler provides conversion function from what gets passed in over the plugin API to an api.VolumeSpec object.
func NewSpecHandler ¶
func NewSpecHandler() SpecHandler
NewSpecHandler returns a new SpecHandler interface
Click to show internal directories.
Click to hide internal directories.