types

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: Apache-2.0, Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigRoot is a config key.
	ConfigRoot = "libstorage"

	// ConfigServer is a config key.
	ConfigServer = ConfigRoot + ".server"

	// ConfigClient is a config key.
	ConfigClient = ConfigRoot + ".client"

	// ConfigClientType is a config key.
	ConfigClientType = ConfigClient + ".type"

	// ConfigHost is a config key.
	ConfigHost = ConfigRoot + ".host"

	// ConfigEmbedded is a config key.
	ConfigEmbedded = ConfigRoot + ".embedded"

	// ConfigService is a config key.
	ConfigService = ConfigRoot + ".service"

	// ConfigOSDriver is a config key.
	ConfigOSDriver = ConfigRoot + ".os.driver"

	// ConfigStorageDriver is a config key.
	ConfigStorageDriver = ConfigRoot + ".storage.driver"

	// ConfigIntegrationDriver is a config key.
	ConfigIntegrationDriver = ConfigRoot + ".integration.driver"

	// ConfigLogging is a config key.
	ConfigLogging = ConfigRoot + ".logging"

	// ConfigLogLevel is a config key.
	ConfigLogLevel = ConfigLogging + ".level"

	// ConfigLogStdout is a config key.
	ConfigLogStdout = ConfigLogging + ".stdout"

	// ConfigLogStderr is a config key.
	ConfigLogStderr = ConfigLogging + ".stderr"

	// ConfigLogHTTPRequests is a config key.
	ConfigLogHTTPRequests = ConfigLogging + ".httpRequests"

	// ConfigLogHTTPResponses is a config key.
	ConfigLogHTTPResponses = ConfigLogging + ".httpResponses"

	// ConfigHTTPDisableKeepAlive is a config key.
	ConfigHTTPDisableKeepAlive = ConfigRoot + ".http.disableKeepAlive"

	// ConfigHTTPWriteTimeout is a config key.
	ConfigHTTPWriteTimeout = ConfigRoot + ".http.writeTimeout"

	// ConfigHTTPReadTimeout is a config key.
	ConfigHTTPReadTimeout = ConfigRoot + ".http.readTimeout"

	// ConfigServices is a config key.
	ConfigServices = ConfigServer + ".services"

	// ConfigServerAutoEndpointMode is a config key.
	ConfigServerAutoEndpointMode = ConfigServer + ".autoEndpointMode"

	// ConfigEndpoints is a config key.
	ConfigEndpoints = ConfigServer + ".endpoints"

	// ConfigServerParseRequestOpts is a config key.
	ConfigServerParseRequestOpts = ConfigServer + ".parseRequestOpts"

	// ConfigExecutorPath is a config key.
	ConfigExecutorPath = ConfigRoot + ".executor.path"

	// ConfigExecutorNoDownload is a config key.
	ConfigExecutorNoDownload = ConfigRoot + ".executor.disableDownload"

	// ConfigClientCacheInstanceID is a config key.
	ConfigClientCacheInstanceID = ConfigClient + ".cache.instanceID"

	// ConfigTLS is a config key.
	ConfigTLS = ConfigRoot + ".tls"

	// ConfigTLSDisabled is a config key.
	ConfigTLSDisabled = ConfigTLS + ".disabled"

	// ConfigTLSInsecure is a config key.
	ConfigTLSInsecure = ConfigTLS + ".insecure"

	// ConfigTLSServerName is a config key.
	ConfigTLSServerName = ConfigTLS + ".serverName"

	// ConfigTLSKnownHosts is a config key.
	ConfigTLSKnownHosts = ConfigTLS + ".knownHosts"

	// ConfigTLSVerifyPeers is a config key.
	ConfigTLSVerifyPeers = ConfigTLS + ".verifyPeers"

	// ConfigTLSClientCertRequired is a config key.
	ConfigTLSClientCertRequired = ConfigTLS + ".clientCertRequired"

	// ConfigTLSTrustedCertsFile is a config key.
	ConfigTLSTrustedCertsFile = ConfigTLS + ".trustedCertsFile"

	// ConfigTLSCertFile is a config key.
	ConfigTLSCertFile = ConfigTLS + ".certFile"

	// ConfigTLSKeyFile is a config key.
	ConfigTLSKeyFile = ConfigTLS + ".keyFile"

	// ConfigDeviceAttachTimeout is a config key.
	ConfigDeviceAttachTimeout = ConfigRoot + ".device.attachTimeout"

	// ConfigDeviceScanType is a config key.
	ConfigDeviceScanType = ConfigRoot + ".device.scanType"

	// ConfigSchemaResponseValidationEnabled is a config key.
	ConfigSchemaResponseValidationEnabled = ConfigRoot +
		".schema.responseValidationEnabled"

	// ConfigServerTasks is a config key.
	ConfigServerTasks = ConfigServer + ".tasks"

	// ConfigServerTasksExeTimeout is a config key.
	ConfigServerTasksExeTimeout = ConfigServerTasks + ".exeTimeout"

	// ConfigServerTasksLogTimeout is a config key.
	ConfigServerTasksLogTimeout = ConfigServerTasks + ".logTimeout"

	// ConfigClientAuth is a config key.
	ConfigClientAuth = ConfigClient + ".auth"

	// ConfigClientAuthToken is a config key.
	ConfigClientAuthToken = ConfigClientAuth + ".token"

	// ConfigServerAuth is a config key.
	ConfigServerAuth = ConfigServer + ".auth"

	// ConfigServerAuthKey is a config key.
	ConfigServerAuthKey = ConfigServerAuth + ".key"

	// ConfigServerAuthAlg is a config key.
	ConfigServerAuthAlg = ConfigServerAuth + ".alg"

	// ConfigServerAuthAllow is a config key.
	ConfigServerAuthAllow = ConfigServerAuth + ".allow"

	// ConfigServerAuthDeny is a config key.
	ConfigServerAuthDeny = ConfigServerAuth + ".deny"

	// ConfigServerAuthDisabled is a config key.
	ConfigServerAuthDisabled = ConfigServerAuth + ".disabled"
)
View Source
const (
	//ConfigOldRoot is a config key.
	ConfigOldRoot = "volume"

	// ConfigOldIntegrationVolMountPreempt is a config key.
	ConfigOldIntegrationVolMountPreempt = ConfigOldRoot + ".mount.preempt"

	// ConfigOldIntegrationVolCreateDisable is a config key.
	ConfigOldIntegrationVolCreateDisable = ConfigOldRoot + ".create.disable"

	// ConfigOldIntegrationVolRemoveDisable is a config key.
	ConfigOldIntegrationVolRemoveDisable = ConfigOldRoot + ".remove.disable"

	// ConfigOldIntegrationVolUnmountIgnoreUsed is a config key.
	ConfigOldIntegrationVolUnmountIgnoreUsed = ConfigOldRoot + ".unmount.ignoreusedcount"

	// ConfigOldIntegrationVolPathCache is a config key.
	ConfigOldIntegrationVolPathCache = ConfigOldRoot + ".path.cache"

	//ConfigOldDocker is a config key.
	ConfigOldDocker = "docker"

	//ConfigOldDockerFsType is a config key.
	ConfigOldDockerFsType = ConfigOldDocker + ".fsType"

	//ConfigOldDockerVolumeType is a  config key.
	ConfigOldDockerVolumeType = ConfigOldDocker + ".volumeType"

	//ConfigOldDockerIOPS is a config key.
	ConfigOldDockerIOPS = ConfigOldDocker + ".iops"

	//ConfigOldDockerSize is a config key.
	ConfigOldDockerSize = ConfigOldDocker + ".size"

	//ConfigOldDockerAvailabilityZone is a config key.
	ConfigOldDockerAvailabilityZone = ConfigOldDocker + ".availabilityZone"

	//ConfigOldDockerMountDirPath is a config key.
	ConfigOldDockerMountDirPath = ConfigOldDocker + ".mountDirPath"

	//ConfigOldDockerLinuxVolumeRootPath is a config key.
	ConfigOldDockerLinuxVolumeRootPath = "linux.volume.rootpath"
)
View Source
const (
	//ConfigIg is a config key.
	ConfigIg = ConfigRoot + ".integration"

	//ConfigIgVol is a config key.
	ConfigIgVol = ConfigIg + ".volume"

	//ConfigIgVolOps is a config key.
	ConfigIgVolOps = ConfigIgVol + ".operations"

	//ConfigIgVolOpsMount is a config key.
	ConfigIgVolOpsMount = ConfigIgVolOps + ".mount"

	//ConfigIgVolOpsMountPreempt is a config key.
	ConfigIgVolOpsMountPreempt = ConfigIgVolOpsMount + ".preempt"

	//ConfigIgVolOpsMountPath is a config key.
	ConfigIgVolOpsMountPath = ConfigIgVolOpsMount + ".path"

	//ConfigIgVolOpsMountRootPath is a config key.
	ConfigIgVolOpsMountRootPath = ConfigIgVolOpsMount + ".rootPath"

	//ConfigIgVolOpsMountRetryCount is a config key.
	ConfigIgVolOpsMountRetryCount = ConfigIgVolOpsMount + ".retryCount"

	//ConfigIgVolOpsMountRetryWait is a config key.
	ConfigIgVolOpsMountRetryWait = ConfigIgVolOpsMount + ".retryWait"

	//ConfigIgVolOpsUnmount is a config key.
	ConfigIgVolOpsUnmount = ConfigIgVolOps + ".unmount"

	//ConfigIgVolOpsUnmountIgnoreUsed is a config key.
	ConfigIgVolOpsUnmountIgnoreUsed = ConfigIgVolOpsUnmount + ".ignoreusedcount"

	// ConfigIgVolOpsPath is a config key.
	ConfigIgVolOpsPath = ConfigIgVolOps + ".path"

	// ConfigIgVolOpsPathCache is a config key.
	ConfigIgVolOpsPathCache = ConfigIgVolOpsPath + ".cache"

	// ConfigIgVolOpsPathCacheEnabled is a config key.
	ConfigIgVolOpsPathCacheEnabled = ConfigIgVolOpsPathCache + ".enabled"

	// ConfigIgVolOpsPathCacheAsync is a config key.
	ConfigIgVolOpsPathCacheAsync = ConfigIgVolOpsPathCache + ".async"

	// ConfigIgVolOpsCreate is a config key.
	ConfigIgVolOpsCreate = ConfigIgVolOps + ".create"

	// ConfigIgVolOpsCreateDisable is a config key.
	ConfigIgVolOpsCreateDisable = ConfigIgVolOpsCreate + ".disable"

	// ConfigIgVolOpsCreateImplicit is a config key.
	ConfigIgVolOpsCreateImplicit = ConfigIgVolOpsCreate + ".implicit"

	// ConfigIgVolOpsCreateDefault is a config key.
	ConfigIgVolOpsCreateDefault = ConfigIgVolOpsCreate + ".default"

	// ConfigIgVolOpsCreateDefaultSize is a config key.
	ConfigIgVolOpsCreateDefaultSize = ConfigIgVolOpsCreateDefault + ".size"

	// ConfigIgVolOpsCreateDefaultFsType is a config key.
	ConfigIgVolOpsCreateDefaultFsType = ConfigIgVolOpsCreateDefault + ".fsType"

	// ConfigIgVolOpsCreateDefaultAZ is a config key.
	ConfigIgVolOpsCreateDefaultAZ = ConfigIgVolOpsCreateDefault + ".availabilityZone"

	// ConfigIgVolOpsCreateDefaultType is a config key.
	ConfigIgVolOpsCreateDefaultType = ConfigIgVolOpsCreateDefault + ".type"

	// ConfigIgVolOpsCreateDefaultIOPS is a config key.
	ConfigIgVolOpsCreateDefaultIOPS = ConfigIgVolOpsCreateDefault + ".IOPS"

	// ConfigIgVolOpsRemove is a config key.
	ConfigIgVolOpsRemove = ConfigIgVolOps + ".remove"

	// ConfigIgVolOpsRemoveDisable is a config key.
	ConfigIgVolOpsRemoveDisable = ConfigIgVolOpsRemove + ".disable"

	// ConfigIgVolOpsRemoveForce is a config key.
	ConfigIgVolOpsRemoveForce = ConfigIgVolOpsRemove + ".force"
)
View Source
const (
	// VolAttNone is the default value. This indicates no attachment
	// information is requested.
	VolAttNone VolumeAttachmentsTypes = 0

	// VolAttFalse is an alias for VolAttNone.
	VolAttFalse = VolAttNone

	// VolAttReq requests attachment information for all retrieved volumes.
	//
	// Mask: 1
	VolAttReq = VolumeAttachmentsRequested

	// VolAttReqForInstance requests attachment information for volumes attached
	// to the instance provided in the instance ID
	//
	// Mask: 1 | 2
	VolAttReqForInstance = VolAttReq | VolumeAttachmentsMine

	// VolAttReqWithDevMapForInstance requests attachment information for
	// volumes attached to the instance provided in the instance ID and perform
	// device mappings where possible.
	//
	// Mask: 1 | 2 | 4
	VolAttReqWithDevMapForInstance = VolAttReqForInstance |
		VolumeAttachmentsDevices

	// VolAttReqOnlyAttachedVols requests attachment information for all
	// retrieved volumes and return only volumes that are attached to some
	// instance.
	//
	// Mask: 1 | 8
	VolAttReqOnlyAttachedVols = VolAttReq | VolumeAttachmentsAttached

	// VolAttReqOnlyUnattachedVols requests attachment information for
	// all retrieved volumes and return only volumes that are not attached to
	// any instance.
	//
	// Mask: 1 | 16
	VolAttReqOnlyUnattachedVols = VolAttReq | VolumeAttachmentsUnattached

	// VolAttReqOnlyVolsAttachedToInstance requests attachment
	// information for all retrieved volumes and return only volumes that
	// attached to the instance provided in the instance ID.
	//
	// Mask: 1 | 2 | 8
	VolAttReqOnlyVolsAttachedToInstance = VolAttReqForInstance |
		VolumeAttachmentsAttached

	// VolAttReqWithDevMapOnlyVolsAttachedToInstance requests attachment
	// information for all retrieved volumes and return only volumes that
	// attached to the instance provided in the instance ID and perform device
	// mappings where possible.
	//
	// Mask: 1 | 2 | 4 | 8
	VolAttReqWithDevMapOnlyVolsAttachedToInstance = VolumeAttachmentsDevices |
		VolAttReqOnlyVolsAttachedToInstance

	// VolAttReqTrue is an alias for
	// VolAttReqWithDevMapOnlyVolsAttachedToInstance.
	VolAttReqTrue = VolAttReqWithDevMapOnlyVolsAttachedToInstance

	// VolumeAttachmentsTrue is an alias for VolAttReqTrue.
	VolumeAttachmentsTrue = VolAttReqTrue

	// VolAttReqOnlyVolsAttachedToInstanceOrUnattachedVols requests attachment
	// information for all retrieved volumes and return only volumes that
	// attached to the instance provided in the instance ID or are not attached
	// to any instance at all. tl;dr - Attached To Me or Available
	//
	// Mask: 1 | 2 | 8 | 16
	VolAttReqOnlyVolsAttachedToInstanceOrUnattachedVols = 0 |
		VolAttReqOnlyVolsAttachedToInstance |
		VolumeAttachmentsUnattached

	// VolAttReqWithDevMapOnlyVolsAttachedToInstanceOrUnattachedVols requests
	// attachment information for all retrieved volumes and return only volumes
	// that attached to the instance provided in the instance ID or are not
	// attached to any instance at all and perform device mappings where
	// possible. tl;dr - Attached To Me With Device Mappings or Available
	//
	// Mask: 1 | 2 | 4 | 8 | 16
	VolAttReqWithDevMapOnlyVolsAttachedToInstanceOrUnattachedVols = 0 |
		VolumeAttachmentsDevices |
		VolAttReqOnlyVolsAttachedToInstanceOrUnattachedVols
)
View Source
const (
	// InstanceIDHeader is the HTTP header that contains an InstanceID.
	InstanceIDHeader = "Libstorage-Instanceid"

	// LocalDevicesHeader is the HTTP header that contains a local device pair.
	LocalDevicesHeader = "Libstorage-Localdevices"

	// TransactionHeader is the HTTP header that contains the transaction
	// sent from the client.
	TransactionHeader = "Libstorage-Tx"

	// ServerNameHeader is the HTTP header that contains the randomly generated
	// name the server creates for unique identification when the server starts
	// for the first time. This header is provided with every response sent
	// from the server.
	ServerNameHeader = "Libstorage-Servername"

	// AuthorizationHeader is the HTTP header that contains the Authorization
	// information.
	AuthorizationHeader = "Authorization"
)

All header names below follow the Golang canonical format for header keys. Please do not alter their casing to your liking or you will break stuff.

View Source
const (
	// TaskStateQueued is the state for a task that has been enqueued but not
	// yet started.
	TaskStateQueued TaskState = "queued"

	// TaskStateRunning is the state for a task that is running.
	TaskStateRunning = "running"

	// TaskStateSuccess is the state for a task that has completed successfully.
	TaskStateSuccess = "success"

	// TaskStateError is the state for a task that has completed with an error.
	TaskStateError = "error"
)
View Source
const LibStorageDriverName = "libstorage"

LibStorageDriverName is the name of the libStorage storage driver.

Variables

View Source
var (
	// Debug is a flag that indicates whether or not the environment variable
	// `LIBSTORAGE_DEBUG` is set to a boolean true value.
	Debug, _ = strconv.ParseBool(os.Getenv("LIBSTORAGE_DEBUG"))

	// Stdout is the writer used when a component in libStorage wishes to
	// write to the standard output stream.
	Stdout io.Writer = os.Stdout

	// Stderr is the writer used when a component in libStorage wishes to
	// write to the standard error stream.
	Stderr io.Writer = os.Stderr
)
View Source
var (
	// ErrIIDMetadataNil is returned by *InstanceID.UnmarshalMetadata when
	// the InstanceID's metadata is empty or nil.
	ErrIIDMetadataNil = goof.New("cannot unmarshal nil metadata")

	// ErrIIDMetadataNilData is returned by *InstanceID.MarshalMetadata when
	// the provided object to marshal is nil.
	ErrIIDMetadataNilData = goof.New("cannot marshal nil metadata")

	// ErrIIDMetadataNilDest is returned by *InstanceID.UnmarshalMetadata when
	// the provided destination into which the metadata should be unmarshaled
	// is nil.
	ErrIIDMetadataNilDest = goof.New("cannot unmarshal into nil receiver")
)
View Source
var ErrMissingStorageService = goof.New("missing storage service")

ErrMissingStorageService occurs when the storage service is expected in the provided context but is not there.

View Source
var ErrNotImplemented = goof.New("not implemented")

ErrNotImplemented is the error that Driver implementations should return if a function is not implemented.

View Source
var ErrTimedOut = goof.New("timed out")

ErrTimedOut is the error that is used to indicate an operation timed out.

Functions

func BackCompat

func BackCompat(config gofig.Config)

BackCompat ensures keys can be used from old configurations.

Types

type APIClient

type APIClient interface {

	// ServerName returns the name of the server to which the client is
	// connected. This is not the same as the host name, rather it's the
	// randomly generated name the server creates for unique identification
	// when the server starts for the first time.
	ServerName() string

	// LogRequests enables or disables the logging of client HTTP requests.
	LogRequests(enabled bool)

	// LogResponses enables or disables the logging of client HTTP responses.
	LogResponses(enabled bool)

	// Root returns a list of root resources.
	Root(ctx Context) ([]string, error)

	// Instances returns a list of instances.
	Instances(ctx Context) (map[string]*Instance, error)

	// InstanceInspect inspects an instance.
	InstanceInspect(ctx Context, service string) (*Instance, error)

	// Services returns a map of the configured Services.
	Services(ctx Context) (map[string]*ServiceInfo, error)

	// ServiceInspect returns information about a service.
	ServiceInspect(ctx Context, name string) (*ServiceInfo, error)

	// Volumes returns a list of all Volumes for all Services.
	Volumes(
		ctx Context,
		attachments VolumeAttachmentsTypes) (ServiceVolumeMap, error)

	// VolumesByService returns a list of all Volumes for a service.
	VolumesByService(
		ctx Context,
		service string,
		attachments VolumeAttachmentsTypes) (VolumeMap, error)

	// VolumeInspect gets information about a single volume by ID.
	VolumeInspect(
		ctx Context,
		service, volumeID string,
		attachments VolumeAttachmentsTypes) (*Volume, error)

	// VolumeInspectByName gets information about a single volume by name.
	VolumeInspectByName(
		ctx Context,
		service, volumeName string,
		attachments VolumeAttachmentsTypes) (*Volume, error)

	// VolumeCreate creates a single volume.
	VolumeCreate(
		ctx Context,
		service string,
		request *VolumeCreateRequest) (*Volume, error)

	// VolumeCreateFromSnapshot creates a single volume from a snapshot.
	VolumeCreateFromSnapshot(
		ctx Context,
		service, snapshotID string,
		request *VolumeCreateRequest) (*Volume, error)

	// VolumeCopy copies a single volume.
	VolumeCopy(
		ctx Context,
		service, volumeID string,
		request *VolumeCopyRequest) (*Volume, error)

	// VolumeRemove removes a single volume.
	VolumeRemove(
		ctx Context,
		service, volumeID string,
		force bool) error

	// VolumeAttach attaches a single volume.
	VolumeAttach(
		ctx Context,
		service string,
		volumeID string,
		request *VolumeAttachRequest) (*Volume, string, error)

	// VolumeDetach attaches a single volume.
	VolumeDetach(
		ctx Context,
		service string,
		volumeID string,
		request *VolumeDetachRequest) (*Volume, error)

	// VolumeDetachAll attaches all volumes from all
	VolumeDetachAll(
		ctx Context,
		request *VolumeDetachRequest) (ServiceVolumeMap, error)

	// VolumeDetachAllForService detaches all volumes from a service.
	VolumeDetachAllForService(
		ctx Context,
		service string,
		request *VolumeDetachRequest) (VolumeMap, error)

	// VolumeSnapshot creates a single snapshot.
	VolumeSnapshot(
		ctx Context,
		service string,
		volumeID string,
		request *VolumeSnapshotRequest) (*Snapshot, error)

	// Snapshots returns a list of all Snapshots for all
	Snapshots(ctx Context) (ServiceSnapshotMap, error)

	// SnapshotsByService returns a list of all Snapshots for a single service.
	SnapshotsByService(
		ctx Context, service string) (SnapshotMap, error)

	// SnapshotInspect gets information about a single snapshot.
	SnapshotInspect(
		ctx Context,
		service, snapshotID string) (*Snapshot, error)

	// SnapshotRemove removes a single snapshot.
	SnapshotRemove(
		ctx Context,
		service, snapshotID string) error

	// SnapshotCopy copies a snapshot to a new snapshot.
	SnapshotCopy(
		ctx Context,
		service, snapshotID string,
		request *SnapshotCopyRequest) (*Snapshot, error)
}

