storage

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Cf_AVERAGE Cf = "AVERAGE"
	Cf_MAX     Cf = "MAX"

	ChecksumAlgorithm_MD5    ChecksumAlgorithm = "md5"
	ChecksumAlgorithm_SHA1   ChecksumAlgorithm = "sha1"
	ChecksumAlgorithm_SHA224 ChecksumAlgorithm = "sha224"
	ChecksumAlgorithm_SHA256 ChecksumAlgorithm = "sha256"
	ChecksumAlgorithm_SHA384 ChecksumAlgorithm = "sha384"
	ChecksumAlgorithm_SHA512 ChecksumAlgorithm = "sha512"

	Content_ISO    Content = "iso"
	Content_VZTMPL Content = "vztmpl"

	Mark_KEEP      Mark = "keep"
	Mark_REMOVE    Mark = "remove"
	Mark_PROTECTED Mark = "protected"
	Mark_RENAMED   Mark = "renamed"

	Timeframe_HOUR  Timeframe = "hour"
	Timeframe_DAY   Timeframe = "day"
	Timeframe_WEEK  Timeframe = "week"
	Timeframe_MONTH Timeframe = "month"
	Timeframe_YEAR  Timeframe = "year"

	Type_QEMU Type = "qemu"
	Type_LXC  Type = "lxc"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cf added in v0.0.15

type Cf string

func PtrCf added in v0.0.15

func PtrCf(i Cf) *Cf

type ChecksumAlgorithm added in v0.0.15

type ChecksumAlgorithm string

func PtrChecksumAlgorithm added in v0.0.15

func PtrChecksumAlgorithm(i ChecksumAlgorithm) *ChecksumAlgorithm

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(c HTTPClient) *Client

func (*Client) DeletePrunebackups

func (c *Client) DeletePrunebackups(ctx context.Context, req DeletePrunebackupsRequest) (string, error)

DeletePrunebackups Prune backups. Only those using the standard naming scheme are considered.

func (*Client) DownloadUrl

func (c *Client) DownloadUrl(ctx context.Context, req DownloadUrlRequest) (string, error)

DownloadUrl Download templates and ISO images by using an URL.

func (*Client) DryrunPrunebackups

func (c *Client) DryrunPrunebackups(ctx context.Context, req DryrunPrunebackupsRequest) ([]DryrunPrunebackupsResponse, error)

DryrunPrunebackups Get prune information for backups. NOTE: this is only a preview and might not be what a subsequent prune call does if backups are removed/added in the meantime.

func (*Client) Find

func (c *Client) Find(ctx context.Context, req FindRequest) ([]FindResponse, error)

Find

func (*Client) Index

func (c *Client) Index(ctx context.Context, req IndexRequest) ([]IndexResponse, error)

Index Get status for all datastores.

func (*Client) ReadStatus

func (c *Client) ReadStatus(ctx context.Context, req ReadStatusRequest) (map[string]interface{}, error)

ReadStatus Read storage status.

func (*Client) Rrd

func (c *Client) Rrd(ctx context.Context, req RrdRequest) (RrdResponse, error)

Rrd Read storage RRD statistics (returns PNG).

func (*Client) Rrddata

func (c *Client) Rrddata(ctx context.Context, req RrddataRequest) ([]map[string]interface{}, error)

Rrddata Read storage RRD statistics.

func (*Client) Upload

func (c *Client) Upload(ctx context.Context, req UploadRequest) (string, error)

Upload Upload templates and ISO images.

type Content added in v0.0.15

type Content string

func PtrContent added in v0.0.15

func PtrContent(i Content) *Content

type DeletePrunebackupsRequest

type DeletePrunebackupsRequest struct {
	Node    string `url:"node" json:"node"`       // The cluster node name.
	Storage string `url:"storage" json:"storage"` // The storage identifier.

	// The following parameters are optional
	PruneBackups *string `url:"prune-backups,omitempty" json:"prune-backups,omitempty"` // Use these retention options instead of those from the storage configuration.
	Type         *Type   `url:"type,omitempty" json:"type,omitempty"`                   // Either 'qemu' or 'lxc'. Only consider backups for guests of this type.
	Vmid         *int    `url:"vmid,omitempty" json:"vmid,omitempty"`                   // Only prune backups for this VM.
}

type DownloadUrlRequest

type DownloadUrlRequest struct {
	Content  Content `url:"content" json:"content"`   // Content type.
	Filename string  `url:"filename" json:"filename"` // The name of the file to create. Caution: This will be normalized!
	Node     string  `url:"node" json:"node"`         // The cluster node name.
	Storage  string  `url:"storage" json:"storage"`   // The storage identifier.
	Url      string  `url:"url" json:"url"`           // The URL to download the file from.

	// The following parameters are optional
	Checksum           *string            `url:"checksum,omitempty" json:"checksum,omitempty"`                       // The expected checksum of the file.
	ChecksumAlgorithm  *ChecksumAlgorithm `url:"checksum-algorithm,omitempty" json:"checksum-algorithm,omitempty"`   // The algorithm to calculate the checksum of the file.
	VerifyCertificates *util.PVEBool      `url:"verify-certificates,omitempty" json:"verify-certificates,omitempty"` // If false, no SSL/TLS certificates will be verified.
}

type DryrunPrunebackupsRequest

type DryrunPrunebackupsRequest struct {
	Node    string `url:"node" json:"node"`       // The cluster node name.
	Storage string `url:"storage" json:"storage"` // The storage identifier.

	// The following parameters are optional
	PruneBackups *string `url:"prune-backups,omitempty" json:"prune-backups,omitempty"` // Use these retention options instead of those from the storage configuration.
	Type         *Type   `url:"type,omitempty" json:"type,omitempty"`                   // Either 'qemu' or 'lxc'. Only consider backups for guests of this type.
	Vmid         *int    `url:"vmid,omitempty" json:"vmid,omitempty"`                   // Only consider backups for this guest.
}

type DryrunPrunebackupsResponse

type DryrunPrunebackupsResponse struct {
	Ctime int    `url:"ctime" json:"ctime"` // Creation time of the backup (seconds since the UNIX epoch).
	Mark  Mark   `url:"mark" json:"mark"`   // Whether the backup would be kept or removed. Backups that are protected or don't use the standard naming scheme are not removed.
	Type  string `url:"type" json:"type"`   // One of 'qemu', 'lxc', 'openvz' or 'unknown'.
	Volid string `url:"volid" json:"volid"` // Backup volume ID.

	// The following parameters are optional
	Vmid *int `url:"vmid,omitempty" json:"vmid,omitempty"` // The VM the backup belongs to.
}

type FindRequest

type FindRequest struct {
	Node    string `url:"node" json:"node"`       // The cluster node name.
	Storage string `url:"storage" json:"storage"` // The storage identifier.

}

type FindResponse

type FindResponse struct {
	Subdir string `url:"subdir" json:"subdir"`
}

type HTTPClient

type HTTPClient interface {
	Do(context.Context, string, string, interface{}, interface{}) error
}

type IndexRequest

type IndexRequest struct {
	Node string `url:"node" json:"node"` // The cluster node name.

	// The following parameters are optional
	Content *string       `url:"content,omitempty" json:"content,omitempty"` // Only list stores which support this content type.
	Enabled *util.PVEBool `url:"enabled,omitempty" json:"enabled,omitempty"` // Only list stores which are enabled (not disabled in config).
	Format  *util.PVEBool `url:"format,omitempty" json:"format,omitempty"`   // Include information about formats
	Storage *string       `url:"storage,omitempty" json:"storage,omitempty"` // Only list status for specified storage
	Target  *string       `url:"target,omitempty" json:"target,omitempty"`   // If target is different to 'node', we only lists shared storages which content is accessible on this 'node' and the specified 'target' node.
}

