vps

package
v6.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 License: MIT Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addons

type Addons struct {
	// A list of non cancellable active addons
	Active []product.Product `json:"active,omitempty"`
	// A list of available addons that you can order
	Available []product.Product `json:"available,omitempty"`
	// A list of addons that you can cancel
	Cancellable []product.Product `json:"cancellable,omitempty"`
}

Addons struct for an Addons

type Backup

type Backup struct {
	// The backup id
	ID int64 `json:"id"`
	// Status of the backup ('active', 'creating', 'reverting', 'deleting', 'pendingDeletion', 'syncing', 'moving')
	Status BackupStatus `json:"status"`
	// The backup creation date
	DateTimeCreate rest.Time `json:"dateTimeCreate"`
	// The backup disk size in kB
	DiskSize int64 `json:"diskSize"`
	// The backup operatingSystem
	OperatingSystem string `json:"operatingSystem"`
	// The name of the availability zone the backup is in
	AvailabilityZone string `json:"availabilityZone"`
}

Backup struct for a Backup

type BackupStatus

type BackupStatus string

BackupStatus is one of the following strings 'active', 'creating', 'reverting', 'deleting', 'pendingDeletion', 'syncing', 'moving'

const (
	// BackupStatusActive is the status field for a ready to use backup
	BackupStatusActive BackupStatus = "active"
	// BackupStatusCreating is the status field for a backup that is still in creation
	BackupStatusCreating BackupStatus = "creating"
	// BackupStatusReverting is the status field for a currently used backup for a revert
	BackupStatusReverting BackupStatus = "reverting"
	// BackupStatusDeleting is the status field for a backup that is about to be deleted
	BackupStatusDeleting BackupStatus = "deleting"
	// BackupStatusPendingDeletion is the status field for a backup that has a pending deletion
	BackupStatusPendingDeletion BackupStatus = "pendingDeletion"
	// BackupStatusSyncing is the status field for a backup that is still syncing
	BackupStatusSyncing BackupStatus = "syncing"
	// BackupStatusMoving is the status field for a moving backup, this means that the backup is under migration
	BackupStatusMoving BackupStatus = "moving"
)

Definition of all of the possible backup statuses

type BigStorage

type BigStorage struct {
	// Name of the big storage
	Name string `json:"name,omitempty"`
	// Name that can be set by customer
	Description string `json:"description"`
	// Disk size of the big storage in kB
	DiskSize int64 `json:"diskSize,omitempty"`
	// Whether a bigstorage has backups
	OffsiteBackups bool `json:"offsiteBackups"`
	// The VPS that the big storage is attached to
	VpsName string `json:"vpsName"`
	// Status of the big storage can be 'active', 'attaching' or 'detachting'
	Status BigStorageStatus `json:"status,omitempty"`
	// Lock status of the big storage, when it is locked, it cannot be attached or detached.
	IsLocked bool `json:"isLocked"`
	// The availability zone the bigstorage is located in
	AvailabilityZone string `json:"availabilityZone,omitempty"`
}

BigStorage struct for a BigStorage

type BigStorageBackup

type BigStorageBackup struct {
	// ID of the big storage
	ID int64 `json:"id,omitempty"`
	// Status of the big storage backup ('active', 'creating', 'reverting', 'deleting', 'pendingDeletion', 'syncing', 'moving')
	Status BackupStatus `json:"status,omitempty"`
	// The backup disk size in kB
	DiskSize int64 `json:"diskSize"`
	// Date of the big storage backup
	DateTimeCreate rest.Time `json:"dateTimeCreate,omitempty"`
	// The name of the availability zone the backup is in
	AvailabilityZone string `json:"availabilityZone,omitempty"`
}

BigStorageBackup struct for a BigStorageBackup

type BigStorageOrder

type BigStorageOrder struct {
	// The size of the big storage in TB's, use a multitude of 2. The maximum size is 40.
	Size int `json:"size"`
	// Whether to order offsite backups, omit this to use current value
	OffsiteBackups bool `json:"offsiteBackups"`
	// The name of the availabilityZone where the BigStorage should be created. This parameter can not be used in conjunction with vpsName
	// If a vpsName is provided as well as an availabilityZone, the zone of the vps is leading
	AvailabilityZone string `json:"availabilityZone,omitempty"`
	// The name of the VPS to attach the big storage to
	VpsName string `json:"vpsName"`
}

