mapping

package
v0.56.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MPL-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// APIParamNamePCIMediatedDevices is the API attribute name of the Proxmox VE API "mediated devices" parameter for a
	// PCI hardware mapping.
	APIParamNamePCIMediatedDevices = "mdev"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	api.Client
}

Client is an interface for accessing the Proxmox cluster mapping API.

func (*Client) Create

func (c *Client) Create(ctx context.Context, hmType proxmoxtypes.Type, data *CreateRequestBody) error

Create creates a new hardware mapping.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, hmType proxmoxtypes.Type, name string) error

Delete deletes a hardware mapping.

func (*Client) ExpandPath

func (c *Client) ExpandPath(hmType proxmoxtypes.Type, path string) string

ExpandPath expands a relative path to a full hardware mapping API path.

func (*Client) Get

func (c *Client) Get(ctx context.Context, hmType proxmoxtypes.Type, name string) (*GetResponseData, error)

Get retrieves the configuration of a single hardware mapping.

func (*Client) List

func (c *Client) List(ctx context.Context, hmType proxmoxtypes.Type, checkNode string) ([]*ListResponseData, error)

List retrieves the list of hardware mappings. If "checkNode" is not empty, the "checks" list will be included in the response that might include configuration correctness diagnostics for the given node.

func (*Client) Update

func (c *Client) Update(ctx context.Context, hmType proxmoxtypes.Type, name string, data *UpdateRequestBody) error

Update updates an existing hardware mapping.

type CreateRequestBody

type CreateRequestBody struct {
	DataBase

	// ID is the hardware mappings identifier.
	ID string `url:"id"`
}

CreateRequestBody contains the data which must be sent when creating a hardware mapping.

type DataBase

type DataBase struct {
	// Description is the optional key for the description for a hardware mapping that is omitted by the Proxmox VE API
	// when not set.
	// Note that even though the Proxmox VE API attribute is named "description" it is generally labeled as "comment"
	// cross the Proxmox VE web UI while only being named "description" in the Proxmox VE API and its documentation.
	Description *string `url:"description,omitempty"`

	// Map is the list of device mappings.
	Map []proxmoxtypes.Map `json:"map" url:"map"`

	// MediatedDevices is the indicator for the optional APIParamNamePCIMediatedDevices parameter.
	MediatedDevices types.CustomBool `json:"mdev" url:"mdev,omitempty,int"`
}

DataBase contains common data for hardware mapping API calls.

type GetResponseBody

type GetResponseBody struct {
	// Data is the hardware mapping get response data.
	Data *GetResponseData `json:"data,omitempty"`
}

GetResponseBody contains the body from a hardware mapping get response.

type GetResponseData

type GetResponseData struct {
	DataBase

	// Type is the required types of the hardware mapping.
	Type proxmoxtypes.Type `json:"type"`
}

GetResponseData contains data received from the hardware mapping API when requesting information about a single mapping.

type ListResponseBody

type ListResponseBody struct {
	// Data is the hardware mapping list response data.
	Data []*ListResponseData `json:"data,omitempty"`
}

ListResponseBody contains the body from a hardware mapping list response.

type ListResponseData

type ListResponseData struct {
	DataBase

	// ChecksPCI might contain relevant diagnostics about incorrect [typesHWM.TypePCI] configurations.
	// The name of the node must be passed to the Proxmox VE API call which maps to the "check-node" URL parameter.
	// Note that the Proxmox VE API, for whatever reason, only returns one error at a time, even though the field is an
	// array.
	ChecksPCI []NodeCheckDiag `json:"checks,omitempty"`

	// ChecksUSB might contain relevant diagnostics about incorrect [typesHWM.TypeUSB] configurations.
	// The name of the node must be passed to the Proxmox VE API call which maps to the "check-node" URL parameter.
	// Note that the actual JSON field name matches the Proxmox VE API, but the name of this variable has been adjusted
	// for clarity.
	// Also note that the Proxmox VE API, for whatever reason, only returns one error at a time, even though the field is
	// an array.
	ChecksUSB []NodeCheckDiag `json:"errors,omitempty"`

	// ID is the hardware mappings identifier.
	ID string `json:"id"`

	// Type is the required types of the hardware mapping.
	Type proxmoxtypes.Type `json:"type"`
}

ListResponseData contains the data from a hardware mapping list response.

type NodeCheckDiag

type NodeCheckDiag struct {
	// Message is the message of the node check diagnostic entry.
	Message *string `json:"message"`

	// Severity is the severity of the node check diagnostic entry.
	Severity *string `json:"severity"`
}

NodeCheckDiag is a hardware mapping configuration correctness diagnostic entry.

type UpdateRequestBody

type UpdateRequestBody struct {
	DataBase

	// Delete are settings that must be deleted from the resource's configuration.
	Delete []string `url:"delete,omitempty,comma"`
}

UpdateRequestBody contains data received from the hardware mapping resource API when updating an existing hardware mapping resource.

Jump to

Keyboard shortcuts

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