types

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: 12 Imported by: 31

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDiskSize added in v0.23.0

func FormatDiskSize(size *DiskSize) string

FormatDiskSize turns a number of bytes into a disk size string.

Types

type CustomBool

type CustomBool bool

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

func CustomBoolPtr added in v0.55.0

func CustomBoolPtr(b *bool) *CustomBool

CustomBoolPtr creates a pointer to a CustomBool.

func (*CustomBool) FromValue added in v0.31.0

func (r *CustomBool) FromValue(tfValue types.Bool)

FromValue sets the numeric boolean based on the value of a Terraform attribute.

func (CustomBool) MarshalJSON

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

MarshalJSON converts a boolean to a JSON value.

func (CustomBool) Pointer added in v0.31.0

func (r CustomBool) Pointer() *CustomBool

Pointer returns a pointers.

func (*CustomBool) PointerBool added in v0.31.0

func (r *CustomBool) PointerBool() *bool

PointerBool returns a pointer to a boolean.

func (CustomBool) ToValue added in v0.31.0

func (r CustomBool) ToValue() types.Bool

ToValue returns a Terraform attribute 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 CustomInt64 added in v0.38.1

type CustomInt64 int64

CustomInt64 allows a JSON int64 value to also be a string.

func (*CustomInt64) UnmarshalJSON added in v0.38.1

func (r *CustomInt64) 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 int64) *DiskSize

DiskSizeFromGigabytes creates a DiskSize from gigabytes.

func ParseDiskSize added in v0.23.0

func ParseDiskSize(size string) (DiskSize, error)

ParseDiskSize parses a disk size string into a number of bytes.

func (*DiskSize) InGigabytes added in v0.19.0

func (r *DiskSize) InGigabytes() int64

InGigabytes returns the disk size in gigabytes.

func (*DiskSize) InMegabytes added in v0.23.0

func (r *DiskSize) InMegabytes() int64

InMegabytes returns the disk size in megabytes.

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.

type HAResourceID added in v0.31.0

type HAResourceID struct {
	Type HAResourceType // The type of this HA resource.
	Name string         // The name of the element the HA resource refers to.
}

HAResourceID represents a HA resource identifier, composed of a resource type and identifier.

func ParseHAResourceID added in v0.31.0

func ParseHAResourceID(input string) (HAResourceID, error)

ParseHAResourceID parses a string that represents a HA resource identifier into a value of `HAResourceID`.

func (HAResourceID) EncodeValues added in v0.31.0

func (rid HAResourceID) EncodeValues(key string, v *url.Values) error

EncodeValues encodes a HA resource ID field into an URL-encoded set of values.

func (HAResourceID) MarshalJSON added in v0.31.0

func (rid HAResourceID) MarshalJSON() ([]byte, error)

MarshalJSON marshals a HA resource identifier into JSON value.

func (HAResourceID) String added in v0.31.0

func (rid HAResourceID) String() string

String converts a HAResourceID value into a string.

func (HAResourceID) ToValue added in v0.31.0

func (rid HAResourceID) ToValue() types.String

ToValue converts a HA resource ID into a Terraform value.

func (*HAResourceID) UnmarshalJSON added in v0.31.0

func (rid *HAResourceID) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals a Proxmox HA resource identifier.

type HAResourceState added in v0.31.0

type HAResourceState int

HAResourceState represents the requested state of a HA resource.

const (
	// HAResourceStateStarted indicates that a HA resource should be started.
	HAResourceStateStarted HAResourceState = 0
	// HAResourceStateStopped indicates that a HA resource should be stopped, but that it should still be relocated
	// on node failure.
	HAResourceStateStopped HAResourceState = 1
	// HAResourceStateDisabled indicates that a HA resource should be stopped. No relocation should occur on node failure.
	HAResourceStateDisabled HAResourceState = 2
	// HAResourceStateIgnored indicates that a HA resource is not managed by the cluster resource manager. No relocation
	// or status change will occur.
	HAResourceStateIgnored HAResourceState = 3
)

func ParseHAResourceState added in v0.31.0

func ParseHAResourceState(input string) (HAResourceState, error)

ParseHAResourceState converts the string representation of a HA resource state into the corresponding enum value. An error is returned if the input string does not match any known state. This function also parses the `enabled` value which is an alias for `started`.

func (HAResourceState) EncodeValues added in v0.31.0

func (s HAResourceState) EncodeValues(key string, v *url.Values) error

EncodeValues encodes a HA resource state field into an URL-encoded set of values.

func (HAResourceState) MarshalJSON added in v0.31.0

func (s HAResourceState) MarshalJSON() ([]byte, error)

MarshalJSON marshals a HA resource state into JSON value.

func (HAResourceState) String added in v0.31.0

func (s HAResourceState) String() string

String converts a HAResourceState value into a string.

func (HAResourceState) ToValue added in v0.31.0

func (s HAResourceState) ToValue() types.String

ToValue converts a HA resource state into a Terraform value.

func (*HAResourceState) UnmarshalJSON added in v0.31.0

func (s *HAResourceState) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals a Proxmox HA resource state.

type HAResourceType added in v0.31.0

type HAResourceType int

HAResourceType represents the type of HA resource.

const (
	// HAResourceTypeVM indicates that a HA resource refers to a virtual machine.
	HAResourceTypeVM HAResourceType = 0
	// HAResourceTypeContainer indicates that a HA resource refers to a container.
	HAResourceTypeContainer HAResourceType = 1
)

func ParseHAResourceType added in v0.31.0

func ParseHAResourceType(input string) (HAResourceType, error)

ParseHAResourceType converts the string representation of a HA resource type into the corresponding enum value. An error is returned if the input string does not match any known type.

func (HAResourceType) EncodeValues added in v0.31.0

func (t HAResourceType) EncodeValues(key string, v *url.Values) error

EncodeValues encodes a HA resource type field into an URL-encoded set of values.

func (HAResourceType) MarshalJSON added in v0.31.0

func (t HAResourceType) MarshalJSON() ([]byte, error)

MarshalJSON marshals a HA resource type into JSON value.

func (HAResourceType) String added in v0.31.0

func (t HAResourceType) String() string

String converts a HAResourceType value into a string.

func (HAResourceType) ToValue added in v0.31.0

func (t HAResourceType) ToValue() types.String

ToValue converts a HA resource type into a Terraform value.

func (*HAResourceType) UnmarshalJSON added in v0.31.0

func (t *HAResourceType) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals a Proxmox HA resource type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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