Documentation
¶
Index ¶
- Constants
- type CPUConfig
- type CPUConfigRequestParam
- type ComputeService
- type Error
- type MemoryConfig
- type MemoryConfigRequestParam
- type OSImage
- type Pagination
- type RegionName
- type ResourceStatus
- type SSHKeyRequestParam
- type VM
- type VMAvailabilityNewParams
- type VMAvailabilityNewParamsBootVolume
- type VMAvailabilityNewParamsDataVolume
- type VMAvailabilityService
- type VMAvailabilityUpdateParams
- type VMList
- type VMListParams
- 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 VMVolumeService
- type Volume
- type VolumeAttachParams
- type VolumeAvailabilityNewParams
- type VolumeAvailabilityService
- type VolumeAvailabilityUpdateParams
- type VolumeKind
- type VolumeList
- type VolumeListParams
- 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 RegionNameApSeo1 = shared.RegionNameApSeo1
Equals "ap-seo-1"
const RegionNameApSin1 = shared.RegionNameApSin1
Equals "ap-sin-1"
const RegionNameApTyo1 = shared.RegionNameApTyo1
Equals "ap-tyo-1"
const RegionNameEuFrk1 = shared.RegionNameEuFrk1
Equals "eu-frk-1"
const RegionNameUsChi1 = shared.RegionNameUsChi1
Equals "us-chi-1"
const RegionNameUsSea1 = shared.RegionNameUsSea1
Equals "us-sea-1"
const RegionNameUsSva1 = shared.RegionNameUsSva1
Equals "us-sva-1"
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 ResourceStatusUpdating = shared.ResourceStatusUpdating
Equals "updating"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CPUConfig ¶
type CPUConfig struct {
// Number of virtual CPUs.
Vcpu int64 `json:"vcpu,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 CPUConfigRequestParam ¶ added in v1.14.0
type CPUConfigRequestParam struct {
// Number of virtual CPUs.
Vcpu int64 `json:"vcpu,required"`
// contains filtered or unexported fields
}
CPU configuration for the VM.
The property Vcpu is required.
func (CPUConfigRequestParam) MarshalJSON ¶ added in v1.14.0
func (r CPUConfigRequestParam) MarshalJSON() (data []byte, err error)
func (*CPUConfigRequestParam) UnmarshalJSON ¶ added in v1.14.0
func (r *CPUConfigRequestParam) UnmarshalJSON(data []byte) error
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 MemoryConfig ¶
type MemoryConfig struct {
// Size of the memory in GB.
Size int64 `json:"size,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 ¶ added in v1.1.0
func (r MemoryConfig) RawJSON() string
Returns the unmodified JSON received from the API
func (*MemoryConfig) UnmarshalJSON ¶
func (r *MemoryConfig) UnmarshalJSON(data []byte) error
type MemoryConfigRequestParam ¶ added in v1.14.0
type MemoryConfigRequestParam struct {
// Size of the memory in GB.
Size int64 `json:"size,required"`
// contains filtered or unexported fields
}
Memory configuration for the VM.
The property Size is required.
func (MemoryConfigRequestParam) MarshalJSON ¶ added in v1.14.0
func (r MemoryConfigRequestParam) MarshalJSON() (data []byte, err error)
func (*MemoryConfigRequestParam) UnmarshalJSON ¶ added in v1.14.0
func (r *MemoryConfigRequestParam) UnmarshalJSON(data []byte) error
type OSImage ¶
type OSImage struct {
// When the OS Image was created.
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// Display name of the OS Image.
DisplayName string `json:"display_name,required"`
// Name of the OS Image.
Name string `json:"name,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 Pagination ¶ added in v1.21.0
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 ¶ added in v1.14.0
type SSHKeyRequestParam struct {
// Public key to and and use to access the VM.
PublicKey string `json:"public_key,required"`
// contains filtered or unexported fields
}
Public SSH key configuration for the VM.
The property PublicKey is required.
func (SSHKeyRequestParam) MarshalJSON ¶ added in v1.14.0
func (r SSHKeyRequestParam) MarshalJSON() (data []byte, err error)
func (*SSHKeyRequestParam) UnmarshalJSON ¶ added in v1.14.0
func (r *SSHKeyRequestParam) UnmarshalJSON(data []byte) error
type VM ¶
type VM struct {
// Unique identifier for the VM.
ID string `json:"id,required"`
// ID of the boot volume attached to the VM.
BootVolumeID string `json:"boot_volume_id,required"`
// CPU configuration for the VM.
CPUConfig CPUConfig `json:"cpu_config,required"`
// When the VM was created.
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// IDs of the data volumes attached to the VM.
DataVolumeIDs []string `json:"data_volume_ids,required"`
// Memory configuration for the VM.
MemoryConfig MemoryConfig `json:"memory_config,required"`
// Name of the VM.
Name string `json:"name,required"`
// Private IP of the VM.
PrivateIP string `json:"private_ip,required"`
// Public IP of the VM.
PublicIP string `json:"public_ip,required"`
// Whether the public IP is enabled for the VM.
PublicIPEnabled bool `json:"public_ip_enabled,required"`
// Region the resource is in.
//
// Any of "us-sea-1", "us-sva-1", "us-sva-2", "us-chi-1", "us-wdc-1", "eu-frk-1",
// "ap-sin-1", "ap-seo-1", "ap-tyo-1".
Region shared.RegionName `json:"region,required"`
// Status of the resource.
//
// Any of "pending", "creating", "updating", "ready", "deleting", "deleted",
// "error".
Status shared.ResourceStatus `json:"status,required"`
// ID of the subnet the VM is in.
SubnetID string `json:"subnet_id,required"`
// Tags to attach to the VM.
Tags []string `json:"tags,required"`
// When the VM was updated.
UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
// ID of the VPC the VM is in.
VPCID string `json:"vpc_id,required"`
// Name of the VPC the VM is in.
VPCName string `json:"vpc_name,required"`
// 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
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
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
VM details.
func (*VM) UnmarshalJSON ¶
type VMAvailabilityNewParams ¶ added in v1.2.0
type VMAvailabilityNewParams struct {
// Boot volume for the VM.
BootVolume VMAvailabilityNewParamsBootVolume `json:"boot_volume,omitzero,required"`
// CPU configuration for the VM.
CPUConfig CPUConfigRequestParam `json:"cpu_config,omitzero,required"`
// Memory configuration for the VM.
MemoryConfig MemoryConfigRequestParam `json:"memory_config,omitzero,required"`
// Name of the VM.
Name string `json:"name,required"`
// Name of the OS Image to use for the VM.
OSImageName string `json:"os_image_name,required"`
// Whether to enable public IP for the VM.
PublicIPEnabled bool `json:"public_ip_enabled,required"`
// Region the resource is in.
//
// Any of "us-sea-1", "us-sva-1", "us-sva-2", "us-chi-1", "us-wdc-1", "eu-frk-1",
// "ap-sin-1", "ap-seo-1", "ap-tyo-1".
Region shared.RegionName `json:"region,omitzero,required"`
// Public SSH key configuration for the VM.
SSHKey SSHKeyRequestParam `json:"ssh_key,omitzero,required"`
// ID of the subnet to use for the VM.
SubnetID string `json:"subnet_id,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 ¶ added in v1.2.0
func (r VMAvailabilityNewParams) MarshalJSON() (data []byte, err error)
func (*VMAvailabilityNewParams) UnmarshalJSON ¶ added in v1.2.0
func (r *VMAvailabilityNewParams) UnmarshalJSON(data []byte) error
type VMAvailabilityNewParamsBootVolume ¶ added in v1.2.0
type VMAvailabilityNewParamsBootVolume struct {
// Size of the Volume in GB.
Size int64 `json:"size,required"`
// Type of the Volume.
//
// Any of "nvme", "abs".
Type VolumeType `json:"type,omitzero,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 ¶ added in v1.2.0
func (r VMAvailabilityNewParamsBootVolume) MarshalJSON() (data []byte, err error)
func (*VMAvailabilityNewParamsBootVolume) UnmarshalJSON ¶ added in v1.2.0
func (r *VMAvailabilityNewParamsBootVolume) UnmarshalJSON(data []byte) error
type VMAvailabilityNewParamsDataVolume ¶ added in v1.2.0
type VMAvailabilityNewParamsDataVolume struct {
// Name of the Volume.
Name string `json:"name,required"`
// Size of the Volume in GB.
Size int64 `json:"size,required"`
// Type of the Volume.
//
// Any of "nvme", "abs".
Type VolumeType `json:"type,omitzero,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 ¶ added in v1.2.0
func (r VMAvailabilityNewParamsDataVolume) MarshalJSON() (data []byte, err error)
func (*VMAvailabilityNewParamsDataVolume) UnmarshalJSON ¶ added in v1.2.0
func (r *VMAvailabilityNewParamsDataVolume) UnmarshalJSON(data []byte) error
type VMAvailabilityService ¶ added in v1.2.0
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 ¶ added in v1.2.0
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 ¶ added in v1.2.0
func (r *VMAvailabilityService) New(ctx context.Context, body VMAvailabilityNewParams, opts ...option.RequestOption) (res *string, err error)
Check VM Create Availability
func (*VMAvailabilityService) Update ¶ added in v1.2.0
func (r *VMAvailabilityService) Update(ctx context.Context, vmID string, body VMAvailabilityUpdateParams, opts ...option.RequestOption) (res *string, err error)
Check VM Update Availability
type VMAvailabilityUpdateParams ¶ added in v1.2.0
type VMAvailabilityUpdateParams struct {
// 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"`
// CPU configuration for the VM.
CPUConfig CPUConfigRequestParam `json:"cpu_config,omitzero"`
// Memory configuration for the VM.
MemoryConfig MemoryConfigRequestParam `json:"memory_config,omitzero"`
// Tags to attach to the VM.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (VMAvailabilityUpdateParams) MarshalJSON ¶ added in v1.2.0
func (r VMAvailabilityUpdateParams) MarshalJSON() (data []byte, err error)
func (*VMAvailabilityUpdateParams) UnmarshalJSON ¶ added in v1.2.0
func (r *VMAvailabilityUpdateParams) UnmarshalJSON(data []byte) error
type VMList ¶
type VMList struct {
Items []VM `json:"items,required"`
// Pagination response details.
Pagination shared.Pagination `json:"pagination,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 ¶ added in v1.21.0
type VMListParams 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 (VMListParams) URLQuery ¶ added in v1.21.0
func (r VMListParams) URLQuery() (v url.Values, err error)
URLQuery serializes VMListParams's query parameters as `url.Values`.
type VMNewParams ¶
type VMNewParams struct {
// Boot volume for the VM.
BootVolume VMNewParamsBootVolume `json:"boot_volume,omitzero,required"`
// CPU configuration for the VM.
CPUConfig CPUConfigRequestParam `json:"cpu_config,omitzero,required"`
// Memory configuration for the VM.
MemoryConfig MemoryConfigRequestParam `json:"memory_config,omitzero,required"`
// Name of the VM.
Name string `json:"name,required"`
// Name of the OS Image to use for the VM.
OSImageName string `json:"os_image_name,required"`
// Whether to enable public IP for the VM.
PublicIPEnabled bool `json:"public_ip_enabled,required"`
// Region the resource is in.
//
// Any of "us-sea-1", "us-sva-1", "us-sva-2", "us-chi-1", "us-wdc-1", "eu-frk-1",
// "ap-sin-1", "ap-seo-1", "ap-tyo-1".
Region shared.RegionName `json:"region,omitzero,required"`
// Public SSH key configuration for the VM.
SSHKey SSHKeyRequestParam `json:"ssh_key,omitzero,required"`
// ID of the subnet to use for the VM.
SubnetID string `json:"subnet_id,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 ¶ added in v1.1.0
func (r *VMNewParams) UnmarshalJSON(data []byte) error
type VMNewParamsBootVolume ¶
type VMNewParamsBootVolume struct {
// Size of the Volume in GB.
Size int64 `json:"size,required"`
// Type of the Volume.
//
// Any of "nvme", "abs".
Type VolumeType `json:"type,omitzero,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 ¶ added in v1.1.0
func (r *VMNewParamsBootVolume) UnmarshalJSON(data []byte) error
type VMNewParamsDataVolume ¶
type VMNewParamsDataVolume struct {
// Name of the Volume.
Name string `json:"name,required"`
// Size of the Volume in GB.
Size int64 `json:"size,required"`
// Type of the Volume.
//
// Any of "nvme", "abs".
Type VolumeType `json:"type,omitzero,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 ¶ added in v1.1.0
func (r *VMNewParamsDataVolume) UnmarshalJSON(data []byte) error
type VMOSImageListParams ¶ added in v1.22.0
type VMOSImageListParams 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 (VMOSImageListParams) URLQuery ¶ added in v1.22.0
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 ¶ added in v1.22.0
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
Volumes VMVolumeService
OSImages VMOSImageService
}
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 ¶ added in v1.21.0
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 ¶ added in v1.13.0
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 {
// 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"`
// CPU configuration for the VM.
CPUConfig CPUConfigRequestParam `json:"cpu_config,omitzero"`
// Memory configuration for the VM.
MemoryConfig MemoryConfigRequestParam `json:"memory_config,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 ¶ added in v1.1.0
func (r *VMUpdateParams) UnmarshalJSON(data []byte) error
type VMVolumeListParams ¶ added in v1.21.0
type VMVolumeListParams 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 (VMVolumeListParams) URLQuery ¶ added in v1.21.0
func (r VMVolumeListParams) URLQuery() (v url.Values, err error)
URLQuery serializes VMVolumeListParams's query parameters as `url.Values`.
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 ¶ added in v1.21.0
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,required"`
// When the Volume was created.
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// Volume kind.
//
// Any of "boot", "data".
Kind VolumeKind `json:"kind,required"`
// Name of the Volume.
Name string `json:"name,required"`
// Region where the Volume is located.
Region string `json:"region,required"`
// Size of the Volume in GB.
Size int64 `json:"size,required"`
// Status of the resource.
//
// Any of "pending", "creating", "updating", "ready", "deleting", "deleted",
// "error".
Status shared.ResourceStatus `json:"status,required"`
// Tags to attach to the Volume.
Tags []string `json:"tags,required"`
// Type of the Volume.
//
// Any of "nvme", "abs".
Type VolumeType `json:"type,required"`
// When the Volume was updated.
UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
// ID of the VM the Volume is attached to.
VMID string `json:"vm_id,required"`
// Name of the VM the Volume is attached to.
VMName string `json:"vm_name,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
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 ¶ added in v1.29.0
type VolumeAttachParams struct {
// ID of the VM to attach the Volume to.
VMID string `json:"vm_id,required"`
// contains filtered or unexported fields
}
func (VolumeAttachParams) MarshalJSON ¶ added in v1.29.0
func (r VolumeAttachParams) MarshalJSON() (data []byte, err error)
func (*VolumeAttachParams) UnmarshalJSON ¶ added in v1.29.0
func (r *VolumeAttachParams) UnmarshalJSON(data []byte) error
type VolumeAvailabilityNewParams ¶ added in v1.2.0
type VolumeAvailabilityNewParams struct {
// Name of the Volume.
Name string `json:"name,required"`
// Region the resource is in.
//
// Any of "us-sea-1", "us-sva-1", "us-sva-2", "us-chi-1", "us-wdc-1", "eu-frk-1",
// "ap-sin-1", "ap-seo-1", "ap-tyo-1".
Region shared.RegionName `json:"region,omitzero,required"`
// Size of the Volume in GB.
Size int64 `json:"size,required"`
// Type of the Volume.
//
// Any of "nvme", "abs".
Type VolumeType `json:"type,omitzero,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 ¶ added in v1.2.0
func (r VolumeAvailabilityNewParams) MarshalJSON() (data []byte, err error)
func (*VolumeAvailabilityNewParams) UnmarshalJSON ¶ added in v1.2.0
func (r *VolumeAvailabilityNewParams) UnmarshalJSON(data []byte) error
type VolumeAvailabilityService ¶ added in v1.2.0
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 ¶ added in v1.2.0
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 ¶ added in v1.2.0
func (r *VolumeAvailabilityService) New(ctx context.Context, body VolumeAvailabilityNewParams, opts ...option.RequestOption) (res *string, err error)
Check Volume Create Availability
func (*VolumeAvailabilityService) Update ¶ added in v1.2.0
func (r *VolumeAvailabilityService) Update(ctx context.Context, volumeID string, body VolumeAvailabilityUpdateParams, opts ...option.RequestOption) (res *string, err error)
Check Volume Update Availability
type VolumeAvailabilityUpdateParams ¶ added in v1.2.0
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 ¶ added in v1.2.0
func (r VolumeAvailabilityUpdateParams) MarshalJSON() (data []byte, err error)
func (*VolumeAvailabilityUpdateParams) UnmarshalJSON ¶ added in v1.2.0
func (r *VolumeAvailabilityUpdateParams) 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,required"`
// Pagination response details.
Pagination shared.Pagination `json:"pagination,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 ¶ added in v1.1.0
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 ¶ added in v1.21.0
type VolumeListParams 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 (VolumeListParams) URLQuery ¶ added in v1.21.0
func (r VolumeListParams) URLQuery() (v url.Values, err error)
URLQuery serializes VolumeListParams's query parameters as `url.Values`.
type VolumeNewParams ¶
type VolumeNewParams struct {
// Name of the Volume.
Name string `json:"name,required"`
// Region the resource is in.
//
// Any of "us-sea-1", "us-sva-1", "us-sva-2", "us-chi-1", "us-wdc-1", "eu-frk-1",
// "ap-sin-1", "ap-seo-1", "ap-tyo-1".
Region shared.RegionName `json:"region,omitzero,required"`
// Size of the Volume in GB.
Size int64 `json:"size,required"`
// Type of the Volume.
//
// Any of "nvme", "abs".
Type VolumeType `json:"type,omitzero,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 ¶ added in v1.1.0
func (r *VolumeNewParams) UnmarshalJSON(data []byte) error
type VolumeService ¶
type VolumeService struct {
Options []option.RequestOption
Availability VolumeAvailabilityService
}
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 ¶ added in v1.29.0
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 ¶ added in v1.29.0
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 ¶ added in v1.21.0
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 ¶ added in v1.25.1
type VolumeType string
Type of the Volume.
const ( VolumeTypeNvme VolumeType = "nvme" VolumeTypeABS VolumeType = "abs" )
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 ¶ added in v1.1.0
func (r *VolumeUpdateParams) UnmarshalJSON(data []byte) error