Documentation
¶
Index ¶
- Constants
- type CPUConfig
- type ComputeService
- 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 MemoryConfig
- type OSImage
- type OrganizationBillingSummary
- type OrganizationBillingSummaryPromotionalCredit
- type Pagination
- type RegionName
- type ResourceStatus
- type SSHKeyRequestParam
- type SourceIPRuleParam
- type SourceIPRuleResponse
- type VM
- type VMAvailabilityNewParams
- type VMAvailabilityNewParamsBootVolume
- type VMAvailabilityNewParamsDataVolume
- type VMAvailabilityService
- type VMAvailabilityUpdateParams
- type VMCostNewParams
- type VMCostNewParamsBootVolume
- type VMCostNewParamsDataVolume
- type VMCostService
- type VMCostUpdateParams
- type VMList
- type VMListParams
- type VMListParamsStatus
- type VMMetricDescriptor
- type VMMetricDescriptorList
- type VMMetricDescriptorService
- type VMMetricListParams
- type VMMetricListParamsAggregation
- type VMMetricListParamsPeriod
- type VMMetricPoint
- type VMMetricSeries
- type VMMetricService
- type VMMetricUnit
- type VMMetrics
- type VMMetricsAggregation
- type VMMetricsPeriod
- type VMNewParams
- type VMNewParamsBootVolume
- type VMNewParamsDataVolume
- type VMOSImageListParams
- type VMOSImageService
- func (r *VMOSImageService) List(ctx context.Context, query VMOSImageListParams, opts ...option.RequestOption) (res *pagination.Cursor[OSImage], err error)
- func (r *VMOSImageService) ListAutoPaging(ctx context.Context, query VMOSImageListParams, opts ...option.RequestOption) *pagination.CursorAutoPager[OSImage]
- type VMService
- func (r *VMService) Delete(ctx context.Context, vmID string, opts ...option.RequestOption) (res *operations.Operation, err error)
- func (r *VMService) Get(ctx context.Context, vmID string, opts ...option.RequestOption) (res *VM, err error)
- func (r *VMService) List(ctx context.Context, query VMListParams, opts ...option.RequestOption) (res *pagination.Cursor[VM], err error)
- func (r *VMService) ListAutoPaging(ctx context.Context, query VMListParams, opts ...option.RequestOption) *pagination.CursorAutoPager[VM]
- func (r *VMService) New(ctx context.Context, body VMNewParams, opts ...option.RequestOption) (res *operations.Operation, err error)
- func (r *VMService) Restart(ctx context.Context, vmID string, opts ...option.RequestOption) (res *operations.Operation, err error)
- func (r *VMService) Update(ctx context.Context, vmID string, body VMUpdateParams, ...) (res *operations.Operation, err error)
- type VMUpdateParams
- type VMVolumeListParams
- type VMVolumeListParamsKind
- type VMVolumeListParamsStatus
- type VMVolumeListParamsType
- type VMVolumeService
- type Volume
- type VolumeAttachParams
- type VolumeAvailabilityNewParams
- type VolumeAvailabilityService
- type VolumeAvailabilityUpdateParams
- type VolumeCostNewParams
- type VolumeCostService
- type VolumeCostUpdateParams
- type VolumeKind
- type VolumeList
- type VolumeListParams
- type VolumeListParamsKind
- type VolumeListParamsStatus
- type VolumeListParamsType
- type VolumeNewParams
- type VolumeService
- func (r *VolumeService) Attach(ctx context.Context, volumeID string, body VolumeAttachParams, ...) (res *operations.Operation, err error)
- func (r *VolumeService) Delete(ctx context.Context, volumeID string, opts ...option.RequestOption) (res *operations.Operation, err error)
- func (r *VolumeService) Detach(ctx context.Context, volumeID string, opts ...option.RequestOption) (res *operations.Operation, err error)
- func (r *VolumeService) Get(ctx context.Context, volumeID string, opts ...option.RequestOption) (res *Volume, err error)
- func (r *VolumeService) List(ctx context.Context, query VolumeListParams, opts ...option.RequestOption) (res *pagination.Cursor[Volume], err error)
- func (r *VolumeService) ListAutoPaging(ctx context.Context, query VolumeListParams, opts ...option.RequestOption) *pagination.CursorAutoPager[Volume]
- func (r *VolumeService) New(ctx context.Context, body VolumeNewParams, opts ...option.RequestOption) (res *operations.Operation, err error)
- func (r *VolumeService) Update(ctx context.Context, volumeID string, body VolumeUpdateParams, ...) (res *operations.Operation, err error)
- type VolumeType
- type VolumeUpdateParams
Constants ¶
const RegionNameUsSva2 = shared.RegionNameUsSva2
Equals "us-sva-2"
const RegionNameUsWdc1 = shared.RegionNameUsWdc1
Equals "us-wdc-1"
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 ResourceStatusSuspended = shared.ResourceStatusSuspended
Equals "suspended"
const ResourceStatusUpdating = shared.ResourceStatusUpdating
Equals "updating"
const VMMetricUnitBytes = shared.VMMetricUnitBytes
Equals "bytes"
const VMMetricUnitBytesPerSecond = shared.VMMetricUnitBytesPerSecond
Equals "bytes_per_second"
const VMMetricUnitCores = shared.VMMetricUnitCores
Equals "cores"
const VMMetricUnitOperationsPerSecond = shared.VMMetricUnitOperationsPerSecond
Equals "operations_per_second"
const VMMetricUnitRatio = shared.VMMetricUnitRatio
Equals "ratio"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CPUConfig ¶
type CPUConfig struct {
// Number of virtual CPUs.
Vcpu int64 `json:"vcpu" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Vcpu respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
CPU configuration for the VM.
func (*CPUConfig) UnmarshalJSON ¶
type ComputeService ¶
type ComputeService struct {
Options []option.RequestOption
VMs VMService
Volumes VolumeService
}
ComputeService 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 NewComputeService method instead.
func NewComputeService ¶
func NewComputeService(opts ...option.RequestOption) (r ComputeService)
NewComputeService 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.
type 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 MemoryConfig ¶
type MemoryConfig struct {
// Size of the memory in GB.
Size int64 `json:"size" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Size respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Memory configuration for the VM.
func (MemoryConfig) RawJSON ¶
func (r MemoryConfig) RawJSON() string
Returns the unmodified JSON received from the API
func (*MemoryConfig) UnmarshalJSON ¶
func (r *MemoryConfig) UnmarshalJSON(data []byte) error
type OSImage ¶
type OSImage struct {
// When the OS Image was created.
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Display name of the OS Image.
DisplayName string `json:"display_name" api:"required"`
// Name of the OS Image.
Name string `json:"name" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreatedAt respjson.Field
DisplayName respjson.Field
Name respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
OS Image details.
func (*OSImage) UnmarshalJSON ¶
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 OrganizationBillingSummaryPromotionalCredit ¶ added in v3.2.3
type OrganizationBillingSummaryPromotionalCredit = shared.OrganizationBillingSummaryPromotionalCredit
Where an organization stands on one credit it can earn automatically.
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 SSHKeyRequestParam ¶
type SSHKeyRequestParam struct {
// Public key to and use to access the VM.
PublicKey string `json:"public_key" api:"required"`
// contains filtered or unexported fields
}
Public SSH key configuration for the VM.
The property PublicKey is required.
func (SSHKeyRequestParam) MarshalJSON ¶
func (r SSHKeyRequestParam) MarshalJSON() (data []byte, err error)
func (*SSHKeyRequestParam) UnmarshalJSON ¶
func (r *SSHKeyRequestParam) UnmarshalJSON(data []byte) error
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 VM ¶
type VM struct {
// Unique identifier for the VM.
ID string `json:"id" api:"required"`
// ID of the boot volume attached to the VM.
BootVolumeID string `json:"boot_volume_id" api:"required"`
// CPU configuration for the VM.
CPUConfig CPUConfig `json:"cpu_config" api:"required"`
// When the VM was created.
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// IDs of the data volumes attached to the VM.
DataVolumeIDs []string `json:"data_volume_ids" api:"required"`
// Memory configuration for the VM.
MemoryConfig MemoryConfig `json:"memory_config" api:"required"`
// Name of the VM.
Name string `json:"name" api:"required"`
// Private IP of the VM.
PrivateIP string `json:"private_ip" api:"required"`
// Project ID the VM belongs to.
ProjectID string `json:"project_id" api:"required"`
// Public IP of the VM.
PublicIP string `json:"public_ip" api:"required"`
// Whether the public IP is enabled for the VM.
PublicIPEnabled bool `json:"public_ip_enabled" api:"required"`
// Region the resource is in.
//
// Any of "us-sva-2", "us-wdc-1".
Region shared.RegionName `json:"region" api:"required"`
// Status of the resource.
//
// Any of "pending", "creating", "updating", "ready", "deleting", "deleted",
// "error", "suspended".
Status shared.ResourceStatus `json:"status" api:"required"`
// ID of the subnet the VM is in.
SubnetID string `json:"subnet_id" api:"required"`
// Tags to attach to the VM.
Tags []string `json:"tags" api:"required"`
// When the VM was updated.
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// ID of the VPC the VM is in.
VPCID string `json:"vpc_id" api:"required"`
// Name of the VPC the VM is in.
VPCName string `json:"vpc_name" api:"required"`
// Instance type name.
InstanceType string `json:"instance_type" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
BootVolumeID respjson.Field
CPUConfig respjson.Field
CreatedAt respjson.Field
DataVolumeIDs respjson.Field
MemoryConfig respjson.Field
Name respjson.Field
PrivateIP respjson.Field
ProjectID respjson.Field
PublicIP respjson.Field
PublicIPEnabled respjson.Field
Region respjson.Field
Status respjson.Field
SubnetID respjson.Field
Tags respjson.Field
UpdatedAt respjson.Field
VPCID respjson.Field
VPCName respjson.Field
InstanceType respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
VM details.
func (*VM) UnmarshalJSON ¶
type VMAvailabilityNewParams ¶
type VMAvailabilityNewParams struct {
// Boot volume for the VM.
BootVolume VMAvailabilityNewParamsBootVolume `json:"boot_volume,omitzero" api:"required"`
// Instance type name.
InstanceType string `json:"instance_type" api:"required"`
// Name of the VM.
Name string `json:"name" api:"required"`
// Name of the OS Image to use for the VM.
OSImageName string `json:"os_image_name" api:"required"`
// Project ID to create the VM in.
ProjectID string `json:"project_id" api:"required"`
// Whether to enable public IP for the VM.
PublicIPEnabled bool `json:"public_ip_enabled" api:"required"`
// Region the resource is in.
//
// Any of "us-sva-2", "us-wdc-1".
Region shared.RegionName `json:"region,omitzero" api:"required"`
// Public SSH key configuration for the VM.
SSHKey SSHKeyRequestParam `json:"ssh_key,omitzero" api:"required"`
// ID of the subnet to use for the VM.
SubnetID string `json:"subnet_id" api:"required"`
// Data volumes for the VM.
DataVolumes []VMAvailabilityNewParamsDataVolume `json:"data_volumes,omitzero"`
// Tags to attach to the VM.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (VMAvailabilityNewParams) MarshalJSON ¶
func (r VMAvailabilityNewParams) MarshalJSON() (data []byte, err error)
func (*VMAvailabilityNewParams) UnmarshalJSON ¶
func (r *VMAvailabilityNewParams) UnmarshalJSON(data []byte) error
type VMAvailabilityNewParamsBootVolume ¶
type VMAvailabilityNewParamsBootVolume struct {
// Size of the Volume in GB.
Size int64 `json:"size" api:"required"`
// Type of the Volume.
//
// Any of "nvme", "abs", "ceph".
Type VolumeType `json:"type,omitzero" api:"required"`
// Tags to attach to the Volume.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
Boot volume for the VM.
The properties Size, Type are required.
func (VMAvailabilityNewParamsBootVolume) MarshalJSON ¶
func (r VMAvailabilityNewParamsBootVolume) MarshalJSON() (data []byte, err error)
func (*VMAvailabilityNewParamsBootVolume) UnmarshalJSON ¶
func (r *VMAvailabilityNewParamsBootVolume) UnmarshalJSON(data []byte) error
type VMAvailabilityNewParamsDataVolume ¶
type VMAvailabilityNewParamsDataVolume struct {
// Name of the Volume.
Name string `json:"name" api:"required"`
// Size of the Volume in GB.
Size int64 `json:"size" api:"required"`
// Type of the Volume.
//
// Any of "nvme", "abs", "ceph".
Type VolumeType `json:"type,omitzero" api:"required"`
// Tags to attach to the Volume.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
VM data volume create request.
The properties Name, Size, Type are required.
func (VMAvailabilityNewParamsDataVolume) MarshalJSON ¶
func (r VMAvailabilityNewParamsDataVolume) MarshalJSON() (data []byte, err error)
func (*VMAvailabilityNewParamsDataVolume) UnmarshalJSON ¶
func (r *VMAvailabilityNewParamsDataVolume) UnmarshalJSON(data []byte) error
type VMAvailabilityService ¶
type VMAvailabilityService struct {
Options []option.RequestOption
}
VMAvailabilityService 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 NewVMAvailabilityService method instead.
func NewVMAvailabilityService ¶
func NewVMAvailabilityService(opts ...option.RequestOption) (r VMAvailabilityService)
NewVMAvailabilityService 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 (*VMAvailabilityService) New ¶
func (r *VMAvailabilityService) New(ctx context.Context, body VMAvailabilityNewParams, opts ...option.RequestOption) (err error)
Check VM Create Availability
func (*VMAvailabilityService) Update ¶
func (r *VMAvailabilityService) Update(ctx context.Context, vmID string, body VMAvailabilityUpdateParams, opts ...option.RequestOption) (err error)
Check VM Update Availability
type VMAvailabilityUpdateParams ¶
type VMAvailabilityUpdateParams struct {
// Instance type name.
InstanceType param.Opt[string] `json:"instance_type,omitzero"`
// Name of the VM.
Name param.Opt[string] `json:"name,omitzero"`
// Whether to enable public IP for the VM.
PublicIPEnabled param.Opt[bool] `json:"public_ip_enabled,omitzero"`
// Tags to attach to the VM.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (VMAvailabilityUpdateParams) MarshalJSON ¶
func (r VMAvailabilityUpdateParams) MarshalJSON() (data []byte, err error)
func (*VMAvailabilityUpdateParams) UnmarshalJSON ¶
func (r *VMAvailabilityUpdateParams) UnmarshalJSON(data []byte) error
type VMCostNewParams ¶
type VMCostNewParams struct {
// Boot volume for the VM.
BootVolume VMCostNewParamsBootVolume `json:"boot_volume,omitzero" api:"required"`
// Instance type name.
InstanceType string `json:"instance_type" api:"required"`
// Name of the VM.
Name string `json:"name" api:"required"`
// Name of the OS Image to use for the VM.
OSImageName string `json:"os_image_name" api:"required"`
// Project ID to create the VM in.
ProjectID string `json:"project_id" api:"required"`
// Whether to enable public IP for the VM.
PublicIPEnabled bool `json:"public_ip_enabled" api:"required"`
// Region the resource is in.
//
// Any of "us-sva-2", "us-wdc-1".
Region shared.RegionName `json:"region,omitzero" api:"required"`
// Public SSH key configuration for the VM.
SSHKey SSHKeyRequestParam `json:"ssh_key,omitzero" api:"required"`
// ID of the subnet to use for the VM.
SubnetID string `json:"subnet_id" api:"required"`
// Data volumes for the VM.
DataVolumes []VMCostNewParamsDataVolume `json:"data_volumes,omitzero"`
// Tags to attach to the VM.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (VMCostNewParams) MarshalJSON ¶
func (r VMCostNewParams) MarshalJSON() (data []byte, err error)
func (*VMCostNewParams) UnmarshalJSON ¶
func (r *VMCostNewParams) UnmarshalJSON(data []byte) error
type VMCostNewParamsBootVolume ¶
type VMCostNewParamsBootVolume struct {
// Size of the Volume in GB.
Size int64 `json:"size" api:"required"`
// Type of the Volume.
//
// Any of "nvme", "abs", "ceph".
Type VolumeType `json:"type,omitzero" api:"required"`
// Tags to attach to the Volume.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
Boot volume for the VM.
The properties Size, Type are required.
func (VMCostNewParamsBootVolume) MarshalJSON ¶
func (r VMCostNewParamsBootVolume) MarshalJSON() (data []byte, err error)
func (*VMCostNewParamsBootVolume) UnmarshalJSON ¶
func (r *VMCostNewParamsBootVolume) UnmarshalJSON(data []byte) error
type VMCostNewParamsDataVolume ¶
type VMCostNewParamsDataVolume struct {
// Name of the Volume.
Name string `json:"name" api:"required"`
// Size of the Volume in GB.
Size int64 `json:"size" api:"required"`
// Type of the Volume.
//
// Any of "nvme", "abs", "ceph".
Type VolumeType `json:"type,omitzero" api:"required"`
// Tags to attach to the Volume.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
VM data volume create request.
The properties Name, Size, Type are required.
func (VMCostNewParamsDataVolume) MarshalJSON ¶
func (r VMCostNewParamsDataVolume) MarshalJSON() (data []byte, err error)
func (*VMCostNewParamsDataVolume) UnmarshalJSON ¶
func (r *VMCostNewParamsDataVolume) UnmarshalJSON(data []byte) error
type VMCostService ¶
type VMCostService struct {
Options []option.RequestOption
}
VMCostService 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 NewVMCostService method instead.
func NewVMCostService ¶
func NewVMCostService(opts ...option.RequestOption) (r VMCostService)
NewVMCostService 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 (*VMCostService) New ¶
func (r *VMCostService) New(ctx context.Context, body VMCostNewParams, opts ...option.RequestOption) (res *shared.CostQuote, err error)
Return a priced cost quote for the proposed VM.
func (*VMCostService) Update ¶
func (r *VMCostService) Update(ctx context.Context, vmID string, body VMCostUpdateParams, opts ...option.RequestOption) (res *shared.CostQuoteUpdate, err error)
Return a priced cost quote for the proposed VM update plus a diff against the current state.
type VMCostUpdateParams ¶
type VMCostUpdateParams struct {
// Instance type name.
InstanceType param.Opt[string] `json:"instance_type,omitzero"`
// Name of the VM.
Name param.Opt[string] `json:"name,omitzero"`
// Whether to enable public IP for the VM.
PublicIPEnabled param.Opt[bool] `json:"public_ip_enabled,omitzero"`
// Tags to attach to the VM.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (VMCostUpdateParams) MarshalJSON ¶
func (r VMCostUpdateParams) MarshalJSON() (data []byte, err error)
func (*VMCostUpdateParams) UnmarshalJSON ¶
func (r *VMCostUpdateParams) UnmarshalJSON(data []byte) error
type VMList ¶
type VMList struct {
Items []VM `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 (*VMList) UnmarshalJSON ¶
type VMListParams ¶
type VMListParams struct {
// Project ID of resources to request
ProjectID string `query:"project_id" api:"required" 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:"-"`
// Maximum number of items to return
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Filter by a case-insensitive substring of the VM name
Name param.Opt[string] `query:"name,omitzero" json:"-"`
// Filter by whether a public IP is enabled
PublicIPEnabled param.Opt[bool] `query:"public_ip_enabled,omitzero" json:"-"`
// Filter by region
Region param.Opt[string] `query:"region,omitzero" json:"-"`
// Comma-separated sort terms in precedence order, each field:asc or field:desc.
// Fields: created_at, updated_at, name, status, vcpu, memory
Sort param.Opt[string] `query:"sort,omitzero" json:"-"`
// Filter by the subnet the VM is attached to
SubnetID param.Opt[string] `query:"subnet_id,omitzero" json:"-"`
// Filter by the VPC the VM is attached to
VPCID param.Opt[string] `query:"vpc_id,omitzero" json:"-"`
// Filter by VM status
//
// Any of "pending", "creating", "updating", "ready", "deleting", "error".
Status VMListParamsStatus `query:"status,omitzero" json:"-"`
// Filter by tags. Repeat the parameter to require several tags; a VM must carry
// all of them.
Tags []string `query:"tags,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (VMListParams) URLQuery ¶
func (r VMListParams) URLQuery() (v url.Values, err error)
URLQuery serializes VMListParams's query parameters as `url.Values`.
type VMListParamsStatus ¶
type VMListParamsStatus string
Filter by VM status
const ( VMListParamsStatusPending VMListParamsStatus = "pending" VMListParamsStatusCreating VMListParamsStatus = "creating" VMListParamsStatusUpdating VMListParamsStatus = "updating" VMListParamsStatusReady VMListParamsStatus = "ready" VMListParamsStatusDeleting VMListParamsStatus = "deleting" VMListParamsStatusError VMListParamsStatus = "error" )
type VMMetricDescriptor ¶
type VMMetricDescriptor struct {
// What the metric measures.
Description string `json:"description" api:"required"`
// Highest value the metric reports, or null when it has no ceiling of its own.
MaxValue float64 `json:"max_value" api:"required"`
// Fully-qualified name of the metric, and the only spelling the metric query
// parameter accepts.
Metric string `json:"metric" api:"required"`
// Lowest value the metric reports.
MinValue float64 `json:"min_value" api:"required"`
// Whether a point's value can be null. A null means the VM reported no observation
// for that period, which is what a stopped VM looks like.
Nullable bool `json:"nullable" api:"required"`
// Unit the values are expressed in.
//
// Any of "ratio", "bytes", "cores", "bytes_per_second", "operations_per_second".
Unit shared.VMMetricUnit `json:"unit" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Description respjson.Field
MaxValue respjson.Field
Metric respjson.Field
MinValue respjson.Field
Nullable respjson.Field
Unit respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Describes one metric a VM reports: how to name it, what its values mean, and the range they fall in.
func (VMMetricDescriptor) RawJSON ¶
func (r VMMetricDescriptor) RawJSON() string
Returns the unmodified JSON received from the API
func (*VMMetricDescriptor) UnmarshalJSON ¶
func (r *VMMetricDescriptor) UnmarshalJSON(data []byte) error
type VMMetricDescriptorList ¶
type VMMetricDescriptorList struct {
Items []VMMetricDescriptor `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 (VMMetricDescriptorList) RawJSON ¶
func (r VMMetricDescriptorList) RawJSON() string
Returns the unmodified JSON received from the API
func (*VMMetricDescriptorList) UnmarshalJSON ¶
func (r *VMMetricDescriptorList) UnmarshalJSON(data []byte) error
type VMMetricDescriptorService ¶
type VMMetricDescriptorService struct {
Options []option.RequestOption
}
VMMetricDescriptorService 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 NewVMMetricDescriptorService method instead.
func NewVMMetricDescriptorService ¶
func NewVMMetricDescriptorService(opts ...option.RequestOption) (r VMMetricDescriptorService)
NewVMMetricDescriptorService 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 (*VMMetricDescriptorService) List ¶
func (r *VMMetricDescriptorService) List(ctx context.Context, opts ...option.RequestOption) (res *VMMetricDescriptorList, err error)
Describe every metric a VM reports: its name, unit, the range its values fall in, and whether a value can be null. Read this instead of holding a list of metric names, so a metric published later is picked up without a client change.
type VMMetricListParams ¶
type VMMetricListParams struct {
// End of the interval, exclusive, as an RFC 3339 timestamp. Defaults to now.
EndTime param.Opt[time.Time] `query:"end_time,omitzero" format:"date-time" json:"-"`
// Start of the interval, inclusive, as an RFC 3339 timestamp. Defaults to an hour
// before end_time. A start older than the 30 days of history kept is served from
// where that history begins.
StartTime param.Opt[time.Time] `query:"start_time,omitzero" format:"date-time" json:"-"`
// How the samples inside one period are folded into a single value.
//
// Any of "mean", "max", "min".
Aggregation VMMetricListParamsAggregation `query:"aggregation,omitzero" json:"-"`
// Metric to return. Repeat the parameter for several; every metric is returned
// when it is left out.
//
// Any of "compute.nirvanalabs.io/vm/cpu/used_cores",
// "compute.nirvanalabs.io/vm/cpu/utilization",
// "compute.nirvanalabs.io/vm/memory/used_bytes",
// "compute.nirvanalabs.io/vm/memory/utilization",
// "compute.nirvanalabs.io/vm/disk/read_bytes",
// "compute.nirvanalabs.io/vm/disk/write_bytes",
// "compute.nirvanalabs.io/vm/disk/read_ops",
// "compute.nirvanalabs.io/vm/disk/write_ops",
// "compute.nirvanalabs.io/vm/network/rx_bytes",
// "compute.nirvanalabs.io/vm/network/tx_bytes".
Metric []string `query:"metric,omitzero" json:"-"`
// Width of one period, and so the spacing between points. An interval holding more
// than 1440 periods is rejected; the error names a period that fits.
//
// Any of "5m", "15m", "1h", "6h", "24h".
Period VMMetricListParamsPeriod `query:"period,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (VMMetricListParams) URLQuery ¶
func (r VMMetricListParams) URLQuery() (v url.Values, err error)
URLQuery serializes VMMetricListParams's query parameters as `url.Values`.
type VMMetricListParamsAggregation ¶
type VMMetricListParamsAggregation string
How the samples inside one period are folded into a single value.
const ( VMMetricListParamsAggregationMean VMMetricListParamsAggregation = "mean" VMMetricListParamsAggregationMax VMMetricListParamsAggregation = "max" VMMetricListParamsAggregationMin VMMetricListParamsAggregation = "min" )
type VMMetricListParamsPeriod ¶
type VMMetricListParamsPeriod string
Width of one period, and so the spacing between points. An interval holding more than 1440 periods is rejected; the error names a period that fits.
const ( VMMetricListParamsPeriod5m VMMetricListParamsPeriod = "5m" VMMetricListParamsPeriod15m VMMetricListParamsPeriod = "15m" VMMetricListParamsPeriod1h VMMetricListParamsPeriod = "1h" VMMetricListParamsPeriod6h VMMetricListParamsPeriod = "6h" VMMetricListParamsPeriod24h VMMetricListParamsPeriod = "24h" )
type VMMetricPoint ¶
type VMMetricPoint struct {
// End of the period the value covers, so a point timestamped 00:05 over
// five-minute periods describes 00:00 through 00:05.
Timestamp time.Time `json:"timestamp" api:"required" format:"date-time"`
// Value over the period, in the series' unit. Null means the VM reported no
// observation for this period, which is what a stopped VM looks like.
Value float64 `json:"value" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Timestamp respjson.Field
Value respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
One period's value.
func (VMMetricPoint) RawJSON ¶
func (r VMMetricPoint) RawJSON() string
Returns the unmodified JSON received from the API
func (*VMMetricPoint) UnmarshalJSON ¶
func (r *VMMetricPoint) UnmarshalJSON(data []byte) error
type VMMetricSeries ¶
type VMMetricSeries struct {
// Fully-qualified name of the metric.
Metric string `json:"metric" api:"required"`
// Values over the interval, oldest first. Every series in a response covers the
// same periods, so they line up index for index.
Points []VMMetricPoint `json:"points" api:"required"`
// Unit the values are expressed in.
//
// Any of "ratio", "bytes", "cores", "bytes_per_second", "operations_per_second".
Unit shared.VMMetricUnit `json:"unit" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Metric respjson.Field
Points respjson.Field
Unit respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
One metric's values over the interval served.
func (VMMetricSeries) RawJSON ¶
func (r VMMetricSeries) RawJSON() string
Returns the unmodified JSON received from the API
func (*VMMetricSeries) UnmarshalJSON ¶
func (r *VMMetricSeries) UnmarshalJSON(data []byte) error
type VMMetricService ¶
type VMMetricService struct {
Options []option.RequestOption
}
VMMetricService 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 NewVMMetricService method instead.
func NewVMMetricService ¶
func NewVMMetricService(opts ...option.RequestOption) (r VMMetricService)
NewVMMetricService 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 (*VMMetricService) List ¶
func (r *VMMetricService) List(ctx context.Context, vmID string, query VMMetricListParams, opts ...option.RequestOption) (res *VMMetrics, err error)
Read a VM's resource metrics over an interval. Every series covers the same periods, so they line up index for index, and a period the VM reported no observation for carries a null value.
type VMMetricUnit ¶
type VMMetricUnit = shared.VMMetricUnit
Unit the values are expressed in.
This is an alias to an internal type.
type VMMetrics ¶
type VMMetrics struct {
// How the samples inside one period were folded into a single value.
//
// Any of "mean", "max", "min".
Aggregation VMMetricsAggregation `json:"aggregation" api:"required"`
// End of the interval served, exclusive.
EndTime time.Time `json:"end_time" api:"required" format:"date-time"`
// One series per requested metric, in the order they were requested.
Metrics []VMMetricSeries `json:"metrics" api:"required"`
// Width of one period, and so the spacing between consecutive points.
//
// Any of "5m", "15m", "1h", "6h", "24h".
Period VMMetricsPeriod `json:"period" api:"required"`
// Start of the interval served, inclusive. It can be later than the requested
// start when the request asked for more than the available history.
StartTime time.Time `json:"start_time" api:"required" format:"date-time"`
// ID of the VM the series belong to.
VMID string `json:"vm_id" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Aggregation respjson.Field
EndTime respjson.Field
Metrics respjson.Field
Period respjson.Field
StartTime respjson.Field
VMID respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A VM's metrics over an interval: one series per metric, on a shared grid of periods.
func (*VMMetrics) UnmarshalJSON ¶
type VMMetricsAggregation ¶
type VMMetricsAggregation string
How the samples inside one period were folded into a single value.
const ( VMMetricsAggregationMean VMMetricsAggregation = "mean" VMMetricsAggregationMax VMMetricsAggregation = "max" VMMetricsAggregationMin VMMetricsAggregation = "min" )
type VMMetricsPeriod ¶
type VMMetricsPeriod string
Width of one period, and so the spacing between consecutive points.
const ( VMMetricsPeriod5m VMMetricsPeriod = "5m" VMMetricsPeriod15m VMMetricsPeriod = "15m" VMMetricsPeriod1h VMMetricsPeriod = "1h" VMMetricsPeriod6h VMMetricsPeriod = "6h" VMMetricsPeriod24h VMMetricsPeriod = "24h" )
type VMNewParams ¶
type VMNewParams struct {
// Boot volume for the VM.
BootVolume VMNewParamsBootVolume `json:"boot_volume,omitzero" api:"required"`
// Instance type name.
InstanceType string `json:"instance_type" api:"required"`
// Name of the VM.
Name string `json:"name" api:"required"`
// Name of the OS Image to use for the VM.
OSImageName string `json:"os_image_name" api:"required"`
// Project ID to create the VM in.
ProjectID string `json:"project_id" api:"required"`
// Whether to enable public IP for the VM.
PublicIPEnabled bool `json:"public_ip_enabled" api:"required"`
// Region the resource is in.
//
// Any of "us-sva-2", "us-wdc-1".
Region shared.RegionName `json:"region,omitzero" api:"required"`
// Public SSH key configuration for the VM.
SSHKey SSHKeyRequestParam `json:"ssh_key,omitzero" api:"required"`
// ID of the subnet to use for the VM.
SubnetID string `json:"subnet_id" api:"required"`
// Data volumes for the VM.
DataVolumes []VMNewParamsDataVolume `json:"data_volumes,omitzero"`
// Tags to attach to the VM.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (VMNewParams) MarshalJSON ¶
func (r VMNewParams) MarshalJSON() (data []byte, err error)
func (*VMNewParams) UnmarshalJSON ¶
func (r *VMNewParams) UnmarshalJSON(data []byte) error
type VMNewParamsBootVolume ¶
type VMNewParamsBootVolume struct {
// Size of the Volume in GB.
Size int64 `json:"size" api:"required"`
// Type of the Volume.
//
// Any of "nvme", "abs", "ceph".
Type VolumeType `json:"type,omitzero" api:"required"`
// Tags to attach to the Volume.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
Boot volume for the VM.
The properties Size, Type are required.
func (VMNewParamsBootVolume) MarshalJSON ¶
func (r VMNewParamsBootVolume) MarshalJSON() (data []byte, err error)
func (*VMNewParamsBootVolume) UnmarshalJSON ¶
func (r *VMNewParamsBootVolume) UnmarshalJSON(data []byte) error
type VMNewParamsDataVolume ¶
type VMNewParamsDataVolume struct {
// Name of the Volume.
Name string `json:"name" api:"required"`
// Size of the Volume in GB.
Size int64 `json:"size" api:"required"`
// Type of the Volume.
//
// Any of "nvme", "abs", "ceph".
Type VolumeType `json:"type,omitzero" api:"required"`
// Tags to attach to the Volume.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
VM data volume create request.
The properties Name, Size, Type are required.
func (VMNewParamsDataVolume) MarshalJSON ¶
func (r VMNewParamsDataVolume) MarshalJSON() (data []byte, err error)
func (*VMNewParamsDataVolume) UnmarshalJSON ¶
func (r *VMNewParamsDataVolume) UnmarshalJSON(data []byte) error
type VMOSImageListParams ¶
type VMOSImageListParams struct {
// Pagination cursor returned by a previous request. Only valid for the same
// filters and sort order.
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
// Filter by a case-insensitive substring of the OS Image display name
DisplayName param.Opt[string] `query:"display_name,omitzero" json:"-"`
// Maximum number of items to return
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Filter by a case-insensitive substring of the OS Image name
Name param.Opt[string] `query:"name,omitzero" json:"-"`
// Comma-separated sort terms in precedence order, each field:asc or field:desc.
// Fields: created_at, name, display_name, position. An image name embeds its
// version, so name:asc is lexicographic rather than newest-first; position is the
// catalog's intended display order.
Sort param.Opt[string] `query:"sort,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (VMOSImageListParams) URLQuery ¶
func (r VMOSImageListParams) URLQuery() (v url.Values, err error)
URLQuery serializes VMOSImageListParams's query parameters as `url.Values`.
type VMOSImageService ¶
type VMOSImageService struct {
Options []option.RequestOption
}
VMOSImageService 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 NewVMOSImageService method instead.
func NewVMOSImageService ¶
func NewVMOSImageService(opts ...option.RequestOption) (r VMOSImageService)
NewVMOSImageService 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 (*VMOSImageService) List ¶
func (r *VMOSImageService) List(ctx context.Context, query VMOSImageListParams, opts ...option.RequestOption) (res *pagination.Cursor[OSImage], err error)
List all OS Images
func (*VMOSImageService) ListAutoPaging ¶
func (r *VMOSImageService) ListAutoPaging(ctx context.Context, query VMOSImageListParams, opts ...option.RequestOption) *pagination.CursorAutoPager[OSImage]
List all OS Images
type VMService ¶
type VMService struct {
Options []option.RequestOption
Availability VMAvailabilityService
Cost VMCostService
Volumes VMVolumeService
OSImages VMOSImageService
Metrics VMMetricService
MetricDescriptors VMMetricDescriptorService
}
VMService 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 NewVMService method instead.
func NewVMService ¶
func NewVMService(opts ...option.RequestOption) (r VMService)
NewVMService 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 (*VMService) Delete ¶
func (r *VMService) Delete(ctx context.Context, vmID string, opts ...option.RequestOption) (res *operations.Operation, err error)
Delete a VM
func (*VMService) Get ¶
func (r *VMService) Get(ctx context.Context, vmID string, opts ...option.RequestOption) (res *VM, err error)
Get details about a VM
func (*VMService) List ¶
func (r *VMService) List(ctx context.Context, query VMListParams, opts ...option.RequestOption) (res *pagination.Cursor[VM], err error)
List all VMs
func (*VMService) ListAutoPaging ¶
func (r *VMService) ListAutoPaging(ctx context.Context, query VMListParams, opts ...option.RequestOption) *pagination.CursorAutoPager[VM]
List all VMs
func (*VMService) New ¶
func (r *VMService) New(ctx context.Context, body VMNewParams, opts ...option.RequestOption) (res *operations.Operation, err error)
Create a VM
func (*VMService) Restart ¶
func (r *VMService) Restart(ctx context.Context, vmID string, opts ...option.RequestOption) (res *operations.Operation, err error)
Restart a VM
func (*VMService) Update ¶
func (r *VMService) Update(ctx context.Context, vmID string, body VMUpdateParams, opts ...option.RequestOption) (res *operations.Operation, err error)
Update a VM
type VMUpdateParams ¶
type VMUpdateParams struct {
// Instance type name.
InstanceType param.Opt[string] `json:"instance_type,omitzero"`
// Name of the VM.
Name param.Opt[string] `json:"name,omitzero"`
// Whether to enable public IP for the VM.
PublicIPEnabled param.Opt[bool] `json:"public_ip_enabled,omitzero"`
// Tags to attach to the VM.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (VMUpdateParams) MarshalJSON ¶
func (r VMUpdateParams) MarshalJSON() (data []byte, err error)
func (*VMUpdateParams) UnmarshalJSON ¶
func (r *VMUpdateParams) UnmarshalJSON(data []byte) error
type VMVolumeListParams ¶
type VMVolumeListParams struct {
// Pagination cursor returned by a previous request. Only valid for the same VM,
// filters and sort order.
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
// Maximum number of items to return
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Filter by a case-insensitive substring of the Volume name
Name param.Opt[string] `query:"name,omitzero" json:"-"`
// Comma-separated sort terms in precedence order, each field:asc or field:desc.
// Fields: created_at, updated_at, name, status, size
Sort param.Opt[string] `query:"sort,omitzero" json:"-"`
// Filter by Volume kind
//
// Any of "boot", "data".
Kind VMVolumeListParamsKind `query:"kind,omitzero" json:"-"`
// Filter by Volume status
//
// Any of "pending", "creating", "updating", "ready", "deleting", "error".
Status VMVolumeListParamsStatus `query:"status,omitzero" json:"-"`
// Filter by tags. Repeat the parameter to require several tags; a Volume must
// carry all of them.
Tags []string `query:"tags,omitzero" json:"-"`
// Filter by storage type
//
// Any of "nvme", "abs", "ceph".
Type VMVolumeListParamsType `query:"type,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (VMVolumeListParams) URLQuery ¶
func (r VMVolumeListParams) URLQuery() (v url.Values, err error)
URLQuery serializes VMVolumeListParams's query parameters as `url.Values`.
type VMVolumeListParamsKind ¶
type VMVolumeListParamsKind string
Filter by Volume kind
const ( VMVolumeListParamsKindBoot VMVolumeListParamsKind = "boot" VMVolumeListParamsKindData VMVolumeListParamsKind = "data" )
type VMVolumeListParamsStatus ¶
type VMVolumeListParamsStatus string
Filter by Volume status
const ( VMVolumeListParamsStatusPending VMVolumeListParamsStatus = "pending" VMVolumeListParamsStatusCreating VMVolumeListParamsStatus = "creating" VMVolumeListParamsStatusUpdating VMVolumeListParamsStatus = "updating" VMVolumeListParamsStatusReady VMVolumeListParamsStatus = "ready" VMVolumeListParamsStatusDeleting VMVolumeListParamsStatus = "deleting" VMVolumeListParamsStatusError VMVolumeListParamsStatus = "error" )
type VMVolumeListParamsType ¶
type VMVolumeListParamsType string
Filter by storage type
const ( VMVolumeListParamsTypeNvme VMVolumeListParamsType = "nvme" VMVolumeListParamsTypeABS VMVolumeListParamsType = "abs" VMVolumeListParamsTypeCeph VMVolumeListParamsType = "ceph" )
type VMVolumeService ¶
type VMVolumeService struct {
Options []option.RequestOption
}
VMVolumeService 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 NewVMVolumeService method instead.
func NewVMVolumeService ¶
func NewVMVolumeService(opts ...option.RequestOption) (r VMVolumeService)
NewVMVolumeService 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 (*VMVolumeService) List ¶
func (r *VMVolumeService) List(ctx context.Context, vmID string, query VMVolumeListParams, opts ...option.RequestOption) (res *pagination.Cursor[Volume], err error)
List VM's Volumes
func (*VMVolumeService) ListAutoPaging ¶
func (r *VMVolumeService) ListAutoPaging(ctx context.Context, vmID string, query VMVolumeListParams, opts ...option.RequestOption) *pagination.CursorAutoPager[Volume]
List VM's Volumes
type Volume ¶
type Volume struct {
// Unique identifier for the Volume.
ID string `json:"id" api:"required"`
// When the Volume was created.
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Volume kind.
//
// Any of "boot", "data".
Kind VolumeKind `json:"kind" api:"required"`
// Name of the Volume.
Name string `json:"name" api:"required"`
// Project ID the Volume belongs to.
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"`
// Size of the Volume in GB.
Size int64 `json:"size" api:"required"`
// Status of the resource.
//
// Any of "pending", "creating", "updating", "ready", "deleting", "deleted",
// "error", "suspended".
Status shared.ResourceStatus `json:"status" api:"required"`
// Tags to attach to the Volume.
Tags []string `json:"tags" api:"required"`
// Type of the Volume.
//
// Any of "nvme", "abs", "ceph".
Type VolumeType `json:"type" api:"required"`
// When the Volume was updated.
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// ID of the VM the Volume is attached to.
VMID string `json:"vm_id" api:"required"`
// Name of the VM the Volume is attached to.
VMName string `json:"vm_name" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
Kind respjson.Field
Name respjson.Field
ProjectID respjson.Field
Region respjson.Field
Size respjson.Field
Status respjson.Field
Tags respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
VMID respjson.Field
VMName respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Volume details.
func (*Volume) UnmarshalJSON ¶
type VolumeAttachParams ¶
type VolumeAttachParams struct {
// ID of the VM to attach the Volume to.
VMID string `json:"vm_id" api:"required"`
// contains filtered or unexported fields
}
func (VolumeAttachParams) MarshalJSON ¶
func (r VolumeAttachParams) MarshalJSON() (data []byte, err error)
func (*VolumeAttachParams) UnmarshalJSON ¶
func (r *VolumeAttachParams) UnmarshalJSON(data []byte) error
type VolumeAvailabilityNewParams ¶
type VolumeAvailabilityNewParams struct {
// Name of the Volume.
Name string `json:"name" api:"required"`
// Project ID the Volume belongs to.
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,omitzero" api:"required"`
// Size of the Volume in GB.
Size int64 `json:"size" api:"required"`
// Type of the Volume.
//
// Any of "nvme", "abs", "ceph".
Type VolumeType `json:"type,omitzero" api:"required"`
// ID of the VM the Volume is attached to.
VMID param.Opt[string] `json:"vm_id,omitzero"`
// Tags to attach to the Volume.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (VolumeAvailabilityNewParams) MarshalJSON ¶
func (r VolumeAvailabilityNewParams) MarshalJSON() (data []byte, err error)
func (*VolumeAvailabilityNewParams) UnmarshalJSON ¶
func (r *VolumeAvailabilityNewParams) UnmarshalJSON(data []byte) error
type VolumeAvailabilityService ¶
type VolumeAvailabilityService struct {
Options []option.RequestOption
}
VolumeAvailabilityService 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 NewVolumeAvailabilityService method instead.
func NewVolumeAvailabilityService ¶
func NewVolumeAvailabilityService(opts ...option.RequestOption) (r VolumeAvailabilityService)
NewVolumeAvailabilityService 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 (*VolumeAvailabilityService) New ¶
func (r *VolumeAvailabilityService) New(ctx context.Context, body VolumeAvailabilityNewParams, opts ...option.RequestOption) (err error)
Check Volume Create Availability
func (*VolumeAvailabilityService) Update ¶
func (r *VolumeAvailabilityService) Update(ctx context.Context, volumeID string, body VolumeAvailabilityUpdateParams, opts ...option.RequestOption) (err error)
Check Volume Update Availability
type VolumeAvailabilityUpdateParams ¶
type VolumeAvailabilityUpdateParams struct {
// Name of the Volume.
Name param.Opt[string] `json:"name,omitzero"`
// Size of the Volume in GB.
Size param.Opt[int64] `json:"size,omitzero"`
// Tags to attach to the Volume.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (VolumeAvailabilityUpdateParams) MarshalJSON ¶
func (r VolumeAvailabilityUpdateParams) MarshalJSON() (data []byte, err error)
func (*VolumeAvailabilityUpdateParams) UnmarshalJSON ¶
func (r *VolumeAvailabilityUpdateParams) UnmarshalJSON(data []byte) error
type VolumeCostNewParams ¶
type VolumeCostNewParams struct {
// Name of the Volume.
Name string `json:"name" api:"required"`
// Project ID the Volume belongs to.
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,omitzero" api:"required"`
// Size of the Volume in GB.
Size int64 `json:"size" api:"required"`
// Type of the Volume.
//
// Any of "nvme", "abs", "ceph".
Type VolumeType `json:"type,omitzero" api:"required"`
// ID of the VM the Volume is attached to.
VMID param.Opt[string] `json:"vm_id,omitzero"`
// Tags to attach to the Volume.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (VolumeCostNewParams) MarshalJSON ¶
func (r VolumeCostNewParams) MarshalJSON() (data []byte, err error)
func (*VolumeCostNewParams) UnmarshalJSON ¶
func (r *VolumeCostNewParams) UnmarshalJSON(data []byte) error
type VolumeCostService ¶
type VolumeCostService struct {
Options []option.RequestOption
}
VolumeCostService 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 NewVolumeCostService method instead.
func NewVolumeCostService ¶
func NewVolumeCostService(opts ...option.RequestOption) (r VolumeCostService)
NewVolumeCostService 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 (*VolumeCostService) New ¶
func (r *VolumeCostService) New(ctx context.Context, body VolumeCostNewParams, opts ...option.RequestOption) (res *shared.CostQuote, err error)
Return a priced cost quote for the proposed Volume.
func (*VolumeCostService) Update ¶
func (r *VolumeCostService) Update(ctx context.Context, volumeID string, body VolumeCostUpdateParams, opts ...option.RequestOption) (res *shared.CostQuoteUpdate, err error)
Return a priced cost quote for the proposed Volume update plus a diff against the current state.
type VolumeCostUpdateParams ¶
type VolumeCostUpdateParams struct {
// Name of the Volume.
Name param.Opt[string] `json:"name,omitzero"`
// Size of the Volume in GB.
Size param.Opt[int64] `json:"size,omitzero"`
// Tags to attach to the Volume.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (VolumeCostUpdateParams) MarshalJSON ¶
func (r VolumeCostUpdateParams) MarshalJSON() (data []byte, err error)
func (*VolumeCostUpdateParams) UnmarshalJSON ¶
func (r *VolumeCostUpdateParams) UnmarshalJSON(data []byte) error
type VolumeKind ¶
type VolumeKind string
Volume kind.
const ( VolumeKindBoot VolumeKind = "boot" VolumeKindData VolumeKind = "data" )
type VolumeList ¶
type VolumeList struct {
Items []Volume `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 (VolumeList) RawJSON ¶
func (r VolumeList) RawJSON() string
Returns the unmodified JSON received from the API
func (*VolumeList) UnmarshalJSON ¶
func (r *VolumeList) UnmarshalJSON(data []byte) error
type VolumeListParams ¶
type VolumeListParams struct {
// Project ID of resources to request
ProjectID string `query:"project_id" api:"required" json:"-"`
// Filter by whether the Volume is attached to a VM. Combine with vm_id and both
// must hold.
Attached param.Opt[bool] `query:"attached,omitzero" 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:"-"`
// Maximum number of items to return
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Filter by a case-insensitive substring of the Volume name
Name param.Opt[string] `query:"name,omitzero" json:"-"`
// Filter by region
Region param.Opt[string] `query:"region,omitzero" json:"-"`
// Comma-separated sort terms in precedence order, each field:asc or field:desc.
// Fields: created_at, updated_at, name, status, size
Sort param.Opt[string] `query:"sort,omitzero" json:"-"`
// Filter by the VM the Volume is attached to
VMID param.Opt[string] `query:"vm_id,omitzero" json:"-"`
// Filter by Volume kind
//
// Any of "boot", "data".
Kind VolumeListParamsKind `query:"kind,omitzero" json:"-"`
// Filter by Volume status
//
// Any of "pending", "creating", "updating", "ready", "deleting", "error".
Status VolumeListParamsStatus `query:"status,omitzero" json:"-"`
// Filter by tags. Repeat the parameter to require several tags; a Volume must
// carry all of them.
Tags []string `query:"tags,omitzero" json:"-"`
// Filter by storage type
//
// Any of "nvme", "abs", "ceph".
Type VolumeListParamsType `query:"type,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (VolumeListParams) URLQuery ¶
func (r VolumeListParams) URLQuery() (v url.Values, err error)
URLQuery serializes VolumeListParams's query parameters as `url.Values`.
type VolumeListParamsKind ¶
type VolumeListParamsKind string
Filter by Volume kind
const ( VolumeListParamsKindBoot VolumeListParamsKind = "boot" VolumeListParamsKindData VolumeListParamsKind = "data" )
type VolumeListParamsStatus ¶
type VolumeListParamsStatus string
Filter by Volume status
const ( VolumeListParamsStatusPending VolumeListParamsStatus = "pending" VolumeListParamsStatusCreating VolumeListParamsStatus = "creating" VolumeListParamsStatusUpdating VolumeListParamsStatus = "updating" VolumeListParamsStatusReady VolumeListParamsStatus = "ready" VolumeListParamsStatusDeleting VolumeListParamsStatus = "deleting" VolumeListParamsStatusError VolumeListParamsStatus = "error" )
type VolumeListParamsType ¶
type VolumeListParamsType string
Filter by storage type
const ( VolumeListParamsTypeNvme VolumeListParamsType = "nvme" VolumeListParamsTypeABS VolumeListParamsType = "abs" VolumeListParamsTypeCeph VolumeListParamsType = "ceph" )
type VolumeNewParams ¶
type VolumeNewParams struct {
// Name of the Volume.
Name string `json:"name" api:"required"`
// Project ID the Volume belongs to.
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,omitzero" api:"required"`
// Size of the Volume in GB.
Size int64 `json:"size" api:"required"`
// Type of the Volume.
//
// Any of "nvme", "abs", "ceph".
Type VolumeType `json:"type,omitzero" api:"required"`
// ID of the VM the Volume is attached to.
VMID param.Opt[string] `json:"vm_id,omitzero"`
// Tags to attach to the Volume.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (VolumeNewParams) MarshalJSON ¶
func (r VolumeNewParams) MarshalJSON() (data []byte, err error)
func (*VolumeNewParams) UnmarshalJSON ¶
func (r *VolumeNewParams) UnmarshalJSON(data []byte) error
type VolumeService ¶
type VolumeService struct {
Options []option.RequestOption
Availability VolumeAvailabilityService
Cost VolumeCostService
}
VolumeService 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 NewVolumeService method instead.
func NewVolumeService ¶
func NewVolumeService(opts ...option.RequestOption) (r VolumeService)
NewVolumeService 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 (*VolumeService) Attach ¶
func (r *VolumeService) Attach(ctx context.Context, volumeID string, body VolumeAttachParams, opts ...option.RequestOption) (res *operations.Operation, err error)
Attach a volume to a VM
func (*VolumeService) Delete ¶
func (r *VolumeService) Delete(ctx context.Context, volumeID string, opts ...option.RequestOption) (res *operations.Operation, err error)
Delete a Volume. Boot or data volumes can be deleted.
func (*VolumeService) Detach ¶
func (r *VolumeService) Detach(ctx context.Context, volumeID string, opts ...option.RequestOption) (res *operations.Operation, err error)
Detach a volume from a VM
func (*VolumeService) Get ¶
func (r *VolumeService) Get(ctx context.Context, volumeID string, opts ...option.RequestOption) (res *Volume, err error)
Get a Volume.
func (*VolumeService) List ¶
func (r *VolumeService) List(ctx context.Context, query VolumeListParams, opts ...option.RequestOption) (res *pagination.Cursor[Volume], err error)
List all volumes
func (*VolumeService) ListAutoPaging ¶
func (r *VolumeService) ListAutoPaging(ctx context.Context, query VolumeListParams, opts ...option.RequestOption) *pagination.CursorAutoPager[Volume]
List all volumes
func (*VolumeService) New ¶
func (r *VolumeService) New(ctx context.Context, body VolumeNewParams, opts ...option.RequestOption) (res *operations.Operation, err error)
Create a Volume. Only data volumes can be created.
func (*VolumeService) Update ¶
func (r *VolumeService) Update(ctx context.Context, volumeID string, body VolumeUpdateParams, opts ...option.RequestOption) (res *operations.Operation, err error)
Update a Volume. Boot or data volumes can be updated.
type VolumeType ¶
type VolumeType string
Type of the Volume.
const ( VolumeTypeNvme VolumeType = "nvme" VolumeTypeABS VolumeType = "abs" VolumeTypeCeph VolumeType = "ceph" )
type VolumeUpdateParams ¶
type VolumeUpdateParams struct {
// Name of the Volume.
Name param.Opt[string] `json:"name,omitzero"`
// Size of the Volume in GB.
Size param.Opt[int64] `json:"size,omitzero"`
// Tags to attach to the Volume.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (VolumeUpdateParams) MarshalJSON ¶
func (r VolumeUpdateParams) MarshalJSON() (data []byte, err error)
func (*VolumeUpdateParams) UnmarshalJSON ¶
func (r *VolumeUpdateParams) UnmarshalJSON(data []byte) error