volume

package
v1.23.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TaskScope indicates that the volume is created and deleted with task
	TaskScope = "task"
	// SharedScope indicates that the volume's lifecycle is outside the scope of task
	SharedScope = "shared"
	// DockerLocalVolumeDriver is the name of the docker default volume driver
	DockerLocalVolumeDriver = "local"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerVolumeConfig

type DockerVolumeConfig struct {
	// Scope represents lifetime of the volume: "task" or "shared"
	Scope string `json:"scope"`
	// Autoprovision is true if agent needs to create the volume,
	// false if it is pre-provisioned outside of ECS
	Autoprovision bool `json:"autoprovision"`
	// Mountpoint is a read-only field returned from docker
	Mountpoint string            `json:"mountPoint"`
	Driver     string            `json:"driver"`
	DriverOpts map[string]string `json:"driverOpts"`
	Labels     map[string]string `json:"labels"`
	// DockerVolumeName is internal docker name for this volume.
	DockerVolumeName string `json:"dockerVolumeName"`
}

DockerVolumeConfig represents docker volume configuration See https://tinyurl.com/zmexdw2

func (*DockerVolumeConfig) Source added in v1.20.0

func (cfg *DockerVolumeConfig) Source() string

Source returns the name of the volume resource which is used as the source of the volume mount

type FSHostVolume added in v1.20.0

type FSHostVolume struct {
	FSSourcePath string `json:"sourcePath"`
}

FSHostVolume is a simple type of HostVolume which references an arbitrary location on the host as the Volume.

func (*FSHostVolume) Source added in v1.20.0

func (fs *FSHostVolume) Source() string

SourcePath returns the path on the host filesystem that should be mounted

type LocalDockerVolume added in v1.20.0

type LocalDockerVolume struct {
	HostPath string `json:"hostPath"`
}

LocalDockerVolume represents a volume without a specified host path This is essentially DockerVolume with only the name specified; however, for backward compatibility we can't directly map to DockerVolume.

func (*LocalDockerVolume) Source added in v1.20.0

func (e *LocalDockerVolume) Source() string

SourcePath returns the generated host path for the volume

type Volume added in v1.20.0

type Volume interface {
	Source() string
}

Volume is an interface for something that may be used as the host half of a docker volume mount

type VolumeResource

type VolumeResource struct {
	// Name is the name of the docker volume
	Name string
	// VolumeConfig contains docker specific volume fields
	VolumeConfig DockerVolumeConfig
	// contains filtered or unexported fields
}

VolumeResource represents volume resource

func NewVolumeResource

func NewVolumeResource(ctx context.Context,
	name string,
	dockerVolumeName string,
	scope string,
	autoprovision bool,
	driver string,
	driverOptions map[string]string,
	labels map[string]string,
	client dockerapi.DockerClient) (*VolumeResource, error)

NewVolumeResource returns a docker volume wrapper object

func (*VolumeResource) ApplyTransition added in v1.20.0

func (vol *VolumeResource) ApplyTransition(nextState resourcestatus.ResourceStatus) error

ApplyTransition calls the function required to move to the specified status

func (*VolumeResource) Cleanup

func (vol *VolumeResource) Cleanup() error

Cleanup performs resource cleanup

func (*VolumeResource) Create

func (vol *VolumeResource) Create() error

Create performs resource creation

func (*VolumeResource) DesiredTerminal added in v1.20.0

func (vol *VolumeResource) DesiredTerminal() bool

DesiredTerminal returns true if the cgroup's desired status is REMOVED

func (*VolumeResource) GetCreatedAt

func (vol *VolumeResource) GetCreatedAt() time.Time

GetCreatedAt sets the timestamp for resource's creation time

func (*VolumeResource) GetDesiredStatus

func (vol *VolumeResource) GetDesiredStatus() resourcestatus.ResourceStatus

GetDesiredStatus safely returns the desired status of the task

func (*VolumeResource) GetKnownStatus

func (vol *VolumeResource) GetKnownStatus() resourcestatus.ResourceStatus

GetKnownStatus safely returns the currently known status of the task

func (*VolumeResource) GetMountPoint

func (vol *VolumeResource) GetMountPoint() string

GetMountPoint gets the mountpoint of the created volume.

func (*VolumeResource) GetName added in v1.20.0

func (vol *VolumeResource) GetName() string

GetName returns the name of the volume resource

func (*VolumeResource) GetTerminalReason

func (vol *VolumeResource) GetTerminalReason() string

GetTerminalReason returns an error string to propagate up through to task state change messages

func (*VolumeResource) Initialize added in v1.20.0

func (vol *VolumeResource) Initialize(resourceFields *taskresource.ResourceFields,
	taskKnownStatus status.TaskStatus,
	taskDesiredStatus status.TaskStatus)

func (*VolumeResource) KnownCreated added in v1.20.0

func (vol *VolumeResource) KnownCreated() bool

KnownCreated returns true if the volume's known status is CREATED

func (*VolumeResource) MarshalJSON

func (vol *VolumeResource) MarshalJSON() ([]byte, error)

MarshalJSON marshals VolumeResource object using duplicate struct VolumeResourceJSON

func (*VolumeResource) NextKnownState added in v1.20.0

func (vol *VolumeResource) NextKnownState() resourcestatus.ResourceStatus

NextKnownState returns the state that the resource should progress to based on its `KnownState`.

func (*VolumeResource) SetAppliedStatus added in v1.20.0

func (vol *VolumeResource) SetAppliedStatus(status resourcestatus.ResourceStatus) bool

SetAppliedStatus sets the applied status of resource and returns whether the resource is already in a transition

func (*VolumeResource) SetCreatedAt

func (vol *VolumeResource) SetCreatedAt(createdAt time.Time)

SetCreatedAt sets the timestamp for resource's creation time

func (*VolumeResource) SetDesiredStatus

func (vol *VolumeResource) SetDesiredStatus(status resourcestatus.ResourceStatus)

SetDesiredStatus safely sets the desired status of the resource

func (*VolumeResource) SetKnownStatus

func (vol *VolumeResource) SetKnownStatus(status resourcestatus.ResourceStatus)

SetKnownStatus safely sets the currently known status of the resource

func (*VolumeResource) SourcePath added in v1.20.0

func (vol *VolumeResource) SourcePath() string

SourcePath is fulfilling the HostVolume interface

func (*VolumeResource) StatusString added in v1.20.0

func (vol *VolumeResource) StatusString(status resourcestatus.ResourceStatus) string

StatusString returns the string of the cgroup resource status

func (*VolumeResource) SteadyState added in v1.20.0

func (vol *VolumeResource) SteadyState() resourcestatus.ResourceStatus

SteadyState returns the transition state of the resource defined as "ready"

func (*VolumeResource) TerminalStatus added in v1.20.0

func (vol *VolumeResource) TerminalStatus() resourcestatus.ResourceStatus

TerminalStatus returns the last transition state of volume

func (*VolumeResource) UnmarshalJSON

func (vol *VolumeResource) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals VolumeResource object using duplicate struct VolumeResourceJSON

type VolumeStatus

type VolumeStatus resourcestatus.ResourceStatus

VolumeStatus defines resource statuses for docker volume

const (
	// VolumeStatusNone is the zero state of a task resource
	VolumeStatusNone VolumeStatus = iota
	// VolumeCreated represents a task resource which has been created
	VolumeCreated
	// VolumeRemoved represents a task resource which has been Removed
	VolumeRemoved
)

func (*VolumeStatus) MarshalJSON

func (vs *VolumeStatus) MarshalJSON() ([]byte, error)

MarshalJSON overrides the logic for JSON-encoding the ResourceStatus type

func (VolumeStatus) String

func (vs VolumeStatus) String() string

StatusString returns a human readable string representation of this object

func (*VolumeStatus) UnmarshalJSON

func (vs *VolumeStatus) UnmarshalJSON(b []byte) error

UnmarshalJSON overrides the logic for parsing the JSON-encoded ResourceStatus data

Jump to

Keyboard shortcuts

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