APIClient is the libStorage API client used for communicating with a remote libStorage endpoint.

type APIFunc

type APIFunc func(
	ctx Context,
	w http.ResponseWriter,
	r *http.Request,
	store Store) error

APIFunc is an adapter to allow the use of ordinary functions as API endpoints. Any function that has the appropriate signature can be register as an API endpoint.

type AuthConfig

type AuthConfig struct {

	// Disabled is a flag indicating whether the auth configuration is disabled.
	Disabled bool

	// Allow is a list of allowed tokens.
	Allow []string

	// Deny is a list of denied tokens.
	Deny []string

	// Key is the signing key.
	Key []byte

	// Alg is the cryptographic algorithm used to sign and verify the token.
	Alg string
}

AuthConfig is the auth configuration.

type AuthToken

type AuthToken struct {
	// Subject is the intended principal of the token.
	Subject string `json:"sub"`

	// Expires is the time at which the token expires.
	Expires int64 `json:"exp"`

	// NotBefore is the the time at which the token becomes valid.
	NotBefore int64 `json:"nbf"`

	// IssuedAt is the time at which the token was issued.
	IssuedAt int64 `json:"iat"`

	// Encoded is the encoded JWT string.
	Encoded string `json:"enc"`
}

AuthToken is a JSON Web Token.

All fields related to times are stored as UTC epochs in seconds.

func (*AuthToken) String

func (s *AuthToken) String() string

String returns the subject of the security token.

type Client

type Client interface {

	// API returns the underlying libStorage API client.
	API() APIClient

	// OS returns the client's OS driver instance.
	OS() OSDriver

	// Storage returns the client's storage driver instance.
	Storage() StorageDriver

	// IntegrationDriver returns the client's integration driver instance.
	Integration() IntegrationDriver

	// Executor returns the storage executor CLI.
	Executor() StorageExecutorCLI
}

Client is the libStorage client.

type ClientType

type ClientType int

ClientType is a client's type.

const (
	// UnknownClientType is an unknown client type.
	UnknownClientType ClientType = iota

	// IntegrationClient is the default client type -- a client that both
	// communicates with a remote libStorage endpoint as well as interacts with
	// the local host.
	IntegrationClient

	// ControllerClient is a libStorage client that has no interaction with
	// the local host, removing any need for access to libStorage executors.
	ControllerClient
)

func ParseClientType

func ParseClientType(str string) ClientType

ParseClientType parses a new client type.

func (ClientType) String

func (t ClientType) String() string

String returns the client type's string representation.

type ConfigKey

type ConfigKey string

ConfigKey is a configuration key.

func (ConfigKey) String

func (k ConfigKey) String() string

String returns the string-representation of the ConfigKey.

type Context

type Context interface {
	context.Context
	FieldLogger

	// WithValue returns a copy of parent in which the value associated with
	// key is val.
	WithValue(key, value interface{}) Context

	// Join joins this context with another, such that value lookups will first
	// first check the current context, and if no such value exist, a lookup
	// will be performed against the right side.
	Join(ctx context.Context) Context
}

Context is a libStorage context.

type ContextLoggerFieldAware

type ContextLoggerFieldAware interface {

	// ContextLoggerField is the fields that is logged as part of a Context's
	// log entry.
	ContextLoggerField() (string, interface{})
}

ContextLoggerFieldAware is used by types that will be logged by the Context logger. The key/value pair returned by the type is then emitted as part of the Context's log entry.

type ContextLoggerFieldsAware

type ContextLoggerFieldsAware interface {

	// ContextLoggerFields are the fields that are logged as part of a
	// Context's log entry.
	ContextLoggerFields() map[string]interface{}
}

ContextLoggerFieldsAware is used by types that will be logged by the Context logger. The fields returned by the type are then emitted as part of the Context's log entry.

type DeviceFormatOpts

type DeviceFormatOpts struct {
	NewFSType   string
	OverwriteFS bool
	Opts        Store
}

DeviceFormatOpts are options when formatting a device.

type DeviceMountOpts

type DeviceMountOpts struct {
	MountOptions string
	MountLabel   string
	FsType       string
	Opts         Store
}

DeviceMountOpts are options when mounting a device.

type DeviceScanType

type DeviceScanType int

DeviceScanType is a type of device scan algorithm.

const (

	// DeviceScanQuick performs a shallow, quick scan.
	DeviceScanQuick DeviceScanType = iota

	// DeviceScanDeep performs a deep, longer scan.
	DeviceScanDeep
)

func ParseDeviceScanType

func ParseDeviceScanType(i interface{}) DeviceScanType

ParseDeviceScanType parses a device scan type.

func (DeviceScanType) String

func (st DeviceScanType) String() string

String returns the string representation of a DeviceScanType.

type Driver

type Driver interface {

	// Name returns the name of the driver
	Name() string

	// Init initializes the driver.
	Init(ctx Context, config gofig.Config) error
}

Driver is the base interface for a libStorage driver.

type DriverInfo

type DriverInfo struct {
	// Name is the driver's name.
	Name string `json:"name"`

	// Type is the type of storage the driver provides: block, nas, object.
	Type StorageType `json:"type"`

	// NextDevice is the next available device information for the service.
	NextDevice *NextDeviceInfo `json:"nextDevice,omitempty" yaml:"nextDevice,omitempty"`
}

DriverInfo is information about a driver.

type EndpointType

type EndpointType int

EndpointType is a type of endpoint.

const (
	// UnknownEndpointType is an unknown endpoint type.
	UnknownEndpointType EndpointType = iota

	// UnixEndpoint is a UNIX socket endpoint.
	UnixEndpoint

	// TCPEndpoint is a TCP endpoint.
	TCPEndpoint
)

func ParseEndpointType

func ParseEndpointType(str string) EndpointType

ParseEndpointType parses the endpoint type.

func (EndpointType) String

func (t EndpointType) String() string

String returns the endpoint type's string representation.

type ErrBadAdminToken

type ErrBadAdminToken struct{ goof.Goof }

ErrBadAdminToken occurs when a bad admin token is provided.

type ErrBadFilter

type ErrBadFilter struct{ goof.Goof }

ErrBadFilter occurs when a bad filter is supplied via the filter query string.

type ErrBatchProcess

type ErrBatchProcess struct{ goof.Goof }

ErrBatchProcess occurs when a batch process is interrupted by an error before the process is complete. This error will contain information about the objects for which the process did complete.

type ErrContextKey

type ErrContextKey struct{ goof.Goof }

ErrContextKey occurs when no value exists for a specified context key.

type ErrContextType

type ErrContextType struct{ goof.Goof }

ErrContextType occurs when a value exists in the context but is not the expected typed.

type ErrDriverTypeErr

type ErrDriverTypeErr struct{ goof.Goof }

ErrDriverTypeErr occurs when a Driver is constructed with an invalid type.

type ErrKnownHost

type ErrKnownHost struct {
	// HostName is the name of the host to which the connection was
	// attempted.
	HostName string

	// PeerAlg is algorithm used to calculate the remote peer's fingerprint.
	PeerAlg string

	// PeerFingerprint is the remote peer's fingerprint.
	PeerFingerprint []byte
}

ErrKnownHost occurs when the client's TLS dialer encounters a problem verifying the remote peer's certificate against a list of known host signatures.

func (*ErrKnownHost) Error

func (e *ErrKnownHost) Error() string

type ErrKnownHostConflict

type ErrKnownHostConflict struct {
	// HostName is the name of the host to which the connection was
	// attempted.
	HostName string

	// KnownHostName is the name of the known host with an associated
	// fingerprint that matches that of the remote peer.
	KnownHostName string

	// PeerAlg is algorithm used to calculate the remote peer's fingerprint.
	PeerAlg string

	// PeerFingerprint is the remote peer's fingerprint.
	PeerFingerprint []byte
}

ErrKnownHostConflict occurs when the client's TLS dialer encounters an existing known host entry for the targeted host name but with a different signature than the one being presented by the remote peer.

func (*ErrKnownHostConflict) Error

func (e *ErrKnownHostConflict) Error() string

type ErrMissingInstanceID

type ErrMissingInstanceID struct{ goof.Goof }

ErrMissingInstanceID occurs when an operation requires the instance ID for the configured service to be avaialble.

type ErrMissingLocalDevices

type ErrMissingLocalDevices struct{ goof.Goof }

ErrMissingLocalDevices occurs when an operation requires local devices and they're missing.

type ErrNotFound

type ErrNotFound struct{ goof.Goof }

ErrNotFound occurs when a Driver inspects or sends an operation to a resource that cannot be found.

type ErrSecTokInvalid

type ErrSecTokInvalid struct {
	// InvalidToken is a flag that indicates whether or not the token was able
	// to be parsed at all.
	InvalidToken bool `json:"invalidToken"`

	// InvalidSig is a flag that indicates whether or not the security token
	// has a valid signature.
	InvalidSig bool `json:"invalidSig"`

	// MissingClaim is empty if all claims are missing or set to the name
	// of the first, detected, missing claim.
	MissingClaim string `json:"claim"`

	// Denied is a flag that indicates whether or not the security token
	// was denied access.
	Denied bool

	// InnerError is the inner error that caused this one.
	InnerError error `json:"innerError,omitempty"`
}

ErrSecTokInvalid occurs when a security token is invalid.

func (*ErrSecTokInvalid) Error

func (e *ErrSecTokInvalid) Error() string

Error returns the error string.

type ErrStoreKey

type ErrStoreKey struct{ goof.Goof }

ErrStoreKey occurs when no value exists for a specified store key.

type ErrUnsupportedForClientType

type ErrUnsupportedForClientType struct{ goof.Goof }

ErrUnsupportedForClientType is the error that occurs when an operation is invoked that is unsupported for the current client type.

type FieldLogger

type FieldLogger interface {
	WithField(key string, value interface{}) LogEntry
	WithFields(fields logrus.Fields) LogEntry
	WithError(err error) LogEntry

	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Printf(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	Panicf(format string, args ...interface{})

	Debug(args ...interface{})
	Info(args ...interface{})
	Print(args ...interface{})
	Warn(args ...interface{})
	Warning(args ...interface{})
	Error(args ...interface{})
	Fatal(args ...interface{})
	Panic(args ...interface{})

	Debugln(args ...interface{})
	Infoln(args ...interface{})
	Println(args ...interface{})
	Warnln(args ...interface{})
	Warningln(args ...interface{})
	Errorln(args ...interface{})
	Fatalln(args ...interface{})
	Panicln(args ...interface{})
}

FieldLogger interface generalizes the Entry and Logger types

type Filter

type Filter struct {

	// Op is the operation.
	Op FilterOperator

	// Children is a list of any sub-filters if this filter is a compound
	// filter.
	Children []*Filter

	// Left is the left operand.
	Left string

	// Right is the right operand.
	Right string
}

Filter is an LDAP-style filter string.

type FilterOperator

type FilterOperator int

FilterOperator is a filter operator.

const (
	// FilterAnd is the & operator.
	FilterAnd FilterOperator = iota

	// FilterOr is the | operator.
	FilterOr

	// FilterNot is the ! operator.
	FilterNot

	// FilterPresent is the =* operator.
	FilterPresent

	// FilterEqualityMatch is the = operator.
	FilterEqualityMatch

	// FilterSubstrings is the = operator in conjunction with a string that
	// has leading and trailing * characters.
	FilterSubstrings

	// FilterSubstringsPrefix is the = operator in conjunction with a string
	// that has a leading * character.
	FilterSubstringsPrefix

	// FilterSubstringsPostfix is the = operator in conjunction with a string
	// that has a trailing * character.
	FilterSubstringsPostfix

	// FilterGreaterOrEqual is the >= operator.
	FilterGreaterOrEqual

	// FilterLessOrEqual is the <= operator.
	FilterLessOrEqual

	// FilterApproxMatch is the ~= operator.
	FilterApproxMatch
)

type Instance

type Instance struct {
	// The ID of the instance to which the object is connected.
	InstanceID *InstanceID `json:"instanceID" yaml:"instanceID,omitempty"`

	// The name of the instance.
	Name string `json:"name,omitempty" yaml:",omitempty"`

	// The name of the provider that owns the object.
	ProviderName string `json:"providerName" yaml:"providerName,omitempty"`

	// The region from which the object originates.
	Region string `json:"region,omitempty" yaml:",omitempty"`

	// Fields are additional properties that can be defined for this type.
	Fields map[string]string `json:"fields,omitempty" yaml:",omitempty"`
}

Instance provides information about a storage object.

type InstanceID

type InstanceID struct {

	// ID is the simple part of the InstanceID.
	ID string `json:"id" yaml:"id"`

	// Driver is the name of the StorageExecutor that created the InstanceID
	// as well as the name of the StorageDriver for which the InstanceID is
	// valid.
	Driver string `json:"driver"`

	// Service is the name of the libStorage service for which the InstanceID
	// is valid.
	Service string `json:"service"`

	// Fields is additional, driver specific data about the Instance ID.
	Fields map[string]string `json:"fields"`
	// contains filtered or unexported fields
}

InstanceID identifies a host to a remote storage platform.

func (*InstanceID) DeleteMetadata

func (i *InstanceID) DeleteMetadata()

DeleteMetadata deletes the metadata from the InstanceID.

func (*InstanceID) HasMetadata

func (i *InstanceID) HasMetadata() bool

HasMetadata returns a flag indicating whether or not the instance ID has any associated metadata.

func (*InstanceID) MarshalJSON

func (i *InstanceID) MarshalJSON() ([]byte, error)

MarshalJSON marshals the InstanceID to JSON.

func (*InstanceID) MarshalMetadata

func (i *InstanceID) MarshalMetadata(data interface{}) error

MarshalMetadata encodes the provided object to JSON and assigns the result to the InstanceID's metadata field.

func (*InstanceID) MarshalText

func (i *InstanceID) MarshalText() ([]byte, error)

MarshalText marshals InstanceID to a text string that adheres to the format `DRIVER[:SERVICE]=ID,FIELDS,[,METADATA]`. If metadata is present it is encoded as a base64 string.

func (*InstanceID) MarshalYAML

func (i *InstanceID) MarshalYAML() (interface{}, error)

MarshalYAML returns the object to marshal to the YAML representation of the InstanceID.

func (*InstanceID) String

func (i *InstanceID) String() string

String returns the string representation of an InstanceID object.

func (*InstanceID) UnmarshalJSON

func (i *InstanceID) UnmarshalJSON(data []byte) error

UnmarshalJSON marshals the InstanceID to JSON.

func (*InstanceID) UnmarshalMetadata

func (i *InstanceID) UnmarshalMetadata(dest interface{}) error

UnmarshalMetadata decodes the InstanceID's metadata into the provided object.

func (*InstanceID) UnmarshalText

func (i *InstanceID) UnmarshalText(value []byte) error

UnmarshalText unmarshals the data into a an InstanceID provided the data adheres to the format described in the MarshalText function.

type InstanceIDMap

type InstanceIDMap map[string]*InstanceID

InstanceIDMap is a map of InstanceID objects.

type IntegrationDriver

type IntegrationDriver interface {
	Driver

	// List a map that relates volume names to their mount points.
	List(
		ctx Context,
		opts Store) ([]VolumeMapping, error)

	// Inspect returns a specific volume as identified by the provided
	// volume name.
	Inspect(
		ctx Context,
		volumeName string,
		opts Store) (VolumeMapping, error)

	// Mount will return a mount point path when specifying either a volumeName
	// or volumeID.  If a overwriteFs boolean is specified it will overwrite
	// the FS based on newFsType if it is detected that there is no FS present.
	Mount(
		ctx Context,
		volumeID, volumeName string,
		opts *VolumeMountOpts) (string, *Volume, error)

	// Unmount will unmount the specified volume by volumeName or volumeID.
	Unmount(
		ctx Context,
		volumeID, volumeName string,
		opts Store) (*Volume, error)

	// Path will return the mounted path of the volumeName or volumeID.
	Path(
		ctx Context,
		volumeID, volumeName string,
		opts Store) (string, error)

	// Create will create a new volume with the volumeName and opts.
	Create(
		ctx Context,
		volumeName string,
		opts *VolumeCreateOpts) (*Volume, error)

	// Remove will remove a volume of volumeName.
	Remove(
		ctx Context,
		volumeName string,
		opts *VolumeRemoveOpts) error

	// Attach will attach a volume based on volumeName to the instance of
	// instanceID.
	Attach(
		ctx Context,
		volumeName string,
		opts *VolumeAttachOpts) (string, error)

	// Detach will detach a volume based on volumeName to the instance of
	// instanceID.
	Detach(
		ctx Context,
		volumeName string,
		opts *VolumeDetachOpts) error
}

IntegrationDriver is the interface implemented to integrate external storage consumers, such as Docker, with libStorage.

type IntegrationDriverManager

type IntegrationDriverManager interface {
	IntegrationDriver

	// Driver returns the underlying driver.
	Driver() IntegrationDriver
}

IntegrationDriverManager is the management wrapper for an IntegrationDriver.

type LSXSupportedOp

type LSXSupportedOp int

LSXSupportedOp is a bit for the mask returned from an executor's Supported function.

const (
	// LSXSOpInstanceID indicates an executor supports "InstanceID".
	// "InstanceID" operation.
	LSXSOpInstanceID LSXSupportedOp = 1 << iota // 1

	// LSXSOpNextDevice indicates an executor supports "NextDevice".
	LSXSOpNextDevice

	// LSXSOpLocalDevices indicates an executor supports "LocalDevices".
	LSXSOpLocalDevices

	// LSXSOpWaitForDevice indicates an executor supports "WaitForDevice".
	LSXSOpWaitForDevice

	// LSXSOpMount indicates an executor supports "Mount".
	LSXSOpMount

	// LSXSOpUmount indicates an executor supports "Umount".
	LSXSOpUmount

	// LSXSOpMounts indicates an executor supports "Mounts".
	LSXSOpMounts
)
const (
	// LSXSOpNone indicates the executor is not supported for the platform.
	LSXSOpNone LSXSupportedOp = 0

	// LSXOpAll indicates the executor supports all operations.
	LSXOpAll LSXSupportedOp = LSXSOpInstanceID |
		LSXSOpNextDevice |
		LSXSOpLocalDevices |
		LSXSOpWaitForDevice |
		LSXSOpMount |
		LSXSOpUmount |
		LSXSOpMounts

	// LSXOpAllNoMount indicates the executor supports all operations except
	// mount and unmount.
	LSXOpAllNoMount = LSXOpAll & ^LSXSOpMount & ^LSXSOpUmount & ^LSXSOpMounts
)

func (LSXSupportedOp) InstanceID

func (v LSXSupportedOp) InstanceID() bool

InstanceID returns a flag that indicates whether the LSXSOpInstanceID bit is set.

func (LSXSupportedOp) LocalDevices

func (v LSXSupportedOp) LocalDevices() bool

LocalDevices returns a flag that indicates whether the LSXSOpLocalDevices bit is set.

func (LSXSupportedOp) Mount

func (v LSXSupportedOp) Mount() bool

Mount returns a flag that indicates whether the LSXSOpMount bit is set.

func (LSXSupportedOp) Mounts

func (v LSXSupportedOp) Mounts() bool

Mounts returns a flag that indicates whether the LSXSOpMounts bit is set.

func (LSXSupportedOp) NextDevice

func (v LSXSupportedOp) NextDevice() bool

NextDevice returns a flag that indicates whether the LSXSOpNextDevice bit is set.

func (LSXSupportedOp) Umount

func (v LSXSupportedOp) Umount() bool

Umount returns a flag that indicates whether the LSXSOpUmount bit is set.

func (LSXSupportedOp) WaitForDevice

func (v LSXSupportedOp) WaitForDevice() bool

WaitForDevice returns a flag that indicates whether the LSXSOpWaitForDevice bit is set.

type Level

type Level log.Level

Level is a log level.

const (
	// PanicLevel level, highest level of severity. Logs and then calls panic
	// with the message passed to Debug, Info, ...
	PanicLevel Level = Level(log.PanicLevel) + iota

	// FatalLevel level. Logs and then calls `os.Exit(1)`. It will exit even
	// if the logging level is set to Panic.
	FatalLevel

	// ErrorLevel level. Logs. Used for errors that should definitely be noted.
	// Commonly used for hooks to send errors to an error tracking service.
	ErrorLevel

	// WarnLevel level. Non-critical entries that deserve eyes.
	WarnLevel

	// InfoLevel level. General operational entries about what's going on
	// inside the application.
	InfoLevel

	// DebugLevel level. Usually only enabled when debugging. Very verbose
	// logging.
	DebugLevel

	// TraceLevel level. An even more verbose levle of logging than DebugLevel.
	TraceLevel
)

These are the different logging levels.

type LocalDevices

type LocalDevices struct {

	// Driver is the name of the StorageExecutor that created the map
	// as well as the name of the StorageDriver for which the map is
	// valid.
	Driver string `json:"driver"`

	// DeviceMap is voluem to device mappings.
	DeviceMap map[string]string `json:"deviceMap,omitempty" yaml:"deviceMap,omitempty"`
}

LocalDevices is a wrapper for a map of volume to device mappings.

func (*LocalDevices) MarshalJSON

func (l *LocalDevices) MarshalJSON() ([]byte, error)

MarshalJSON marshals the InstanceID to JSON.

func (*LocalDevices) MarshalText

func (l *LocalDevices) MarshalText() ([]byte, error)

MarshalText marshals LocalDevices to a text string that adheres to the format `DRIVER=VOLUMEID::DEVICEID[,VOLUMEID::DEVICEID,...]`.

func (*LocalDevices) MarshalYAML

func (l *LocalDevices) MarshalYAML() (interface{}, error)

MarshalYAML returns the object to marshal to the YAML representation of the LocalDevices.

func (*LocalDevices) String

func (l *LocalDevices) String() string

String returns the string representation of a LocalDevices object.

func (*LocalDevices) UnmarshalJSON

func (l *LocalDevices) UnmarshalJSON(data []byte) error

UnmarshalJSON marshals the InstanceID to JSON.

func (*LocalDevices) UnmarshalText

func (l *LocalDevices) UnmarshalText(value []byte) error

UnmarshalText unmarshals the data into a an InstanceID provided the data adheres to the format described in the MarshalText function.

type LocalDevicesMap

type LocalDevicesMap map[string]*LocalDevices

LocalDevicesMap is a map of LocalDevices objects.

type LocalDevicesOpts

type LocalDevicesOpts struct {
	ScanType DeviceScanType
	Opts     Store
}

LocalDevicesOpts are options when getting a list of local devices.

type LogEntry

type LogEntry interface {
	FieldLogger
}

LogEntry is collected data to be emitted as a log entry.

type Middleware

type Middleware interface {

	// Name returns the name of the middlware.
	Name() string

	// Handler enables the chaining of middlware.
	Handler(handler APIFunc) APIFunc

	// Handle is for processing an incoming request.
	Handle(
		ctx Context,
		w http.ResponseWriter,
		r *http.Request,
		store Store) error
}

Middleware is middleware for a route.

type MiddlewareFunc

type MiddlewareFunc func(handler APIFunc) APIFunc

MiddlewareFunc is an adapter to allow the use of ordinary functions as API filters. Any function that has the appropriate signature can be register as a middleware.

type MountInfo

type MountInfo struct {
	// ID is a unique identifier of the mount (may be reused after umount).
	ID int `json:"id,omitempty" yaml:"id,omitempty"`

	// Parent indicates the ID of the mount parent (or of self for the top of
	// the mount tree).
	Parent int `json:"parent,omitempty" yaml:"parent,omitempty"`

	// Major indicates one half of the device ID which identifies the device
	// class.
	Major int `json:"major,omitempty" yaml:"major,omitempty"`

	// Minor indicates one half of the device ID which identifies a specific
	// instance of device.
	Minor int `json:"minor,omitempty" yaml:"minor,omitempty"`

	// Root of the mount within the filesystem.
	Root string `json:"root,omitempty" yaml:"root,omitempty"`

	// MountPoint indicates the mount point relative to the process's root.
	MountPoint string `json:"mountPoint,omitempty" yaml:"mountPoint,omitempty"`

	// Opts represents mount-specific options.
	Opts string `json:"opts,omitempty" yaml:"opts,omitempty"`

	// Optional represents optional fields.
	Optional string `json:"optional,omitempty" yaml:"optional,omitempty"`

	// FSType indicates the type of filesystem, such as EXT3.
	FSType string `json:"fsType,omitempty" yaml:"fsType,omitempty"`

	// Source indicates filesystem specific information or "none".
	Source string `json:"source,omitempty" yaml:"source,omitempty"`

	// VFSOpts represents per super block options.
	VFSOpts string `json:"vfsOpts,omitempty" yaml:"vfsOpts,omitempty"`

	// Fields are additional properties that can be defined for this type.
	Fields map[string]string `json:"fields,omitempty" yaml:"fields,omitempty"`
}

MountInfo reveals information about a particular mounted filesystem. This struct is populated from the content in the /proc/<pid>/mountinfo file.

type NewConfigReg

type NewConfigReg func(ctx Context, reg gofig.ConfigRegistration)

NewConfigReg is given to the registry to register a new configuration registration request.

type NewIntegrationDriver

type NewIntegrationDriver func() IntegrationDriver

NewIntegrationDriver is a function that constructs a new IntegrationDriver.

type NewOSDriver

type NewOSDriver func() OSDriver

NewOSDriver is a function that constructs a new OSDriver.

type NewRequestObjFunc

type NewRequestObjFunc func() interface{}

NewRequestObjFunc is a function that creates a new instance of the type to which the request body is serialized.

type NewStorageDriver

type NewStorageDriver func() StorageDriver

NewStorageDriver is a function that constructs a new StorageDriver.

type NewStorageExecutor

type NewStorageExecutor func() StorageExecutor

NewStorageExecutor is a function that constructs a new StorageExecutors.

type NextDeviceInfo

type NextDeviceInfo struct {
	// Ignore is a flag that indicates whether the client logic should invoke
	// the GetNextAvailableDeviceName function prior to submitting an
	// AttachVolume request to the server.
	Ignore bool `json:"ignore"`

	// Prefix is the first part of a device path's value after the "/dev/"
	// porition. For example, the prefix in "/dev/xvda" is "xvd".
	Prefix string `json:"prefix"`

	// Pattern is the regex to match the part of a device path after the prefix.
	Pattern string `json:"pattern"`
}

NextDeviceInfo assists the libStorage client in determining the next available device name by providing the driver's device prefix and optional pattern.

For example, the Amazon Web Services (AWS) device prefix is "xvd" and its pattern is "[a-z]". These two values would be used to determine on an EC2 instance where "/dev/xvda" and "/dev/xvdb" are in use that the next available device name is "/dev/xvdc".

If the Ignore field is set to true then the client logic does not invoke the GetNextAvailableDeviceName function prior to submitting an AttachVolume request to the server.

type OSDriver

type OSDriver interface {
	Driver

	// Mounts get a list of mount points for a local device.
	Mounts(
		ctx Context,
		deviceName, mountPoint string,
		opts Store) ([]*MountInfo, error)

	// Mount mounts a device to a specified path.
	Mount(
		ctx Context,
		deviceName, mountPoint string,
		opts *DeviceMountOpts) error

	// Unmount unmounts the underlying device from the specified path.
	Unmount(
		ctx Context,
		mountPoint string,
		opts Store) error

	// IsMounted checks whether a path is mounted or not
	IsMounted(
		ctx Context,
		mountPoint string,
		opts Store) (bool, error)

	// Format formats a device.
	Format(
		ctx Context,
		deviceName string,
		opts *DeviceFormatOpts) error
}

OSDriver is the interface implemented by types that provide OS introspection and management.

type OSDriverManager

type OSDriverManager interface {
	OSDriver

	// Driver returns the underlying driver.
	Driver() OSDriver
}

OSDriverManager is the management wrapper for an OSDriver.

type PathConfig

type PathConfig struct {

	// Token is the app token.
	Token string

	// Home is the path to the system, root, data directory.
	Home string

	// Etc is the path to the etc directory.
	Etc string

	// Lib is the path to the lib directory.
	Lib string

	// Log is the path to the log directory.
	Log string

	// Run is the path to the run directory.
	Run string

	// TLS is the path to the tls directory.
	TLS string

	// DefaultTLSCertFile is the path to the default TLS cert file.
	DefaultTLSCertFile string

	// DefaultTLSKeyFile is the path to the default TLS key file.
	DefaultTLSKeyFile string

	// DefaultTLSTrustedRootsFile is the path to the default TLS trusted roots
	// file.
	DefaultTLSTrustedRootsFile string

	// DefaultTLSKnownHosts is the default path to the TLS known hosts file.
	DefaultTLSKnownHosts string

	// UserHome is the path to the user, root, data directory.
	UserHome string

	// UserDefaultTLSKnownHosts is the default path to the user, TLS known
	// hosts file.
	UserDefaultTLSKnownHosts string
}

PathConfig contains the path configuration for the application.

type ProvidesAPIClient

type ProvidesAPIClient interface {

	// API provides the API client.
	API() APIClient
}

ProvidesAPIClient is any type that provides the API client.

type ProvidesStorageExecutorCLI

type ProvidesStorageExecutorCLI interface {
	// XCLI returns the StorageExecutorCLI.
	XCLI() StorageExecutorCLI
}

ProvidesStorageExecutorCLI is a type that provides the StorageExecutorCLI.

type Route

type Route interface {

	// Queries add query strings that must match for a route.
	Queries(queries ...string) Route

	// Middlewares adds middleware to the route.
	Middlewares(middlewares ...Middleware) Route

	// Name returns the name of the route.
	GetName() string

	// GetHandler returns the raw function to create the http handler.
	GetHandler() APIFunc

	// GetMethod returns the http method that the route responds to.
	GetMethod() string

	// GetPath returns the subpath where the route responds to.
	GetPath() string

	// GetQueries returns the query strings for which the route should respond.
	GetQueries() []string

	// GetMiddlewares returns a list of route-specific middleware.
	GetMiddlewares() []Middleware
}

Route defines an individual API route in the server.

type Router

type Router interface {

	// Routes returns all of the router's routes.
	Routes() []Route

	// Name returns the name of the router.
	Name() string

	// Init initializes the router.
	Init(config gofig.Config)
}

Router defines an interface to specify a group of routes to add the the server.

type Server

type Server interface {
	io.Closer

	// Name returns the name of the server.
	Name() string

	// Addrs returns the server's configured endpoint addresses.
	Addrs() []string
}

Server is the interface for a libStorage server.

type Service

type Service interface {
	Driver
}

Service is the base type for services.

type ServiceInfo

type ServiceInfo struct {
	// Name is the service's name.
	Name string `json:"name"`

	// Instance is the service's instance.
	Instance *Instance `json:"instance,omitempty" yaml:",omitempty"`

	// Driver is the name of the driver registered for the service.
	Driver *DriverInfo `json:"driver"`
}

ServiceInfo is information about a service.

type ServiceSnapshotMap

type ServiceSnapshotMap map[string]SnapshotMap

ServiceSnapshotMap is the response for listing snapshots for multiple services.

type ServiceVolumeMap

type ServiceVolumeMap map[string]VolumeMap

ServiceVolumeMap is the response for listing volumes for multiple services.

type Services

type Services interface {
	// Storage gets the storage service.
	Storage() StorageService

	// Tasks gets the task service.
	Tasks() TaskTrackingService
}

Services is a service's container.

type ServicesMap

type ServicesMap map[string]*ServiceInfo

ServicesMap is the response when getting one to many ServiceInfos.

type Snapshot

type Snapshot struct {
	// A description of the snapshot.
	Description string `json:"description,omitempty" yaml:",omitempty"`

	// The name of the snapshot.
	Name string `json:"name,omitempty" yaml:",omitempty"`

	// A flag indicating whether or not the snapshot is encrypted.
	Encrypted bool `json:"encrypted,omitempty" yaml:"encrypted,omitempty"`

	// The snapshot's ID.
	ID string `json:"id" yaml:"id"`

	// The time (epoch) at which the request to create the snapshot was submitted.
	StartTime int64 `json:"startTime,omitempty" yaml:"startTime,omitempty"`

	// The status of the snapshot.
	Status string `json:"status,omitempty" yaml:",omitempty"`

	// The ID of the volume to which the snapshot belongs.
	VolumeID string `json:"volumeID,omitempty" yaml:"volumeID,omitempty"`

	// The size of the volume to which the snapshot belongs.
	VolumeSize int64 `json:"volumeSize,omitempty" yaml:"volumeSize,omitempty"`

	// Fields are additional properties that can be defined for this type.
	Fields map[string]string `json:"fields,omitempty" yaml:",omitempty"`
}

Snapshot provides information about a storage-layer snapshot.

type SnapshotCopyRequest

type SnapshotCopyRequest struct {
	SnapshotName  string                 `json:"snapshotName"`
	DestinationID string                 `json:"destinationID"`
	Opts          map[string]interface{} `json:"opts,omitempty"`
}

SnapshotCopyRequest is the JSON body for copying a snapshot.

type SnapshotMap

type SnapshotMap map[string]*Snapshot

SnapshotMap is the response for listing snapshots for a single service.

type SnapshotRemoveRequest

type SnapshotRemoveRequest struct {
	Opts map[string]interface{} `json:"opts,omitempty"`
}

SnapshotRemoveRequest is the JSON body for removing a snapshot.

type StorageDriver

type StorageDriver interface {
	Driver

	// NextDeviceInfo returns the information about the driver's next available
	// device workflow.
	NextDeviceInfo(
		ctx Context) (*NextDeviceInfo, error)

	// Type returns the type of storage the driver provides.
	Type(
		ctx Context) (StorageType, error)

	// InstanceInspect returns an instance.
	InstanceInspect(
		ctx Context,
		opts Store) (*Instance, error)

	// Volumes returns all volumes or a filtered list of volumes.
	Volumes(
		ctx Context,
		opts *VolumesOpts) ([]*Volume, error)

	// VolumeInspect inspects a single volume.
	VolumeInspect(
		ctx Context,
		volumeID string,
		opts *VolumeInspectOpts) (*Volume, error)

	// VolumeCreate creates a new volume.
	VolumeCreate(
		ctx Context,
		name string,
		opts *VolumeCreateOpts) (*Volume, error)

	// VolumeCreateFromSnapshot creates a new volume from an existing snapshot.
	VolumeCreateFromSnapshot(
		ctx Context,
		snapshotID,
		volumeName string,
		opts *VolumeCreateOpts) (*Volume, error)

	// VolumeCopy copies an existing volume.
	VolumeCopy(
		ctx Context,
		volumeID,
		volumeName string,
		opts Store) (*Volume, error)

	// VolumeSnapshot snapshots a volume.
	VolumeSnapshot(
		ctx Context,
		volumeID,
		snapshotName string,
		opts Store) (*Snapshot, error)

	// VolumeRemove removes a volume.
	VolumeRemove(
		ctx Context,
		volumeID string,
		opts *VolumeRemoveOpts) error

	// VolumeAttach attaches a volume and provides a token clients can use
	// to validate that device has appeared locally.
	VolumeAttach(
		ctx Context,
		volumeID string,
		opts *VolumeAttachOpts) (*Volume, string, error)

	// VolumeDetach detaches a volume.
	VolumeDetach(
		ctx Context,
		volumeID string,
		opts *VolumeDetachOpts) (*Volume, error)

	// Snapshots returns all volumes or a filtered list of snapshots.
	Snapshots(
		ctx Context,
		opts Store) ([]*Snapshot, error)

	// SnapshotInspect inspects a single snapshot.
	SnapshotInspect(
		ctx Context,
		snapshotID string,
		opts Store) (*Snapshot, error)

	// SnapshotCopy copies an existing snapshot.
	SnapshotCopy(
		ctx Context,
		snapshotID,
		snapshotName,
		destinationID string,
		opts Store) (*Snapshot, error)

	// SnapshotRemove removes a snapshot.
	SnapshotRemove(
		ctx Context,
		snapshotID string,
		opts Store) error
}

StorageDriver is a libStorage driver used by the routes to implement the backend functionality.

Functions that inspect a resource or send an operation to a resource should always return ErrResourceNotFound if the acted upon resource cannot be found.

type StorageDriverManager

type StorageDriverManager interface {
	StorageDriver

	// Driver returns the underlying driver.
	Driver() StorageDriver
}

StorageDriverManager is the management wrapper for a StorageDriver.

type StorageDriverVolInspectByName

type StorageDriverVolInspectByName interface {
	StorageDriver

	// VolumeInspectByName inspects a single volume by name.
	VolumeInspectByName(
		ctx Context,
		volumeName string,
		opts *VolumeInspectOpts) (*Volume, error)
}

StorageDriverVolInspectByName is a StorageDriver with a VolumeInspectByName function

type StorageDriverWithLogin

type StorageDriverWithLogin interface {
	StorageDriver

	// Login creates a new connection to the storage platform for the provided
	// context.
	Login(
		ctx Context) (interface{}, error)
}

StorageDriverWithLogin is a StorageDriver with a Login function.

type StorageExecutor

type StorageExecutor interface {
	Driver
	StorageExecutorFunctions
}

StorageExecutor is the part of a storage driver that is downloaded at runtime by the libStorage client.

type StorageExecutorCLI

type StorageExecutorCLI interface {
	StorageExecutorFunctions
	StorageExecutorWithMount
	StorageExecutorWithMounts
	StorageExecutorWithUnmount

	// WaitForDevice blocks until the provided attach token appears in the
	// map returned from LocalDevices or until the timeout expires, whichever
	// occurs first.
	//
	// The return value is a boolean flag indicating whether or not a match was
	// discovered as well as the result of the last LocalDevices call before a
	// match is discovered or the timeout expires.
	WaitForDevice(
		ctx Context,
		opts *WaitForDeviceOpts) (bool, *LocalDevices, error)

	// Supported returns a flag indicating whether the executor supports
	// specific functions for a storage platform on the current host.
	Supported(
		ctx Context,
		opts Store) (LSXSupportedOp, error)
}

StorageExecutorCLI provides a way to interact with the CLI tool built with the driver implementations of the StorageExecutor interface.

type StorageExecutorFunctions

type StorageExecutorFunctions interface {
	// InstanceID returns the local system's InstanceID.
	InstanceID(
		ctx Context,
		opts Store) (*InstanceID, error)

	// NextDevice returns the next available device.
	NextDevice(
		ctx Context,
		opts Store) (string, error)

	// LocalDevices returns a map of the system's local devices.
	LocalDevices(
		ctx Context,
		opts *LocalDevicesOpts) (*LocalDevices, error)
}

StorageExecutorFunctions is the collection of functions that are required of a StorageExecutor.

type StorageExecutorWithMount

type StorageExecutorWithMount interface {

	// Mount mounts a device to a specified path.
	Mount(
		ctx Context,
		deviceName, mountPoint string,
		opts *DeviceMountOpts) error
}

StorageExecutorWithMount is an interface that executor implementations may use to become part of the mount workflow.

type StorageExecutorWithMounts

type StorageExecutorWithMounts interface {

	// Mounts get a list of mount points.
	Mounts(
		ctx Context,
		opts Store) ([]*MountInfo, error)
}

StorageExecutorWithMounts is an interface that executor implementations may use to become part of the mounts workflow.

type StorageExecutorWithSupported

type StorageExecutorWithSupported interface {
	StorageExecutorFunctions

	// Supported returns a flag indicating whether or not the platform
	// implementing the executor is valid for the host on which the executor
	// resides.
	Supported(
		ctx Context,
		opts Store) (bool, error)
}

StorageExecutorWithSupported is an interface that executor implementations may use by defining the function "Supported(Context, Store) (bool, error)". This function indicates whether a storage platform is valid when executing the executor binary on a given client.

type StorageExecutorWithUnmount

type StorageExecutorWithUnmount interface {

	// Unmount unmounts the underlying device from the specified path.
	Unmount(
		ctx Context,
		mountPoint string,
		opts Store) error
}

StorageExecutorWithUnmount is an interface that executor implementations may use to become part of unmount workflow.

type StorageService

type StorageService interface {
	Service

	// Driver returns the service's StorageDriver.
	Driver() StorageDriver

	// TaskEnqueue enqueues a task for execution.
	TaskEnqueue(
		ctx Context,
		run StorageTaskRunFunc,
		schema []byte) *Task

	// AuthConfig returns the storage service's authentication configuration.
	AuthConfig() *AuthConfig
}

StorageService is a service that provides the interaction with StorageDrivers.

type StorageTaskRunFunc

type StorageTaskRunFunc func(
	ctx Context,
	service StorageService) (interface{}, error)

StorageTaskRunFunc is a function responsible for a storage-service task's execution.

type StorageType

type StorageType string

StorageType is the type of storage a driver provides.

const (
	// Block is block storage.
	Block StorageType = "block"

	// NAS is network attached storage.
	NAS StorageType = "nas"

	// Object is object-backed storage.
	Object StorageType = "object"
)

type Store

type Store interface {

	// Map returns the contents of the store as a map[string]interface{}.
	Map() map[string]interface{}

	// Keys returns a list of all the keys in the store.
	Keys() []string

	// IsSet returns true if a key exists.
	IsSet(k string) bool

	// Get returns a value for the key; a nil value if the key does not exist.
	Get(k string) interface{}

	// GetAttachments returns a VolumeAttachmentsTypes value for the key
	// "attachments" or a zero value if the key does not exist.
	GetAttachments() VolumeAttachmentsTypes

	// GetVolumeAttachmentsTypes returns a VolumeAttachmentsTypes value for a
	// key; a zero value if the key does not exist.
	GetVolumeAttachmentsTypes(k string) VolumeAttachmentsTypes

	// GetString returns a string value for a key; an empty string if the key
	// does not exist.
	GetString(k string) string

	// GetStringPtr returns a pointer to a string value for a key; nil if
	// the key does not exist.
	GetStringPtr(k string) *string

	// GetBool returns a boolean value for the key; false if the key does not
	// exist.
	GetBool(k string) bool

	// GetBoolPtr returns a pointer to a boolean value for the key; nil if the
	// key does not exist.
	GetBoolPtr(k string) *bool

	// GetInt return an int value for the key; 0 if the key does not exist.
	GetInt(k string) int

	// GetInt return a pointer to an int value for the key; nil if the key does
	// not exist.
	GetIntPtr(k string) *int

	// GetInt64 return an int64 value for the key; 0 if the key does not exist.
	GetInt64(k string) int64

	// GetInt64Ptr return a pointer to an int64 value for the key; nil if the
	// key does not exist.
	GetInt64Ptr(k string) *int64

	// GetIntSlice returns an int slice value for a key; a nil value if
	// the key does not exist.
	GetIntSlice(k string) []int

	// GetStringSlice returns a string slice value for a key; a nil value if
	// the key does not exist.
	GetStringSlice(k string) []string

	// GetBoolSlice returns a bool slice value for a key; a nil value if
	// the key does not exist.
	GetBoolSlice(k string) []bool

	// GetInstanceID returns an instance ID for a key; a nil value if the key
	// does not exist.
	GetInstanceID(k string) *InstanceID

	// GetMap returns a map value for a key; a nil value if the key does not
	// exist.
	GetMap(k string) map[string]interface{}

	// GetStore returns a Store value for a key; a nil value if the key does
	// not exist.
	GetStore(k string) Store

	// Set sets a key/value in the store.
	Set(k string, v interface{})

	// Deletes a key/value from the store. If the value exists in the map it
	// is returned.
	Delete(k string) interface{}
}

Store is a key/value store with case-insensitive keys.

type TLSConfig

type TLSConfig struct {
	tls.Config

	// VerifyPeers is a flag that indicates whether peer certificates
	// should be validated against a PeerFingerprint or known hosts files.
	VerifyPeers bool

	// SysKnownHosts is the path to the system's known_hosts file.
	SysKnownHosts string

	// UsrKnownHosts is the path to the user's known_hosts file.
	UsrKnownHosts string

	// KnownHost is the trusted, remote host information.
	KnownHost *TLSKnownHost
}

TLSConfig is a custom TLS configuration that includes the concept of a peer certificate's fingerprint.

type TLSKnownHost

type TLSKnownHost struct {

	// Host is the name of the known host. This value is derived from the
	// CommonName value in the remote host's certiicate.
	Host string

	// Alg is the cryptographic algorithm used to calculate the fingerprint.
	Alg string

	// Fingerprint is known host's certificate's fingerprint.
	Fingerprint []byte
}

TLSKnownHost contains the identifying information of trusted, remote peer.

func (*TLSKnownHost) String

func (kh *TLSKnownHost) String() string

String returns a known_hosts string.

type Task

type Task struct {
	// ID is the task's ID.
	ID int `json:"id" yaml:"id"`

	// User is the name of the user that created the task.
	User string `json:"user,omitempty" yaml:",omitempty"`

	// CompleteTime is the time stamp when the task was completed
	// (whether success or failure).
	CompleteTime int64 `json:"completeTime,omitempty" yaml:"completeTime,omitempty"`

	// QueueTime is the time stamp when the task was created.
	QueueTime int64 `json:"queueTime" yaml:"queueTime"`

	// StartTime is the time stamp when the task started running.
	StartTime int64 `json:"startTime,omitempty" yaml:"startTime,omitempty"`

	// State is the current state of the task.
	State TaskState `json:"state"`

	// Result holds the result of the task.
	Result interface{} `json:"result,omitempty" yaml:",omitempty"`

	// Error contains the error if the task was unsuccessful.
	Error error `json:"error,omitempty" yaml:",omitempty"`
}

Task is a representation of an asynchronous, long-running task.

type TaskExecutionService

type TaskExecutionService interface {
	Service

	// TaskEnqueue enqueues a task for execution.
	TaskEnqueue(
		ctx Context,
		run TaskRunFunc,
		schema []byte) *Task
}

TaskExecutionService is a service for executing tasks.

type TaskRunFunc

type TaskRunFunc func(ctx Context) (interface{}, error)

TaskRunFunc is a function responsible for a task's execution.

type TaskState

type TaskState string

TaskState is the possible state of a task.

type TaskTrackingService

type TaskTrackingService interface {
	Service

	// Tasks returns a channel on which all tasks tracked via TrackTasks are
	// received.
	Tasks() <-chan *Task

	// TaskTrack creates a new, trackable task.
	TaskTrack(ctx Context) *Task

	// TaskEnqueue enqueues a task for execution.
	TaskEnqueue(
		ctx Context,
		run TaskRunFunc,
		schema []byte) *Task

	// TaskInspect returns the task with the specified ID.
	TaskInspect(taskID int) *Task

	// TaskWait blocks until the specified task completes.
	TaskWait(taskID int) <-chan int

	// TaskWaitAll blocks until all the specified tasks complete.
	TaskWaitAll(taskIDs ...int) <-chan int

	// TaskWaitC returns a channel that is closed when the specified task
	// completes.
	TaskWaitC(taskID int) <-chan int

	// TaskWaitAll returns a channel that is closed when the specified task
	// completes.
	TaskWaitAllC(taskIDs ...int) <-chan int
}

TaskTrackingService a service for tracking tasks.

type Transaction

type Transaction struct {

	// ID is the transaction's ID.
	ID *UUID `json:"id" yaml:"id"`

	// Created is the UTC timestampe at which the transaction was created.
	Created TxTimestamp `json:"created"`
}

Transaction contains transaction information.

func NewTransaction

func NewTransaction() (*Transaction, error)

NewTransaction returns a new transaction.

func (*Transaction) ContextLoggerFields

func (t *Transaction) ContextLoggerFields() map[string]interface{}

ContextLoggerFields indicate to the context logger what data to log.

func (*Transaction) MarshalText

func (t *Transaction) MarshalText() ([]byte, error)

MarshalText marshals the Transaction to a string.

func (*Transaction) String

func (t *Transaction) String() string

String returns the string representation of the transaction.

func (*Transaction) UnmarshalText

func (t *Transaction) UnmarshalText(text []byte) error

UnmarshalText unmarshals the Transaction from a string.

type TxTimestamp

type TxTimestamp time.Time

TxTimestamp is a transaction's timestamp.

func (TxTimestamp) MarshalText

func (t TxTimestamp) MarshalText() ([]byte, error)

MarshalText marshals the TxTimestamp to a string.

func (TxTimestamp) String

func (t TxTimestamp) String() string

String returns the timestamp's epoch.

func (*TxTimestamp) UnmarshalText

func (t *TxTimestamp) UnmarshalText(text []byte) error

UnmarshalText unmarshals the timestamp from a string to a TxTimestamp.

type UUID

type UUID [16]byte

UUID is a UUID.

This was totally stolen from https://github.com/nu7hatch/gouuid/blob/master/uuid.go, and all credit goes to that author. It was included like this in order to reduce external dependencies.

func MustNewUUID

func MustNewUUID() *UUID

MustNewUUID is like NewUUID but panics if it encounters an error when creating a new UUID.

func NewUUID

func NewUUID() (*UUID, error)

NewUUID returns a new UUID.

func ParseUUID

func ParseUUID(s string) (*UUID, error)

ParseUUID is a helper function on top of UnmarshalText.

func (*UUID) MarshalText

func (u *UUID) MarshalText() ([]byte, error)

MarshalText marshals the UUID to a string.

func (*UUID) String

func (u *UUID) String() string

String returns unparsed version of the generated UUID sequence.

func (*UUID) UnmarshalText

func (u *UUID) UnmarshalText(text []byte) error

UnmarshalText unmarshals the UUID from a hex string to a UUID instance. This function accepts UUID string in following formats:

uuid.ParseHex("6ba7b814-9dad-11d1-80b4-00c04fd430c8")
uuid.ParseHex("{6ba7b814-9dad-11d1-80b4-00c04fd430c8}")
uuid.ParseHex("urn:uuid:6ba7b814-9dad-11d1-80b4-00c04fd430c8")

type Volume

type Volume struct {
	// Attachments is information about the instances to which the volume
	// is attached.
	Attachments []*VolumeAttachment `json:"attachments,omitempty" yaml:"attachments,omitempty"`

	// AttachmentState indicates whether or not a volume is attached. A client
	// can surmise the same state stored in this field by inspecting a volume's
	// Attachments field, but this field provides the server a means of doing
	// that inspection and storing the result so the client does not have to do
	// so.
	AttachmentState VolumeAttachmentStates `json:"attachmentState,omitempty" yaml:"attachmentState,omitempty"`

	// The availability zone for which the volume is available.
	AvailabilityZone string `json:"availabilityZone,omitempty" yaml:"availabilityZone,omitempty"`

	// A flag indicating whether or not the volume is encrypted.
	Encrypted bool `json:"encrypted,omitempty" yaml:"encrypted,omitempty"`

	// The volume IOPs.
	IOPS int64 `json:"iops,omitempty" yaml:"iops,omitempty"`

	// The name of the volume.
	Name string `json:"name" yaml:"name,omitempty"`

	// NetworkName is the name the device is known by in order to discover
	// locally.
	NetworkName string `json:"networkName,omitempty" yaml:"networkName,omitempty"`

	// The size of the volume.
	Size int64 `json:"size,omitempty" yaml:"size,omitempty"`

	// The volume status.
	Status string `json:"status,omitempty" yaml:"status,omitempty"`

	// ID is a piece of information that uniquely identifies the volume on
	// the storage platform to which the volume belongs. A volume ID is not
	// guaranteed to be unique across multiple, configured services.
	ID string `json:"id" yaml:"id"`

	// The volume type.
	Type string `json:"type" yaml:"type"`

	// Fields are additional properties that can be defined for this type.
	Fields map[string]string `json:"fields,omitempty" yaml:"fields,omitempty"`
}

Volume provides information about a storage volume.

func (*Volume) MountPoint

func (v *Volume) MountPoint() string

MountPoint returns the volume's mount point, if one is present.

func (*Volume) VolumeName

func (v *Volume) VolumeName() string

VolumeName returns the volume's name.

type VolumeAttachOpts

type VolumeAttachOpts struct {
	NextDevice *string
	Force      bool
	Opts       Store
}

VolumeAttachOpts are options for attaching a volume.

type VolumeAttachRequest

type VolumeAttachRequest struct {
	Force          bool                   `json:"force,omitempty"`
	NextDeviceName *string                `json:"nextDeviceName,omitempty"`
	Opts           map[string]interface{} `json:"opts,omitempty"`
}

VolumeAttachRequest is the JSON body for attaching a volume to an instance.

type VolumeAttachResponse

type VolumeAttachResponse struct {
	Volume      *Volume `json:"volume"`
	AttachToken string  `json:"attachToken"`
}

VolumeAttachResponse is the JSON response for attaching a volume to an instance.

type VolumeAttachment

type VolumeAttachment struct {
	// The name of the device on which the volume to which the object is
	// attached is mounted.
	DeviceName string `json:"deviceName" yaml:"deviceName,omitempty"`

	// MountPoint is the mount point for the volume. This field is set when a
	// volume is retrieved via an integration driver.
	MountPoint string `json:"mountPoint,omitempty" yaml:"mountPoint,omitempty"`

	// The ID of the instance on which the volume to which the attachment
	// belongs is mounted.
	InstanceID *InstanceID `json:"instanceID" yaml:"instanceID,omitempty"`

	// The status of the attachment.
	Status string `json:"status" yaml:",omitempty"`

	// The ID of the volume to which the attachment belongs.
	VolumeID string `json:"volumeID" yaml:"volumeID,omitempty"`

	// Fields are additional properties that can be defined for this type.
	Fields map[string]string `json:"fields,omitempty" yaml:",omitempty"`
}

VolumeAttachment provides information about an object attached to a storage volume.

type VolumeAttachmentStates

type VolumeAttachmentStates int

VolumeAttachmentStates is the volume's attachment state possibilities.

const (
	// VolumeAttachmentStateUnknown indicates the driver has set the state,
	// but it is explicitly unknown and should not be inferred from the list of
	// attachments alone.
	VolumeAttachmentStateUnknown VolumeAttachmentStates = 1

	// VolumeAttached indicates the volume is attached to the instance
	// specified in the API call that requested the volume information.
	VolumeAttached VolumeAttachmentStates = 2

	// VolumeAvailable indicates the volume is not attached to any instance.
	VolumeAvailable VolumeAttachmentStates = 3

	// VolumeUnavailable indicates the volume is attached to some instance
	// other than the one specified in the API call that requested the
	// volume information.
	VolumeUnavailable VolumeAttachmentStates = 4
)

func (VolumeAttachmentStates) String

func (s VolumeAttachmentStates) String() string

String returns the string represntation of a VolumeAttachmentStates value.

type VolumeAttachmentsTypes

type VolumeAttachmentsTypes int

VolumeAttachmentsTypes is the type of the volume attachments bitmask.

const (

	// VolumeAttachmentsRequested indicates attachment information is requested.
	VolumeAttachmentsRequested VolumeAttachmentsTypes = 1 << iota // 1

	// VolumeAttachmentsMine indicates attachment information should
	// be returned for volumes attached to the instance specified in the
	// instance ID request header. If this bit is set then the instance ID
	// header is required.
	VolumeAttachmentsMine // 2

	// VolumeAttachmentsDevices indicates an attempt should made to map devices
	// provided via the local devices request header to the appropriate
	// attachment information. If this bit is set then the instance ID and
	// local device headers are required.
	VolumeAttachmentsDevices // 4

	// VolumeAttachmentsAttached indicates only volumes that are attached
	// should be returned.
	VolumeAttachmentsAttached // 8

	// VolumeAttachmentsUnattached indicates only volumes that are unattached
	// should be returned.
	VolumeAttachmentsUnattached // 16
)

func ParseVolumeAttachmentTypes

func ParseVolumeAttachmentTypes(v interface{}) VolumeAttachmentsTypes

ParseVolumeAttachmentTypes parses a value into a VolumeAttachmentsTypes value.

func (VolumeAttachmentsTypes) Attached

func (v VolumeAttachmentsTypes) Attached() bool

Attached returns a flag that indicates only volumes that are attached should be returned.

func (VolumeAttachmentsTypes) Devices

func (v VolumeAttachmentsTypes) Devices() bool

Devices returns a flag that indicates an attempt should made to map devices provided via the local devices request header to the appropriate attachment information. If this bit is set then the instance ID and local device headers are required.

func (VolumeAttachmentsTypes) Mine

func (v VolumeAttachmentsTypes) Mine() bool

Mine returns a flag that indicates attachment information should be returned for volumes attached to the instance specified in the instance ID request header. If this bit is set then the instance ID header is required.

func (VolumeAttachmentsTypes) Requested

func (v VolumeAttachmentsTypes) Requested() bool

Requested returns a flag that indicates attachment information is requested.

func (VolumeAttachmentsTypes) RequiresInstanceID

func (v VolumeAttachmentsTypes) RequiresInstanceID() bool

RequiresInstanceID returns a flag that indicates whether the attachment bit requires an instance ID to perform successfully.

func (VolumeAttachmentsTypes) Unattached

func (v VolumeAttachmentsTypes) Unattached() bool

Unattached returns a flag that indicates only volumes that are unattached should be returned.

type VolumeCopyRequest

type VolumeCopyRequest struct {
	VolumeName string                 `json:"volumeName"`
	Opts       map[string]interface{} `json:"opts,omitempty"`
}

VolumeCopyRequest is the JSON body for copying a volume.

type VolumeCreateOpts

type VolumeCreateOpts struct {
	AvailabilityZone *string
	IOPS             *int64
	Size             *int64
	Type             *string
	Encrypted        *bool
	EncryptionKey    *string
	Opts             Store
}

VolumeCreateOpts are options when creating a new volume.

type VolumeCreateRequest

type VolumeCreateRequest struct {
	Name             string                 `json:"name"`
	AvailabilityZone *string                `json:"availabilityZone,omitempty"`
	Encrypted        *bool                  `json:"encrypted,omitempty"`
	EncryptionKey    *string                `json:"encryptionKey,omitempty"`
	IOPS             *int64                 `json:"iops,omitempty"`
	Size             *int64                 `json:"size,omitempty"`
	Type             *string                `json:"type,omitempty"`
	Opts             map[string]interface{} `json:"opts,omitempty"`
}

VolumeCreateRequest is the JSON body for creating a new volume.

type VolumeDetachOpts

type VolumeDetachOpts struct {
	Force bool
	Opts  Store
}

VolumeDetachOpts are options for detaching a volume.

type VolumeDetachRequest

type VolumeDetachRequest struct {
	Force bool                   `json:"force,omitempty"`
	Opts  map[string]interface{} `json:"opts,omitempty"`
}

VolumeDetachRequest is the JSON body for detaching a volume from an instance.

type VolumeDevice

type VolumeDevice struct {
	// The name of the device.
	Name string `json:"name"`

	// The ID of the instance to which the device is connected.
	InstanceID *InstanceID `json:"instanceID,omitempty" yaml:"instanceID,omitempty"`

	// The name of the network on which the device resides.
	NetworkName string `json:"networkName,omitempty" yaml:"networkName,omitempty"`

	// The name of the provider that owns the block device.
	ProviderName string `json:"providerName,omitempty" yaml:"providerName,omitempty"`

	// The region from which the device originates.
	Region string `json:"region,omitempty" yaml:",omitempty"`

	// The device status.
	Status string `json:"status"`

	// The ID of the volume for which the device is mounted.
	VolumeID string `json:"volumeID" yaml:"volumeID"`

	// Fields are additional properties that can be defined for this type.
	Fields map[string]string `json:"fields,omitempty" yaml:",omitempty"`
}

VolumeDevice provides information about a volume's backing storage device. This might be a block device, NAS device, object device, etc.

type VolumeInspectOpts

type VolumeInspectOpts struct {
	Attachments VolumeAttachmentsTypes
	Opts        Store
}

VolumeInspectOpts are options when inspecting a volume.

type VolumeMap

type VolumeMap map[string]*Volume

VolumeMap is the response for listing volumes for a single service.

type VolumeMapping

type VolumeMapping interface {
	// VolumeName returns the volume's name.
	VolumeName() string

	// MountPoint returns the volume's mount point.
	MountPoint() string

	// Status returns the volume's details for an inspect.
	Status() map[string]interface{}
}

VolumeMapping is a volume's name and the path to which it is mounted.

type VolumeMountOpts

type VolumeMountOpts struct {
	OverwriteFS bool
	NewFSType   string
	Preempt     bool
	Opts        Store
}

VolumeMountOpts are options for mounting a volume.

type VolumeRemoveOpts

type VolumeRemoveOpts struct {
	Force bool
	Opts  Store
}

VolumeRemoveOpts are options for removing a volume.

type VolumeSnapshotRequest

type VolumeSnapshotRequest struct {
	SnapshotName string                 `json:"snapshotName"`
	Opts         map[string]interface{} `json:"opts,omitempty"`
}

VolumeSnapshotRequest is the JSON body for snapshotting a volume.

type VolumesOpts

type VolumesOpts struct {
	Attachments VolumeAttachmentsTypes
	Opts        Store
}

VolumesOpts are options when inspecting a volume.

type WaitForDeviceOpts

type WaitForDeviceOpts struct {
	LocalDevicesOpts

	// Token is the value returned by a remote VolumeAttach call that the
	// client can use to block until a specific device has appeared in the
	// local devices list.
	Token string

	// Timeout is the maximum duration for which to wait for a device to
	// appear in the local devices list.
	Timeout time.Duration
}

WaitForDeviceOpts are options when waiting on specific local device to appear.

Jump to

Keyboard shortcuts

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