BigStorageOrder struct which is used to construct a new order request for a bigstorage

type BigStorageRepository

type BigStorageRepository repository.RestRepository

BigStorageRepository allows you to manage all api actions on a bigstorage getting information, ordering, upgrading, attaching/detaching it to a vps

func (*BigStorageRepository) AttachToVps

func (r *BigStorageRepository) AttachToVps(vpsName string, bigStorage BigStorage) error

AttachToVps allows you to attach a given VPS by name to a BigStorage

func (*BigStorageRepository) Cancel

func (r *BigStorageRepository) Cancel(bigStorageName string, endTime gotransip.CancellationTime) error

Cancel cancels a bigstorage for the specified endTime. You can set the endTime to end or immediately, this has the following implications:

  • end: The Big Storage will be terminated from the end date of the agreement as can be found in the applicable quote;
  • immediately: The Big Storage will be terminated immediately.

func (*BigStorageRepository) DetachFromVps

func (r *BigStorageRepository) DetachFromVps(bigStorage BigStorage) error

DetachFromVps allows you to detach a bigstorage from the vps it is attached to

func (*BigStorageRepository) GetAll

func (r *BigStorageRepository) GetAll() ([]BigStorage, error)

GetAll returns a list of your bigstorages

func (*BigStorageRepository) GetBackups

func (r *BigStorageRepository) GetBackups(bigStorageName string) ([]BigStorageBackup, error)

GetBackups returns a list of backups for a specific bigstorage

func (*BigStorageRepository) GetByName

func (r *BigStorageRepository) GetByName(bigStorageName string) (BigStorage, error)

GetByName returns a specific BigStorage struct by name

func (*BigStorageRepository) GetSelection

func (r *BigStorageRepository) GetSelection(page int, itemsPerPage int) ([]BigStorage, error)

GetSelection returns a limited list of bigstorages, specify how many and which page/chunk of your bigstorage you want to retrieve

func (*BigStorageRepository) GetUsage

func (r *BigStorageRepository) GetUsage(bigStorageName string, period UsagePeriod) ([]UsageDataDisk, error)

GetUsage allows you to query your bigstorage usage within a certain period

func (*BigStorageRepository) GetUsageLast24Hours

func (r *BigStorageRepository) GetUsageLast24Hours(bigStorageName string) ([]UsageDataDisk, error)

GetUsageLast24Hours allows you to get usage statistics for a given bigstorage within the last 24 hours

func (*BigStorageRepository) Order

func (r *BigStorageRepository) Order(order BigStorageOrder) error

Order allows you to order a new bigstorage

func (*BigStorageRepository) RevertBackup

func (r *BigStorageRepository) RevertBackup(bigStorageName string, backupID int64) error

RevertBackup allows you to revert a bigstorage by bigstorage name and backupID

func (*BigStorageRepository) Update

func (r *BigStorageRepository) Update(bigStorage BigStorage) error

Update allows you to alter the BigStorage in several ways outlined below:

  • Changing the description of a Big Storage;
  • One Big Storages can only be attached to one VPS at a time;
  • One VPS can have a maximum of 10 bigstorages attached;
  • Set the vpsName property to the VPS name to attach to for attaching Big Storage;
  • Set the vpsName property to null to detach the Big Storage from the currently attached VPS.

func (*BigStorageRepository) Upgrade

func (r *BigStorageRepository) Upgrade(bigStorageName string, size int, offsiteBackups bool) error

Upgrade allows you to upgrade a BigStorage's size or/and to enable off-site backups

type BigStorageStatus

type BigStorageStatus string

BigStorageStatus is one of the following strings 'active', 'attaching', 'detaching'

const (
	// BigStorageStatusActive is the status field for an active BigStorage, ready to use
	BigStorageStatusActive BigStorageStatus = "active"
	// BigStorageStatusAttaching is the status field for a BigStorage that is being attached to a vps
	BigStorageStatusAttaching BigStorageStatus = "attaching"
	// BigStorageStatusDetaching is the status field for a BigStorage that is being detached from a vps
	BigStorageStatusDetaching BigStorageStatus = "detaching"
)

Definition of all of the possible bigstorage backup statuses

type Firewall

type Firewall struct {
	// Whether the firewall is enabled for this VPS
	IsEnabled bool `json:"isEnabled"`
	// Ruleset of the VPS
	RuleSet []FirewallRule `json:"ruleSet"`
}

Firewall struct for the Vps Firewall

type FirewallRepository

type FirewallRepository repository.RestRepository

FirewallRepository allows you to get information on the current Vps firewall and to update it

func (*FirewallRepository) GetFirewall

func (r *FirewallRepository) GetFirewall(vpsName string) (Firewall, error)

GetFirewall returns the state of the current VPS firewall

func (*FirewallRepository) UpdateFirewall

func (r *FirewallRepository) UpdateFirewall(vpsName string, firewall Firewall) error

UpdateFirewall allows you to update the state of the firewall. Enabling it, disabling it, Adding / removing of ruleSets, updating the whitelists.

type FirewallRule

type FirewallRule struct {
	// The rule name
	Description string `json:"description,omitempty"`
	// The start port of this firewall rule
	StartPort int `json:"startPort"`
	// The end port of this firewall rule
	EndPort int `json:"endPort"`
	// The protocol `tcp` ,  `udp` or `tcp_udp`
	Protocol string `json:"protocol"`
	// Whitelisted IP's or ranges that are allowed to connect, empty to allow all
	Whitelist []ipaddress.IPRange `json:"whitelist"`
}

FirewallRule struct for a VpsFirewallRule

type IgnoreTime

type IgnoreTime struct {
	// Start from (24 hour format)
	TimeFrom string `json:"timeFrom"`
	// End at (24 hour format)
	TimeTo string `json:"timeTo"`
}

IgnoreTime struct for IgnoreTime

type MonitoringContact

type MonitoringContact struct {
	// ID number of the contact
	ID int64 `json:"id,omitempty"`
	// Name of the contact
	Name string `json:"name"`
	// Telephone number of the contact
	Telephone string `json:"telephone"`
	// Email address of the contact
	Email string `json:"email"`
}

MonitoringContact struct for a MonitoringContact

type OperatingSystem

type OperatingSystem struct {
	// Description
	Description string `json:"description,omitempty"`
	// Is a preinstallable image
	IsPreinstallableImage bool `json:"isPreinstallableImage,omitempty"`
	// The operating system name
	Name string `json:"name"`
	// The monthly price of the operating system in cents
	Price int `json:"price,omitempty"`
	// The version of the operating system
	Version string `json:"version,omitempty"`
}

OperatingSystem struct for an OperatingSystem

type Order

type Order struct {
	// Name of the product
	ProductName string `json:"productName"`
	// The name of the operating system to install
	OperatingSystem string `json:"operatingSystem"`
	// The name of the availability zone where the vps should be created
	AvailabilityZone string `json:"availabilityZone,omitempty"`
	// Array with additional addons
	Addons []string `json:"addons,omitempty"`
	// The name for the host, only needed for installing a preinstallable control panel image
	Hostname string `json:"hostname,omitempty"`
	// The description of the VPS
	Description string `json:"description,omitempty"`
	// Base64 encoded preseed / kickstart instructions, when installing unattended
	Base64InstallText string `json:"base64InstallText,omitempty"`
}

Order struct can be used to order a new VPS

type PrivateNetwork

type PrivateNetwork struct {
	// The unique private network name
	Name string `json:"name"`
	// The custom name that can be set by customer
	Description string `json:"description"`
	// If the Private Network is administratively blocked
	IsBlocked bool `json:"isBlocked"`
	// When locked, another process is already working with this private network
	IsLocked bool `json:"isLocked"`
	// The VPSes in this private network
	VpsNames []string `json:"vpsNames,omitempty"`
}

PrivateNetwork struct for a PrivateNetwork

type PrivateNetworkRepository

type PrivateNetworkRepository repository.RestRepository

PrivateNetworkRepository allows you to manage all private network api actions like listing, ordering, canceling, getting information, updating description, attaching and detaching vpses

func (*PrivateNetworkRepository) AttachVps

func (r *PrivateNetworkRepository) AttachVps(vpsName string, privateNetworkName string) error

AttachVps allows you to attach a VPS to a PrivateNetwork

func (*PrivateNetworkRepository) Cancel

