usage

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 16 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const RegionNameUsSva2 = shared.RegionNameUsSva2

Equals "us-sva-2"

View Source
const RegionNameUsWdc1 = shared.RegionNameUsWdc1

Equals "us-wdc-1"

View Source
const ResourceStatusCreating = shared.ResourceStatusCreating

Equals "creating"

View Source
const ResourceStatusDeleted = shared.ResourceStatusDeleted

Equals "deleted"

View Source
const ResourceStatusDeleting = shared.ResourceStatusDeleting

Equals "deleting"

View Source
const ResourceStatusError = shared.ResourceStatusError

Equals "error"

View Source
const ResourceStatusPending = shared.ResourceStatusPending

Equals "pending"

View Source
const ResourceStatusReady = shared.ResourceStatusReady

Equals "ready"

View Source
const ResourceStatusUpdating = shared.ResourceStatusUpdating

Equals "updating"

View Source
const VMMetricUnitBytes = shared.VMMetricUnitBytes

Equals "bytes"

View Source
const VMMetricUnitBytesPerSecond = shared.VMMetricUnitBytesPerSecond

Equals "bytes_per_second"

View Source
const VMMetricUnitCores = shared.VMMetricUnitCores

Equals "cores"

View Source
const VMMetricUnitOperationsPerSecond = shared.VMMetricUnitOperationsPerSecond

Equals "operations_per_second"

View Source
const VMMetricUnitRatio = shared.VMMetricUnitRatio

Equals "ratio"

Variables

This section is empty.

Functions

This section is empty.

Types

type CostQuote

type CostQuote = shared.CostQuote

Cost quote returned by POST /cost. current_summary and updated_summary hold the org billing summary now and with this resource; omitted when the caller cannot view billing.

This is an alias to an internal type.

type CostQuoteUpdate

type CostQuoteUpdate = shared.CostQuoteUpdate

Cost quote returned by PATCH /:id/cost: current-state quote, post-update quote, and signed diff. current_summary and updated_summary omitted when the caller cannot view billing.

This is an alias to an internal type.

type CostQuoteUpdateAfter

type CostQuoteUpdateAfter = shared.CostQuoteUpdateAfter

Quote for the proposed (post-update) resource state.

This is an alias to an internal type.

type CostQuoteUpdateAfterUsageDimension

type CostQuoteUpdateAfterUsageDimension = shared.CostQuoteUpdateAfterUsageDimension

Priced row for a single usage dimension emitted by a resource.

This is an alias to an internal type.

type CostQuoteUpdateBefore

type CostQuoteUpdateBefore = shared.CostQuoteUpdateBefore

Quote for the proposed (post-update) resource state.

This is an alias to an internal type.

type CostQuoteUpdateBeforeUsageDimension

type CostQuoteUpdateBeforeUsageDimension = shared.CostQuoteUpdateBeforeUsageDimension

Priced row for a single usage dimension emitted by a resource.

This is an alias to an internal type.

type CostQuoteUpdateDiff

type CostQuoteUpdateDiff = shared.CostQuoteUpdateDiff

Per-dimension and total deltas: after minus before.

This is an alias to an internal type.

type CostQuoteUpdateDiffUsageDimension

type CostQuoteUpdateDiffUsageDimension = shared.CostQuoteUpdateDiffUsageDimension

Per-dimension diff entry. Both before and after are always present.

This is an alias to an internal type.

type CostQuoteUpdateDiffUsageDimensionAfter

type CostQuoteUpdateDiffUsageDimensionAfter = shared.CostQuoteUpdateDiffUsageDimensionAfter

Priced row after the update. Always present.

This is an alias to an internal type.

type CostQuoteUpdateDiffUsageDimensionBefore

type CostQuoteUpdateDiffUsageDimensionBefore = shared.CostQuoteUpdateDiffUsageDimensionBefore

Priced row after the update. Always present.

This is an alias to an internal type.

type CostQuoteUsageDimension

type CostQuoteUsageDimension = shared.CostQuoteUsageDimension

Priced row for a single usage dimension emitted by a resource.

