types

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2023 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDiskSize added in v0.24.0

func FormatDiskSize(size DiskSize) string

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

func StrPtr added in v0.24.0

func StrPtr(s string) *string

StrPtr returns a pointer to a string.

Types

type CustomBool

type CustomBool bool

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

func BoolPtr added in v0.24.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) Pointer

func (r CustomBool) Pointer() *CustomBool

Pointer returns a pointers.

func (*CustomBool) PointerBool

func (r *CustomBool) PointerBool() *bool

PointerBool returns a pointer to a boolean.

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.24.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.24.0

func DiskSizeFromGigabytes(size int) DiskSize

DiskSizeFromGigabytes creates a DiskSize from gigabytes.

func ParseDiskSize added in v0.24.0

func ParseDiskSize(size string) (DiskSize, error)

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

func (DiskSize) InGigabytes added in v0.24.0

func (r DiskSize) InGigabytes() int

InGigabytes returns the disk size in gigabytes.

func (DiskSize) InMegabytes added in v0.24.0

func (r DiskSize) InMegabytes() int

InMegabytes returns the disk size in megabytes.

func (DiskSize) MarshalJSON added in v0.24.0

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

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

func (DiskSize) String added in v0.24.0

func (r DiskSize) String() string

String returns the string representation of the disk size.

func (*DiskSize) UnmarshalJSON added in v0.24.0

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

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

type IPAddrType

type IPAddrType struct {
	basetypes.StringType
}

IPAddrType is a type that represents an IP address.

func (IPAddrType) Equal

func (t IPAddrType) Equal(o attr.Type) bool

Equal returns true if the two types are equal.

func (IPAddrType) String

func (t IPAddrType) String() string

String returns a string representation of the type.

func (IPAddrType) Validate

func (t IPAddrType) Validate(_ context.Context, value tftypes.Value, valuePath path.Path) diag.Diagnostics

Validate ensures the value is valid IP address.

func (IPAddrType) ValueFromString

ValueFromString converts a string value to a StringValuable.

func (IPAddrType) ValueFromTerraform

func (t IPAddrType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)

ValueFromTerraform converts a Terraform value to a StringValuable.

func (IPAddrType) ValueType

func (t IPAddrType) ValueType(_ context.Context) attr.Value

ValueType returns the underlying value type.

type IPAddrValue

type IPAddrValue struct {
	basetypes.StringValue
}

IPAddrValue is a type that represents an IP address value.

func NewIPAddrPointerValue

func NewIPAddrPointerValue(value *string) IPAddrValue

NewIPAddrPointerValue returns a new IPAddrValue from a string pointer.

func (IPAddrValue) Equal

func (v IPAddrValue) Equal(o attr.Value) bool

Equal returns true if the two values are equal.

func (IPAddrValue) Type

func (v IPAddrValue) Type(_ context.Context) attr.Type

Type returns the type of the value.

type IPCIDRType

type IPCIDRType struct {
	basetypes.StringType
}

IPCIDRType is a type that represents an IP address in CIDR notation.

func (IPCIDRType) Equal

func (t IPCIDRType) Equal(o attr.Type) bool

Equal returns true if the two types are equal.

func (IPCIDRType) String

func (t IPCIDRType) String() string

String returns a string representation of the type.

func (IPCIDRType) Validate

func (t IPCIDRType) Validate(_ context.Context, value tftypes.Value, valuePath path.Path) diag.Diagnostics

Validate ensures the value is valid IP address in CIDR notation.

func (IPCIDRType) ValueFromString

ValueFromString converts a string value to a StringValuable.

func (IPCIDRType) ValueFromTerraform

func (t IPCIDRType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)

ValueFromTerraform converts a Terraform value to a StringValuable.

func (IPCIDRType) ValueType

func (t IPCIDRType) ValueType(_ context.Context) attr.Value

ValueType returns the underlying value type.

type IPCIDRValue

type IPCIDRValue struct {
	basetypes.StringValue
}

IPCIDRValue is a type that represents an IP address in CIDR notation.

func NewIPCIDRPointerValue

func NewIPCIDRPointerValue(value *string) IPCIDRValue

NewIPCIDRPointerValue returns a new IPCIDRValue from a string pointer.

func (IPCIDRValue) Equal

func (v IPCIDRValue) Equal(o attr.Value) bool

Equal returns true if the two values are equal.

func (IPCIDRValue) Type

func (v IPCIDRValue) Type(_ context.Context) attr.Type

Type returns the type of the value.

Jump to

Keyboard shortcuts

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