func (r *PrivateNetworkRepository) Cancel(privateNetworkName string, endTime gotransip.CancellationTime) error

Cancel allows you to cancel a private network

func (*PrivateNetworkRepository) DetachVps

func (r *PrivateNetworkRepository) DetachVps(vpsName string, privateNetworkName string) error

DetachVps allows you to detach a VPS from a PrivateNetwork

func (*PrivateNetworkRepository) GetAll

GetAll returns a list of all your private networks

func (*PrivateNetworkRepository) GetByName

func (r *PrivateNetworkRepository) GetByName(privateNetworkName string) (PrivateNetwork, error)

GetByName allows you to get a specific PrivateNetwork by name

func (*PrivateNetworkRepository) GetSelection

func (r *PrivateNetworkRepository) GetSelection(page int, itemsPerPage int) ([]PrivateNetwork, error)

GetSelection returns a limited list of private networks, specify how many and which page/chunk of private networks you want to retrieve

func (*PrivateNetworkRepository) Order

func (r *PrivateNetworkRepository) Order(description string) error

Order allows you to order new private network with a given description

func (*PrivateNetworkRepository) Update

func (r *PrivateNetworkRepository) Update(privateNetwork PrivateNetwork) error

Update allows you to update the private network. You can change the description by changing the Description field on the PrivateNetwork struct Updating it using this function.

type Repository

type Repository repository.RestRepository

Repository is the vps repository this repository allows you to manage all VPS services for your TransIP account

func (*Repository) AddIPv6Address

func (r *Repository) AddIPv6Address(vpsName string, address net.IP) error

AddIPv6Address allows you to add an IPv6 address to your VPS. After adding an IPv6 address, you can set the reverse DNS for this address using the UpdateReverseDNS function.

func (*Repository) Cancel

func (r *Repository) Cancel(vpsName string, endTime gotransip.CancellationTime) error

Cancel will cancel the VPS, thus deleting it

func (*Repository) CancelAddon

func (r *Repository) CancelAddon(vpsName string, addon string) error

CancelAddon allows you to cancel an add-on by name, specifying the VPS name as well. Due to technical restrictions (possible dataloss) storage add-ons cannot be cancelled.

func (*Repository) Clone

func (r *Repository) Clone(vpsName string) error

Clone allows you to clone an existing VPS There are a few things to take into account when you want to clone an existing VPS to a new VPS:

- If the original VPS (which you’re going to clone) is currently locked, the clone will fail;

  • Cloned control panels can be used on the VPS, but as the IP address changes, this does require you to synchronise the new license on the new VPS (licenses are often IP-based);
  • Possibly, your VPS has its network interface(s) configured using (a) static IP(‘s) rather than a dynamic allocation using DHCP. If this is the case, you have to configure the new IP(‘s) on the new VPS. Do note that this is not the case with our pre-installed control panel images;
  • VPS add-ons such as Big Storage aren’t affected by cloning - these will stay attached to the original VPS and can’t be swapped automatically

func (*Repository) CloneToAvailabilityZone

func (r *Repository) CloneToAvailabilityZone(vpsName string, availabilityZone string) error

CloneToAvailabilityZone allows you to clone a vps to a specific availability zone, identified by name

func (*Repository) ConvertBackupToSnapshot

func (r *Repository) ConvertBackupToSnapshot(vpsName string, backupID int64, snapshotDescription string) error

ConvertBackupToSnapshot allows you to convert a backup to a snapshot

func (*Repository) CreateSnapshot

func (r *Repository) CreateSnapshot(vpsName string, description string, shouldStartVps bool) error

CreateSnapshot allows you to create a snapshot for restoring it at a later time or restoring it to another VPS. See the function RevertSnapshot for this.

func (*Repository) GetAddons

func (r *Repository) GetAddons(vpsName string) (Addons, error)

GetAddons returns a struct with 'cancellable', 'available' and 'active' addons in it for the given VPS

func (*Repository) GetAll

func (r *Repository) GetAll() ([]Vps, error)

GetAll returns a list of all your VPSs

func (*Repository) GetAllByTags

func (r *Repository) GetAllByTags(tags []string) ([]Vps, error)

GetAllByTags returns a list of all VPSs that match the tags provided

func (*Repository) GetAllUsage

