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 ¶
This section is empty.
Functions ¶
func ParseInUnit ¶ added in v1.12.0
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") -> returns FractionalValueError ParseInUnit(UnitMebibytes, "10") -> returns syntax error (missing unit) ParseInUnit(UnitNone, "42") -> 42 ParseInUnit(UnitNone, "42 MiB") -> returns syntax 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
DomainInfo contains the metadata for a domain that appears in both resource data and rate data reports.
type FractionalValueError ¶
type FractionalValueError struct { Source ValueWithUnit Target Unit }
FractionalValueError is returned by ValueWithUnit.ConvertTo() when the conversion would yield a fractional value in the target unit.
func (FractionalValueError) Error ¶
func (e FractionalValueError) Error() string
Error implements the error interface.
type IncompatibleUnitsError ¶
IncompatibleUnitsError is returned by ValueWithUnit.ConvertTo() when the original and target unit are incompatible and cannot be converted into each other.
func (IncompatibleUnitsError) Error ¶
func (e IncompatibleUnitsError) Error() string
Error implements the error interface.
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 ¶
Unit enumerates allowed values for the unit a resource's quota/usage is measured in.
const ( UnitNone Unit = liquid.UnitNone UnitBytes Unit = liquid.UnitBytes UnitKibibytes Unit = liquid.UnitKibibytes UnitMebibytes Unit = liquid.UnitMebibytes UnitGibibytes Unit = liquid.UnitGibibytes UnitTebibytes Unit = liquid.UnitTebibytes UnitPebibytes Unit = liquid.UnitPebibytes UnitExbibytes Unit = liquid.UnitExbibytes UnitUnspecified Unit = liquid.UnitUnspecified )
type UnixEncodedTime ¶ added in v1.4.0
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 struct { Value uint64 `json:"value" yaml:"value"` Unit Unit `json:"unit" yaml:"unit"` }
ValueWithUnit is used to represent values with units in subresources.
func (ValueWithUnit) ConvertTo ¶
func (v ValueWithUnit) ConvertTo(u Unit) (ValueWithUnit, error)
ConvertTo returns an equal value in the given Unit. IncompatibleUnitsError is returned if the source unit cannot be converted into the target unit. FractionalValueError is returned if the conversion does not yield an integer value in the new unit.
func (ValueWithUnit) String ¶
func (v ValueWithUnit) String() string
String appends the unit (if any) to the given value. This should only be used for error messages; actual UIs should be more clever about formatting values (e.g. ValueWithUnit{1048576,UnitMebibytes}.String() returns "1048576 MiB" where "1 TiB" would be more appropriate).
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. |