Estimate VM Update Cost
client.Compute.VMs.Cost.Update(ctx, vmID, body) (*CostQuoteUpdate, error)
PATCH/v1/compute/vms/{vm_id}/cost
Return a priced cost quote for the proposed VM update plus a diff against the current state.
Estimate VM Update Cost
package main
import (
"context"
"fmt"
"github.com/nirvana-labs/nirvana-go"
"github.com/nirvana-labs/nirvana-go/compute"
"github.com/nirvana-labs/nirvana-go/option"
)
func main() {
client := nirvana.NewClient(
option.WithAPIKey("My API Key"),
)
costQuoteUpdate, err := client.Compute.VMs.Cost.Update(
context.TODO(),
"vm_id",
compute.VMCostUpdateParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", costQuoteUpdate.After)
}
{
"after": {
"monthly_total": "-69125",
"usage_dimensions": [
{
"dimension": "compute_vcpu",
"dimension_display_name": "vCPU (hours)",
"monthly_amount": "-69125",
"quantity": 4,
"unit_price": "-69125"
}
]
},
"before": {
"monthly_total": "-69125",
"usage_dimensions": [
{
"dimension": "compute_vcpu",
"dimension_display_name": "vCPU (hours)",
"monthly_amount": "-69125",
"quantity": 4,
"unit_price": "-69125"
}
]
},
"currency": "USD",
"diff": {
"monthly_total_delta": "-69125",
"usage_dimensions": [
{
"after": {
"monthly_amount": "-69125",
"quantity": 4,
"unit_price": "-69125"
},
"before": {
"monthly_amount": "-69125",
"quantity": 4,
"unit_price": "-69125"
},
"dimension": "compute_vcpu",
"dimension_display_name": "vCPU (hours)",
"monthly_amount_delta": "-69125"
}
]
},
"priced_at": "2025-01-01T00:00:00Z"
}Returns Examples
{
"after": {
"monthly_total": "-69125",
"usage_dimensions": [
{
"dimension": "compute_vcpu",
"dimension_display_name": "vCPU (hours)",
"monthly_amount": "-69125",
"quantity": 4,
"unit_price": "-69125"
}
]
},
"before": {
"monthly_total": "-69125",
"usage_dimensions": [
{
"dimension": "compute_vcpu",
"dimension_display_name": "vCPU (hours)",
"monthly_amount": "-69125",
"quantity": 4,
"unit_price": "-69125"
}
]
},
"currency": "USD",
"diff": {
"monthly_total_delta": "-69125",
"usage_dimensions": [
{
"after": {
"monthly_amount": "-69125",
"quantity": 4,
"unit_price": "-69125"
},
"before": {
"monthly_amount": "-69125",
"quantity": 4,
"unit_price": "-69125"
},
"dimension": "compute_vcpu",
"dimension_display_name": "vCPU (hours)",
"monthly_amount_delta": "-69125"
}
]
},
"priced_at": "2025-01-01T00:00:00Z"
}