types

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MPL-2.0 Imports: 9 Imported by: 31

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StrPtr added in v0.19.0

func StrPtr(s string) *string

StrPtr returns a pointer to a string.

Types

type Client

type Client interface {
	// DoRequest performs a request against the Proxmox API.
	DoRequest(
		ctx context.Context,
		method, path string,
		requestBody, responseBody interface{},
	) error

	// ExpandPath expands a path relative to the client's base path.
	// For example, if the client is configured for a VM and the
	// path is "firewall/options", the returned path will be
	// "/nodes/<node>/qemu/<vmid>/firewall/options".
	ExpandPath(path string) string
}

type CustomBool

type CustomBool bool

CustomBool allows a JSON boolean value to also be an integer.

func BoolPtr added in v0.19.0

func BoolPtr(s bool) *CustomBool

BoolPtr returns a pointer to a bool.

func (CustomBool) MarshalJSON

func (r CustomBool) MarshalJSON() ([]byte, error)

MarshalJSON converts a boolean to a JSON value.

func (*CustomBool) UnmarshalJSON

func (r *CustomBool) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a JSON value to a boolean.

type CustomCommaSeparatedList

type CustomCommaSeparatedList []string

CustomCommaSeparatedList allows a JSON string to also be a string array.

func (*CustomCommaSeparatedList) MarshalJSON

func (r *CustomCommaSeparatedList) MarshalJSON() ([]byte, error)

MarshalJSON converts a boolean to a JSON value.

func (*CustomCommaSeparatedList) UnmarshalJSON

func (r *CustomCommaSeparatedList) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a JSON value to a boolean.

type CustomInt

type CustomInt int

CustomInt allows a JSON integer value to also be a string.

func (*CustomInt) UnmarshalJSON

func (r *CustomInt) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a JSON value to an integer.

type CustomLineBreakSeparatedList

type CustomLineBreakSeparatedList []string

CustomLineBreakSeparatedList allows a multiline JSON string to also be a string array.

func (*CustomLineBreakSeparatedList) MarshalJSON

func (r *CustomLineBreakSeparatedList) MarshalJSON() ([]byte, error)

MarshalJSON converts a boolean to a JSON value.

func (*CustomLineBreakSeparatedList) UnmarshalJSON

func (r *CustomLineBreakSeparatedList) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a JSON value to a boolean.

type CustomPrivileges

type CustomPrivileges []string

CustomPrivileges allows a JSON object of privileges to also be a string array.

func (*CustomPrivileges) MarshalJSON

func (r *CustomPrivileges) MarshalJSON() ([]byte, error)

MarshalJSON converts a boolean to a JSON value.

func (*CustomPrivileges) UnmarshalJSON

func (r *CustomPrivileges) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a JSON value to a boolean.

type CustomTimestamp

type CustomTimestamp time.Time

CustomTimestamp allows a JSON boolean value to also be a unix timestamp.

func (CustomTimestamp) MarshalJSON

func (r CustomTimestamp) MarshalJSON() ([]byte, error)

MarshalJSON converts a timestamp to a JSON value.

func (*CustomTimestamp) UnmarshalJSON

func (r *CustomTimestamp) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a JSON value to a timestamp.

type DiskSize added in v0.19.0

type DiskSize int64

DiskSize allows a JSON integer value to also be a string. This is mapped to `<DiskSize>` data type in Proxmox API. Represents a disk size in bytes.

func DiskSizeFromGigabytes added in v0.19.0

func DiskSizeFromGigabytes(size int) DiskSize

DiskSizeFromGigabytes creates a DiskSize from gigabytes.

func (DiskSize) InGigabytes added in v0.19.0

func (r DiskSize) InGigabytes() int

InGigabytes returns the disk size in gigabytes.

func (DiskSize) MarshalJSON added in v0.19.0

func (r DiskSize) MarshalJSON() ([]byte, error)

MarshalJSON marshals a disk size into a Proxmox API `<DiskSize>` string.

func (DiskSize) String added in v0.19.0

func (r DiskSize) String() string

String returns the string representation of the disk size.

func (*DiskSize) UnmarshalJSON added in v0.19.0

func (r *DiskSize) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals a disk size from a Proxmox API `<DiskSize>` string.

Jump to

Keyboard shortcuts

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