Documentation
¶
Overview ¶
Package client provides a KiwiVM API client for BandwagonHost VPS instances.
Use NewClient with a KiwiVM API key and VEID, then pass a context.Context to each method. Read-only methods use GET requests. Methods that change VPS state use POST requests with application/x-www-form-urlencoded form data. For those write calls, request parameters and credentials are not placed in the URL.
KiwiVM returns an error field in every API response. The client converts non-zero API errors into BWHError, including optional locking details when the VPS is busy. Use GetBWHError or errors.As to inspect structured API errors.
Some methods can affect service availability, networking, credentials, abuse state, or stored data. Callers should add their own confirmation and validation around write methods such as Client.Kill, Client.ReinstallOS, Client.ResetRootPassword, Client.RestoreSnapshot, and Client.StartMigration.
Index ¶
- func IsAuthenticationError(err error) bool
- func IsBWHError(err error) bool
- func IsLockedError(err error) bool
- type AdditionalLockingInfo
- type AuditLogEntry
- type AuditLogResponse
- type AvailableOSResponse
- type BWHError
- type BackupInfo
- type BackupListResponse
- type BaseResponse
- type Client
- func (c *Client) AddIPv6(ctx context.Context) (*IPv6AddResponse, error)
- func (c *Client) AssignPrivateIP(ctx context.Context, ip string) (*PrivateIPAssignResponse, error)
- func (c *Client) CopyBackupToSnapshot(ctx context.Context, backupToken string) error
- func (c *Client) CreateSnapshot(ctx context.Context, description string) (*CreateSnapshotResponse, error)
- func (c *Client) DeleteIPv6(ctx context.Context, subnet string) error
- func (c *Client) DeletePrivateIP(ctx context.Context, ip string) error
- func (c *Client) DeleteSnapshot(ctx context.Context, fileName string) error
- func (c *Client) ExportSnapshot(ctx context.Context, fileName string) (*SnapshotExportResponse, error)
- func (c *Client) GetAuditLog(ctx context.Context) (*AuditLogResponse, error)
- func (c *Client) GetAvailableOS(ctx context.Context) (*AvailableOSResponse, error)
- func (c *Client) GetAvailablePrivateIPs(ctx context.Context) (*PrivateIPAvailableResponse, error)
- func (c *Client) GetLiveServiceInfo(ctx context.Context) (*LiveServiceInfo, error)
- func (c *Client) GetMigrateLocations(ctx context.Context) (*MigrateLocationsResponse, error)
- func (c *Client) GetNotificationPreferences(ctx context.Context) (*NotificationPreferencesResponse, error)
- func (c *Client) GetPolicyViolations(ctx context.Context) (*PolicyViolationsResponse, error)
- func (c *Client) GetRateLimitStatus(ctx context.Context) (*RateLimitStatus, error)
- func (c *Client) GetRawUsageStats(ctx context.Context) (*UsageStatsResponse, error)
- func (c *Client) GetServiceInfo(ctx context.Context) (*ServiceInfo, error)
- func (c *Client) GetSshKeys(ctx context.Context) (*SshKeysResponse, error)
- func (c *Client) GetSuspensionDetails(ctx context.Context) (*SuspensionDetailsResponse, error)
- func (c *Client) ImportSnapshot(ctx context.Context, sourceVeid, sourceToken string) error
- func (c *Client) Kill(ctx context.Context) error
- func (c *Client) ListBackups(ctx context.Context) (*BackupListResponse, error)
- func (c *Client) ListSnapshots(ctx context.Context) (*SnapshotListResponse, error)
- func (c *Client) MountISO(ctx context.Context, iso string) error
- func (c *Client) ReinstallOS(ctx context.Context, osTemplate string) error
- func (c *Client) ResetRootPassword(ctx context.Context) (*ResetRootPasswordResponse, error)
- func (c *Client) ResolvePolicyViolation(ctx context.Context, recordID int) error
- func (c *Client) Restart(ctx context.Context) error
- func (c *Client) RestoreSnapshot(ctx context.Context, fileName string) error
- func (c *Client) SetBaseURL(baseURL string)
- func (c *Client) SetHostname(ctx context.Context, newHostname string) error
- func (c *Client) SetNotificationPreferences(ctx context.Context, preferences map[string]bool) (*SetNotificationPreferencesResponse, error)
- func (c *Client) SetPTR(ctx context.Context, ip, ptr string) error
- func (c *Client) Start(ctx context.Context) error
- func (c *Client) StartMigration(ctx context.Context, locationID string) (*MigrateStartResponse, error)
- func (c *Client) StartMigrationWithTimeout(ctx context.Context, locationID string, timeout time.Duration) (*MigrateStartResponse, error)
- func (c *Client) Stop(ctx context.Context) error
- func (c *Client) ToggleSnapshotSticky(ctx context.Context, fileName string, sticky bool) error
- func (c *Client) UnmountISO(ctx context.Context) error
- func (c *Client) Unsuspend(ctx context.Context, recordID int) error
- func (c *Client) UpdateSshKeys(ctx context.Context, sshKeys []string) error
- type CreateSnapshotResponse
- type FlexibleInt
- type IPNullrouteInfo
- type IPNullroutes
- type IPv6AddResponse
- type LiveServiceInfo
- type MigrateLocationsResponse
- type MigrateStartResponse
- type NotificationPreference
- type NotificationPreferenceDescriptionMap
- type NotificationPreferenceStateMap
- type NotificationPreferencesResponse
- type PolicyViolationRecord
- type PolicyViolationsResponse
- type PrivateIPAssignResponse
- type PrivateIPAvailableResponse
- type RateLimitStatus
- type ResetRootPasswordResponse
- type ServiceInfo
- type SetNotificationPreferencesResponse
- type SnapshotExportResponse
- type SnapshotInfo
- type SnapshotListResponse
- type SshKeysResponse
- func (r *SshKeysResponse) GetShortenedSshKeysPreferredSlice() []string
- func (r *SshKeysResponse) GetShortenedSshKeysUserSlice() []string
- func (r *SshKeysResponse) GetShortenedSshKeysVeidSlice() []string
- func (r *SshKeysResponse) GetSshKeysPreferredSlice() []string
- func (r *SshKeysResponse) GetSshKeysUserSlice() []string
- func (r *SshKeysResponse) GetSshKeysVeidSlice() []string
- type SuspensionDetailsResponse
- type SuspensionRecord
- type UsageDataPoint
- type UsageStatsResponse
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAuthenticationError ¶
IsAuthenticationError checks if the error is an authentication failure. Based on observed BWH API behavior: error code 700005.
func IsLockedError ¶
IsLockedError checks if the error is due to VPS being locked. Based on observed BWH API behavior: error code 788888.
Types ¶
type AdditionalLockingInfo ¶
type AdditionalLockingInfo struct {
LastStatusUpdateSecondsAgo int `json:"last_status_update_s_ago"`
CompletedPercent int `json:"completed_percent"`
FriendlyProgressMessage string `json:"friendly_progress_message"`
}
AdditionalLockingInfo contains detailed locking status information.
type AuditLogEntry ¶
type AuditLogEntry struct {
Timestamp int64 `json:"timestamp"` // Unix timestamp of the event
RequestorIPv4 uint32 `json:"requestor_ipv4"` // IPv4 address of the requestor (as integer)
Type int `json:"type"` // Event type code
Summary string `json:"summary"` // Human-readable summary of the event
}
AuditLogEntry represents a single audit log entry.
type AuditLogResponse ¶
type AuditLogResponse struct {
BaseResponse
LogEntries []AuditLogEntry `json:"log_entries"` // Array of audit log entries
}
AuditLogResponse represents the response from getAuditLog API call.
type AvailableOSResponse ¶
type AvailableOSResponse struct {
BaseResponse
Installed string `json:"installed"` // Currently installed Operating System
Templates []string `json:"templates"` // Array of available OS templates
}
AvailableOSResponse represents the response from getAvailableOS API call.
type BWHError ¶
type BWHError struct {
Code int `json:"error"`
Message string `json:"message"`
AdditionalErrorInfo string `json:"additionalErrorInfo,omitempty"`
AdditionalLockingInfo *AdditionalLockingInfo `json:"additionalLockingInfo,omitempty"`
}
BWHError represents a BWH API error with structured information.
func GetBWHError ¶
GetBWHError extracts BWH error details from an error.
Example ¶
package main
import (
"context"
"log"
"github.com/strahe/bwh/pkg/client"
)
func main() {
c := client.NewClient("your-api-key", "your-veid")
ctx := context.Background()
_, err := c.GetRateLimitStatus(ctx)
if err != nil {
if apiErr, ok := client.GetBWHError(err); ok {
log.Printf("KiwiVM API error %d: %s", apiErr.Code, apiErr.Message)
return
}
log.Fatal(err)
}
}
Output:
type BackupInfo ¶
type BackupInfo struct {
Token string `json:"-"` // Backup token (from map key)
Size int64 `json:"size"` // Backup size in bytes
OS string `json:"os"` // Operating system
MD5 string `json:"md5"` // MD5 hash
Timestamp int64 `json:"timestamp"` // Unix timestamp
}
BackupInfo represents a single backup entry.
type BackupListResponse ¶
type BackupListResponse struct {
BaseResponse
Backups map[string]BackupInfo `json:"backups"` // Map of backup token to backup info
}
BackupListResponse represents the response from backup/list API call.
type BaseResponse ¶
type BaseResponse struct {
Error int `json:"error"`
Message string `json:"message,omitempty"`
AdditionalErrorInfo string `json:"additionalErrorInfo,omitempty"`
AdditionalLockingInfo *AdditionalLockingInfo `json:"additionalLockingInfo,omitempty"`
}
BaseResponse represents the base response structure for API calls.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a BandwagonHost API client.
func NewClient ¶
NewClient creates a new BandwagonHost client.
Example ¶
package main
import (
"context"
"log"
"github.com/strahe/bwh/pkg/client"
)
func main() {
c := client.NewClient("your-api-key", "your-veid")
ctx := context.Background()
info, err := c.GetServiceInfo(ctx)
if err != nil {
log.Fatal(err)
}
log.Printf("hostname: %s", info.Hostname)
}
Output:
func (*Client) AddIPv6 ¶
func (c *Client) AddIPv6(ctx context.Context) (*IPv6AddResponse, error)
AddIPv6 assigns a new IPv6 /64 subnet to the VPS.
func (*Client) AssignPrivateIP ¶
AssignPrivateIP assigns a private IPv4 address; if ip is empty, a random one will be assigned.
func (*Client) CopyBackupToSnapshot ¶
CopyBackupToSnapshot copies a backup to a restorable snapshot.
func (*Client) CreateSnapshot ¶
func (c *Client) CreateSnapshot(ctx context.Context, description string) (*CreateSnapshotResponse, error)
CreateSnapshot creates a snapshot with optional description.
func (*Client) DeleteIPv6 ¶
DeleteIPv6 releases a specified IPv6 /64 subnet from the VPS.
func (*Client) DeletePrivateIP ¶
DeletePrivateIP deletes a private IPv4 address.
func (*Client) DeleteSnapshot ¶
DeleteSnapshot deletes a snapshot by fileName.
func (*Client) ExportSnapshot ¶
func (c *Client) ExportSnapshot(ctx context.Context, fileName string) (*SnapshotExportResponse, error)
ExportSnapshot generates a token for transferring a snapshot to another instance.
func (*Client) GetAuditLog ¶
func (c *Client) GetAuditLog(ctx context.Context) (*AuditLogResponse, error)
GetAuditLog gets audit log entries for the VPS.
func (*Client) GetAvailableOS ¶
func (c *Client) GetAvailableOS(ctx context.Context) (*AvailableOSResponse, error)
GetAvailableOS gets the list of available operating systems for reinstallation.
func (*Client) GetAvailablePrivateIPs ¶
func (c *Client) GetAvailablePrivateIPs(ctx context.Context) (*PrivateIPAvailableResponse, error)
GetAvailablePrivateIPs returns all available private IPv4 addresses that can be assigned.
func (*Client) GetLiveServiceInfo ¶
func (c *Client) GetLiveServiceInfo(ctx context.Context) (*LiveServiceInfo, error)
GetLiveServiceInfo gets real-time information about the server including detailed VPS status. This call may take up to 15 seconds to complete as it queries the actual VPS status.
func (*Client) GetMigrateLocations ¶
func (c *Client) GetMigrateLocations(ctx context.Context) (*MigrateLocationsResponse, error)
GetMigrateLocations returns all possible migration locations and metadata.
func (*Client) GetNotificationPreferences ¶ added in v0.2.0
func (c *Client) GetNotificationPreferences(ctx context.Context) (*NotificationPreferencesResponse, error)
GetNotificationPreferences gets KiwiVM notification settings and their state.
func (*Client) GetPolicyViolations ¶ added in v0.2.0
func (c *Client) GetPolicyViolations(ctx context.Context) (*PolicyViolationsResponse, error)
GetPolicyViolations gets active policy violations.
func (*Client) GetRateLimitStatus ¶
func (c *Client) GetRateLimitStatus(ctx context.Context) (*RateLimitStatus, error)
GetRateLimitStatus gets current API rate limit status.
func (*Client) GetRawUsageStats ¶
func (c *Client) GetRawUsageStats(ctx context.Context) (*UsageStatsResponse, error)
GetRawUsageStats gets detailed usage statistics.
func (*Client) GetServiceInfo ¶
func (c *Client) GetServiceInfo(ctx context.Context) (*ServiceInfo, error)
GetServiceInfo gets information about the server.
func (*Client) GetSshKeys ¶
func (c *Client) GetSshKeys(ctx context.Context) (*SshKeysResponse, error)
GetSshKeys gets SSH keys from both Hypervisor Vault and Billing Portal.
func (*Client) GetSuspensionDetails ¶ added in v0.2.0
func (c *Client) GetSuspensionDetails(ctx context.Context) (*SuspensionDetailsResponse, error)
GetSuspensionDetails gets service suspension details and abuse evidence.
func (*Client) ImportSnapshot ¶
ImportSnapshot imports a snapshot from another instance using VEID and token.
func (*Client) Kill ¶
Kill forcefully stops 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.
func (*Client) ListBackups ¶
func (c *Client) ListBackups(ctx context.Context) (*BackupListResponse, error)
ListBackups lists all available backups.
func (*Client) ListSnapshots ¶
func (c *Client) ListSnapshots(ctx context.Context) (*SnapshotListResponse, error)
ListSnapshots gets the list of snapshots.
func (*Client) MountISO ¶
MountISO sets the ISO image to boot from. The VM must be completely shut down and restarted after this API call.
func (*Client) ReinstallOS ¶
ReinstallOS reinstalls the operating system. WARNING: This will destroy all data on the VPS!
func (*Client) ResetRootPassword ¶
func (c *Client) ResetRootPassword(ctx context.Context) (*ResetRootPasswordResponse, error)
ResetRootPassword resets the root password and returns the new password.
func (*Client) ResolvePolicyViolation ¶ added in v0.2.0
ResolvePolicyViolation marks a policy violation as resolved.
func (*Client) RestoreSnapshot ¶
RestoreSnapshot restores a snapshot by fileName and overwrites all data on the VPS.
func (*Client) SetBaseURL ¶
SetBaseURL sets a custom base URL for the API client.
func (*Client) SetHostname ¶
SetHostname sets a new hostname for the VPS.
func (*Client) SetNotificationPreferences ¶ added in v0.2.0
func (c *Client) SetNotificationPreferences(ctx context.Context, preferences map[string]bool) (*SetNotificationPreferencesResponse, error)
SetNotificationPreferences updates KiwiVM notification preferences.
func (*Client) StartMigration ¶
func (c *Client) StartMigration(ctx context.Context, locationID string) (*MigrateStartResponse, error)
StartMigration starts VPS migration to a new location with a default 15-minute timeout. Starting migration will replace all IPv4 addresses of the VPS.
func (*Client) StartMigrationWithTimeout ¶
func (c *Client) StartMigrationWithTimeout(ctx context.Context, locationID string, timeout time.Duration) (*MigrateStartResponse, error)
StartMigrationWithTimeout starts VPS migration to a new location with a custom timeout. Starting migration will replace all IPv4 addresses of the VPS.
func (*Client) ToggleSnapshotSticky ¶
ToggleSnapshotSticky sets or removes sticky attribute for a snapshot.
func (*Client) UnmountISO ¶
UnmountISO removes the ISO image and configures the VM to boot from primary storage. The VM must be completely shut down and restarted after this API call.
type CreateSnapshotResponse ¶
type CreateSnapshotResponse struct {
BaseResponse
NotificationEmail string `json:"notificationEmail"`
}
CreateSnapshotResponse represents the response from creating a snapshot.
type FlexibleInt ¶
type FlexibleInt struct {
Value int64
}
FlexibleInt can unmarshal both string and int values from JSON.
func (*FlexibleInt) UnmarshalJSON ¶
func (f *FlexibleInt) UnmarshalJSON(data []byte) error
type IPNullrouteInfo ¶ added in v0.2.0
type IPNullrouteInfo struct {
NullrouteTimestamp int64 `json:"nullroute_timestamp"`
NullrouteDurationSeconds int `json:"nullroute_duration_s"`
Log string `json:"log"`
}
IPNullrouteInfo contains details for a null-routed IP address.
type IPNullroutes ¶ added in v0.2.0
type IPNullroutes map[string]IPNullrouteInfo
IPNullroutes maps IP addresses to their nullroute details.
func (*IPNullroutes) UnmarshalJSON ¶ added in v0.2.0
func (n *IPNullroutes) UnmarshalJSON(data []byte) error
UnmarshalJSON supports KiwiVM's empty-array response and non-empty object response.
type IPv6AddResponse ¶
type IPv6AddResponse struct {
BaseResponse
AssignedSubnet string `json:"assigned_subnet"` // Newly assigned IPv6 /64 subnet
}
IPv6AddResponse represents the response from ipv6/add API call.
type LiveServiceInfo ¶
type LiveServiceInfo struct {
ServiceInfo
// Common fields for both OVZ and KVM
IsCPUThrottled FlexibleInt `json:"is_cpu_throttled"` // 0 = not throttled, 1 = throttled (resets every 2 hours)
SSHPort int `json:"ssh_port"` // SSH port of the VPS
// OpenVZ specific fields
VzStatus map[string]any `json:"vz_status,omitempty"` // OpenVZ beancounters, load average, processes, etc.
VzQuota map[string]any `json:"vz_quota,omitempty"` // OpenVZ disk size, inodes and usage info
// KVM specific fields
VeStatus string `json:"ve_status,omitempty"` // Starting, Running or Stopped
VeMac1 string `json:"ve_mac1,omitempty"` // MAC address of primary network interface
VeUsedDiskSpaceB FlexibleInt `json:"ve_used_disk_space_b,omitzero"` // Occupied disk space in bytes
VeDiskQuotaGB FlexibleInt `json:"ve_disk_quota_gb,omitzero"` // Actual size of disk image in GB
IsDiskThrottled FlexibleInt `json:"is_disk_throttled,omitzero"` // 0 = not throttled, 1 = throttled (resets 15-180 min)
LiveHostname string `json:"live_hostname,omitempty"` // Result of "hostname" command inside VPS
LoadAverage string `json:"load_average,omitempty"` // Raw load average string
MemAvailableKB FlexibleInt `json:"mem_available_kb,omitzero"` // Available RAM in KB
SwapTotalKB FlexibleInt `json:"swap_total_kb,omitzero"` // Total Swap in KB
SwapAvailableKB FlexibleInt `json:"swap_available_kb,omitzero"` // Available Swap in KB
ScreendumpPngBase64 string `json:"screendump_png_base64,omitempty"` // base64 encoded PNG screenshot of VGA console
}
LiveServiceInfo represents the complete live VPS information including ServiceInfo and real-time status.
type MigrateLocationsResponse ¶
type MigrateLocationsResponse struct {
BaseResponse
CurrentLocation string `json:"currentLocation"` // Current VPS location ID
Locations []string `json:"locations"` // All possible migration locations
Descriptions map[string]string `json:"descriptions"` // Map of location ID to human-readable description
DataTransferMultipliers map[string]int `json:"dataTransferMultipliers"` // Map of location ID to data transfer multiplier
}
MigrateLocationsResponse represents the response from migrate/getLocations API call.
type MigrateStartResponse ¶
type MigrateStartResponse struct {
BaseResponse
NotificationEmail string `json:"notificationEmail"` // E-mail where completion notification will be sent
NewIPs []string `json:"newIps"` // New IP addresses assigned to the VPS
}
MigrateStartResponse represents the response from migrate/start API call.
type NotificationPreference ¶ added in v0.2.0
type NotificationPreference struct {
FriendlyDescription string `json:"friendly_description"`
IsEnabled int `json:"is_enabled"`
ChangedTimestamp int64 `json:"changed_timestamp"`
SValue string `json:"s_value"`
}
NotificationPreference describes a KiwiVM e-mail notification preference.
type NotificationPreferenceDescriptionMap ¶ added in v0.2.0
NotificationPreferenceDescriptionMap maps preference IDs to descriptions.
func (*NotificationPreferenceDescriptionMap) UnmarshalJSON ¶ added in v0.2.0
func (m *NotificationPreferenceDescriptionMap) UnmarshalJSON(data []byte) error
UnmarshalJSON supports KiwiVM's PHP empty-array response for associative maps.
type NotificationPreferenceStateMap ¶ added in v0.2.0
NotificationPreferenceStateMap maps preference IDs to enabled states.
func (*NotificationPreferenceStateMap) UnmarshalJSON ¶ added in v0.2.0
func (m *NotificationPreferenceStateMap) UnmarshalJSON(data []byte) error
UnmarshalJSON supports KiwiVM's PHP empty-array response for associative maps.
type NotificationPreferencesResponse ¶ added in v0.2.0
type NotificationPreferencesResponse struct {
BaseResponse
EmailPreferences map[string]map[string]NotificationPreference `json:"email_preferences"`
NotificationEmail string `json:"notificationEmail"`
}
NotificationPreferencesResponse represents notification settings and their state.
type PolicyViolationRecord ¶ added in v0.2.0
type PolicyViolationRecord struct {
RecordID int `json:"record_id"`
Timestamp int64 `json:"timestamp"`
SuspendAt int64 `json:"suspend_at"`
Flag string `json:"flag"`
IsSoft int `json:"is_soft"`
AbusePoints int `json:"abuse_points"`
EvidenceData string `json:"evidence_data"`
}
PolicyViolationRecord describes an unresolved policy violation.
type PolicyViolationsResponse ¶ added in v0.2.0
type PolicyViolationsResponse struct {
BaseResponse
TotalAbusePoints int `json:"total_abuse_points"`
MaxAbusePoints int `json:"max_abuse_points"`
PolicyViolations []PolicyViolationRecord `json:"policy_violations,omitempty"`
}
PolicyViolationsResponse represents the response from getPolicyViolations.
type PrivateIPAssignResponse ¶
type PrivateIPAssignResponse struct {
BaseResponse
AssignedIPs []string `json:"assigned_ips"` // Array of successfully assigned private IPv4 addresses
}
PrivateIPAssignResponse represents the response from privateIp/assign API call.
type PrivateIPAvailableResponse ¶
type PrivateIPAvailableResponse struct {
BaseResponse
AvailableIPs []string `json:"available_ips"` // Array of available private IPv4 addresses
}
PrivateIPAvailableResponse represents the response from privateIp/getAvailableIps API call.
type RateLimitStatus ¶
type RateLimitStatus struct {
BaseResponse
RemainingPoints15Min int `json:"remaining_points_15min"` // API calls remaining in 15-minute window
RemainingPoints24H int `json:"remaining_points_24h"` // API calls remaining in 24-hour window
}
RateLimitStatus represents the response from getRateLimitStatus API call.
type ResetRootPasswordResponse ¶
type ResetRootPasswordResponse struct {
BaseResponse
Password string `json:"password"` // The new root password
}
ResetRootPasswordResponse represents the response from resetRootPassword API call.
type ServiceInfo ¶
type ServiceInfo struct {
BaseResponse
// Basic VPS Information
VMType string `json:"vm_type"` // Hypervisor type (ovz or kvm)
Hostname string `json:"hostname"` // Hostname of the VPS
Plan string `json:"plan"` // Name of plan
OS string `json:"os"` // Operating system
Email string `json:"email"` // Primary e-mail address of the account
// Node and Location Information
NodeAlias string `json:"node_alias"` // Internal nickname of the physical node
NodeLocationID string `json:"node_location_id"` // Location identifier
NodeLocation string `json:"node_location"` // Physical location (country, state)
NodeDatacenter string `json:"node_datacenter"` // Datacenter details
LocationIPv6Ready bool `json:"location_ipv6_ready"` // Whether IPv6 is supported at the current location
// Resource Allocation (all in bytes)
PlanDisk int64 `json:"plan_disk"` // Disk quota (bytes)
PlanRAM int64 `json:"plan_ram"` // RAM (bytes)
PlanSwap int64 `json:"plan_swap"` // SWAP (bytes)
// Data Transfer Information
PlanMonthlyData int64 `json:"plan_monthly_data"` // Allowed monthly data transfer (bytes). Multiply by monthly_data_multiplier
DataCounter int64 `json:"data_counter"` // Data transfer used in current billing month. Multiply by monthly_data_multiplier
MonthlyDataMultiplier int `json:"monthly_data_multiplier"` // Bandwidth accounting coefficient for expensive locations
DataNextReset int64 `json:"data_next_reset"` // Date and time of transfer counter reset (UNIX timestamp)
// Network Configuration
IPAddresses []string `json:"ip_addresses"` // IPv4 addresses and IPv6 /64 subnets assigned to VPS
IPv6SitTunnelEndpoint string `json:"ipv6_sit_tunnel_endpoint"` // IPv6 SIT tunnel endpoint
PrivateIPAddresses []string `json:"private_ip_addresses"` // Private IPv4 addresses assigned to VPS
IPNullroutes IPNullroutes `json:"ip_nullroutes"` // Information on IP address nullrouting during (D)DoS attacks
PlanMaxIPv6s int `json:"plan_max_ipv6s"` // Maximum number of IPv6 /64 subnets allowed by plan
// ISO Images
ISO1 string `json:"iso1"` // Mounted image #1
ISO2 string `json:"iso2"` // Mounted image #2 (currently unsupported)
AvailableISOs []string `json:"available_isos"` // Array of ISO images available for use
// Network Features
PlanPrivateNetworkAvailable bool `json:"plan_private_network_available"` // Whether Private Network features are available on this plan
LocationPrivateNetworkAvailable bool `json:"location_private_network_available"` // Whether Private Network features are available at this location
RDNSAPIAvailable bool `json:"rdns_api_available"` // Whether rDNS records can be set via API
PTR map[string]string `json:"ptr"` // rDNS records (ip=>value)
FreeIPReplacementInterval int `json:"free_ip_replacement_interval"` // Free IP replacement interval (deprecated, returns -100)
// Security and Status
Suspended bool `json:"suspended"` // Whether VPS is suspended
PolicyViolation bool `json:"policy_violation"` // Whether there is an active policy violation that needs attention
SuspensionCount int `json:"suspension_count"` // Number of times service was suspended in current calendar year
TotalAbusePoints int `json:"total_abuse_points"` // Total abuse points accumulated in current calendar year
MaxAbusePoints int `json:"max_abuse_points"` // Maximum abuse points allowed by plan in a calendar year
}
ServiceInfo represents the complete BWH VPS service information.
type SetNotificationPreferencesResponse ¶ added in v0.2.0
type SetNotificationPreferencesResponse struct {
BaseResponse
SubmittedEmailPreferences NotificationPreferenceStateMap `json:"submitted_email_preferences"`
UpdatedEmailPreferences NotificationPreferenceStateMap `json:"updated_email_preferences"`
FriendlyDescriptions NotificationPreferenceDescriptionMap `json:"friendly_descriptions"`
}
SetNotificationPreferencesResponse represents changed notification preferences.
type SnapshotExportResponse ¶
type SnapshotExportResponse struct {
BaseResponse
Token string `json:"token"` // Token for import
}
SnapshotExportResponse represents the response from snapshot/export API call.
type SnapshotInfo ¶
type SnapshotInfo struct {
FileName string `json:"fileName"` // File name of the snapshot
OS string `json:"os"` // Operating system of the snapshot
Description string `json:"description"` // Description of the snapshot
Size FlexibleInt `json:"size"` // Size of the snapshot in bytes (compressed)
MD5 string `json:"md5"` // MD5 hash of the snapshot
Sticky bool `json:"sticky"` // Whether snapshot is sticky (never purged)
Uncompressed FlexibleInt `json:"uncompressed"` // Uncompressed size in bytes
PurgesIn FlexibleInt `json:"purgesIn"` // Seconds until snapshot is purged
DownloadLink string `json:"downloadLink"` // HTTP download link
DownloadLinkSSL string `json:"downloadLinkSSL"` // HTTPS download link
}
SnapshotInfo represents a single snapshot.
type SnapshotListResponse ¶
type SnapshotListResponse struct {
BaseResponse
Snapshots []SnapshotInfo `json:"snapshots"` // Array of snapshots
}
SnapshotListResponse represents the response from snapshot/list API call.
type SshKeysResponse ¶
type SshKeysResponse struct {
BaseResponse
SshKeysVeid string `json:"ssh_keys_veid"` // Per-VM keys in Hypervisor Vault (newline-separated)
SshKeysUser string `json:"ssh_keys_user"` // Per-Account keys in Billing Portal (newline-separated)
SshKeysPreferred string `json:"ssh_keys_preferred"` // Keys that will be used during reinstallOS (newline-separated)
ShortenedSshKeysVeid string `json:"shortened_ssh_keys_veid"` // Visually shortened VM keys
ShortenedSshKeysUser string `json:"shortened_ssh_keys_user"` // Visually shortened user keys
ShortenedSshKeysPreferred string `json:"shortened_ssh_keys_preferred"` // Visually shortened preferred keys
}
SshKeysResponse represents the response from getSshKeys API call.
func (*SshKeysResponse) GetShortenedSshKeysPreferredSlice ¶
func (r *SshKeysResponse) GetShortenedSshKeysPreferredSlice() []string
GetShortenedSshKeysPreferredSlice returns shortened preferred SSH keys as a slice.
func (*SshKeysResponse) GetShortenedSshKeysUserSlice ¶
func (r *SshKeysResponse) GetShortenedSshKeysUserSlice() []string
GetShortenedSshKeysUserSlice returns shortened user SSH keys as a slice.
func (*SshKeysResponse) GetShortenedSshKeysVeidSlice ¶
func (r *SshKeysResponse) GetShortenedSshKeysVeidSlice() []string
GetShortenedSshKeysVeidSlice returns shortened VM SSH keys as a slice.
func (*SshKeysResponse) GetSshKeysPreferredSlice ¶
func (r *SshKeysResponse) GetSshKeysPreferredSlice() []string
GetSshKeysPreferredSlice returns preferred SSH keys as a slice.
func (*SshKeysResponse) GetSshKeysUserSlice ¶
func (r *SshKeysResponse) GetSshKeysUserSlice() []string
GetSshKeysUserSlice returns user SSH keys as a slice.
func (*SshKeysResponse) GetSshKeysVeidSlice ¶
func (r *SshKeysResponse) GetSshKeysVeidSlice() []string
GetSshKeysVeidSlice returns VM SSH keys as a slice.
type SuspensionDetailsResponse ¶ added in v0.2.0
type SuspensionDetailsResponse struct {
BaseResponse
SuspensionCount int `json:"suspension_count"`
TotalAbusePoints int `json:"total_abuse_points"`
MaxAbusePoints int `json:"max_abuse_points"`
Suspensions []SuspensionRecord `json:"suspensions,omitempty"`
Evidence map[string]string `json:"evidence,omitempty"`
}
SuspensionDetailsResponse represents the response from getSuspensionDetails.
type SuspensionRecord ¶ added in v0.2.0
type SuspensionRecord struct {
RecordID int `json:"record_id"`
Flag string `json:"flag"`
IsSoft int `json:"is_soft"`
EvidenceRecordID int `json:"evidence_record_id"`
AbusePoints int `json:"abuse_points"`
}
SuspensionRecord describes an outstanding service suspension issue.
type UsageDataPoint ¶
type UsageDataPoint struct {
Timestamp int64 `json:"timestamp"` // Unix timestamp
CPUUsage int `json:"cpu_usage"` // CPU usage percentage
NetworkInBytes int64 `json:"network_in_bytes"` // Network incoming bytes
NetworkOutBytes int64 `json:"network_out_bytes"` // Network outgoing bytes
DiskReadBytes int64 `json:"disk_read_bytes"` // Disk read bytes
DiskWriteBytes int64 `json:"disk_write_bytes"` // Disk write bytes
}
UsageDataPoint represents a single data point in usage statistics.
type UsageStatsResponse ¶
type UsageStatsResponse struct {
BaseResponse
Data []UsageDataPoint `json:"data"` // Array of usage data points
VMType string `json:"vm_type"` // VM type (kvm/ovz)
}
UsageStatsResponse represents the response from getRawUsageStats API call.