type IndexResponse

type IndexResponse struct {
	Content string `url:"content" json:"content"` // Allowed storage content types.
	Storage string `url:"storage" json:"storage"` // The storage identifier.
	Type    string `url:"type" json:"type"`       // Storage type.

	// The following parameters are optional
	Active       *util.PVEBool `url:"active,omitempty" json:"active,omitempty"`               // Set when storage is accessible.
	Avail        *int          `url:"avail,omitempty" json:"avail,omitempty"`                 // Available storage space in bytes.
	Enabled      *util.PVEBool `url:"enabled,omitempty" json:"enabled,omitempty"`             // Set when storage is enabled (not disabled).
	Shared       *util.PVEBool `url:"shared,omitempty" json:"shared,omitempty"`               // Shared flag from storage configuration.
	Total        *int          `url:"total,omitempty" json:"total,omitempty"`                 // Total storage space in bytes.
	Used         *int          `url:"used,omitempty" json:"used,omitempty"`                   // Used storage space in bytes.
	UsedFraction *float64      `url:"used_fraction,omitempty" json:"used_fraction,omitempty"` // Used fraction (used/total).
}

type Mark added in v0.0.15

type Mark string

func PtrMark added in v0.0.15

func PtrMark(i Mark) *Mark

type ReadStatusRequest

type ReadStatusRequest struct {
	Node    string `url:"node" json:"node"`       // The cluster node name.
	Storage string `url:"storage" json:"storage"` // The storage identifier.

}

type RrdRequest

type RrdRequest struct {
	Ds        string    `url:"ds" json:"ds"`               // The list of datasources you want to display.
	Node      string    `url:"node" json:"node"`           // The cluster node name.
	Storage   string    `url:"storage" json:"storage"`     // The storage identifier.
	Timeframe Timeframe `url:"timeframe" json:"timeframe"` // Specify the time frame you are interested in.

	// The following parameters are optional
	Cf *Cf `url:"cf,omitempty" json:"cf,omitempty"` // The RRD consolidation function
}

type RrdResponse

type RrdResponse struct {
	Filename string `url:"filename" json:"filename"`
}

type RrddataRequest

type RrddataRequest struct {
	Node      string    `url:"node" json:"node"`           // The cluster node name.
	Storage   string    `url:"storage" json:"storage"`     // The storage identifier.
	Timeframe Timeframe `url:"timeframe" json:"timeframe"` // Specify the time frame you are interested in.

	// The following parameters are optional
	Cf *Cf `url:"cf,omitempty" json:"cf,omitempty"` // The RRD consolidation function
}

type Timeframe added in v0.0.15

type Timeframe string

func PtrTimeframe added in v0.0.15

func PtrTimeframe(i Timeframe) *Timeframe

type Type added in v0.0.15

type Type string

func PtrType added in v0.0.15

func PtrType(i Type) *Type

type UploadRequest

type UploadRequest struct {
	Content  Content `url:"content" json:"content"`   // Content type.
	Filename string  `url:"filename" json:"filename"` // The name of the file to create. Caution: This will be normalized!
	Node     string  `url:"node" json:"node"`         // The cluster node name.
	Storage  string  `url:"storage" json:"storage"`   // The storage identifier.

	// The following parameters are optional
	Checksum          *string            `url:"checksum,omitempty" json:"checksum,omitempty"`                     // The expected checksum of the file.
	ChecksumAlgorithm *ChecksumAlgorithm `url:"checksum-algorithm,omitempty" json:"checksum-algorithm,omitempty"` // The algorithm to calculate the checksum of the file.
	Tmpfilename       *string            `url:"tmpfilename,omitempty" json:"tmpfilename,omitempty"`               // The source file name. This parameter is usually set by the REST handler. You can only overwrite it when connecting to the trusted port on localhost.
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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