func (r *Repository) GetAllUsage(vpsName string, period UsagePeriod) (Usage, error)

GetAllUsage returns a Usage struct filled with all usage data for the given UsagePeriod. UsagePeriod is struct containing a start and end unix timestamp

func (*Repository) GetAllUsage24Hours

func (r *Repository) GetAllUsage24Hours(vpsName string) (Usage, error)

GetAllUsage24Hours returns all usage data for a given Vps within the last 24 hours

func (*Repository) GetBackups

func (r *Repository) GetBackups(vpsName string) ([]Backup, error)

GetBackups allows you to get a list of backups for a given VPS which you can use to revert or convert to snapshot

func (*Repository) GetByName

func (r *Repository) GetByName(vpsName string) (Vps, error)

GetByName returns information on a specific VPS by name

func (*Repository) GetIPAddressByAddress

func (r *Repository) GetIPAddressByAddress(vpsName string, address net.IP) (ipaddress.IPAddress, error)

GetIPAddressByAddress returns network information for the specified IP address

func (*Repository) GetIPAddresses

func (r *Repository) GetIPAddresses(vpsName string) ([]ipaddress.IPAddress, error)

GetIPAddresses returns all IPv4 and IPv6 addresses attached to the VPS

func (*Repository) GetOperatingSystems

func (r *Repository) GetOperatingSystems(vpsName string) ([]OperatingSystem, error)

GetOperatingSystems returns a list of operating systems that you can install on a vps

func (*Repository) GetSelection

func (r *Repository) GetSelection(page int, itemsPerPage int) ([]Vps, error)

GetSelection returns a limited list of VPSs, specify how many and which page/chunk of VPSs you want to retrieve

func (*Repository) GetSnapshotByName

func (r *Repository) GetSnapshotByName(vpsName string, snapshotName string) (Snapshot, error)

GetSnapshotByName returns a Snapshot for a VPS given its snapshotName and vpsName

func (*Repository) GetSnapshots

func (r *Repository) GetSnapshots(vpsName string) ([]Snapshot, error)

GetSnapshots returns a list of Snapshots for a given VPS

func (*Repository) GetUpgrades

func (r *Repository) GetUpgrades(vpsName string) ([]product.Product, error)

GetUpgrades returns all available product upgrades for a VPS

func (*Repository) GetUsage

func (r *Repository) GetUsage(vpsName string, usageTypes []UsageType, period UsagePeriod) (Usage, error)

GetUsage will allow you to request your vps usage for a specified period and usage type, for convenience you can also use the GetUsages or GetUsagesLast24Hours

func (*Repository) GetVNCData

func (r *Repository) GetVNCData(vpsName string) (VncData, error)

GetVNCData will return VncData about your vps. It allows you to get the location, token and password in order to connect directly to the VNC console of your VPS.

func (*Repository) Handover

func (r *Repository) Handover(vpsName string, targetCustomerName string) error

Handover will handover a VPS to another TransIP Account. This call will initiate the handover process. The actual handover will be done when the target customer accepts the handover

func (*Repository) InstallOperatingSystem

func (r *Repository) InstallOperatingSystem(vpsName string, operatingSystemName string, hostname string, base64InstallText string) error

InstallOperatingSystem allows you to install an operating system to a Vps, optionally you can specify a hostname and a base64InstallText, which would be the automatic installation configuration of your Vps for more information, see: https://api.transip.nl/rest/docs.html#vps-operatingsystems-post

func (*Repository) Order

func (r *Repository) Order(vpsOrder Order) error

Order allows you to order a new VPS

func (*Repository) OrderAddons

func (r *Repository) OrderAddons(vpsName string, addons []string) error

OrderAddons allows you to expand VPS specs with a given list of addons to order

func (*Repository) OrderMultiple

func (r *Repository) OrderMultiple(orders []Order) error

OrderMultiple allows you to order multiple vpses at the same time

func (*Repository) RegenerateVNCToken

func (r *Repository) RegenerateVNCToken(vpsName string) error

RegenerateVNCToken allows you to regenerate the VNC credentials for a VPS

func (*Repository) RemoveIPv6Address

func (r *Repository) RemoveIPv6Address(vpsName string, address net.IP) error

RemoveIPv6Address allows you to remove an IPv6 address from the registered list of IPv6 address within your VPS's `/64` range.

func (*Repository) RemoveSnapshot

func (r *Repository) RemoveSnapshot(vpsName string, snapshotName string) error

RemoveSnapshot allows you to remove a snapshot from a given VPS

func (*Repository) Reset

func (r *Repository) Reset(vpsName string) error

Reset allows you to reset a VPS, a reset is essentially the stop and start command combined into one

func (*Repository) RevertBackup

func (r *Repository) RevertBackup(vpsName string, backupID int64) error

RevertBackup allows you to revert a backup

func (*Repository) RevertSnapshot

func (r *Repository) RevertSnapshot(vpsName string, snapshotName string) error

RevertSnapshot allows you to revert a snapshot of a vps, if you want to revert a snapshot to a different vps you can use the RevertSnapshotToOtherVps method

func (*Repository) RevertSnapshotToOtherVps

func (r *Repository) RevertSnapshotToOtherVps(vpsName string, snapshotName string, destinationVps string) error

RevertSnapshotToOtherVps allows you to revert a snapshot to a different vps

func (*Repository) Start

func (r *Repository) Start(vpsName string) error

Start allows you to start a VPS, given that it’s currently in a stopped state

func (*Repository) Stop

func (r *Repository) Stop(vpsName string) error

Stop allows you to stop a VPS

func (*Repository) Update

func (r *Repository) Update(vps Vps) error

Update allows you to lock/unlock a VPS, update a VPS description, and add/remove tags.

For locking the VPS, set isCustomerLocked to true. Set the value to false for unlocking the VPS
You can change your VPS description by simply changing the description attribute
To add/remove tags, you must update the tags attribute

func (*Repository) UpdateReverseDNS

func (r *Repository) UpdateReverseDNS(vpsName string, ip ipaddress.IPAddress) error

UpdateReverseDNS allows you to update the reverse dns for IPv4 addresses as wal as IPv6 addresses

func (*Repository) Upgrade

func (r *Repository) Upgrade(vpsName string, productName string) error

Upgrade allows you to upgrade a VPS by name and productName

type Snapshot

type Snapshot struct {
	// The snapshot creation date
	DateTimeCreate string `json:"dateTimeCreate,omitempty"`
	// The snapshot description
	Description string `json:"description,omitempty"`
	// The size of the snapshot in kB
	DiskSize int64 `json:"diskSize,omitempty"`
	// The snapshot name
	Name string `json:"name,omitempty"`
	// The snapshot OperatingSystem
	OperatingSystem string `json:"operatingSystem,omitempty"`
	// The snapshot status ('active', 'creating', 'reverting', 'deleting', 'pendingDeletion', 'syncing', 'moving')
	Status SnapshotStatus `json:"status,omitempty"`
}

Snapshot struct for a Snapshot

type SnapshotStatus

type SnapshotStatus string

SnapshotStatus is one of the following strings 'active', 'creating', 'reverting', 'deleting', 'pendingDeletion', 'syncing', 'moving'

const (
	// SnapshotStatusActive is the status field for an active snapshot, ready to use
	SnapshotStatusActive SnapshotStatus = "active"
	// SnapshotStatusCreating is the status field for a snapshot that is going to be created
	SnapshotStatusCreating SnapshotStatus = "creating"
	// SnapshotStatusReverting is the status field for snapshot that is being reverted
	SnapshotStatusReverting SnapshotStatus = "reverting"
	// SnapshotStatusDeleting is the status field for snapshot that is going to be deleted
	SnapshotStatusDeleting SnapshotStatus = "deleting"
	// SnapshotStatusPendingDeletion is the status field for snapshot that is going to be deleted in the near future
	SnapshotStatusPendingDeletion SnapshotStatus = "pendingDeletion"
	// SnapshotStatusSyncing is the status field for a snapshot that is still under creation
	SnapshotStatusSyncing SnapshotStatus = "syncing"
	// SnapshotStatusMoving is the status field for a snapshot that is moving to another location,
	// this means that the snapshot is under migration
	SnapshotStatusMoving SnapshotStatus = "moving"
)

Definition of all of the possible snapshot statuses

type Status

type Status string

Status is one of the following strings 'created', 'installing', 'running', 'stopped', 'paused'

const (
	// VpsStatusCreated is the status field for a vps that is created but not yet used
	VpsStatusCreated Status = "created"
	// VpsStatusInstalling is the status field for a vps that is going to be installed
	VpsStatusInstalling Status = "installing"
	// VpsStatusRunning is the status field for a vps that is currently turned on
	VpsStatusRunning Status = "running"
	// VpsStatusStopped is the status field for a vps that is in stopped state
	VpsStatusStopped Status = "stopped"
	// VpsStatusPaused is the status field for a vps that is in paused state
	VpsStatusPaused Status = "paused"
)

Definition of all of the possible vps statuses

type TCPMonitor

type TCPMonitor struct {
	// IP Address that is monitored
	IPAddress net.IP `json:"ipAddress"`
	// Title of the monitor
	Label string `json:"label"`
	// Ports that are monitored
	Ports []int `json:"ports"`
	// Checking interval in minutes (numbers 1-6)
	Interval int `json:"interval"`
	// Allowed time outs (numbers 1-5)
	AllowedTimeouts int `json:"allowedTimeouts"`
	// TCPMonitorContact that will be notified for this monitor
	Contacts []TCPMonitorContact `json:"contacts"`
	// The hours when the TCP monitoring is ignored (no notifications are sent out)
	IgnoreTimes []IgnoreTime `json:"ignoreTimes"`
}

TCPMonitor struct for a TCPMonitor, tcp monitors are created on specific IPs

type TCPMonitorContact

type TCPMonitorContact struct {
	// Monitoring contact id
	ID int64 `json:"id"`
	// Send emails to contact
	EnableEmail bool `json:"enableEmail"`
	// Send SMS text messages to contact
	EnableSMS bool `json:"enableSMS"`
}

TCPMonitorContact struct for a TCPMonitorContact

type TCPMonitorRepository

type TCPMonitorRepository repository.RestRepository

TCPMonitorRepository allows you to manage all tcp monitor and tcp monitor contact api actions like listing, getting information, adding, updating, deleting tcp monitors updating, creating, deleting contacts

func (*TCPMonitorRepository) CreateContact

func (r *TCPMonitorRepository) CreateContact(contact MonitoringContact) error

CreateContact allows you to add a new contact which could be used by the tcp monitoring

func (*TCPMonitorRepository) CreateTCPMonitor

func (r *TCPMonitorRepository) CreateTCPMonitor(vpsName string, tcpMonitor TCPMonitor) error

CreateTCPMonitor allows you to create a tcp monitor and specify which ports you would like to monitor.

To get a better grip on which fields exist and which can be changes have a look at the TCPMonitor struct or see the documentation: https://api.transip.nl/rest/docs.html#vps-tcp-monitors-post

func (*TCPMonitorRepository) GetContacts

func (r *TCPMonitorRepository) GetContacts() ([]MonitoringContact, error)

GetContacts returns a list of all your monitoring contacts

func (*TCPMonitorRepository) GetTCPMonitors

func (r *TCPMonitorRepository) GetTCPMonitors(vpsName string) ([]TCPMonitor, error)

GetTCPMonitors returns an overview of all existing monitors attached to a VPS

func (*TCPMonitorRepository) RemoveContact

func (r *TCPMonitorRepository) RemoveContact(contactID int64) error

RemoveContact allows you to delete a specific contact by id

func (*TCPMonitorRepository) RemoveTCPMonitor

func (r *TCPMonitorRepository) RemoveTCPMonitor(vpsName string, ip net.IP) error

RemoveTCPMonitor allows you to remove a tcp monitor for a specific ip address on a specifc VPS

func (*TCPMonitorRepository) UpdateContact

func (r *TCPMonitorRepository) UpdateContact(contact MonitoringContact) error

UpdateContact updates the specified contact

func (*TCPMonitorRepository) UpdateTCPMonitor

func (r *TCPMonitorRepository) UpdateTCPMonitor(vpsName string, tcpMonitor TCPMonitor) error

UpdateTCPMonitor allows you to update your monitor settings for a given tcp monitored ip

type Usage

type Usage struct {
	CPU     []UsageDataCPU     `json:"cpu"`
	Disk    []UsageDataDisk    `json:"disk"`
	Network []UsageDataNetwork `json:"network"`
}

Usage struct for an Usage

type UsageDataCPU

type UsageDataCPU struct {
	// Date of the entry, by default in UNIX timestamp format
	Date int64 `json:"date"`
	// The percentage of CPU usage for this entry
	Percentage float32 `json:"percentage"`
}

UsageDataCPU struct contains cpu usage percentage for a certain date

type UsageDataDisk

type UsageDataDisk struct {
	// Date of the entry, by default in UNIX timestamp format
	Date int64 `json:"date"`
	// The read IOPS for this entry
	IopsRead float32 `json:"iopsRead"`
	// The write IOPS for this entry
	IopsWrite float32 `json:"iopsWrite"`
}

UsageDataDisk struct contains disk usage for a certain date

type UsageDataNetwork

type UsageDataNetwork struct {
	// Date of the entry, by default in UNIX timestamp format
	Date float32 `json:"date"`
	// The amount of inbound traffic in Mbps for this usage entry
	MbitIn float32 `json:"mbitIn"`
	// The amount of outbound traffic in Mbps for this usage entry
	MbitOut float32 `json:"mbitOut"`
}

UsageDataNetwork struct for UsageDataNetwork

type UsagePeriod

type UsagePeriod struct {
	// TimeStart contains a unix timestamp for the start of the period
	TimeStart int64 `json:"dateTimeStart"`
	// TimeEnd contains a unix timestamp for the end of the period
	TimeEnd int64 `json:"dateTimeEnd"`
}

UsagePeriod is struct that can be used to query usage statistics for a certain period

type UsageType

type UsageType string

UsageType can be one of the following strings 'cpu', 'disk', 'network'

const (
	// UsageTypeCPU is used to request the cpu usage data of a VPS
	UsageTypeCPU UsageType = "cpu"
	// UsageTypeDisk is used to request the disk usage data of a VPS
	UsageTypeDisk UsageType = "disk"
	// UsageTypeNetwork is used to request the network usage data of a VPS
	UsageTypeNetwork UsageType = "network"
)

type VncData

type VncData struct {
	// Location of the VNC Proxy
	Host string `json:"host,omitempty"`
	// Password to setup up the VNC connection (changes dynamically)
	Password string `json:"password,omitempty"`
	// Websocket path including the token
	Path string `json:"path,omitempty"`
	// token to identify the VPS to connect to (changes dynamically)
	Token string `json:"token,omitempty"`
	// Complete websocket URL
	URL string `json:"url,omitempty"`
}

VncData struct for the vps vnc data

type Vps

type Vps struct {
	// The unique VPS name
	Name string `json:"name"`
	// The name that can be set by customer
	Description string `json:"description,omitempty"`
	// The product name
	ProductName string `json:"productName,omitempty"`
	// The VPS OperatingSystem
	OperatingSystem string `json:"operatingSystem,omitempty"`
	// The VPS disk size in kB
	DiskSize int64 `json:"diskSize,omitempty"`
	// The VPS memory size in kB
	MemorySize int64 `json:"memorySize,omitempty"`
	// The VPS cpu count
	CPUs int `json:"cpus,omitempty"`
	// The VPS status, either 'created', 'installing', 'running', 'stopped' or 'paused'
	Status Status `json:"status,omitempty"`
	// The VPS main ipAddress
	IPAddress string `json:"ipAddress,omitempty"`
	// The VPS macaddress
	MacAddress string `json:"macAddress,omitempty"`
	// The amount of snapshots that is used on this VPS
	CurrentSnapshots int `json:"currentSnapshots,omitempty"`
	// The maximum amount of snapshots for this VPS
	MaxSnapshots int `json:"maxSnapshots,omitempty"`
	// Whether or not another process is already doing stuff with this VPS
	IsLocked bool `json:"isLocked,omitempty"`
	// If the VPS is administratively blocked
	IsBlocked bool `json:"isBlocked,omitempty"`
	// If this VPS is locked by the customer
	IsCustomerLocked bool `json:"isCustomerLocked,omitempty"`
	// The name of the availability zone the VPS is in
	AvailabilityZone string `json:"availabilityZone,omitempty"`
	// The custom tags added to this VPS
	Tags []string `json:"tags,omitempty"`
}

Vps struct for a Vps

Jump to

Keyboard shortcuts

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