spec

package
v8.0.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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)

	// GetTokenSecretFromString parses the full token secret path from the name.
	// If the token was parsed, it returns:
	// 	(tokenSecret, true)
	// If the token wasn't parsed, it returns:
	// 	("", false)
	GetTokenSecretFromString(str string) (string, 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
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL