kiwivm

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2025 License: MIT Imports: 12 Imported by: 0

README

kiwivm-go

GoDoc Go Report Card

kiwivm-go is a Go library for the KiwiVM(BandwagonHOST) API.

Installing

You need a working Go environment.

go get github.com/ZhangXavier/kiwivm-go

Documentation

Index

Constants

View Source
const (
	EnvVeID   = "KIWIVM_VEID"
	EnvApiKey = "KIWIVM_API_KEY"
)
View Source
const (
	Host = "https://api.64clouds.com"
)

Variables

View Source
var UnknownError = &Error{
	Code:    -1,
	Message: "unknown error",
}

Functions

func DecodeJson

func DecodeJson(r io.Reader, v any) error

func Get

func Get[T any](ctx context.Context, c *Client, path string) (*T, error)

func GetWithQueryParams

func GetWithQueryParams[T any](ctx context.Context, c *Client, path string, req any) (*T, error)

func IntToNetIP4

func IntToNetIP4(ipv4Int int64) net.IP

func IntToNetIP4Str

func IntToNetIP4Str(ipv4Int int64) string

func MarshalString

func MarshalString(v any) string

Types

type AuditLog

type AuditLog struct {
	Timestamp     int64  `json:"timestamp"`
	RequestorIpv4 int64  `json:"requestor_ipv4"`
	Type          int    `json:"type"`
	Summary       string `json:"summary"`
}

type Auth

type Auth struct {
	VeID   string `url:"veid"`
	APIKey string `url:"api_key"`
}

type Backup

type Backup struct {
	Size      int    `json:"size"`
	OS        string `json:"os"`
	MD5       string `json:"md5"`
	Timestamp int64  `json:"timestamp"`
}

type BackupCopyToSnapshotReq

type BackupCopyToSnapshotReq struct {
	BackupToken string `json:"backupToken"`
}

type BackupCopyToSnapshotRsp

type BackupCopyToSnapshotRsp struct {
	NotificationEmail string `json:"notificationEmail"`
	Error             int    `json:"error"`
}

type BackupListRsp

type BackupListRsp struct {
	// Array of backups (backup_token, size, os, md5, timestamp).
	Backups map[string]Backup `json:"backups"`
	Error   int               `json:"error"`
}

type BandwidthAlert

type BandwidthAlert struct {
	FriendlyDescription string `json:"friendly_description"`
	IsEnabled           int    `json:"is_enabled"`
	ChangedTimestamp    int64  `json:"changed_timestamp"`
	SValue              string `json:"s_value"`
}

type BasicShellCDReq

type BasicShellCDReq struct {
	CurrentDir string `json:"currentDir"`
	NewDir     string `json:"newDir"`
}

type BasicShellCDRsp

type BasicShellCDRsp struct {
	// Result of the "pwd" command after the change.
	PWD   string `json:"pwd"`
	Error int    `json:"error"`
}

type BasicShellExecReq

type BasicShellExecReq struct {
	Command string `json:"command"`
}

type BasicShellExecRsp

type BasicShellExecRsp struct {
	// Exit status code of the executed command
	Error int `json:"error"`
	// Console output of the executed command
	Message string `json:"message"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func GetDefaultTestClient

func GetDefaultTestClient() *Client

func NewClient

func NewClient(veID, apiKey string, optFunc ...ClientOptFunc) *Client

func (*Client) BackupCopyToSnapshot

func (c *Client) BackupCopyToSnapshot(ctx context.Context, req *BackupCopyToSnapshotReq) (*BackupCopyToSnapshotRsp, error)

BackupCopyToSnapshot Copies a backup identified by backup_token (returned by backup/list) into a restorable Snapshot.

func (*Client) BackupList

func (c *Client) BackupList(ctx context.Context) (*BackupListRsp, error)

BackupList Get list of automatic backups.

func (*Client) BasicShellCD

func (c *Client) BasicShellCD(ctx context.Context, req *BasicShellCDReq) (*BasicShellCDRsp, error)

BasicShellCD Simulate change of directory inside of the VPS. Can be used to build a shell like Basic shell.

func (*Client) BasicShellExec

func (c *Client) BasicShellExec(ctx context.Context, req *BasicShellExecReq) (*BasicShellExecRsp, error)

BasicShellExec Execute a shell command on the VPS (synchronously).

func (*Client) CloneFromExternalServer

func (c *Client) CloneFromExternalServer(ctx context.Context, req *CloneFromExternalServerReq) (*CloneFromExternalServerRsp, error)

CloneFromExternalServer (OVZ only) Clone a remote server or VPS. See Migrate from another server for example on how this works. TODO: Need Test

func (*Client) GetAuditLog

func (c *Client) GetAuditLog(ctx context.Context) (*GetAuditLogRsp, error)

GetAuditLog Returns an array with the detailed audit log shown under Audit Log in KiwiVM.

func (*Client) GetAvailableOS

func (c *Client) GetAvailableOS(ctx context.Context) (*GetAvailableOSRsp, error)

func (*Client) GetLiveServiceInfo

func (c *Client) GetLiveServiceInfo(ctx context.Context) (*GetLiveServiceInfoRsp, error)

GetLiveServiceInfo This function returns all data provided by getServiceInfo. In addition, it provides detailed status of the VPS. Please note that this call may take up to 15 seconds to complete.

func (*Client) GetPolicyViolations

func (c *Client) GetPolicyViolations(ctx context.Context) (*GetPolicyViolationsRsp, error)

GetPolicyViolations Retrieve information related to active policy violations.

func (*Client) GetRateLimitStatus

func (c *Client) GetRateLimitStatus(ctx context.Context) (*GetRateLimitStatusRsp, error)

GetRateLimitStatus When you perform too many API calls in a short amount of time, KiwiVM API may start dropping your requests for a few minutes. This call allows monitoring this matter.

func (*Client) GetRawUsageStats

func (c *Client) GetRawUsageStats(ctx context.Context) (*GetRawUsageStatsRsp, error)

GetRawUsageStats Returns a two-dimensional array with the detailed usage statistics shown under Detailed Statistics in KiwiVM.

func (*Client) GetSSHKeys

func (c *Client) GetSSHKeys(ctx context.Context) (*GetSSHKeysRsp, error)

GetSSHKeys Get SSH keys stored in Hypervisor Vault, as well as the ones stored in the Billing Portal.

func (*Client) GetServiceInfo

func (c *Client) GetServiceInfo(ctx context.Context) (*GetServiceInfoRsp, error)

func (*Client) GetSuspensionDetails

func (c *Client) GetSuspensionDetails(ctx context.Context) (*GetSuspensionDetailsRsp, error)

GetSuspensionDetails Retrieve information related to service suspensions.

func (*Client) IPV6Add

func (c *Client) IPV6Add(ctx context.Context, req *IPV6AddReq) (*IPV6AddRsp, error)

IPV6Add Assigns a new IPv6 address. For initial IPv6 assignment an empty IP is required (call without parameters), and a new IP from the available pool is assigned automatically. All subsequent requested IPv6 addresses must be within the /64 subnet of the first IPv6 address. TODO: Need Test

func (*Client) IPV6Delete

func (c *Client) IPV6Delete(ctx context.Context, req *IPV6DeleteReq) (*IPV6DeleteRsp, error)

IPV6Delete Releases specified IPv6 address. TODO: Need Test

func (*Client) ISOMount

func (c *Client) ISOMount(ctx context.Context, req *ISOMountReq) (*ISOMountRsp, error)

ISOMount Sets ISO image to boot from. VM must be completely shut down and restarted after this API call. TODO: Need Tests

func (*Client) ISOUnmount

func (c *Client) ISOUnmount(ctx context.Context) (*ISOUnmountRsp, error)

ISOUnmount Removes ISO image and configures VM to boot from primary storage. VM must be completely shut down and restarted after this API call. TODO: Need Tests

func (*Client) Kill

func (c *Client) Kill(ctx context.Context) (*KillRsp, error)

Kill Allows to forcibly stop a VPS that is stuck and cannot be stopped by normal means. Please use this feature with great care as any unsaved data will be lost. TODO: Need Test

func (*Client) KiwiVMGetNotificationPreferences

func (c *Client) KiwiVMGetNotificationPreferences(ctx context.Context) (*KiwiVMGetNotificationPreferencesRsp, error)

KiwiVMGetNotificationPreferences Returns all available notification settings, as well as their state

func (*Client) KiwiVMSetNotificationPreferences

func (c *Client) KiwiVMSetNotificationPreferences(ctx context.Context, req *KiwiVMSetNotificationPreferencesReq) (*KiwiVMSetNotificationPreferencesRsp, error)

KiwiVMSetNotificationPreferences Changes notification preferences TODO: Need Test

func (*Client) MigrateGetLocations

func (c *Client) MigrateGetLocations(ctx context.Context) (*MigrateGetLocationsRsp, error)

MigrateGetLocations Return all possible migration locations.

func (*Client) MigrateStart

func (c *Client) MigrateStart(ctx context.Context, req *MigrateStartReq) (*MigrateStartRsp, error)

MigrateStart Start VPS migration to new location. Takes new location ID as input. Note that this will result in all IPv4 addresses to be replaced with new ones, and all IPv6 addresses will be released. TODO: Need Test

func (*Client) PrivateIPGetAvailableIPs

func (c *Client) PrivateIPGetAvailableIPs(ctx context.Context) (*PrivateIPGetAvailableIPsRsp, error)

PrivateIPGetAvailableIPs Returns all available (free) IPv4 addresses which you can activate on VM TODO: Need Test

func (*Client) PrivateIpAssign

func (c *Client) PrivateIpAssign(ctx context.Context, req *PrivateIpAssignReq) (*PrivateIpAssignRsp, error)

PrivateIpAssign Assign private IP address. If IP address not specified, a random address will be assigned. TODO: Need Test

func (*Client) PrivateIpDelete

func (c *Client) PrivateIpDelete(ctx context.Context, req *PrivateIpDeleteReq) (*PrivateIpDeleteRsp, error)

PrivateIpDelete Delete private IP address. TODO: Need Test

func (*Client) ReinstallOS

func (c *Client) ReinstallOS(ctx context.Context, req *ReinstallOSReq) (*ReinstallOSRsp, error)

ReinstallOS Reinstall the Operating System. OS must be specified via "os" variable. Use getAvailableOS call to get list of available systems. TODO: Need Test

func (*Client) ResetRootPassword

func (c *Client) ResetRootPassword(ctx context.Context) (*ResetRootPasswordRsp, error)

ResetRootPassword Generates and sets a new root password. TODO: Need Test

func (*Client) ResolvePolicyViolation

func (c *Client) ResolvePolicyViolation(ctx context.Context, req *ResolvePolicyViolationReq) (*ResolvePolicyViolationRsp, error)

ResolvePolicyViolation Mark policy violation as resolved. This is required to avoid service suspension. Refer to getPolicyViolations call for details. TODO: Need Test

func (*Client) Restart

func (c *Client) Restart(ctx context.Context) (*RestartRsp, error)

Restart Reboots the VPS

func (*Client) SetHostname

func (c *Client) SetHostname(ctx context.Context, req *SetHostnameReq) (*SetHostnameRsp, error)

SetHostname Sets new hostname.

func (*Client) SetPTR

func (c *Client) SetPTR(ctx context.Context, req *SetPTRReq) (*SetPTRRsp, error)

SetPTR Sets new PTR (rDNS) record for IP.

func (*Client) ShellScriptExec

func (c *Client) ShellScriptExec(ctx context.Context, req *ShellScriptExecReq) (*ShellScriptExecRsp, error)

ShellScriptExec Execute a shell script on the VPS (asynchronously).

func (*Client) SnapshotCreate

func (c *Client) SnapshotCreate(ctx context.Context, req *SnapshotCreateReq) (*SnapshotCreateRsp, error)

SnapshotCreate Create snapshot

func (*Client) SnapshotDelete

func (c *Client) SnapshotDelete(ctx context.Context, req *SnapshotDeleteReq) (*SnapshotDeleteRsp, error)

SnapshotDelete Delete snapshot by fileName (can be retrieved with snapshot/list call).

func (*Client) SnapshotExport

func (c *Client) SnapshotExport(ctx context.Context, req *SnapshotExportReq) (*SnapshotExportRsp, error)

SnapshotExport Generates a token with which the snapshot can be transferred to another instance.

func (*Client) SnapshotImport

func (c *Client) SnapshotImport(ctx context.Context, req *SnapshotImportReq) (*SnapshotImportRsp, error)

SnapshotImport Imports a snapshot from another instance identified by VEID and Token. Both VEID and Token must be obtained from another instance beforehand with a snapshot/export call. TODO: Need Tests

func (*Client) SnapshotList

func (c *Client) SnapshotList(ctx context.Context) (*SnapshotListRsp, error)

SnapshotList Get list of snapshots.

func (*Client) SnapshotRestore

func (c *Client) SnapshotRestore(ctx context.Context, req *SnapshotRestoreReq) (*SnapshotRestoreRsp, error)

SnapshotRestore Restores snapshot by fileName (can be retrieved with snapshot/list call). This will overwrite all data on the VPS. TODO: Need Tests

func (*Client) SnapshotToggleSticky

func (c *Client) SnapshotToggleSticky(ctx context.Context, req *SnapshotToggleStickyReq) (*SnapshotToggleStickyRsp, error)

SnapshotToggleSticky Set or remove sticky attribute ("sticky" snapshots are never purged). Name of snapshot can be retrieved with snapshot/list call – look for fileName variable.

func (*Client) Start

func (c *Client) Start(ctx context.Context) (*StartRsp, error)

Start the VPS

func (*Client) Stop

func (c *Client) Stop(ctx context.Context) (*StopRsp, error)

Stop the VPS

func (*Client) Unsuspend

func (c *Client) Unsuspend(ctx context.Context, req *UnsuspendReq) (*UnsuspendRsp, error)

Unsuspend Clear abuse issue identified by record_id and unsuspend the VPS. Refer to getSuspensionDetails call for details. TODO: Need Test

func (*Client) UpdateSSHKeys

func (c *Client) UpdateSSHKeys(ctx context.Context, req *UpdateSSHKeysReq) (*UpdateSSHKeysRsp, error)

UpdateSSHKeys Update per-VM SSH keys in Hypervisor Vault. Keys will be written to /root/.ssh/authorized_keys during a reinstallOS call. These keys will override any keys set in Billing Portal. TODO: Need Test

type ClientOptFunc

type ClientOptFunc func(client *resty.Client)

func WithDebug

func WithDebug(debug bool) ClientOptFunc

func WithLogger

func WithLogger(logger resty.Logger) ClientOptFunc

func WithTimeout

func WithTimeout(timeout time.Duration) ClientOptFunc

type CloneFromExternalServerReq

type CloneFromExternalServerReq struct {
	ExternalServerIP           string `json:"externalServerIP"`
	ExternalServerSSHPort      string `json:"externalServerSSHport"`
	ExternalServerRootPassword string `json:"externalServerRootPassword"`
}

type CloneFromExternalServerRsp

type CloneFromExternalServerRsp struct {
	Error int `json:"error"`
}

type EmailPreferences

type EmailPreferences struct {
	BandwidthAlerts       map[string]BandwidthAlert `json:"Bandwidth Alerts"`
	SecurityNotifications map[string]BandwidthAlert `json:"Security Notifications"`
	SystemNotifications   map[string]BandwidthAlert `json:"System Notifications"`
	Miscellaneous         map[string]BandwidthAlert `json:"Miscellaneous"`
}

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (Error) Error

func (e Error) Error() string

type ErrorRsp

type ErrorRsp struct {
	Error   int    `json:"error"`
	Message string `json:"message"`
}

type GetAuditLogRsp

type GetAuditLogRsp struct {
	LogEntries []AuditLog `json:"log_entries"`
	Error      int        `json:"error"`
}

type GetAvailableOSRsp

type GetAvailableOSRsp struct {
	// Currently installed Operating System
	Installed string `json:"installed"`
	// Array of available OS
	Templates []string `json:"templates"`
	Error     int      `json:"error"`
}

type GetLiveServiceInfoRsp

type GetLiveServiceInfoRsp struct {
	GetServiceInfoRsp

	// Depending on hypervisor this call will return the following information:
	//
	// [OVZ hypervisor]
	// array containing OpenVZ beancounters, system load average,
	// number of processes, open files, sockets, memory usage etc
	VzStatus json.RawMessage `json:"vz_status"`
	// array containing OpenVZ disk size, inodes and usage info
	VzQuota json.RawMessage `json:"vz_quota"`

	// [KVM hypervisor]
	// Starting, Running or Stopped
	VeStatus string `json:"ve_status"`
	// MAC address of primary network interface
	VeMac1 string `json:"ve_mac1"`
	// Occupied (mapped) disk space in bytes
	VeUsedDiskSpaceB int64 `json:"ve_used_disk_space_b"`
	// Actual size of disk image in GB
	VeDiskQuotaGb string `json:"ve_disk_quota_gb"`
	// 0 = Disk I/O is not throttled, 1 = Disk I/O is throttled due to high usage.
	// Throttling resets automatically every 15-180 minutes depending on sustained
	// storage I/O utilization.
	IsDiskThrottled string `json:"is_disk_throttled"`
	// Result of "hostname" command executed inside VPS
	LiveHostname string `json:"live_hostname"`
	// Raw load average string
	LoadAverage string `json:"load_average"`
	// Amount of available RAM in KB
	MemAvailableKB int `json:"mem_available_kb"`
	// Total amount of Swap in KB
	SwapTotalKB int `json:"swap_total_kb"`
	// Amount of available Swap in KB
	SwapAvailableKB int `json:"swap_available_kb"`
	// base64 encoded png screenshot of the VGA console
	ScreenDumpPngBase64 string `json:"screendump_png_base64"`
	VeID                int    `json:"veid"`

	// both
	// 0 = CPU is not throttled, 1 = CPU is throttled due to high usage.
	// Throttling resets automatically every 2 hours.
	IsCpuThrottled string `json:"is_cpu_throttled"`
	// SSH port of the VPS (returned only if VPS is running)
	SSHPort int `json:"ssh_port"`
	Error   int `json:"error"`
}

type GetPolicyViolationsRsp

type GetPolicyViolationsRsp struct {
	// Total abuse points accumulated in current calendar year
	TotalAbusePoints int `json:"total_abuse_points"`
	// Maximum abuse points allowed by plan in a calendar year
	MaxAbusePoints int `json:"max_abuse_points"`
	// array of all outstanding issues along with supporing evidence of abuse. See example below.
	PolicyViolations []*PolicyViolations `json:"policy_violations"`
	Error            int                 `json:"error"`
}

type GetRateLimitStatusRsp

type GetRateLimitStatusRsp struct {
	// Number of "points" available to use in the current 15-minute interval
	RemainingPoints15Min int `json:"remaining_points_15min"`
	// Number of "points" available to use in the current 24-hour interval
	RemainingPoints24H int `json:"remaining_points_24h"`
	Error              int `json:"error"`
}

type GetRawUsageStatsRsp

type GetRawUsageStatsRsp struct {
	Data   []*RawUsage `json:"data"`
	VmType string      `json:"vm_type"`
	Error  int         `json:"error"`
}

func (*GetRawUsageStatsRsp) DiskReadBytes

func (s *GetRawUsageStatsRsp) DiskReadBytes(beginTime, endTime time.Time) int64

func (*GetRawUsageStatsRsp) DiskWriteBytes

func (s *GetRawUsageStatsRsp) DiskWriteBytes(beginTime, endTime time.Time) int64

func (*GetRawUsageStatsRsp) GetData

func (s *GetRawUsageStatsRsp) GetData(beginTime, endTime time.Time) []*RawUsage

func (*GetRawUsageStatsRsp) NetworkInBytes

func (s *GetRawUsageStatsRsp) NetworkInBytes(beginTime, endTime time.Time) int64

func (*GetRawUsageStatsRsp) NetworkOutBytes

func (s *GetRawUsageStatsRsp) NetworkOutBytes(beginTime, endTime time.Time) int64

type GetSSHKeysRsp

type GetSSHKeysRsp struct {
	// Per-VM SSH Keys stored in Hypervisor Vault
	SSHKeysVeID string `json:"ssh_keys_veid"`
	// Per-Account SSH keys stored in the Billing Portal
	SshKeysUser string `json:"ssh_keys_user"`
	// SSH Keys, which will be actually used during a reinstallOS call
	// (Per-VM Keys will always override Per-Account keys)
	SSHKeysPreferred string `json:"ssh_keys_preferred"`
	// Visually shortened keys
	ShortenedSshKeysVeID string `json:"shortened_ssh_keys_veid"`
	// Visually shortened keys
	ShortenedSshKeysUser string `json:"shortened_ssh_keys_user"`
	// Visually shortened keys
	ShortenedSshKeysPreferred string `json:"shortened_ssh_keys_preferred"`
	Error                     int    `json:"error"`
}

type GetServiceInfoRsp

type GetServiceInfoRsp struct {
	// Hypervizor type (ovz or kvm)
	VmType string `json:"vm_type"`
	// Hostname of the VPS
	Hostname string `json:"hostname"`
	// IP address of the physical node
	NodeIp string `json:"node_ip"`
	// Internal nickname of the physical node
	NodeAlias string `json:"node_alias"`
	// Physical location (country, state)
	NodeLocation string `json:"node_location"`
	// Whether IPv6 is supported at the current location
	LocationIpv6Ready bool `json:"location_ipv6_ready"`
	// Name of plan
	Plan string `json:"plan"`
	// Disk quota (bytes)
	PlanDisk int64 `json:"plan_disk"`
	// RAM (bytes)
	PlanRam int `json:"plan_ram"`
	// SWAP (bytes)
	PlanSwap int `json:"plan_swap"`
	// Operating system
	OS string `json:"os"`
	// Primary e-mail address of the account
	Email string `json:"email"`
	// Allowed monthly data transfer (bytes).
	// Needs to be multiplied by monthly_data_multiplier - see below.
	PlanMonthlyData int64 `json:"plan_monthly_data"`
	// Data transfer used in the current billing month.
	// Needs to be multiplied by monthly_data_multiplier - see below.
	DataCounter int64 `json:"data_counter"`
	// Some locations offer more expensive bandwidth;
	// this variable contains the bandwidth accounting coefficient.
	MonthlyDataMultiplier int `json:"monthly_data_multiplier"`
	// Date and time of transfer counter reset (UNIX timestamp)
	DataNextReset int64 `json:"data_next_reset"`
	// IPv4 and IPv6 addresses assigned to VPS (Array)
	IpAddresses []string `json:"ip_addresses"`
	// Private IPv4 addresses assigned to VPS (Array)
	PrivateIpAddresses []string `json:"private_ip_addresses"`
	// Information on IP address nullrouting during (D)DoS attacks (Array).
	// Sample output when IP is under attack.
	IpNullRoutes []string `json:"ip_nullroutes"`
	// Mounted image #1
	Iso1 string `json:"iso1"`
	// Mounted image #2 (currently unsupported)
	Iso2 string `json:"iso2"`
	// Array of ISO images available for use
	AvailableISOs []string `json:"available_isos"`
	// Maximum number of IPv6 addresses allowed by plan
	PlanMaxIPV6s int `json:"plan_max_ipv6s"`
	// Whether or not rDNS records can be set via API
	RDNSAPIAvailable bool `json:"rdns_api_available"`
	// Whether or not Private Network features are available on this plan
	PlanPrivateNetworkAvailable bool `json:"plan_private_network_available"`
	// Whether or not Private Network features are available at this location
	LocationPrivateNetworkAvailable bool `json:"location_private_network_available"`
	// rDNS records (Array of two-dimensional arrays: ip=>value)
	Ptr map[string]string `json:"ptr"`
	// Whether VPS is suspended
	Suspended bool `json:"suspended"`
	// Whether there is an active policy violation that needs attention (see getPolicyViolations)
	PolicyViolation bool `json:"policy_violation"`
	// Number of times service was suspended in current calendar year
	SuspensionCount int `json:"suspension_count"`
	// Total abuse points accumulated in current calendar year
	TotalAbusePoints int `json:"total_abuse_points"`
	// Maximum abuse points allowed by plan in a calendar year
	MaxAbusePoints int    `json:"max_abuse_points"`
	NodeLocationId string `json:"node_location_id"`
	NodeDatacenter string `json:"node_datacenter"`
	Error          int    `json:"error"`
}

type GetSuspensionDetailsRsp

type GetSuspensionDetailsRsp struct {
	// Number of times service was suspended in current calendar year
	SuspensionCount int `json:"suspension_count"`
	// Total abuse points accumulated in current calendar year
	TotalAbusePoints int `json:"total_abuse_points"`
	// Maximum abuse points allowed by plan in a calendar year
	MaxAbusePoints int `json:"max_abuse_points"`
	// array of all outstanding issues along with supporing evidence of abuse. See example below.
	Suspensions []*Suspensions `json:"suspensions"`
	// Full text of the complaint or more details about the issue
	Evidence map[int64]string `json:"evidence"`
	Error    int              `json:"error"`
}

type IPV6AddReq

type IPV6AddReq struct {
	IP string `json:"ip"`
}

type IPV6AddRsp

type IPV6AddRsp struct {
	// TODO
	AssignedSubnet json.RawMessage `json:"assigned_subnet"`
	Error          int             `json:"error"`
}

type IPV6DeleteReq

type IPV6DeleteReq struct {
	IP string `json:"ip"`
}

type IPV6DeleteRsp

type IPV6DeleteRsp struct {
	Error int `json:"error"`
}

type ISOMountReq

type ISOMountReq struct {
	ISO string `json:"iso"`
}

type ISOMountRsp

type ISOMountRsp struct {
	Error int `json:"error"`
}

type ISOUnmountRsp

type ISOUnmountRsp struct {
	Error int `json:"error"`
}

type IsSoft

type IsSoft int8
const (
	// IsSoftContact must contact support to unsuspend
	IsSoftContact IsSoft = iota
	// IsSoftAPI can unsuspend via API call
	IsSoftAPI
)

type KillRsp

type KillRsp struct {
	Error int `json:"error"`
}

type KiwiVMGetNotificationPreferencesRsp

type KiwiVMGetNotificationPreferencesRsp struct {
	// Array of available notifications and their state
	EmailPreferences EmailPreferences `json:"email_preferences"`
	// Currently configured e-mail address where notifications are sent
	NotificationEmail string `json:"notificationEmail"`
	Error             int    `json:"error"`
}

type KiwiVMSetNotificationPreferencesReq

type KiwiVMSetNotificationPreferencesReq struct {
	// JsonNotificationPreferences (json formatted array, preference_id:0/1)
	// Changes notification preferences
	JsonNotificationPreferences string `json:"json_notification_preferences"`
}

type KiwiVMSetNotificationPreferencesRsp

type KiwiVMSetNotificationPreferencesRsp struct {
	// TODO
	// Array of submitted changes
	SubmittedEmailPreferences json.RawMessage `json:"submitted_email_preferences"`
	// Array of actually changed preferences
	UpdatedEmailPreferences json.RawMessage `json:"updated_email_preferences"`
	// Friendly descriptions of all preferences
	FriendlyDescriptions string `json:"friendly_descriptions"`
	Error                int    `json:"error"`
}

type MigrateGetLocationsRsp

type MigrateGetLocationsRsp struct {
	// ID of current location
	CurrentLocation string `json:"currentLocation"`
	// IDs of locations available for migration into
	Locations []string `json:"locations"`
	// Friendly descriptions of available locations
	Descriptions map[string]string `json:"descriptions"`
	// Some locations may offer more expensive bandwidth
	// where monthly allowance will be lower.
	// This array contains monthly data transfer allowance
	// multipliers for each location.
	DataTransferMultipliers map[string]int `json:"dataTransferMultipliers"`
	Error                   int            `json:"error"`
}

type MigrateStartReq

type MigrateStartReq struct {
	Location string `json:"location"`
}

type MigrateStartRsp

type MigrateStartRsp struct {
	Error int `json:"error"`
}

type PolicyViolations

type PolicyViolations struct {
	// Case ID, for resolvePolicyViolation
	RecordId int `json:"record_id"`
	// Unix timestamp when record was created
	Timestamp int64 `json:"timestamp"`
	// Service will be suspended if not resolved by this time
	SuspendAt int64 `json:"suspend_at"`
	// Type of abuse
	Flag   string `json:"flag"`
	IsSoft IsSoft `json:"is_soft"`
	// Each abuse incident increases total_abuse_points counter
	AbusePoints int `json:"abuse_points"`
	// Details of violation (text)
	EvidenceData string `json:"evidence_data"`
}

type PrivateIPGetAvailableIPsRsp

type PrivateIPGetAvailableIPsRsp struct {
	// TODO
	//assigned_ips: Array of successfully assigned private IP addresses
	Error int `json:"error"`
}

type PrivateIpAssignReq

type PrivateIpAssignReq struct {
	IP string `json:"ip"`
}

type PrivateIpAssignRsp

type PrivateIpAssignRsp struct {
	// TODO
	//assigned_ips: Array of successfully assigned private IP addresses
	Error int `json:"error"`
}

type PrivateIpDeleteReq

type PrivateIpDeleteReq struct {
	IP string `json:"ip"`
}

type PrivateIpDeleteRsp

type PrivateIpDeleteRsp struct {
	Error int `json:"error"`
}

type RawUsage

type RawUsage struct {
	Timestamp       int64 `json:"timestamp"`
	CpuUsage        int64 `json:"cpu_usage"`
	NetworkInBytes  int64 `json:"network_in_bytes"`
	NetworkOutBytes int64 `json:"network_out_bytes"`
	DiskReadBytes   int64 `json:"disk_read_bytes"`
	DiskWriteBytes  int64 `json:"disk_write_bytes"`
}

type ReinstallOSReq

type ReinstallOSReq struct {
	OS string `json:"os"`
}

type ReinstallOSRsp

type ReinstallOSRsp struct {
	Error int `json:"error"`
}

type ResetRootPasswordRsp

type ResetRootPasswordRsp struct {
	Error int `json:"error"`
}

type ResolvePolicyViolationReq

type ResolvePolicyViolationReq struct {
	RecordID string `url:"record_id"`
}

type ResolvePolicyViolationRsp

type ResolvePolicyViolationRsp struct {
	Error int `json:"error"`
}

type RestartRsp

type RestartRsp struct {
	Error int `json:"error"`
}

type SetHostnameReq

type SetHostnameReq struct {
	NewHostname string `json:"newHostname"`
}

type SetHostnameRsp

type SetHostnameRsp struct {
	Error int `json:"error"`
}

type SetPTRReq

type SetPTRReq struct {
	IP  string `json:"ip"`
	PTR string `json:"ptr"`
}

type SetPTRRsp

type SetPTRRsp struct {
	Error int `json:"error"`
}

type ShellScriptExecReq

type ShellScriptExecReq struct {
	Script string `json:"script"`
}

type ShellScriptExecRsp

type ShellScriptExecRsp struct {
	NodeIP string `json:"node_ip"`
	// Name of the output log file.
	Log            string `json:"log"`
	OutputStreamID string `json:"output_stream_id"`
	Error          int    `json:"error"`
}

type Snapshot

type Snapshot struct {
	FileName        string `json:"fileName"`
	Os              string `json:"os"`
	Description     string `json:"description"`
	Size            string `json:"size"`
	Md5             string `json:"md5"`
	Sticky          bool   `json:"sticky"`
	Uncompressed    int64  `json:"uncompressed"`
	PurgesIn        int    `json:"purgesIn"`
	DownloadLink    string `json:"downloadLink"`
	DownloadLinkSSL string `json:"downloadLinkSSL"`
}

type SnapshotCreateReq

type SnapshotCreateReq struct {
	Description string `json:"description"`
}

type SnapshotCreateRsp

type SnapshotCreateRsp struct {
	// E-mail address on file where notification will be sent once task is completed.
	NotificationEmail string `json:"notificationEmail"`
	Error             int    `json:"error"`
}

type SnapshotDeleteReq

type SnapshotDeleteReq struct {
	Snapshot string `json:"snapshot"`
}

type SnapshotDeleteRsp

type SnapshotDeleteRsp struct {
	NotificationEmail string `json:"notificationEmail"`
	Error             int    `json:"error"`
}

type SnapshotExportReq

type SnapshotExportReq struct {
	Snapshot string `json:"snapshot"`
}

type SnapshotExportRsp

type SnapshotExportRsp struct {
	Token string `json:"token"`
	Error int    `json:"error"`
}

type SnapshotImportReq

type SnapshotImportReq struct {
	SourceVeID  string `json:"sourceVeid"`
	SourceToken string `json:"sourceToken"`
}

type SnapshotImportRsp

type SnapshotImportRsp struct {
	Error int `json:"error"`
}

type SnapshotListRsp

type SnapshotListRsp struct {
	// Array of snapshots (fileName, os, description, size, md5, sticky, purgesIn, downloadLink).
	Snapshots []*Snapshot `json:"snapshots"`
	Error     int         `json:"error"`
}

type SnapshotRestoreReq

type SnapshotRestoreReq struct {
	Snapshot string `json:"snapshot"`
}

type SnapshotRestoreRsp

type SnapshotRestoreRsp struct {
	Error int `json:"error"`
}

type SnapshotToggleStickyReq

type SnapshotToggleStickyReq struct {
	Snapshot string `json:"snapshot"`
	Sticky   Sticky `json:"sticky"`
}

type SnapshotToggleStickyRsp

type SnapshotToggleStickyRsp struct {
	Error int `json:"error"`
}

type StartRsp

type StartRsp struct {
	IsMounted int `json:"is_mounted"`
	Error     int `json:"error"`
}

type Sticky

type Sticky int8
const (
	StickyRemove Sticky = iota
	StickySet
)

type StopRsp

type StopRsp struct {
	Error int `json:"error"`
}

type Suspensions

type Suspensions struct {
	// Case ID, needed to unsuspend the service via "unsuspend" API call
	RecordId int `json:"record_id"`
	// Type of abuse
	Flag   string `json:"flag"`
	IsSoft IsSoft `json:"is_soft"`
	// Detailed abuse report ID (see below)
	EvidenceRecordId string `json:"evidence_record_id"`
	// Each abuse incident increases total_abuse_points counter
	AbusePoints int `json:"abuse_points"`
}

type UnsuspendReq

type UnsuspendReq struct {
	RecordID string `url:"record_id"`
}

type UnsuspendRsp

type UnsuspendRsp struct {
	Error int `json:"error"`
}

type UpdateSSHKeysReq

type UpdateSSHKeysReq struct {
	SSHKeys string `json:"ssh_keys"`
}

type UpdateSSHKeysRsp

type UpdateSSHKeysRsp struct {
	Error int `json:"error"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL