Help us shape the future of Go! Take the 2026 Go Developer Survey

volume

package
v2.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BackupDestinationLocal   BackupDestination = "local"
	BackupDestinationS3      BackupDestination = "s3"
	BackupDestinationLocalS3 BackupDestination = "local_s3"

	BackupFormatArchive BackupFormat = "archive"
	BackupFormatRustic  BackupFormat = "rustic"
)
View Source
const (
	FileOpCreateFile   = workspace.FileOpCreateFile
	FileOpCreateFolder = workspace.FileOpCreateFolder
	FileOpUpdateFile   = workspace.FileOpUpdateFile
	FileOpRename       = workspace.FileOpRename
	FileOpMove         = workspace.FileOpMove
	FileOpDelete       = workspace.FileOpDelete
	FileOpRestoreFile  = "restore_file"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Backup added in v2.15.0

type Backup struct {
	ID                string                `json:"id"`
	UpdatedAt         *time.Time            `json:"updatedAt,omitempty"`
	VolumeName        string                `json:"volumeName"`
	Size              int64                 `json:"size"`
	CreatedAt         time.Time             `json:"createdAt"`
	Status            string                `json:"status"`
	Trigger           string                `json:"trigger"`
	Destination       BackupDestination     `json:"destination"`
	Format            BackupFormat          `json:"format"`
	LocalSnapshotID   string                `json:"localSnapshotId,omitempty"`
	RemoteSnapshotID  string                `json:"remoteSnapshotId,omitempty"`
	S3DestinationID   string                `json:"s3DestinationId,omitempty"`
	RemoteInstanceID  string                `json:"remoteInstanceId,omitempty"`
	S3DestinationName string                `json:"s3DestinationName,omitempty"`
	PolicyID          string                `json:"policyId,omitempty"`
	Error             string                `json:"error,omitempty"`
	ActivityID        *string               `json:"activityId,omitempty"`
	Type              backup.ManagementType `json:"type"`
	RemoteAvailable   *bool                 `json:"remoteAvailable,omitempty"`
}

Backup is one volume backup run.

func (*Backup) Entry added in v2.16.0

func (b *Backup) Entry() BackupEntry

Entry is the backup as the API lists it.

type BackupDestination added in v2.9.0

type BackupDestination string

type BackupEntry

type BackupEntry struct {
	RemoteAvailable   *bool                 `json:"remoteAvailable,omitempty"`
	ActivityID        *string               `json:"activityId,omitempty"`
	ID                string                `json:"id" doc:"Unique identifier of the backup"`
	VolumeName        string                `json:"volumeName" doc:"Name of the volume"`
	Size              int64                 `json:"size" doc:"Total size of the backup contents"`
	CreatedAt         string                `json:"createdAt" doc:"When the backup was created"`
	Status            string                `json:"status" doc:"Backup result status"`
	Trigger           string                `json:"trigger" doc:"How the backup was started"`
	Destination       BackupDestination     `json:"destination" doc:"Requested backup storage target"`
	Format            BackupFormat          `json:"format" doc:"Storage format of the backup: legacy tar.gz archive or Rustic snapshot"`
	LocalSnapshotID   string                `json:"localSnapshotId,omitempty" doc:"Snapshot ID in the local Rustic repository"`
	RemoteSnapshotID  string                `json:"remoteSnapshotId,omitempty" doc:"Snapshot ID in the S3 Rustic repository"`
	S3DestinationID   string                `json:"s3DestinationId,omitempty" doc:"S3 destination used by the backup"`
	S3DestinationName string                `json:"s3DestinationName,omitempty" doc:"Name of the S3 destination used by the backup"`
	PolicyID          string                `json:"policyId,omitempty" doc:"Backup policy that created the backup"`
	Error             string                `json:"error,omitempty" doc:"Backup error when the run failed"`
	Type              backup.ManagementType `json:"type" doc:"Whether the backup was system-managed or volume-managed"`
}

type BackupFormat added in v2.9.0

type BackupFormat string

type BackupPolicy added in v2.9.0

type BackupPolicy struct {
	ID                string       `json:"id"`
	VolumeName        string       `json:"volumeName"`
	Enabled           bool         `json:"enabled"`
	Schedule          string       `json:"schedule"`
	RetentionCount    int          `json:"retentionCount"`
	StopContainers    bool         `json:"stopContainers"`
	LocalEnabled      bool         `json:"localEnabled"`
	S3Enabled         bool         `json:"s3Enabled"`
	S3DestinationID   string       `json:"s3DestinationId,omitempty"`
	S3DestinationName string       `json:"s3DestinationName,omitempty"`
	S3Available       bool         `json:"s3Available"`
	S3Bucket          string       `json:"s3Bucket,omitempty"`
	LastRun           *BackupEntry `json:"lastRun,omitempty"`
}

type BackupPolicyCollection added in v2.9.0

type BackupPolicyCollection struct {
	Policies    []BackupPolicy `json:"policies"`
	S3Available bool           `json:"s3Available"`
}

type Committer added in v2.11.0

type Committer interface {
	Commit(ctx context.Context) error
}

type Create

type Create struct {
	// Name of the volume.
	//
	// Required: true
	Name string `json:"name" minLength:"1" doc:"Name of the volume"`

	// Driver is the volume driver to use.
	//
	// Required: false
	Driver string `json:"driver,omitempty" doc:"Volume driver (e.g., local, nfs)"`

	// DriverOpts contains driver-specific options.
	//
	// Required: false
	DriverOpts map[string]string `json:"driverOpts,omitempty" doc:"Driver-specific options"`

	// Labels contains user-defined metadata for the volume.
	//
	// Required: false
	Labels map[string]string `json:"labels,omitempty" doc:"User-defined labels"`
}

Create is used to create a new volume.

type CreateBackupRequest added in v2.9.0

type CreateBackupRequest struct {
	Destination     BackupDestination `json:"destination,omitempty" doc:"Optional destination override for this manual backup"`
	PolicyID        string            `json:"policyId,omitempty" doc:"Optional backup policy whose settings should be used"`
	S3DestinationID string            `json:"s3DestinationId,omitempty" doc:"Saved S3 destination for a manual remote backup"`
}

type DiscoverBackupsRequest added in v2.12.0

type DiscoverBackupsRequest struct {
	S3DestinationID string `json:"s3DestinationId" doc:"S3 destination to scan for existing volume backups"`
}

type DiscoverBackupsResponse added in v2.12.0

type DiscoverBackupsResponse struct {
	Count  int      `json:"count" doc:"Number of newly discovered volume backups"`
	Errors []string `json:"errors,omitempty" doc:"Per-repository failures encountered during discovery"`
}

type JournalSource added in v2.11.0

type JournalSource interface {
	JournalVolumes() []JournalVolume
}

type JournalVolume added in v2.11.0

type JournalVolume struct {
	Key     string            `json:"key"`
	OldName string            `json:"oldName"`
	NewName string            `json:"newName"`
	Driver  string            `json:"driver,omitempty"`
	Options map[string]string `json:"options,omitempty"`
	Labels  map[string]string `json:"labels,omitempty"`
}

type Migration added in v2.11.0

type Migration interface {
	Apply(ctx context.Context) error
	Rollback(ctx context.Context) error
}

type ProjectVolumeRenameConflictError added in v2.11.0

type ProjectVolumeRenameConflictError struct {
	VolumeName string
}

func (*ProjectVolumeRenameConflictError) Error added in v2.11.0

type ProjectVolumeRenameInUseError added in v2.11.0

type ProjectVolumeRenameInUseError struct {
	VolumeName   string
	ContainerIDs []string
}

func (*ProjectVolumeRenameInUseError) Error added in v2.11.0

type ProjectVolumeRenameInsufficientSpaceError added in v2.11.0

type ProjectVolumeRenameInsufficientSpaceError struct {
	SourceVolume string
	TargetVolume string
	Detail       string
}

func (*ProjectVolumeRenameInsufficientSpaceError) Error added in v2.11.0

type PruneReport

type PruneReport struct {
	// VolumesDeleted is a list of volume names that were deleted.
	//
	// Required: true
	VolumesDeleted []string `json:"volumesDeleted"`

	// SpaceReclaimed is the amount of space reclaimed in bytes.
	//
	// Required: true
	SpaceReclaimed uint64 `json:"spaceReclaimed"`

	// ActivityID is the activity created by the prune action.
	//
	// Required: false
	ActivityID *string `json:"activityId,omitempty"`
}

PruneReport is the result of a volume prune operation.

type Rename added in v2.9.0

type Rename struct {
	// Name is the new volume name.
	//
	// Required: true
	Name string `json:"name" minLength:"1" doc:"New volume name"`
}

Rename is used to rename an existing volume.

type RenameEntry added in v2.11.0

type RenameEntry struct {
	Key           string
	OldName       string
	NewName       string
	OldVolume     volume.Volume
	CreateOptions client.VolumeCreateOptions
}

RenameEntry describes a source volume and the target configuration for a copy-based rename.

type SourceCleanupError added in v2.11.0

type SourceCleanupError struct {
	SourceVolume string
	Err          error
}

func (*SourceCleanupError) Error added in v2.11.0

func (e *SourceCleanupError) Error() string

func (*SourceCleanupError) Unwrap added in v2.11.0

func (e *SourceCleanupError) Unwrap() error

type TargetMissingWithSourceError added in v2.11.0

type TargetMissingWithSourceError struct {
	SourceVolume string
	TargetVolume string
}

func (*TargetMissingWithSourceError) Error added in v2.11.0

type TargetPreservedDuringRollbackError added in v2.11.0

type TargetPreservedDuringRollbackError struct {
	SourceVolume string
	TargetVolume string
	Err          error
}

func (*TargetPreservedDuringRollbackError) Error added in v2.11.0

func (*TargetPreservedDuringRollbackError) Unwrap added in v2.11.0

type UpdateBackupPolicies added in v2.9.0

type UpdateBackupPolicies struct {
	Policies []UpdateBackupPolicy `json:"policies"`
}

type UpdateBackupPolicy added in v2.9.0

type UpdateBackupPolicy = backup.UpdateBackupPolicy

type UploadBackupRequest added in v2.9.0

type UploadBackupRequest struct {
	S3DestinationID string `json:"s3DestinationId" doc:"S3 destination for the uploaded backup"`
}

type UsageCounts

type UsageCounts struct {
	// Inuse is the number of volumes currently in use.
	//
	// Required: true
	Inuse int `json:"inuse"`

	// Unused is the number of volumes not in use.
	//
	// Required: true
	Unused int `json:"unused"`

	// Total is the total number of volumes.
	//
	// Required: true
	Total int `json:"total"`
}

UsageCounts contains counts of volumes by usage status.

type Volume

type Volume struct {
	base.EnvironmentTag

	// ID is the unique identifier of the volume.
	//
	// Required: true
	ID string `json:"id"`

	// Name of the volume.
	//
	// Required: true
	Name string `json:"name"`

	// Driver is the volume driver used.
	//
	// Required: true
	Driver string `json:"driver"`

	// Mountpoint is the path where the volume is mounted.
	//
	// Required: true
	Mountpoint string `json:"mountpoint"`

	// Scope of the volume (local, global, etc).
	//
	// Required: true
	Scope string `json:"scope"`

	// Options contains driver-specific options.
	//
	// Required: true
	Options map[string]string `json:"options"`

	// Labels contains user-defined metadata for the volume.
	//
	// Required: true
	Labels map[string]string `json:"labels"`

	// CreatedAt is the time when the volume was created.
	//
	// Required: true
	CreatedAt string `json:"createdAt"`

	// InUse indicates if the volume is currently in use by a container.
	//
	// Required: true
	InUse bool `json:"inUse"`

	// UsageData contains size and reference count information.
	//
	// Required: false
	UsageData *volume.UsageData `json:"usageData,omitempty"`

	// Size is the size of the volume in bytes.
	//
	// Required: false
	Size int64 `json:"size"`

	// Containers is a list of container IDs using this volume.
	//
	// Required: true
	Containers []string `json:"containers"`

	// ActivityID is the activity created by a mutating volume action.
	//
	// Required: false
	ActivityID *string `json:"activityId,omitempty"`
}

Volume represents a Docker volume.

func NewSummary

func NewSummary(v volume.Volume) Volume

NewSummary creates a Volume from a docker volume.Volume, calculating InUse based on whether the volume has a reference count of 1 or more.

InUse is set to true if the volume's UsageData.RefCount is >= 1, false otherwise.

type VolumesExternallyRemovedError added in v2.11.0

type VolumesExternallyRemovedError struct {
	Volumes []JournalVolume
}

func (*VolumesExternallyRemovedError) Error added in v2.11.0

type WorkspaceFileChange added in v2.8.0

type WorkspaceFileChange struct {
	Operation     string `json:"operation" binding:"required" enum:"create_file,create_folder,update_file,rename,move,delete,restore_file"`
	RelativePath  string `json:"relativePath" binding:"required"`
	NewName       string `json:"newName,omitempty"`
	NewParentPath string `json:"newParentPath,omitempty"`
	UploadIndex   *int   `json:"uploadIndex,omitempty" minimum:"0"`
	// BaselineIndex references an uploaded copy of the content an update_file
	// change was drafted against. The volume workspace revision is already
	// content-aware, so the baseline is accepted for API symmetry with
	// project workspaces but not separately compared.
	BaselineIndex *int   `json:"baselineIndex,omitempty" minimum:"0"`
	BackupID      string `json:"backupId,omitempty"`
	Recursive     bool   `json:"recursive,omitempty"`
}

type WorkspaceUpdateManifest added in v2.8.0

type WorkspaceUpdateManifest struct {
	FileTreeRevision string                `json:"fileTreeRevision" binding:"required"`
	FileChanges      []WorkspaceFileChange `json:"fileChanges" binding:"required" minItems:"1" maxItems:"500"`
}

Jump to

Keyboard shortcuts

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