Documentation ¶
Overview ¶
Package lunanode provides a Go client for interacting with Luna Node resources
Index ¶
- type BillingService
- type BillingServiceOp
- type Client
- type FloatingIP
- type FloatingIPsService
- type FloatingIPsServiceOp
- type IP
- type Image
- type ImageDetails
- type ImagesService
- type ImagesServiceOp
- func (s *ImagesServiceOp) Delete(imageID string) error
- func (s *ImagesServiceOp) Details(imageID string) (*ImageDetails, error)
- func (s *ImagesServiceOp) Fetch(region, name, location, format string, virtio *string) (string, error)
- func (s *ImagesServiceOp) List() ([]Image, error)
- func (s ImagesServiceOp) Rename(imageID, name string) error
- func (s *ImagesServiceOp) Replicate(imageID, region string) (string, error)
- type Network
- type Plan
- type PlansService
- type PlansServiceOp
- type RegionsService
- type RegionsServiceOp
- type Rule
- type RuleInsertOptions
- type SSHKey
- type SSHKeysService
- type SSHKeysServiceOp
- type SecurityGroup
- type SecurityGroupsService
- type SecurityGroupsServiceOp
- func (s *SecurityGroupsServiceOp) Create(region, name string) (string, error)
- func (s *SecurityGroupsServiceOp) Delete(region, groupID string) error
- func (s *SecurityGroupsServiceOp) List() ([]SecurityGroup, error)
- func (s *SecurityGroupsServiceOp) Rename(region, groupID, name string) error
- func (s *SecurityGroupsServiceOp) RuleDelete(region, groupID, ruleID string) error
- func (s *SecurityGroupsServiceOp) RuleInsert(options *RuleInsertOptions) (string, error)
- func (s *SecurityGroupsServiceOp) RuleList(region, groupID string) ([]Rule, error)
- type Snapshot
- type StartupScript
- type StartupScriptsService
- type StartupScriptsServiceOp
- func (s *StartupScriptsServiceOp) Create(name, content string) (string, error)
- func (s *StartupScriptsServiceOp) Delete(scriptID string) error
- func (s *StartupScriptsServiceOp) Get(scriptID string) (*StartupScript, error)
- func (s *StartupScriptsServiceOp) List() ([]StartupScript, error)
- func (s *StartupScriptsServiceOp) Update(scriptID, name, content string) error
- type VM
- type VMAddress
- type VMCreateOptions
- type VMFloatingIPAddOptions
- type VMFloatingIPDeleteOptions
- type VMInfo
- type VMsService
- type VMsServiceOp
- func (s *VMsServiceOp) Create(hostname, planID string, options *VMCreateOptions) (string, error)
- func (s *VMsServiceOp) Delete(vmID string) error
- func (s *VMsServiceOp) Diskswap(vmID string) error
- func (s *VMsServiceOp) FloatingIPAdd(vmID string, options *VMFloatingIPAddOptions) error
- func (s *VMsServiceOp) FloatingIPDelete(vmID string, options *VMFloatingIPDeleteOptions) error
- func (s *VMsServiceOp) IPAdd(vmID string, ip *string) (string, error)
- func (s *VMsServiceOp) IPDelete(vmID, ip string) error
- func (s *VMsServiceOp) IPList(vmID string) ([]IP, error)
- func (s *VMsServiceOp) Info(vmID string) (*VMInfo, error)
- func (s *VMsServiceOp) List() ([]VM, error)
- func (s *VMsServiceOp) Reboot(vmID string) error
- func (s *VMsServiceOp) Reimage(vmID, imageID string) error
- func (s *VMsServiceOp) Rename(vmID, hostname string) error
- func (s *VMsServiceOp) Rescue(vmID string) error
- func (s *VMsServiceOp) Resize(vmID, planID string) error
- func (s *VMsServiceOp) SecurityGroupAdd(vmID, groupID string) error
- func (s *VMsServiceOp) SecurityGroupRemove(vmID, groupID string) error
- func (s *VMsServiceOp) Shelve(vmID string) error
- func (s *VMsServiceOp) Snapshot(vmID, label string) (string, error)
- func (s *VMsServiceOp) Start(vmID string) error
- func (s *VMsServiceOp) Stop(vmID string) error
- func (s *VMsServiceOp) Unshelve(vmID string) error
- func (s *VMsServiceOp) VNC(vmID string) (string, error)
- type VirtualNetworksService
- type VirtualNetworksServiceOp
- type Volume
- type VolumeCreateOptions
- type VolumeInfo
- type VolumesService
- type VolumesServiceOp
- func (s *VolumesServiceOp) Attach(volumeID, vmID, target string) error
- func (s *VolumesServiceOp) Create(region, label, size string, options *VolumeCreateOptions) (string, error)
- func (s *VolumesServiceOp) Delete(volumeID string) error
- func (s *VolumesServiceOp) Detach(volumeID string) error
- func (s *VolumesServiceOp) Extend(volumeID, size string) error
- func (s *VolumesServiceOp) Info(volumeID string) (*VolumeInfo, error)
- func (s *VolumesServiceOp) List() ([]Volume, error)
- func (s *VolumesServiceOp) Rename(volumeID, name string) error
- func (s *VolumesServiceOp) SnapshotCreate(volumeID, label string) (string, error)
- func (s *VolumesServiceOp) SnapshotDelete(region, snapshotID string) error
- func (s *VolumesServiceOp) SnapshotList(region string) ([]Snapshot, error)
- func (s *VolumesServiceOp) SnapshotReplicate(region, snapshotID, imageName, destinationRegion string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BillingService ¶
BillingService is an interface for interfacing with the billing endpoints of the Luna Node API.
type BillingServiceOp ¶
type BillingServiceOp struct {
// contains filtered or unexported fields
}
BillingServiceOp handles communication with billing related methods of the Luna Node API.
func (*BillingServiceOp) Credit ¶
func (s *BillingServiceOp) Credit() (string, error)
Credit returns the amount of credit in your account in $USD.
type Client ¶
type Client struct { VMs VMsService Images ImagesService Volumes VolumesService FloatingIPs FloatingIPsService VirtualNetworks VirtualNetworksService SecurityGroups SecurityGroupsService StartupScripts StartupScriptsService SSHKeys SSHKeysService Plans PlansService Regions RegionsService Billing BillingService // contains filtered or unexported fields }
Client represents a Luna Node client.
type FloatingIP ¶
type FloatingIP struct { AttachedID string `json:"attached_id"` AttachedName string `json:"attached_name"` AttachedType string `json:"attached_type"` Hostname string `json:"hostname"` IP string `json:"ip"` Region string `json:"region"` Reverse string `json:"reverse"` TimeUpdated string `json:"time_updated"` }
FloatingIP represents a Luna Node floating IP.
type FloatingIPsService ¶
type FloatingIPsService interface { List() ([]FloatingIP, error) Add(region string) (string, error) Delete(region, ip string) error }
FloatingIPsService is an interface for interfacing with the floating IP endpoints of the Luna Node API.
type FloatingIPsServiceOp ¶
type FloatingIPsServiceOp struct {
// contains filtered or unexported fields
}
FloatingIPsServiceOp handles communication with floating IP related methods of the Luna Node API.
func (*FloatingIPsServiceOp) Add ¶
func (s *FloatingIPsServiceOp) Add(region string) (string, error)
Add adds a new unattached floating IP to the specified region.
func (*FloatingIPsServiceOp) Delete ¶
func (s *FloatingIPsServiceOp) Delete(region, ip string) error
Delete deletes an unattached floating IP from the account.
func (*FloatingIPsServiceOp) List ¶
func (s *FloatingIPsServiceOp) List() ([]FloatingIP, error)
List lists all floating IPs.
type IP ¶
type IP struct { Floating string `json:"floating"` Networking string `json:"networking"` NetworkID string `json:"network_id"` Port string `json:"port"` Subnet string `json:"subnet"` SubnetIdentification string `json:"subnet_identification"` }
IP represents a Luna Node IP.
type Image ¶
type Image struct { ImageID string `json:"image_id"` Name string `json:"name"` Region string `json:"region"` Status string `json:"status"` }
Image represents a Luna Node image.
type ImageDetails ¶
type ImageDetails struct { CacheMode string `json:"cache_mode"` Checksum string `json:"checksum"` DiskFormat string `json:"disk_format"` HwDiskBus string `json:"hw_disk_bus"` HwVideoModel string `json:"hw_video_model"` HwVifModel string `json:"hw_vif_model"` IsReadOnly string `json:"is_read_only"` LibvirtCPUMode string `json:"libvirt_cpu_mode"` Metadata []string `json:"metadata"` Name string `json:"name"` Region string `json:"region"` Size string `json:"size"` Status string `json:"status"` TimeCreated string `json:"time_created"` }
ImageDetails represents Luna Node extended image details.
type ImagesService ¶
type ImagesService interface { Fetch(region, name, location, format string, virtio *string) (string, error) List() ([]Image, error) Details(imageID string) (*ImageDetails, error) Delete(imageID string) error Replicate(imageID, region string) (string, error) Rename(imageID, name string) error }
ImagesService is an interface for interfacing with the images endpoints of the Luna Node API.
type ImagesServiceOp ¶
type ImagesServiceOp struct {
// contains filtered or unexported fields
}
ImagesServiceOp handles communication with image related methods of the Luna Node API.
func (*ImagesServiceOp) Delete ¶
func (s *ImagesServiceOp) Delete(imageID string) error
Delete deletes the specified image.
func (*ImagesServiceOp) Details ¶
func (s *ImagesServiceOp) Details(imageID string) (*ImageDetails, error)
Details retrieves additional details about an image.
func (*ImagesServiceOp) Fetch ¶
func (s *ImagesServiceOp) Fetch(region, name, location, format string, virtio *string) (string, error)
Fetch adds a new image from an HTTP, HTTPS or FTP source. If virtio is "yes", virtio storage and network drivers will be used for VMs provisioned with this image.
func (*ImagesServiceOp) List ¶
func (s *ImagesServiceOp) List() ([]Image, error)
List lists available images.
func (ImagesServiceOp) Rename ¶
func (s ImagesServiceOp) Rename(imageID, name string) error
Rename renames an image.
type Network ¶
type Network struct { Name string `json:"name"` NetID string `json:"net_id"` Subnet string `json:"subnet"` }
Network represents a Luna Node virtual network.
type Plan ¶
type Plan struct { AllRegions string `json:"all_regions"` Bandwidth string `json:"bandwidth"` Category string `json:"category"` CPUPoints string `json:"cpu_points"` Name string `json:"name"` PlanID string `json:"plan_id"` Price string `json:"price"` PriceMonthlyNice string `json:"price_monthly_nice"` PriceNice string `json:"price_nice"` RAM string `json:"ram"` Regions []string `json:"regions"` RegionsNice string `json:"regions_nice"` Storage string `json:"storage"` VCPU string `json:"vcpu"` }
Plan represents a Luna Node plan.
type PlansService ¶
PlansService is an interface for interfacing with the regions endpoints of the Luna Node API.
type PlansServiceOp ¶
type PlansServiceOp struct {
// contains filtered or unexported fields
}
PlansServiceOp handles communication with plan related methods of the Luna Node API.
func (*PlansServiceOp) List ¶
func (s *PlansServiceOp) List() ([]Plan, error)
List lists all plans and their region(s).
type RegionsService ¶
RegionsService is an interface for interfacing with the regions endpoints of the Luna Node API.
type RegionsServiceOp ¶
type RegionsServiceOp struct {
// contains filtered or unexported fields
}
RegionsServiceOp handles communication with region related methods of the Luna Node API.
type Rule ¶
type Rule struct { Direction string EtherType string ID string Label string PortRange string Protocol string Remote string }
Rule represents a Luna Node security group rule.
type RuleInsertOptions ¶
type RuleInsertOptions struct { // Region specifies the region of the security group. Region string `json:"region"` // GroupID specifies the security group ID. GroupID string `json:"group_id"` // Direction specifies the rules for permitting incoming traffic. Specify // "ingress" for rules permitting incoming traffic or "egress" for rules // permitting outgoing traffic. Direction string `json:"direction"` // Type specifies the IP version, either "4" or "6". Type string `json:"type"` // Protocol specifies which protocols to permit. Specify "*" for all protocols, // or "tcp", "udp" or "icmp". Protocol string `json:"protocol"` // RemoteType is either "cidr" or "group". RemoteType string `json:"remote_type"` // RemoteValue is either a CIDR or group. E.g. if RemoteType is "cidr" then // specify a CIDR like "1.2.3.4/32". If RemoteType is "group" then specify // a security group ID. RemoteValue string `json:"remote_value"` // PortMin (optional) specifies the lower bound of the port range (if protocol is "tcp" // or "udp".) PortMin string `json:"port_min,omitempty"` // PortMax (optional) specifies the upper bound of a port range (if protocol is "tcp" // or "udp".) PortMax string `json:"port_max,omitempty"` // Label (optional) specifies the optional label for this rule Label string `json:"label,omitempty"` }
RuleInsertOptions represents additional options for rule insertion.
type SSHKeysService ¶
type SSHKeysService interface { Add(label, sshKey string) (string, error) List() ([]SSHKey, error) Remove(keyID string) error }
SSHKeysService is an interface for interfacing with the SSH key endpoints of the Luna Node API.
type SSHKeysServiceOp ¶
type SSHKeysServiceOp struct {
// contains filtered or unexported fields
}
SSHKeysServiceOp handles communication with SSH key related methods of the Luna Node API.
func (*SSHKeysServiceOp) Add ¶
func (s *SSHKeysServiceOp) Add(label, sshKey string) (string, error)
Add adds an SSH key and returns the ID.
func (*SSHKeysServiceOp) List ¶
func (s *SSHKeysServiceOp) List() ([]SSHKey, error)
List lists all SSH keys.
func (*SSHKeysServiceOp) Remove ¶
func (s *SSHKeysServiceOp) Remove(keyID string) error
Remove removes an SSH key.
type SecurityGroup ¶
type SecurityGroup struct { Name string `json:"name"` Region string `json:"region"` ID string `json:"securitygroup_id"` }
SecurityGroup represents a Luna Node security group.
type SecurityGroupsService ¶
type SecurityGroupsService interface { List() ([]SecurityGroup, error) Create(region, name string) (string, error) Delete(region, groupID string) error Rename(region, groupID, name string) error RuleList(region, groupID string) ([]Rule, error) RuleInsert(options *RuleInsertOptions) (string, error) RuleDelete(region, groupID, ruleID string) error }
SecurityGroupsService is an interface for interfacing with the security groups endpoints of the Luna Node API.
type SecurityGroupsServiceOp ¶
type SecurityGroupsServiceOp struct {
// contains filtered or unexported fields
}
SecurityGroupsServiceOp handles communication with security group related methods of the Luna Node API.
func (*SecurityGroupsServiceOp) Create ¶
func (s *SecurityGroupsServiceOp) Create(region, name string) (string, error)
Create creates a security group for the specified region.
func (*SecurityGroupsServiceOp) Delete ¶
func (s *SecurityGroupsServiceOp) Delete(region, groupID string) error
Delete deletes a security group.
func (*SecurityGroupsServiceOp) List ¶
func (s *SecurityGroupsServiceOp) List() ([]SecurityGroup, error)
List lists all security groups.
func (*SecurityGroupsServiceOp) Rename ¶
func (s *SecurityGroupsServiceOp) Rename(region, groupID, name string) error
Rename renames an existing security group.
func (*SecurityGroupsServiceOp) RuleDelete ¶
func (s *SecurityGroupsServiceOp) RuleDelete(region, groupID, ruleID string) error
RuleDelete deletes a specified role from a group.
func (*SecurityGroupsServiceOp) RuleInsert ¶
func (s *SecurityGroupsServiceOp) RuleInsert(options *RuleInsertOptions) (string, error)
RuleInsert inserts a new rule into a security group. Each rule allows certain types of traffic between VMs in this security group (and remote hosts defined by remoteType and remoteValue). To authorize traffic for any remote host, set remoteType to "cidr" and remoteValue to "0.0.0.0/0" (repeat for IPv6 if desired.) You can also optionally set a port range for a TCP/UDP rule by setting both portMin and portMax. To authorize traffic for a single port, set portMin equal to portMax.
type Snapshot ¶
type Snapshot struct { ID string `json:"id"` Name string `json:"name"` Region string `json:"region"` Size string `json:"size"` Status string `json:"status"` UserID string `json:"user_id"` Volume Volume `json:"volume"` }
Snapshot represents a Luna Node snapshot.
type StartupScript ¶
type StartupScript struct { Content string `json:"content"` ID string `json:"id"` Name string `json:"name"` }
StartupScript represents a Luna Node startup script.
type StartupScriptsService ¶
type StartupScriptsService interface { List() ([]StartupScript, error) Get(scriptID string) (*StartupScript, error) Create(name, content string) (string, error) Update(scriptID, name, content string) error Delete(scriptID string) error }
StartupScriptsService is an interface for interfacing with the startup scripts endpoints of the Luna Node API.
type StartupScriptsServiceOp ¶
type StartupScriptsServiceOp struct {
// contains filtered or unexported fields
}
StartupScriptsServiceOp handles communication with startup scripts related methods of the Luna Node API.
func (*StartupScriptsServiceOp) Create ¶
func (s *StartupScriptsServiceOp) Create(name, content string) (string, error)
Create creates a script and returns its ID.
func (*StartupScriptsServiceOp) Delete ¶
func (s *StartupScriptsServiceOp) Delete(scriptID string) error
Delete deletes a startup script.
func (*StartupScriptsServiceOp) Get ¶
func (s *StartupScriptsServiceOp) Get(scriptID string) (*StartupScript, error)
Get gets a script by script ID.
func (*StartupScriptsServiceOp) List ¶
func (s *StartupScriptsServiceOp) List() ([]StartupScript, error)
List lists all startup scripts.
func (*StartupScriptsServiceOp) Update ¶
func (s *StartupScriptsServiceOp) Update(scriptID, name, content string) error
Update updates an existing script's contents.
type VM ¶
type VM struct { Bandwidth string `json:"bandwidth"` Hostname string `json:"hostname"` Name string `json:"name"` OSStatus string `json:"os_status"` PlanID string `json:"plan_id"` PrimaryIP string `json:"primary_ip"` PrivateIP string `json:"private_ip"` RAM string `json:"ram"` Region string `json:"region"` Storage string `json:"storage"` VCPU string `json:"vcpu"` ID string `json:"vm_id"` }
A VM represents a Luna Node VM.
type VMAddress ¶
type VMAddress struct { Addr string `json:"addr"` External string `json:"external"` Version string `json:"version"` }
VMAddress represents a Luna Node address (after VM creation.) It appears that there is a bug in the Luna Node API where during VM creation the "addresses" field of the "info" endpoint is an empty string, whereas after VM creation the value is the struct below. As such, VMInfo encodes the field as an interface{}. It is up to the user to check the validity of the Addresses field and potentially build a VMAddress. This is to reduce deserialization overhead until the API is corrected.
type VMCreateOptions ¶
type VMCreateOptions struct { // ImageID specifies the Image ID to use for creation (retrieved from ImageList.) ImageID string `json:"image_id,omitempty"` // VolumeID specifies the Volume ID to use for creation retrieved from VolumeList. VolumeID string `json:"volume_id,omitempty"` // VolumeVirtio specifies whether to use the virtio storage driver. Either // "yes" or "no" (default "no" for IDE driver.) VolumeVirtio string `json:"volume_virtio,omitempty"` // Region specifies the VM creation region. Must be "toronto", "montreal" or // "roubaix" (defaults to "toronto".) Region string `json:"region,omitempty"` // IP specifies an unattached floating IP to use for this VM. Default is to // grab a new floating IP. IP string `json:"ip,omitempty"` // NetID specifies a network ID retrieved from NetworkList. NetID string `json:"net_id,omitempty"` // SecurityGroups specifies a comma-separated list of security group IDs // (e.g.: "123,999", see SecurityList.) SecurityGroups string `json:"security_groups,omitempty"` // Scripts specifies a comma-separated list of script IDs // (e.g.: "123,999", see ScriptList.) Scripts string `json:"scripts,omitempty"` // KeyIDs specifies a comma-separated list of key IDs (e.g.: "123,999", see SSHKeyList.) KeyIDs string `json:"key_ids,omitempty"` // SetPassword specifies if a password should be set via cloud-init. Either // "yes" or "no" (not needed for templates.) SetPassword string `json:"set_password,omitempty"` // AffinityGroup specifies an affinity group UUID // (e.g. "68766804-eff2-4ac5-bed7-7daa2fa528c9") AffinityGroup string `json:"affinity_group,omitempty"` }
VMCreateOptions represents additional options for VM creation. One of ImageID or VolumeID *must* be set.
type VMFloatingIPAddOptions ¶
type VMFloatingIPAddOptions struct { // IP specifies the floating IP address to add (see FloatingList.) IP string `json:"ip,omitempty"` // PrivateIP specifies the internal IP to which the floating IP should be // attached. PrivateIP string `json:"private_ip,omitempty"` }
VMFloatingIPAddOptions represents additional options for floating IP addition.
type VMFloatingIPDeleteOptions ¶
type VMFloatingIPDeleteOptions struct { // IP specifies the floating IP address currently attached to the VM. IP string `json:"ip,omitempty"` // Keep specifies if the floating IP on the account should be kept after // deletion ("yes" or "no", defaults "no".) Keep string `json:"keep,omitempty"` }
VMFloatingIPDeleteOptions represents additional options for floating IP deletion.
type VMInfo ¶
type VMInfo struct { Extra VM `json:"extra"` Info struct { AdditionalIP []string `json:"additionalip"` AdditionalPrivateIP []string `json:"additionalprivateip"` // Should be a []VMAddress. See note on VMAddress. Addresses interface{} `json:"addresses"` ErrorDetail string `json:"error_detail"` HostID string `json:"host_id"` Hostname string `json:"hostname"` ImageName string `json:"image"` IP string `json:"ip"` IPv6 []string `json:"ipv6"` LoginDetails string `json:"login_details"` OS string `json:"os"` PrivateIP string `json:"private_ip"` // Should be a []string. During VM creation it is an empty string, // which is incorrect. SecurityGroupIDs interface{} `json:"security_group_ids"` // Should be a []string. During VM creation it is an empty string, // which is incorrect. SecurityGroups interface{} `json:"security_groups"` Status string `json:"status"` StatusColor string `json:"status_color"` StatusNoHTML string `json:"status_nohtml"` StatusRaw string `json:"status_raw"` TaskState string `json:"task_state"` Volumes string `json:"volumes"` } `json:"info"` }
VMInfo represents the extended information attached to a Luna Node VM.
type VMsService ¶
type VMsService interface { Create(hostname, planID string, options *VMCreateOptions) (string, error) List() ([]VM, error) Start(vmID string) error Stop(vmID string) error Reboot(vmID string) error Diskswap(vmID string) error Rescue(vmID string) error Shelve(vmID string) error Unshelve(vmID string) error Delete(vmID string) error Info(vmID string) (*VMInfo, error) Reimage(vmID, imageID string) error Resize(vmID, planID string) error VNC(vmID string) (string, error) FloatingIPAdd(vmID string, options *VMFloatingIPAddOptions) error FloatingIPDelete(vmID string, options *VMFloatingIPDeleteOptions) error IPList(vmID string) ([]IP, error) IPAdd(vmID string, ip *string) (string, error) IPDelete(vmID, ip string) error SecurityGroupAdd(vmID, groupID string) error SecurityGroupRemove(vmID, groupID string) error Snapshot(vmID, label string) (string, error) Rename(vmID, hostname string) error }
VMsService is an interface for interfacing with the VM endpoints of the Luna Node API.
type VMsServiceOp ¶
type VMsServiceOp struct {
// contains filtered or unexported fields
}
VMsServiceOp handles communication with VM related methods of the Luna Node API.
func (*VMsServiceOp) Create ¶
func (s *VMsServiceOp) Create(hostname, planID string, options *VMCreateOptions) (string, error)
Create creates a Luna Node VM. Hostname is used as the label for the VM as well as the hostname. The plan ID can either be a numeric ID retrieved from PlanList or a string ID like "m.2" or "s.4".
func (*VMsServiceOp) Diskswap ¶
func (s *VMsServiceOp) Diskswap(vmID string) error
Diskswap performs a diskswap on a VM.
func (*VMsServiceOp) FloatingIPAdd ¶
func (s *VMsServiceOp) FloatingIPAdd(vmID string, options *VMFloatingIPAddOptions) error
FloatingIPAdd adds a new floating IP to a VM. This does not add an internal IP (see VMIPAdd.) If IP is not set, a new floating IP will be added to the account and attached to the specified VM. PrivateIP must be set if the VM has more than one internal IP.
func (*VMsServiceOp) FloatingIPDelete ¶
func (s *VMsServiceOp) FloatingIPDelete(vmID string, options *VMFloatingIPDeleteOptions) error
FloatingIPDelete deletes one or all floating IPs from a VM. If Keep is "yes", then the floating IP will be retained on the account in an unattached state. Unattached floating IPs can be used as the IP parameter in VMCreate or VMFloatingIPAdd. If IP is not set, all floating IPs attached to the VM will be detached.
func (*VMsServiceOp) IPAdd ¶
func (s *VMsServiceOp) IPAdd(vmID string, ip *string) (string, error)
IPAdd adds an internal IP to a VM. The internal IP will not be associated with a floating IP. If you want an additional floating IP, call VMFloatingIPAdd after adding the internal IP. If IP is not set, an arbitrary, unused internal IP will be selected.
func (*VMsServiceOp) IPDelete ¶
func (s *VMsServiceOp) IPDelete(vmID, ip string) error
IPDelete removes an internal IP from a VM. The IP must not have any associated floating IP. If it does, the floating IP must first be detailed with VMFloatingIPDelete.
func (*VMsServiceOp) IPList ¶
func (s *VMsServiceOp) IPList(vmID string) ([]IP, error)
IPList lists all IPs attached to a VM. The Floating attribute will not appear if the internal IP has no associated floating IP.
func (*VMsServiceOp) Info ¶
func (s *VMsServiceOp) Info(vmID string) (*VMInfo, error)
Info requests additional information about a VM.
func (*VMsServiceOp) Reimage ¶
func (s *VMsServiceOp) Reimage(vmID, imageID string) error
Reimage reimages an existing VM.
func (*VMsServiceOp) Rename ¶
func (s *VMsServiceOp) Rename(vmID, hostname string) error
Rename renames a VM.
func (*VMsServiceOp) Rescue ¶
func (s *VMsServiceOp) Rescue(vmID string) error
Rescue boots a VM into rescue mode.
func (*VMsServiceOp) Resize ¶
func (s *VMsServiceOp) Resize(vmID, planID string) error
Resize resizes an existing VM.
func (*VMsServiceOp) SecurityGroupAdd ¶
func (s *VMsServiceOp) SecurityGroupAdd(vmID, groupID string) error
SecurityGroupAdd adds a VM to a security group.
func (*VMsServiceOp) SecurityGroupRemove ¶
func (s *VMsServiceOp) SecurityGroupRemove(vmID, groupID string) error
SecurityGroupRemove removes a VM from a security group.
func (*VMsServiceOp) Snapshot ¶
func (s *VMsServiceOp) Snapshot(vmID, label string) (string, error)
Snapshot takes a snapshot of a VM and returns the image ID.
func (*VMsServiceOp) Unshelve ¶
func (s *VMsServiceOp) Unshelve(vmID string) error
Unshelve unshelves a VM.
type VirtualNetworksService ¶
type VirtualNetworksService interface { List() ([]Network, error) Create(region, name, subnet, dns string) (string, error) Delete(region, netID string) error }
VirtualNetworksService is an interface for interfacing with the virtual networks endpoints of the Luna Node API.
type VirtualNetworksServiceOp ¶
type VirtualNetworksServiceOp struct {
// contains filtered or unexported fields
}
VirtualNetworksServiceOp handles communication with virtual networks related methods of the Luna Node API.
func (*VirtualNetworksServiceOp) Create ¶
func (s *VirtualNetworksServiceOp) Create(region, name, subnet, dns string) (string, error)
Create creates a virtual network for a specified region
func (*VirtualNetworksServiceOp) Delete ¶
func (s *VirtualNetworksServiceOp) Delete(region, netID string) error
Delete deletes a virtual network.
func (*VirtualNetworksServiceOp) List ¶
func (s *VirtualNetworksServiceOp) List() ([]Network, error)
List lists all virtual networks.
type Volume ¶
type Volume struct { ID string `json:"id"` Identification string `json:"identification"` Name string `json:"name"` Region string `json:"region"` Size string `json:"size"` Status string `json:"status"` TimeCreated string `json:"time_created"` UserID string `json:"user_id"` }
Volume represents a Luna Node volume.
type VolumeCreateOptions ¶
type VolumeCreateOptions struct { // Image specifies the image ID which may be a snapshot of a VM. Image string `json:"image_id,omitempty"` // SnapshotID specifies the ID of a volume snapshot SnapshotID string `json:"snapshot_id,omitempty"` }
VolumeCreateOptions represents additional options for volume creation.
type VolumeInfo ¶
type VolumeInfo struct { Attached string `json:"attached"` Created string `json:"created"` ID string `json:"id"` Identification string `json:"identification"` Name string `json:"name"` Size string `json:"size"` Status string `json:"status"` }
VolumeInfo represents additional info regaring a Luna Node volume.
type VolumesService ¶
type VolumesService interface { Create(region, label, size string, options *VolumeCreateOptions) (string, error) List() ([]Volume, error) Info(volumeID string) (*VolumeInfo, error) Attach(volumeID, vmID, target string) error Detach(volumeID string) error Extend(volumeID, size string) error Rename(volumeID, name string) error Delete(volumeID string) error SnapshotCreate(volumeID, label string) (string, error) SnapshotList(region string) ([]Snapshot, error) SnapshotReplicate(region, snapshotID, imageName, destinationRegion string) (string, error) SnapshotDelete(region, snapshotID string) error }
VolumesService is an interface for interfacing with the volumes endpoints of the Luna Node API.
type VolumesServiceOp ¶
type VolumesServiceOp struct {
// contains filtered or unexported fields
}
VolumesServiceOp handles communication with volume related methods of the Luna Node API.
func (*VolumesServiceOp) Attach ¶
func (s *VolumesServiceOp) Attach(volumeID, vmID, target string) error
Attach attaches a volume to an existing VM.
func (*VolumesServiceOp) Create ¶
func (s *VolumesServiceOp) Create(region, label, size string, options *VolumeCreateOptions) (string, error)
Create creates a volume with specified size in Gb. If neither Image or SnapshotID are specified, an empty volume is created.
func (*VolumesServiceOp) Delete ¶
func (s *VolumesServiceOp) Delete(volumeID string) error
Delete deletes an existing volume.
func (*VolumesServiceOp) Detach ¶
func (s *VolumesServiceOp) Detach(volumeID string) error
Detach detaches a volume attached to a VM.
func (*VolumesServiceOp) Extend ¶
func (s *VolumesServiceOp) Extend(volumeID, size string) error
Extend extends the size of an existing volume. Size is in Gb.
func (*VolumesServiceOp) Info ¶
func (s *VolumesServiceOp) Info(volumeID string) (*VolumeInfo, error)
Info requests additional information about a volume.
func (*VolumesServiceOp) List ¶
func (s *VolumesServiceOp) List() ([]Volume, error)
List lists all volumes.
func (*VolumesServiceOp) Rename ¶
func (s *VolumesServiceOp) Rename(volumeID, name string) error
Rename renames an existing volume.
func (*VolumesServiceOp) SnapshotCreate ¶
func (s *VolumesServiceOp) SnapshotCreate(volumeID, label string) (string, error)
SnapshotCreate creates a snapshot of a specified volume with a label.
func (*VolumesServiceOp) SnapshotDelete ¶
func (s *VolumesServiceOp) SnapshotDelete(region, snapshotID string) error
SnapshotDelete deletes a snapshot from a specified region.
func (*VolumesServiceOp) SnapshotList ¶
func (s *VolumesServiceOp) SnapshotList(region string) ([]Snapshot, error)
SnapshotList lists all snapshots for a region.
func (*VolumesServiceOp) SnapshotReplicate ¶
func (s *VolumesServiceOp) SnapshotReplicate(region, snapshotID, imageName, destinationRegion string) (string, error)
SnapshotReplicate replicates a snapshot to another region.