Documentation
¶
Index ¶
- Constants
- type CPU
- type CPUParam
- type Error
- type Operation
- type OperationKind
- type OperationService
- type OperationStatus
- type OperationType
- type Ram
- type RamParam
- type RamUnit
- type RegionName
- type ResourceStatus
- type SSHKeyParam
- type Storage
- type StorageParam
- type StorageType
- type StorageUnit
- type VM
- type VMListParams
- type VMListResponse
- type VMNewParams
- type VMService
- func (r *VMService) Delete(ctx context.Context, vmID string, opts ...option.RequestOption) (res *shared.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 *VMListResponse, err error)
- func (r *VMService) New(ctx context.Context, body VMNewParams, opts ...option.RequestOption) (res *shared.Operation, err error)
- func (r *VMService) Update(ctx context.Context, vmID string, body VMUpdateParams, ...) (res *shared.Operation, err error)
- type VMUpdateParams
Constants ¶
const OperationKindFirewallRule = shared.OperationKindFirewallRule
This is an alias to an internal value.
const OperationKindVM = shared.OperationKindVM
This is an alias to an internal value.
const OperationKindVPC = shared.OperationKindVPC
This is an alias to an internal value.
const OperationStatusDone = shared.OperationStatusDone
This is an alias to an internal value.
const OperationStatusFailed = shared.OperationStatusFailed
This is an alias to an internal value.
const OperationStatusPending = shared.OperationStatusPending
This is an alias to an internal value.
const OperationStatusRunning = shared.OperationStatusRunning
This is an alias to an internal value.
const OperationTypeCreate = shared.OperationTypeCreate
This is an alias to an internal value.
const OperationTypeDelete = shared.OperationTypeDelete
This is an alias to an internal value.
const OperationTypeUpdate = shared.OperationTypeUpdate
This is an alias to an internal value.
const RegionNameAmsterdam = shared.RegionNameAmsterdam
This is an alias to an internal value.
const RegionNameChicago = shared.RegionNameChicago
This is an alias to an internal value.
const RegionNameFrankfurt = shared.RegionNameFrankfurt
This is an alias to an internal value.
const RegionNameHongkong = shared.RegionNameHongkong
This is an alias to an internal value.
const RegionNameLondon = shared.RegionNameLondon
This is an alias to an internal value.
const RegionNameMumbai = shared.RegionNameMumbai
This is an alias to an internal value.
const RegionNameSaopaulo = shared.RegionNameSaopaulo
This is an alias to an internal value.
const RegionNameSeattle = shared.RegionNameSeattle
This is an alias to an internal value.
const RegionNameSiliconvalley = shared.RegionNameSiliconvalley
This is an alias to an internal value.
const RegionNameSingapore = shared.RegionNameSingapore
This is an alias to an internal value.
const RegionNameStockholm = shared.RegionNameStockholm
This is an alias to an internal value.
const RegionNameSydney = shared.RegionNameSydney
This is an alias to an internal value.
const RegionNameTokyo = shared.RegionNameTokyo
This is an alias to an internal value.
const RegionNameWashingtondc = shared.RegionNameWashingtondc
This is an alias to an internal value.
const ResourceStatusCreating = shared.ResourceStatusCreating
This is an alias to an internal value.
const ResourceStatusDeleted = shared.ResourceStatusDeleted
This is an alias to an internal value.
const ResourceStatusDeleting = shared.ResourceStatusDeleting
This is an alias to an internal value.
const ResourceStatusFailed = shared.ResourceStatusFailed
This is an alias to an internal value.
const ResourceStatusPending = shared.ResourceStatusPending
This is an alias to an internal value.
const ResourceStatusReady = shared.ResourceStatusReady
This is an alias to an internal value.
const ResourceStatusUpdating = shared.ResourceStatusUpdating
This is an alias to an internal value.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CPU ¶
type CPU struct {
Cores int64 `json:"cores,required"`
JSON cpuJSON `json:"-"`
}
CPU details.
func (*CPU) UnmarshalJSON ¶
type OperationKind ¶
type OperationKind = shared.OperationKind
This is an alias to an internal type.
type OperationService ¶
type OperationService struct {
Options []option.RequestOption
}
OperationService 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 NewOperationService method instead.
func NewOperationService ¶
func NewOperationService(opts ...option.RequestOption) (r *OperationService)
NewOperationService 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 OperationStatus ¶
type OperationStatus = shared.OperationStatus
This is an alias to an internal type.
type OperationType ¶
type OperationType = shared.OperationType
This is an alias to an internal type.
type Ram ¶
type Ram struct {
// RAM size
Size int64 `json:"size,required"`
// Unit (GB, MB, etc.)
Unit RamUnit `json:"unit,required"`
JSON ramJSON `json:"-"`
}
RAM details.
func (*Ram) UnmarshalJSON ¶
type RamParam ¶
type RamParam struct {
// RAM size
Size param.Field[int64] `json:"size,required"`
// Unit (GB, MB, etc.)
Unit param.Field[RamUnit] `json:"unit,required"`
}
RAM details.
func (RamParam) MarshalJSON ¶
type ResourceStatus ¶
type ResourceStatus = shared.ResourceStatus
This is an alias to an internal type.
type SSHKeyParam ¶
SSH key details.
func (SSHKeyParam) MarshalJSON ¶
func (r SSHKeyParam) MarshalJSON() (data []byte, err error)
type Storage ¶
type Storage struct {
// Storage size
Size int64 `json:"size,required"`
// Storage type.
Type StorageType `json:"type,required"`
// Storage unit.
Unit StorageUnit `json:"unit,required"`
// Disk name, used later
DiskName string `json:"disk_name"`
JSON storageJSON `json:"-"`
}
Storage details.
func (*Storage) UnmarshalJSON ¶
type StorageParam ¶
type StorageParam struct {
// Storage size
Size param.Field[int64] `json:"size,required"`
// Storage type.
Type param.Field[StorageType] `json:"type,required"`
// Storage unit.
Unit param.Field[StorageUnit] `json:"unit,required"`
// Disk name, used later
DiskName param.Field[string] `json:"disk_name"`
}
Storage details.
func (StorageParam) MarshalJSON ¶
func (r StorageParam) MarshalJSON() (data []byte, err error)
type StorageType ¶
type StorageType string
Storage type.
const (
StorageTypeNvme StorageType = "nvme"
)
func (StorageType) IsKnown ¶
func (r StorageType) IsKnown() bool
type StorageUnit ¶
type StorageUnit string
Storage unit.
const (
StorageUnitGB StorageUnit = "GB"
)
func (StorageUnit) IsKnown ¶
func (r StorageUnit) IsKnown() bool
type VM ¶
type VM struct {
ID string `json:"id,required"`
// CPU details.
CPUConfig CPU `json:"cpu_config,required"`
CreatedAt string `json:"created_at,required"`
// RAM details.
MemConfig Ram `json:"mem_config,required"`
Name string `json:"name,required"`
PublicIP string `json:"public_ip,required"`
Region shared.RegionName `json:"region,required"`
Status shared.ResourceStatus `json:"status,required"`
StorageConfig []Storage `json:"storage_config,required"`
UpdatedAt string `json:"updated_at,required"`
// VPC details.
VPC vpcs.VPC `json:"vpc,required"`
JSON vmJSON `json:"-"`
}
VM details.
func (*VM) UnmarshalJSON ¶
type VMListParams ¶
func (VMListParams) URLQuery ¶
func (r VMListParams) URLQuery() (v url.Values)
URLQuery serializes VMListParams's query parameters as `url.Values`.
type VMListResponse ¶
type VMListResponse struct {
Items []VM `json:"items,required"`
JSON vmListResponseJSON `json:"-"`
}
func (*VMListResponse) UnmarshalJSON ¶
func (r *VMListResponse) UnmarshalJSON(data []byte) (err error)
type VMNewParams ¶
type VMNewParams struct {
// CPU details.
CPU param.Field[CPUParam] `json:"cpu,required"`
Name param.Field[string] `json:"name,required"`
NeedPublicIP param.Field[bool] `json:"need_public_ip,required"`
OsImageID param.Field[int64] `json:"os_image_id,required"`
Ports param.Field[[]string] `json:"ports,required"`
// RAM details.
Ram param.Field[RamParam] `json:"ram,required"`
Region param.Field[shared.RegionName] `json:"region,required"`
SourceAddress param.Field[string] `json:"source_address,required"`
// SSH key details.
SSHKey param.Field[SSHKeyParam] `json:"ssh_key,required"`
Storage param.Field[[]StorageParam] `json:"storage,required"`
SubnetID param.Field[string] `json:"subnet_id"`
}
func (VMNewParams) MarshalJSON ¶
func (r VMNewParams) MarshalJSON() (data []byte, err error)
type VMService ¶
type VMService struct {
Options []option.RequestOption
Operations *OperationService
}
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 *shared.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 *VMListResponse, err error)
List all VMs
type VMUpdateParams ¶
type VMUpdateParams struct {
// CPU details.
CPU param.Field[CPUParam] `json:"cpu"`
// RAM details.
Ram param.Field[RamParam] `json:"ram"`
Storage param.Field[[]StorageParam] `json:"storage"`
}
func (VMUpdateParams) MarshalJSON ¶
func (r VMUpdateParams) MarshalJSON() (data []byte, err error)