dataset

package
v0.37.2 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccessNone      = Access("NONE")
	AccessReadOnly  = Access("READ_ONLY")
	AccessReadWrite = Access("READ_WRITE")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Access

type Access string

Access permission to the entries of a data set.

type CreateSpec

type CreateSpec struct {
	// Name should take the form "com.company.project" to avoid conflict with other uses.
	// Must not be empty.
	Name string `json:"name"`

	// Description of the data set.
	Description string `json:"description"`

	// Host controls access to the data set entries by the ESXi host and the vCenter.
	// For example, if the host access is set to NONE, the entries of this data set
	// will not be accessible through the vCenter API.
	// Must not be empty.
	Host Access `json:"host"`

	// Guest controls access to the data set entries by the guest OS of the VM (i.e. in-guest APIs).
	// For example, if the guest access is set to READ_ONLY, it will be forbidden
	// to create, delete, and update entries in this data set via the VMware Guest SDK.
	// Must not be empty.
	Guest Access `json:"guest"`

	// OmitFromSnapshotAndClone controls whether the data set is included in snapshots and clones of the VM.
	// When a VM is reverted to a snapshot, any data set with OmitFromSnapshotAndClone=true will be destroyed.
	// Default is false.
	OmitFromSnapshotAndClone *bool `json:"omit_from_snapshot_and_clone,omitempty"`
}

Describes a data set to be created.

type Info

type Info struct {
	Name                     string `json:"name"`
	Description              string `json:"description"`
	Host                     Access `json:"host"`
	Guest                    Access `json:"guest"`
	Used                     int    `json:"used"`
	OmitFromSnapshotAndClone bool   `json:"omit_from_snapshot_and_clone"`
}

Data set information.

type Manager

type Manager struct {
	*rest.Client
}

Manager extends rest.Client, adding data set related methods.

Data sets functionality was introduced in vSphere 8.0, and requires the VM to have virtual hardware version 20 or newer.

See the VMware Guest SDK Programming Guide for details on using data sets from within the guest OS of a VM.

See https://developer.vmware.com/apis/vsphere-automation/latest/vcenter/vm/data_sets/

func NewManager

func NewManager(client *rest.Client) *Manager

NewManager creates a new Manager instance with the given client.

func (*Manager) CreateDataSet

func (c *Manager) CreateDataSet(ctx context.Context, vm string, spec *CreateSpec) (string, error)

CreateDataSet creates a data set associated with the given virtual machine.

func (*Manager) DeleteDataSet

func (c *Manager) DeleteDataSet(ctx context.Context, vm string, dataSet string, force bool) error

DeleteDataSet deletes an existing data set from the given virtual machine. The operation will fail if the data set is not empty. Set the force flag to delete a non-empty data set.

func (*Manager) DeleteEntry

func (c *Manager) DeleteEntry(ctx context.Context, vm string, dataSet string, key string) error

DeleteEntry removes an existing entry from the given data set.

func (*Manager) GetDataSet

func (c *Manager) GetDataSet(ctx context.Context, vm string, dataSet string) (*Info, error)

GetDataSet retrieves information about the given data set.

func (*Manager) GetEntry

func (c *Manager) GetEntry(ctx context.Context, vm string, dataSet string, key string) (string, error)

GetEntry returns the value of the data set entry with the given key.

func (*Manager) ListDataSets

func (c *Manager) ListDataSets(ctx context.Context, vm string) ([]Summary, error)

ListDataSets returns a list of brief descriptions of the data sets on with the given virtual machine.

func (*Manager) ListEntries

func (c *Manager) ListEntries(ctx context.Context, vm string, dataSet string) ([]string, error)

ListEntries returns a list of all entry keys in the given data set.

func (*Manager) SetEntry

func (c *Manager) SetEntry(ctx context.Context, vm string, dataSet string, key string, value string) error

SetEntry creates or updates an entry in the given data set. If an entry with the given key already exists, it will be overwritten. The key can be at most 4096 bytes. The value can be at most 1MB.

func (*Manager) UpdateDataSet

func (c *Manager) UpdateDataSet(ctx context.Context, vm string, dataSet string, spec *UpdateSpec) error

UpdateDataSet modifies the given data set.

type Summary

type Summary struct {
	DataSet     string `json:"data_set"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

Brief data set information.

type UpdateSpec

type UpdateSpec struct {
	Description              *string `json:"description,omitempty"`
	Host                     *Access `json:"host,omitempty"`
	Guest                    *Access `json:"guest,omitempty"`
	OmitFromSnapshotAndClone *bool   `json:"omit_from_snapshot_and_clone,omitempty"`
}

Describes modifications to a data set.

Jump to

Keyboard shortcuts

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