storage

package
v0.97.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MPL-2.0 Imports: 15 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ContentTypeBackup   = "backup"   // VM backups
	ContentTypeImages   = "images"   // VM disk images
	ContentTypeImport   = "import"   // VM disk images for import
	ContentTypeISO      = "iso"      // ISO images
	ContentTypeRootDir  = "rootdir"  // Container root directories
	ContentTypeSnippets = "snippets" // Snippets (cloud-init, hook scripts, etc.)
	ContentTypeVZTmpl   = "vztmpl"   // Container templates
)

Content type constants for Proxmox VE datastores.

Variables

This section is empty.

Functions

func IsValidContentType added in v0.90.0

func IsValidContentType(contentType string) bool

IsValidContentType checks if the given content type is valid.

func ValidContentTypes added in v0.94.0

func ValidContentTypes() []string

ValidContentTypes returns all valid content type values.

Types

type Client

type Client struct {
	api.Client

	StorageName string
}

Client is an interface for accessing the Proxmox node storage API.

func (*Client) APIUpload

func (c *Client) APIUpload(
	ctx context.Context,
	d *api.FileUploadRequest,
	tempDir string,
) (*DatastoreUploadResponseBody, error)

APIUpload uploads a file to a datastore using the Proxmox API.

func (*Client) DeleteDatastoreFile

func (c *Client) DeleteDatastoreFile(
	ctx context.Context,
	volumeID string,
) error

DeleteDatastoreFile deletes a file in a datastore.

func (*Client) DownloadFileByURL

func (c *Client) DownloadFileByURL(
	ctx context.Context,
	d *DownloadURLPostRequestBody,
) error

DownloadFileByURL downloads the file using URL.

func (*Client) DownloadOCIImageByReference added in v0.89.0

func (c *Client) DownloadOCIImageByReference(
	ctx context.Context,
	d *OCIRegistryPullRequestBody,
) error

DownloadOCIImageByReference downloads the OCI image by its reference.

func (*Client) ExpandPath

func (c *Client) ExpandPath(path string) string

ExpandPath expands a relative path to a full node storage API path.

func (*Client) GetDatastoreFile

func (c *Client) GetDatastoreFile(
	ctx context.Context,
	volumeID string,
) (*DatastoreFileGetResponseData, error)

GetDatastoreFile get a file details in a datastore.

func (*Client) GetDatastoreStatus

func (c *Client) GetDatastoreStatus(
	ctx context.Context,
) (*DatastoreGetStatusResponseData, error)

GetDatastoreStatus gets status information for a given datastore.

func (*Client) ListDatastoreFiles

func (c *Client) ListDatastoreFiles(
	ctx context.Context,
	contentType *string,
) ([]*DatastoreFileListResponseData, error)

ListDatastoreFiles retrieves a list of the files in a datastore. contentType is optional and filters the results by content type (e.g., "iso", "vztmpl", "backup"). If contentType is nil, all files in the datastore are returned (unfiltered).

func (*Client) ListDatastores

func (c *Client) ListDatastores(
	ctx context.Context,
	d *DatastoreListRequestBody,
) ([]*DatastoreListResponseData, error)

ListDatastores retrieves a list of nodes.

func (*Client) Tasks

func (c *Client) Tasks() *tasks.Client

Tasks returns a client for managing node storage tasks.

type DatastoreFileGetRequestData

type DatastoreFileGetRequestData struct {
	Node     string `json:"node,omitempty"   url:"node,omitempty"`
	VolumeID string `json:"volume,omitempty" url:"volume,omitempty"`
}

DatastoreFileGetRequestData contains the body from a datastore content get request.

type DatastoreFileGetResponseBody

type DatastoreFileGetResponseBody struct {
	Data *DatastoreFileGetResponseData `json:"data,omitempty" url:"data,omitempty"`
}

DatastoreFileGetResponseBody contains the body from a datastore content get response.

type DatastoreFileGetResponseData

type DatastoreFileGetResponseData struct {
	Path       *string `json:"path"           url:"path,omitempty"`
	FileFormat *string `json:"format"         url:"format,omitempty"`
	FileSize   *int64  `json:"size"           url:"size,omitempty"`
	SpaceUsed  *int64  `json:"used,omitempty" url:"used,omitempty"`
}

DatastoreFileGetResponseData contains the data from a datastore content get response.

type DatastoreFileListRequestBody added in v0.90.0

type DatastoreFileListRequestBody struct {
	ContentType *string `json:"content,omitempty" url:"content,omitempty"`
}

DatastoreFileListRequestBody contains the request parameters for listing datastore files.

type DatastoreFileListResponseBody

type DatastoreFileListResponseBody struct {
	Data []*DatastoreFileListResponseData `json:"data,omitempty"`
}

DatastoreFileListResponseBody contains the body from a datastore content list response.

type DatastoreFileListResponseData

type DatastoreFileListResponseData struct {
	ContentType    string  `json:"content"`
	FileFormat     string  `json:"format"`
	FileSize       int64   `json:"size"`
	ParentVolumeID *string `json:"parent,omitempty"`
	SpaceUsed      *int    `json:"used,omitempty"`
	VMID           *int    `json:"vmid,omitempty"`
	VolumeID       string  `json:"volid"`
}

DatastoreFileListResponseData contains the data from a datastore content list response.

type DatastoreGetStatusResponseBody

type DatastoreGetStatusResponseBody struct {
	Data *DatastoreGetStatusResponseData `json:"data,omitempty"`
}

DatastoreGetStatusResponseBody contains the body from a datastore status get request.

type DatastoreGetStatusResponseData

type DatastoreGetStatusResponseData struct {
	Active         *types.CustomBool               `json:"active,omitempty"`
	AvailableBytes *int64                          `json:"avail,omitempty"`
	Content        *types.CustomCommaSeparatedList `json:"content,omitempty" url:"content,omitempty,comma"`
	Enabled        *types.CustomBool               `json:"enabled,omitempty"`
	Shared         *types.CustomBool               `json:"shared,omitempty"`
	TotalBytes     *int64                          `json:"total,omitempty"`
	Type           *string                         `json:"type,omitempty"`
	UsedBytes      *int64                          `json:"used,omitempty"`
}

DatastoreGetStatusResponseData contains the data from a datastore status get request.

type DatastoreListRequestBody

type DatastoreListRequestBody struct {
	ContentTypes types.CustomCommaSeparatedList `json:"content,omitempty" url:"content,omitempty,comma"`
	Enabled      *types.CustomBool              `json:"enabled,omitempty" url:"enabled,omitempty,int"`
	Format       *types.CustomBool              `json:"format,omitempty"  url:"format,omitempty,int"`
	ID           *string                        `json:"storage,omitempty" url:"storage,omitempty"`
	Target       *string                        `json:"target,omitempty"  url:"target,omitempty"`
}

DatastoreListRequestBody contains the body for a datastore list request.

type DatastoreListResponseBody

type DatastoreListResponseBody struct {
	Data []*DatastoreListResponseData `json:"data,omitempty"`
}

DatastoreListResponseBody contains the body from a datastore list response.

type DatastoreListResponseData

type DatastoreListResponseData struct {
	Active              *types.CustomBool               `json:"active,omitempty"`
	ContentTypes        *types.CustomCommaSeparatedList `json:"content,omitempty"`
	Enabled             *types.CustomBool               `json:"enabled,omitempty"`
	ID                  string                          `json:"storage,omitempty"`
	Shared              *types.CustomBool               `json:"shared,omitempty"`
	SpaceAvailable      *types.CustomInt64              `json:"avail,omitempty"`
	SpaceTotal          *types.CustomInt64              `json:"total,omitempty"`
	SpaceUsed           *types.CustomInt64              `json:"used,omitempty"`
	SpaceUsedPercentage *types.CustomFloat64            `json:"used_fraction,omitempty"`
	Type                string                          `json:"type,omitempty"`
}

DatastoreListResponseData contains the data from a datastore list response.

type DatastoreUploadResponseBody

type DatastoreUploadResponseBody struct {
	UploadID *string `json:"data,omitempty"`
}

DatastoreUploadResponseBody contains the body from a datastore upload response.

type DownloadURLPostRequestBody

type DownloadURLPostRequestBody struct {
	Content           *string           `json:"content,omitempty"             url:"content,omitempty"`
	FileName          *string           `json:"filename,omitempty"            url:"filename,omitempty"`
	Node              *string           `json:"node,omitempty"                url:"node,omitempty"`
	Storage           *string           `json:"storage,omitempty"             url:"storage,omitempty"`
	URL               *string           `json:"url,omitempty"                 url:"url,omitempty"`
	Checksum          *string           `json:"checksum,omitempty"            url:"checksum,omitempty"`
	ChecksumAlgorithm *string           `json:"checksum-algorithm,omitempty"  url:"checksum-algorithm,omitempty"`
	Compression       *string           `json:"compression,omitempty"         url:"compression,omitempty"`
	Verify            *types.CustomBool `json:"verify-certificates,omitempty" url:"verify-certificates,omitempty,int"`
}

DownloadURLPostRequestBody contains the body for a DownloadURL post request.

type DownloadURLResponseBody

type DownloadURLResponseBody struct {
	TaskID *string `json:"data,omitempty"`
}

DownloadURLResponseBody contains the body from a DownloadURL post response.

type OCIRegistryPullRequestBody added in v0.89.0

type OCIRegistryPullRequestBody struct {
	FileName  *string `json:"filename,omitempty"  url:"filename,omitempty"`
	Reference *string `json:"reference,omitempty" url:"reference,omitempty"`
	Storage   *string `json:"storage,omitempty"   url:"storage,omitempty"`
}

OCIRegistryPullRequestBody contains the data for an OCI registry pull request.

type OCIRegistryPullResponseBody added in v0.89.0

type OCIRegistryPullResponseBody struct {
	TaskID *string `json:"data,omitempty"`
}

OCIRegistryPullResponseBody contains the response for an OCI registry pull request.

Jump to

Keyboard shortcuts

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