This is an alias to an internal type.

type Error

type Error = apierror.Error

type OrganizationBillingSummary

type OrganizationBillingSummary = shared.OrganizationBillingSummary

Forward-looking billing summary for an organization. All costs are run-rate projections from the organization's current active usage ("≈ $X/mo at current usage").

This is an alias to an internal type.

type Pagination

type Pagination = shared.Pagination

Pagination response details.

This is an alias to an internal type.

type RegionName

type RegionName = shared.RegionName

Region the resource is in.

This is an alias to an internal type.

type ResourceStatus

type ResourceStatus = shared.ResourceStatus

Status of the resource.

This is an alias to an internal type.

type SourceIPRuleParam

type SourceIPRuleParam = shared.SourceIPRuleParam

IP filter rules.

This is an alias to an internal type.

type SourceIPRuleResponse

type SourceIPRuleResponse = shared.SourceIPRuleResponse

IP filter rules.

This is an alias to an internal type.

type Usage

type Usage struct {
	Dimensions []UsageDimension `json:"dimensions" api:"required"`
	EndedAt    string           `json:"ended_at" api:"required"`
	ProjectID  string           `json:"project_id" api:"required"`
	// Region the resource is in.
	//
	// Any of "us-sva-2", "us-wdc-1".
	Region     shared.RegionName `json:"region" api:"required"`
	ResourceID string            `json:"resource_id" api:"required"`
	// Kind of metered resource a ledger row belongs to.
	//
	// Any of "vm", "volume", "vpc", "nks_cluster", "nks_node_pool",
	// "nks_load_balancer".
	ResourceType UsageResourceType `json:"resource_type" api:"required"`
	StartedAt    string            `json:"started_at" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Dimensions   respjson.Field
		EndedAt      respjson.Field
		ProjectID    respjson.Field
		Region       respjson.Field
		ResourceID   respjson.Field
		ResourceType respjson.Field
		StartedAt    respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Usage record for a single metered resource.

func (Usage) RawJSON

func (r Usage) RawJSON() string

Returns the unmodified JSON received from the API

func (*Usage) UnmarshalJSON

func (r *Usage) UnmarshalJSON(data []byte) error

type UsageDimension

type UsageDimension struct {
	ID        string               `json:"id" api:"required"`
	Dimension string               `json:"dimension" api:"required"`
	EndedAt   string               `json:"ended_at" api:"required"`
	Quantity  int64                `json:"quantity" api:"required"`
	StartedAt string               `json:"started_at" api:"required"`
	Children  []UsageDimensionLeaf `json:"children"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Dimension   respjson.Field
		EndedAt     respjson.Field
		Quantity    respjson.Field
		StartedAt   respjson.Field
		Children    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Top-level dimension entry; bundle heads expand via children.

func (UsageDimension) RawJSON

func (r UsageDimension) RawJSON() string

Returns the unmodified JSON received from the API

func (*UsageDimension) UnmarshalJSON

func (r *UsageDimension) UnmarshalJSON(data []byte) error

type UsageDimensionLeaf

type UsageDimensionLeaf struct {
	ID        string `json:"id" api:"required"`
	Dimension string `json:"dimension" api:"required"`
	EndedAt   string `json:"ended_at" api:"required"`
	Quantity  int64  `json:"quantity" api:"required"`
	StartedAt string `json:"started_at" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Dimension   respjson.Field
		EndedAt     respjson.Field
		Quantity    respjson.Field
		StartedAt   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

One ledger segment for a (resource, dimension) pair.

func (UsageDimensionLeaf) RawJSON

func (r UsageDimensionLeaf) RawJSON() string

Returns the unmodified JSON received from the API

func (*UsageDimensionLeaf) UnmarshalJSON

func (r *UsageDimensionLeaf) UnmarshalJSON(data []byte) error

type UsageList

type UsageList struct {
	Items []Usage `json:"items" api:"required"`
	// Pagination response details.
	Pagination shared.Pagination `json:"pagination" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Items       respjson.Field
		Pagination  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UsageList) RawJSON

func (r UsageList) RawJSON() string

Returns the unmodified JSON received from the API

func (*UsageList) UnmarshalJSON

func (r *UsageList) UnmarshalJSON(data []byte) error

type UsageListParams

type UsageListParams struct {
	// Only resources metered at or before this RFC 3339 instant
	ActiveAtMax param.Opt[time.Time] `query:"active_at_max,omitzero" format:"date-time" json:"-"`
	// Only resources metered at or after this RFC 3339 instant; a window a usage row
	// must overlap
	ActiveAtMin param.Opt[time.Time] `query:"active_at_min,omitzero" format:"date-time" json:"-"`
	// Pagination cursor returned by a previous request. Only valid for the same
	// filters and sort order.
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	// Only resources with usage in this dimension
	Dimension param.Opt[string] `query:"dimension,omitzero" json:"-"`
	// Maximum number of items to return
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Filter by region
	Region param.Opt[string] `query:"region,omitzero" json:"-"`
	// Filter by a single resource
	ResourceID param.Opt[string] `query:"resource_id,omitzero" json:"-"`
	// Sort term as field:asc or field:desc. Field: created_at, the resource's earliest
	// usage row matching the filters
	Sort param.Opt[string] `query:"sort,omitzero" json:"-"`
	// Filter by the kind of resource metered
	//
	// Any of "vm", "volume", "vpc", "nks_cluster", "nks_node_pool",
	// "nks_load_balancer".
	ResourceType UsageListParamsResourceType `query:"resource_type,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (UsageListParams) URLQuery

func (r UsageListParams) URLQuery() (v url.Values, err error)

URLQuery serializes UsageListParams's query parameters as `url.Values`.

type UsageListParamsResourceType

type UsageListParamsResourceType string

Filter by the kind of resource metered

const (
	UsageListParamsResourceTypeVM              UsageListParamsResourceType = "vm"
	UsageListParamsResourceTypeVolume          UsageListParamsResourceType = "volume"
	UsageListParamsResourceTypeVPC             UsageListParamsResourceType = "vpc"
	UsageListParamsResourceTypeNKSCluster      UsageListParamsResourceType = "nks_cluster"
	UsageListParamsResourceTypeNKSNodePool     UsageListParamsResourceType = "nks_node_pool"
	UsageListParamsResourceTypeNKSLoadBalancer UsageListParamsResourceType = "nks_load_balancer"
)

type UsageResourceType

type UsageResourceType string

Kind of metered resource a ledger row belongs to.

const (
	UsageResourceTypeVM              UsageResourceType = "vm"
	UsageResourceTypeVolume          UsageResourceType = "volume"
	UsageResourceTypeVPC             UsageResourceType = "vpc"
	UsageResourceTypeNKSCluster      UsageResourceType = "nks_cluster"
	UsageResourceTypeNKSNodePool     UsageResourceType = "nks_node_pool"
	UsageResourceTypeNKSLoadBalancer UsageResourceType = "nks_load_balancer"
)

type UsageService

type UsageService struct {
	Options []option.RequestOption
}

UsageService contains methods and other services that help with interacting with the Nirvana Labs API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewUsageService method instead.

func NewUsageService

func NewUsageService(opts ...option.RequestOption) (r UsageService)

NewUsageService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*UsageService) Get

func (r *UsageService) Get(ctx context.Context, resourceID string, opts ...option.RequestOption) (res *Usage, err error)

Get the usage record for a single resource (metadata plus dimension history) for the current organization.

func (*UsageService) List

func (r *UsageService) List(ctx context.Context, query UsageListParams, opts ...option.RequestOption) (res *pagination.Cursor[Usage], err error)

List per-resource usage records for the current organization. Each item is one resource with its nested dimension history (active and closed segments).

func (*UsageService) ListAutoPaging

List per-resource usage records for the current organization. Each item is one resource with its nested dimension history (active and closed segments).

type VMMetricUnit

type VMMetricUnit = shared.VMMetricUnit

Unit the values are expressed in.

This is an alias to an internal type.

Jump to

Keyboard shortcuts

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