Documentation
¶
Index ¶
- Constants
- type CostQuote
- type CostQuoteUpdate
- type CostQuoteUpdateAfter
- type CostQuoteUpdateAfterUsageDimension
- type CostQuoteUpdateBefore
- type CostQuoteUpdateBeforeUsageDimension
- type CostQuoteUpdateDiff
- type CostQuoteUpdateDiffUsageDimension
- type CostQuoteUpdateDiffUsageDimensionAfter
- type CostQuoteUpdateDiffUsageDimensionBefore
- type CostQuoteUsageDimension
- type Error
- type Pagination
- type RegionName
- type ResourceStatus
- type SourceIPRuleParam
- type SourceIPRuleResponse
- type Usage
- type UsageDimension
- type UsageDimensionLeaf
- type UsageList
- type UsageListParams
- type UsageResourceType
- type UsageService
- func (r *UsageService) Get(ctx context.Context, resourceID string, opts ...option.RequestOption) (res *Usage, err error)
- func (r *UsageService) List(ctx context.Context, query UsageListParams, opts ...option.RequestOption) (res *pagination.Cursor[Usage], err error)
- func (r *UsageService) ListAutoPaging(ctx context.Context, query UsageListParams, opts ...option.RequestOption) *pagination.CursorAutoPager[Usage]
Constants ¶
const RegionNameUsSva2 = shared.RegionNameUsSva2
Equals "us-sva-2"
const ResourceStatusCreating = shared.ResourceStatusCreating
Equals "creating"
const ResourceStatusDeleted = shared.ResourceStatusDeleted
Equals "deleted"
const ResourceStatusDeleting = shared.ResourceStatusDeleting
Equals "deleting"
const ResourceStatusError = shared.ResourceStatusError
Equals "error"
const ResourceStatusPending = shared.ResourceStatusPending
Equals "pending"
const ResourceStatusReady = shared.ResourceStatusReady
Equals "ready"
const ResourceStatusUpdating = shared.ResourceStatusUpdating
Equals "updating"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CostQuote ¶ added in v1.88.6
Cost quote returned by POST /cost.
This is an alias to an internal type.
type CostQuoteUpdate ¶ added in v1.88.6
type CostQuoteUpdate = shared.CostQuoteUpdate
Cost quote returned by PATCH /:id/cost: the current-state quote, the post-update quote, and the signed diff.
This is an alias to an internal type.
type CostQuoteUpdateAfter ¶ added in v1.88.6
type CostQuoteUpdateAfter = shared.CostQuoteUpdateAfter
Quote for the proposed (post-update) resource state.
This is an alias to an internal type.
type CostQuoteUpdateAfterUsageDimension ¶ added in v1.88.6
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 ¶ added in v1.88.6
type CostQuoteUpdateBefore = shared.CostQuoteUpdateBefore
Quote for the proposed (post-update) resource state.
This is an alias to an internal type.
type CostQuoteUpdateBeforeUsageDimension ¶ added in v1.88.6
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 ¶ added in v1.88.6
type CostQuoteUpdateDiff = shared.CostQuoteUpdateDiff
Per-dimension and total deltas: after minus before.
This is an alias to an internal type.
type CostQuoteUpdateDiffUsageDimension ¶ added in v1.88.6
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 ¶ added in v1.88.6
type CostQuoteUpdateDiffUsageDimensionAfter = shared.CostQuoteUpdateDiffUsageDimensionAfter
Priced row after the update. Always present.
This is an alias to an internal type.
type CostQuoteUpdateDiffUsageDimensionBefore ¶ added in v1.88.6
type CostQuoteUpdateDiffUsageDimensionBefore = shared.CostQuoteUpdateDiffUsageDimensionBefore
Priced row after the update. Always present.
This is an alias to an internal type.
type CostQuoteUsageDimension ¶ added in v1.88.6
type CostQuoteUsageDimension = shared.CostQuoteUsageDimension
Priced row for a single usage dimension emitted by a resource.
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".
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", "connect_connection", "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) UnmarshalJSON ¶
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) UnmarshalJSON ¶
type UsageListParams ¶
type UsageListParams struct {
// Pagination cursor returned by a previous request
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
// Maximum number of items to return
Limit param.Opt[int64] `query:"limit,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 UsageResourceType ¶
type UsageResourceType string
Kind of metered resource a ledger row belongs to.
const ( UsageResourceTypeVM UsageResourceType = "vm" UsageResourceTypeVolume UsageResourceType = "volume" UsageResourceTypeVPC UsageResourceType = "vpc" UsageResourceTypeConnectConnection UsageResourceType = "connect_connection" 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 ¶
func (r *UsageService) ListAutoPaging(ctx context.Context, query UsageListParams, opts ...option.RequestOption) *pagination.CursorAutoPager[Usage]
List per-resource usage records for the current organization. Each item is one resource with its nested dimension history (active and closed segments).