limes

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 4 Imported by: 10

Documentation

Overview

Package limes contains data structures that appear on the Limes API. This package only has basic types that are shared between the resource API and the rate API. The concrete types for each of these sub-APIs are in the packages in the two subdirectories.

Index

Constants

This section is empty.

Variables

View Source
var (
	// UnitNone is used for countable (rather than measurable) resources or rates.
	UnitNone = units.UnitNone

	// UnitBytes is exactly that. Its MultiplyBy() method can be used to instantiate non-standard units.
	UnitBytes = units.UnitBytes
	// UnitKibibytes is exactly that. Its MultiplyBy() method can be used to instantiate non-standard units.
	UnitKibibytes = units.UnitKibibytes
	// UnitMebibytes is exactly that. Its MultiplyBy() method can be used to instantiate non-standard units.
	UnitMebibytes = units.UnitMebibytes
	// UnitGibibytes is exactly that. Its MultiplyBy() method can be used to instantiate non-standard units.
	UnitGibibytes = units.UnitGibibytes
	// UnitTebibytes is exactly that. Its MultiplyBy() method can be used to instantiate non-standard units.
	UnitTebibytes = units.UnitTebibytes
	// UnitPebibytes is exactly that. Its MultiplyBy() method can be used to instantiate non-standard units.
	UnitPebibytes = units.UnitPebibytes
	// UnitExbibytes is exactly that. Its MultiplyBy() method can be used to instantiate non-standard units.
	UnitExbibytes = units.UnitExbibytes
)

Functions

func ParseInUnit added in v1.12.0

func ParseInUnit(u Unit, str string) (uint64, error)

ParseInUnit parses the string representation of a value with this unit (or any unit that can be converted to it).

ParseInUnit(UnitMebibytes, "10 MiB") -> 10
ParseInUnit(UnitMebibytes, "10 GiB") -> 10240
ParseInUnit(UnitMebibytes, "10 KiB") -> error: incompatible unit
ParseInUnit(UnitMebibytes, "10")     -> error: missing unit
ParseInUnit(UnitNone, "42")          -> 42
ParseInUnit(UnitNone, "42 MiB")      -> error: unexpected unit

Types

type AvailabilityZone added in v1.9.0

type AvailabilityZone = liquid.AvailabilityZone

AvailabilityZone is the name of an availability zone. Some special values are enumerated at the original declaration site.

const (
	// AvailabilityZoneAny marks values that are not bound to a specific AZ.
	AvailabilityZoneAny AvailabilityZone = liquid.AvailabilityZoneAny
	// AvailabilityZoneUnknown marks values that are bound to an unknown AZ.
	AvailabilityZoneUnknown AvailabilityZone = liquid.AvailabilityZoneUnknown
)

type ClusterInfo added in v1.4.0

type ClusterInfo struct {
	ID string `json:"id"`
}

ClusterInfo contains the metadata for a cluster that appears in both resource data and rate data reports.

type DomainInfo added in v1.4.0

type DomainInfo struct {
	UUID string `json:"id"`
	Name string `json:"name"`
}

DomainInfo contains the metadata for a domain that appears in both resource data and rate data reports.

type ProjectInfo added in v1.4.0

type ProjectInfo struct {
	UUID       string `json:"id"`
	Name       string `json:"name"`
	ParentUUID string `json:"parent_id"`
}

ProjectInfo contains the metadata for a project that appears in both resource data and rate data reports.

type ServiceInfo

type ServiceInfo struct {
	// Type returns the service type that the backend service for this
	// plugin implements. This string must be identical to the type string from
	// the Keystone service catalog.
	Type ServiceType `json:"type"`
	// ProductName returns the name of the product that is the reference
	// implementation for this service. For example, ProductName = "nova" for
	// Type = "compute".
	ProductName string `json:"-"`
	// Area is a hint that UIs can use to group similar services.
	Area string `json:"area"`
}

ServiceInfo contains the metadata for a backend service that appears in both resource data and rate data reports.

type ServiceType added in v1.10.11

type ServiceType string

ServiceType identifies a backend service that can have resources or rates. This type is used to distinguish service types from other types of string values in function signatures.

type Unit

type Unit = units.Unit

Unit represents the unit a resource or rate is measured in.

type UnixEncodedTime added in v1.4.0

type UnixEncodedTime struct {
	time.Time
}

UnixEncodedTime is a time.Time that marshals into JSON as a UNIX timestamp.

This is a single-member struct instead of a newtype because the former enables directly calling time.Time methods on this type, e.g. t.String() instead of time.Time(t).String().

func (UnixEncodedTime) MarshalJSON added in v1.4.0

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

MarshalJSON implements the json.Marshaler interface.

func (*UnixEncodedTime) UnmarshalJSON added in v1.4.0

func (t *UnixEncodedTime) UnmarshalJSON(buf []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type ValueWithUnit

type ValueWithUnit = units.LimesV1ValueWithUnit

ValueWithUnit is used to represent values with units in subresources.

Directories

Path Synopsis
Package limesrates contains data structures that appear on the Limes rate API.
Package limesrates contains data structures that appear on the Limes rate API.
Package limesresources contains data structures that appear on the Limes resource API.
Package limesresources contains data structures that appear on the Limes resource API.

Jump to

Keyboard shortcuts

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