solus

package module
v0.0.0-...-a9f6da8 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

README

SolusVM v2 GoLang SDK

Go Reference GitHub Workflow Status Report Card Coverage Status

solus-go-sdk is a Go client for accessing SolusVM v2 API

SolusVM is a virtual infrastructure management solution that facilitates choice, simplicity, and performance for ISPs and enterprises. Offer blazing fast, on-demand VMs, a simple API, and an easy-to-use self-service control panel for your customers to unleash your full potential for growth.

Official site

Usage

client, err := solus.NewClient(baseURL, solus.EmailAndPasswordAuthenticator{
    Email: "email@example.com",
    Password: "12345678",
})

Or

client, err := solus.NewClient(baseURL, solus.APITokenAuthenticator{Token: "api token"})

Development

For (re)generating code just run go generate

Documentation

Index

Constants

View Source
const (
	// BootModeDisk indicates booting from original disk.
	BootModeDisk BootMode = "disk"

	// BootModeRescue indicates booting from rescue ISO image.
	BootModeRescue BootMode = "rescue"

	// DiskCacheModeNone indicates no disk cache.
	DiskCacheModeNone DiskCacheMode = "none"

	// DiskCacheModeDefault indicates default disk cache.
	DiskCacheModeDefault DiskCacheMode = "default"

	// DiskCacheModeDirectSync indicates direct sync disk cache.
	DiskCacheModeDirectSync DiskCacheMode = "directsync"

	// DiskCacheModeWriteback indicates writeback disk cache.
	DiskCacheModeWriteback DiskCacheMode = "writeback"

	// DiskCacheModeWritethrough indicates writethrough disk cache.
	DiskCacheModeWritethrough DiskCacheMode = "writethrough"

	// DiskCacheModeUnsafe indicates unsafe disk cache.
	DiskCacheModeUnsafe DiskCacheMode = "unsafe"

	// DiskDriverSATA indicates SATA disk driver.
	DiskDriverSATA DiskDriver = "sata"

	// DiskDriverSCSI indicates SCSI disk driver.
	DiskDriverSCSI DiskDriver = "scsi"

	// DiskDriverIDE is IDE disk driver.
	DiskDriverIDE DiskDriver = "ide"

	// DiskDriverVirtIO indicates virtio disk driver.
	DiskDriverVirtIO DiskDriver = "virtio"

	// FirmwareBios indicates BIOS firmware.
	FirmwareBios string = "bios"

	// FirmwareEFI indicates EFI firmware.
	FirmwareEFI string = "efi"
)

Variables

This section is empty.

Functions

func BackupNodeHetznerStorageBoxCredentials

func BackupNodeHetznerStorageBoxCredentials(
	host string,
	login string,
	key string,
) map[string]interface{}

BackupNodeHetznerStorageBoxCredentials creates Hetzner Storage Box specific connection credentials.

func BackupNodeSSHRsyncCredentials

func BackupNodeSSHRsyncCredentials(
	host string,
	port int,
	login string,
	key string,
	storagePath string,
) map[string]interface{}

BackupNodeSSHRsyncCredentials creates SSH+Rsync specific connection credentials.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if specified error is produced 'cause requested resource is not found.

func IsValidCloudInitVersion

func IsValidCloudInitVersion(v string) bool

IsValidCloudInitVersion returns true if specified cloud-init version is valid.

func IsValidVirtualizationType

func IsValidVirtualizationType(v string) bool

IsValidVirtualizationType returns true if specified virtualization type is valid.

Types

type APITokenAuthenticator

type APITokenAuthenticator struct {
	Token string
}

APITokenAuthenticator authenticate by provided API token.

func (APITokenAuthenticator) Authenticate

func (a APITokenAuthenticator) Authenticate(*Client) (Credentials, error)

Authenticate authenticates by API token.

type AccountService

type AccountService service

AccountService handles all available methods with a current user account.

func (*AccountService) Get

func (s *AccountService) Get(ctx context.Context) (User, error)

Get retrieves current user account.

type ActivityLogs

type ActivityLogs struct {
	ID        int               `json:"id"`
	Event     ActivityLogsEvent `json:"event"`
	UserEmail string            `json:"user_email"`
	CreatedAt string            `json:"created_at"`
	Data      json.RawMessage   `json:"data,omitempty"`
}

ActivityLogs represents an Activity Logs.

type ActivityLogsEvent

type ActivityLogsEvent string

ActivityLogsEvent represents an Activity Logs event.

const (
	ActivityLogsEventAdditionalIPCreateRequested ActivityLogsEvent = "additional_ip_create_requested"
	ActivityLogsEventAdditionalIPCreateFailed    ActivityLogsEvent = "additional_ip_create_failed"
	ActivityLogsEventAdditionalIPCreated         ActivityLogsEvent = "additional_ip_created"

	ActivityLogsEventAdditionalIPDeleteRequested ActivityLogsEvent = "additional_ip_delete_requested"
	ActivityLogsEventAdditionalIPDeleteFailed    ActivityLogsEvent = "additional_ip_delete_failed"
	ActivityLogsEventAdditionalIPDeleted         ActivityLogsEvent = "additional_ip_deleted"

	ActivityLogsEventBackupsDeleted ActivityLogsEvent = "backups_deleted"

	ActivityLogsEventComputeResourceCreateRequested ActivityLogsEvent = "compute_resource_create_requested"
	ActivityLogsEventComputeResourceDeleteRequested ActivityLogsEvent = "compute_resource_delete_requested"

	ActivityLogsEventComputeResourceVMCreateRequested ActivityLogsEvent = "compute_resource_vm_create_requested"
	ActivityLogsEventComputeResourceVMCreateFailed    ActivityLogsEvent = "compute_resource_vm_create_failed"
	ActivityLogsEventComputeResourceVMCreated         ActivityLogsEvent = "compute_resource_vm_created"

	ActivityLogsEventComputeResourceVMDeleteRequested ActivityLogsEvent = "compute_resource_vm_delete_requested"

	ActivityLogsEventComputeResourceVMBatchDeleted ActivityLogsEvent = "compute_resource_vm_batch_deleted"

	ActivityLogsEventExternalIntegrationRequested ActivityLogsEvent = "external_integration_requested"

	ActivityLogsEventFailedToSendEmailNotification ActivityLogsEvent = "failed_to_send_email_notification"

	ActivityLogsEventIPBlockChanged ActivityLogsEvent = "ip_block_changed"

	ActivityLogsEventLocationCreated ActivityLogsEvent = "location_created"
	ActivityLogsEventLocationDeleted ActivityLogsEvent = "location_deleted"
	ActivityLogsEventLocationChanged ActivityLogsEvent = "location_changed"

	ActivityLogsEventUserCreateRequested ActivityLogsEvent = "user_create_requested"
	ActivityLogsEventUserCreateFailed    ActivityLogsEvent = "user_create_failed"
	ActivityLogsEventUserCreated         ActivityLogsEvent = "user_created"

	ActivityLogsEventUserDeleteRequested ActivityLogsEvent = "user_delete_requested"
	ActivityLogsEventUserDeleteFailed    ActivityLogsEvent = "user_delete_failed"
	ActivityLogsEventUserDeleted         ActivityLogsEvent = "user_deleted"
)

type ActivityLogsResponse

type ActivityLogsResponse struct {
	Data []ActivityLogs `json:"data"`
	// contains filtered or unexported fields
}

ActivityLogsResponse represents an Activity Logs response.

func (*ActivityLogsResponse) Err

func (r *ActivityLogsResponse) Err() error

Err return an error which is occurred during fetching next page data.

func (*ActivityLogsResponse) Next

Next using for iterating through all data entities.

Examples:

	ctx, cancelFunc := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancelFunc()

 for {
		for _, datum := range resp.Data {
			doSmthWithDatum(datum)
		}

		if !resp.Next(ctx) {
			break
		}
	}

 if resp.Err() != nil {
		handleAnError(resp.Err())
	}

type ActivityLogsService

type ActivityLogsService service

ActivityLogsService provides access to Activity Logs.

func (*ActivityLogsService) List

List return list of activity logs, filter can be nil.

type AdditionalDiskCreateRequest

type AdditionalDiskCreateRequest struct {
	Name    string `json:"name"`
	Size    int    `json:"size"`
	OfferID int    `json:"offer_id"`
}

type Application

type Application struct {
	ID               int         `json:"id"`
	Name             string      `json:"name"`
	Icon             Icon        `json:"icon"`
	URL              string      `json:"url"`
	CloudInitVersion string      `json:"cloud_init_version"`
	UserData         string      `json:"user_data_template"`
	LoginLink        LoginLink   `json:"login_link"`
	JSONSchema       string      `json:"json_schema"`
	IsDefault        bool        `json:"is_default"`
	IsVisible        bool        `json:"is_visible"`
	IsBuiltin        bool        `json:"is_buildin"`
	AvailablePlans   []ShortPlan `json:"available_plans"`
}

Application represents an application.

type ApplicationCreateRequest

type ApplicationCreateRequest struct {
	Name             string    `json:"name"`
	URL              string    `json:"url"`
	IconID           int       `json:"icon_id"`
	CloudInitVersion string    `json:"cloud_init_version"`
	UserDataTemplate string    `json:"user_data_template"`
	JSONSchema       string    `json:"json_schema"`
	IsVisible        bool      `json:"is_visible"`
	LoginLink        LoginLink `json:"login_link"`
	AvailablePlans   []int     `json:"available_plans,omitempty"`
}

ApplicationCreateRequest represents available properties for creating a new application.

type ApplicationsResponse

type ApplicationsResponse struct {
	Data []Application `json:"data"`
	// contains filtered or unexported fields
}

ApplicationsResponse represents paginated list of applications. This cursor can be used for iterating over all available applications.

func (*ApplicationsResponse) Err

func (r *ApplicationsResponse) Err() error

Err return an error which is occurred during fetching next page data.

func (*ApplicationsResponse) Next

Next using for iterating through all data entities.

Examples:

	ctx, cancelFunc := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancelFunc()

 for {
		for _, datum := range resp.Data {
			doSmthWithDatum(datum)
		}

		if !resp.Next(ctx) {
			break
		}
	}

 if resp.Err() != nil {
		handleAnError(resp.Err())
	}

type ApplicationsService

type ApplicationsService service

ApplicationsService handles all available methods with applications.

func (*ApplicationsService) Create

Create creates new application.

func (*ApplicationsService) List

List lists all applications.

type AuthLoginRequest

type AuthLoginRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

AuthLoginRequest represents all required properties for authentication.

type AuthLoginResponse

type AuthLoginResponse struct {
	Credentials Credentials `json:"credentials"`
}

AuthLoginResponse represents an authentication response.

type Authenticator

type Authenticator interface {
	// Authenticate authenticates client and return credentials
	// which should be used for making further API calls.
	// The Client is fully initialized. Any endpoints which is not requires
	// authentication may be called.
	Authenticate(c *Client) (Credentials, error)
}

Authenticator interface for client authentication.

type Backup

type Backup struct {
	ID                int                  `json:"id"`
	Type              BackupType           `json:"type"`
	CreationMethod    BackupCreationMethod `json:"creation_method"`
	Status            BackupStatus         `json:"status"`
	Size              float32              `json:"size"`
	ComputeResourceVM VirtualServer        `json:"compute_resource_vm"`
	BackupNode        BackupNode           `json:"backup_node"`
	Creator           User                 `json:"creator"`
	CreatedAt         string               `json:"created_at"`
	BackupProgress    float32              `json:"backup_progress"`
	BackupFailReason  string               `json:"backup_fail_reason"`
	Disk              int                  `json:"disk"`
}

Backup represent a backup.

func (Backup) IsFinished

func (b Backup) IsFinished() bool

IsFinished returns true if the backup is finished, successfully or not.

type BackupCreationMethod

type BackupCreationMethod string

BackupCreationMethod represents a way how a backup was created.

const (
	// BackupCreationMethodAuto backup was created automatically by scheduler.
	BackupCreationMethodAuto BackupCreationMethod = "auto"

	// BackupCreationMethodManual backup was created manually by user request.
	BackupCreationMethodManual BackupCreationMethod = "manual"
)

type BackupNode

type BackupNode struct {
	ID                    int                    `json:"id"`
	Name                  string                 `json:"name"`
	Type                  BackupNodeType         `json:"type"`
	Credentials           map[string]interface{} `json:"credentials"`
	ComputeResourcesCount int                    `json:"compute_resources_count"`
	BackupsCount          int                    `json:"backups_count"`
	TotalBackupsSize      int                    `json:"total_backups_size"`
	ComputeResources      []ComputeResource      `json:"compute_resources"`
}

BackupNode represents a backup node. The backup node is a server or a service where backup can be stored.

type BackupNodeRequest

type BackupNodeRequest struct {
	Name             string                 `json:"name"`
	Type             BackupNodeType         `json:"type"`
	ComputeResources []int                  `json:"compute_resources,omitempty"`
	Credentials      map[string]interface{} `json:"credentials,omitempty"`
}

BackupNodeRequest represents available properties for creating new or updating existing backup nodes.

type BackupNodeType

type BackupNodeType string

BackupNodeType a backup node type.

const (
	// BackupNodeTypeSSHRsync uses SSH with rsync to manipulate backups.
	BackupNodeTypeSSHRsync BackupNodeType = "ssh_rsync"

	// BackupNodeTypeHetznerStorageBox Hetzner Storage Box specific backup node
	// type.
	// https://docs.hetzner.com/robot/storage-box/general
	BackupNodeTypeHetznerStorageBox BackupNodeType = "hetzner_storage_box"
)

type BackupNodesService

type BackupNodesService service

BackupNodesService handles all available methods with backup nodes.

func (*BackupNodesService) Create

Create creates new backup node.

func (*BackupNodesService) Delete

func (s *BackupNodesService) Delete(ctx context.Context, id int) error

Delete deletes specified backup node.

func (*BackupNodesService) Update

Update updates specified backup node.

type BackupStatus

type BackupStatus string

BackupStatus represents available backup's statuses.

const (
	// BackupStatusPending indicates backup is still not processing and waits until
	// it will be dispatched.
	BackupStatusPending BackupStatus = "pending"

	// BackupStatusInProgress indicates backup is processing right now.
	BackupStatusInProgress BackupStatus = "in_progress"

	// BackupStatusCreated indicates backup was successfully created.
	BackupStatusCreated BackupStatus = "created"

	// BackupStatusFailed indicates backup wasn't created due to some reason.
	BackupStatusFailed BackupStatus = "failed"
)

type BackupType

type BackupType string

BackupType a backup type.

const (
	// BackupTypeFull a full server backup.
	// Include all disk's data.
	BackupTypeFull BackupType = "full"

	// BackupTypeIncremental an incremental server backup.
	// Include only changed disk's data since last backup.
	BackupTypeIncremental BackupType = "incremental"
)

type BackupsService

type BackupsService service

BackupsService handles all available methods with backups.

func (*BackupsService) Delete

func (s *BackupsService) Delete(ctx context.Context, id int) error

Delete deletes specified backup.

func (*BackupsService) Get

func (s *BackupsService) Get(ctx context.Context, id int) (Backup, error)

Get gets specified backup.

func (*BackupsService) Restore

func (s *BackupsService) Restore(ctx context.Context, id int) (Task, error)

Restore restores a related server from a specific backup.

type BandwidthPlanLimit

type BandwidthPlanLimit struct {
	IsEnabled bool                   `json:"is_enabled"`
	Limit     int                    `json:"limit"`
	Unit      BandwidthPlanLimitUnit `json:"unit"`
}

BandwidthPlanLimit represents network bandwidth specific limit.

type BandwidthPlanLimitUnit

type BandwidthPlanLimitUnit string

BandwidthPlanLimitUnit represents available units for network bandwidth limit.

const (
	// BandwidthPlanLimitUnitKbps indicates kilobits per second unit.
	BandwidthPlanLimitUnitKbps BandwidthPlanLimitUnit = "Kbps"

	// BandwidthPlanLimitUnitMbps indicates megabits per second unit.
	BandwidthPlanLimitUnitMbps BandwidthPlanLimitUnit = "Mbps"

	// BandwidthPlanLimitUnitGbps indicates gigabits per second unit.
	BandwidthPlanLimitUnitGbps BandwidthPlanLimitUnit = "Gbps"
)

type BootMode

type BootMode string

BootMode represents available server boot modes.

type Client

type Client struct {
	BaseURL     *url.URL
	UserAgent   string
	Credentials Credentials
	Headers     http.Header
	HTTPClient  *http.Client
	Logger      Logger
	Retries     int
	RetryAfter  time.Duration

	Account           *AccountService
	ActivityLogs      *ActivityLogsService
	Applications      *ApplicationsService
	BackupNodes       *BackupNodesService
	Backups           *BackupsService
	ComputeResources  *ComputeResourcesService
	IPBlocks          *IPBlocksService
	Icons             *IconsService
	License           *LicenseService
	Locations         *LocationsService
	OsImageVersions   *OsImageVersionsService
	OsImages          *OsImagesService
	Permission        *PermissionsService
	Plans             *PlansService
	Projects          *ProjectsService
	Roles             *RolesService
	SSHKeys           *SSHKeysService
	ServersMigrations *ServersMigrationsService
	Settings          *SettingsService
	Snapshots         *SnapshotsService
	Storage           *StorageService
	StorageTypes      *StorageTypesService
	Tasks             *TasksService
	Users             *UsersService
	VirtualServers    *VirtualServersService
	// contains filtered or unexported fields
}

Client a Solus API client.

func NewClient

func NewClient(
	baseURL *url.URL,
	a Authenticator,
	opts ...ClientOption,
) (*Client, error)

NewClient create and initialize Client instance.

type ClientOption

type ClientOption func(c *Client)

ClientOption represent client initialization options.

func AllowInsecure

func AllowInsecure() ClientOption

AllowInsecure allows skipping certificate verify.

func SetRetryPolicy

func SetRetryPolicy(retries int, retryAfter time.Duration) ClientOption

SetRetryPolicy sets number of retries and timeout between them.

func WithLogger

func WithLogger(logger Logger) ClientOption

WithLogger inject specific logger into client.

type CloudInitVersion

type CloudInitVersion string

CloudInitVersion represents available cloud-init config versions.

const (
	// CloudInitVersionV0 indicates v0 cloud-init config version.
	CloudInitVersionV0 CloudInitVersion = "v0"

	// CloudInitVersionCentOS6 indicates CentOS 6 specific v0 cloud-init config
	// version.
	CloudInitVersionCentOS6 CloudInitVersion = "v0-centos6"

	// CloudInitVersionDebian9 indicates Debian 9 specific v0 cloud-init config
	// version.
	CloudInitVersionDebian9 CloudInitVersion = "v0-debian9"

	// CloudInitVersionV2 indicates v2 cloud-init config version.
	CloudInitVersionV2 CloudInitVersion = "v2"

	// CloudInitVersionV2Alpine indicates Alpine specific v2 cloud-init config
	// version.
	CloudInitVersionV2Alpine CloudInitVersion = "v2-alpine"

	// CloudInitVersionV2Centos indicates CentOS 7 & 8 specific v2 cloud-init config
	// version.
	CloudInitVersionV2Centos CloudInitVersion = "v2-centos"

	// CloudInitVersionV2Debian10 indicates Debian 10 specific v2 cloud-init config
	// version.
	CloudInitVersionV2Debian10 CloudInitVersion = "v2-debian10"

	// CloudInitVersionCloudBase indicates cloudbase config version.
	CloudInitVersionCloudBase CloudInitVersion = "cloudbase"
)

type ComputeResource

type ComputeResource struct {
	ID        int                     `json:"id"`
	Name      string                  `json:"name"`
	Host      string                  `json:"host"`
	AgentPort int                     `json:"agent_port"`
	Settings  ComputeResourceSettings `json:"settings"`
	Status    ComputerResourceStatus  `json:"status"`
	Locations []Location              `json:"locations"`
	IPBlocks  []IPBlock               `json:"ip_blocks"`
	Metrics   ComputeResourceMetrics  `json:"metrics"`
	VMsCount  int                     `json:"vms_count"`
	Version   string                  `json:"version"`
	IsLocked  bool                    `json:"is_locked"`
}

ComputeResource represents a compute resource. The compute resource is a server where virtual machines will be running.

type ComputeResourceAuthType

type ComputeResourceAuthType string

ComputeResourceAuthType represents available authentication methods for the agent installation during compute resource creating.

const (
	// ComputeResourceAuthTypePassword indicates connect by password.
	ComputeResourceAuthTypePassword ComputeResourceAuthType = "lpass"

	// ComputeResourceAuthTypeKey indicates connect by SSH key.
	ComputeResourceAuthTypeKey ComputeResourceAuthType = "lkey"
)

type ComputeResourceBalanceStrategy

type ComputeResourceBalanceStrategy string

ComputeResourceBalanceStrategy represents available balancing strategies for compute resource. These strategies will be used during a server creation for choosing which compute resource should be used.

const (
	// ComputeResourceBalanceStrategyRoundRobin indicates compute resource will
	// be choosing by round-robin algorithm.
	ComputeResourceBalanceStrategyRoundRobin ComputeResourceBalanceStrategy = "round-robin"

	// ComputeResourceBalanceStrategyRandom indicates compute resource will be
	// chosen randomly.
	ComputeResourceBalanceStrategyRandom ComputeResourceBalanceStrategy = "random"

	// ComputeResourceBalanceStrategyMostStorageAvailable indicates compute resource
	// with most available storage space will be chosen.
	ComputeResourceBalanceStrategyMostStorageAvailable ComputeResourceBalanceStrategy = "most-storage-available"
)

type ComputeResourceInstallStep

type ComputeResourceInstallStep struct {
	ID                int                              `json:"id"`
	ComputeResourceID int                              `json:"compute_resource_id"`
	Title             string                           `json:"title"`
	Status            ComputeResourceInstallStepStatus `json:"status"`
	StatusText        string                           `json:"status_text"`
	Progress          float32                          `json:"progress"`
}

ComputeResourceInstallStep represents a compute resource install step.

type ComputeResourceInstallStepStatus

type ComputeResourceInstallStepStatus string

ComputeResourceInstallStepStatus represents available compute resource's install step statuses.

const (
	// ComputeResourceInstallStepStatusRunning indicates install step is running.
	ComputeResourceInstallStepStatusRunning ComputeResourceInstallStepStatus = "running"

	// ComputeResourceInstallStepStatusDone indicates install step is successfully
	// done.
	ComputeResourceInstallStepStatusDone ComputeResourceInstallStepStatus = "done"

	// ComputeResourceInstallStepStatusError indicates install step is failed.
	ComputeResourceInstallStepStatusError ComputeResourceInstallStepStatus = "error"
)

type ComputeResourceMetrics

type ComputeResourceMetrics struct {
	Network ComputeResourceMetricsNetwork `json:"network"`
}

ComputeResourceMetrics represents compute resource's metrics.

type ComputeResourceMetricsNetwork

type ComputeResourceMetricsNetwork struct {
	IPv6Enabled bool `json:"ipv6_enabled"`
}

ComputeResourceMetricsNetwork represents compute resource's network metrics.

type ComputeResourceNetwork

type ComputeResourceNetwork struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	// AddrConfType for 'static' or 'dhcp'
	AddrConfType string `json:"addr_conf_type"`
	IPVersion    int    `json:"ip_version"`
	IP           string `json:"ip"`
	Mask         string `json:"mask"`
	MaskSize     int    `json:"mask_size"`
}

ComputeResourceNetwork represents compute resource's network.

type ComputeResourcePhysicalVolume

type ComputeResourcePhysicalVolume struct {
	VGFree string `json:"vg_free"`
	VGName string `json:"vg_name"`
	VGSize string `json:"vg_size"`
	PVUsed string `json:"pv_used"`
}

ComputeResourcePhysicalVolume represents a compute resource's physical volume.

type ComputeResourceServerCreateRequest

type ComputeResourceServerCreateRequest struct {
	Name             string                       `json:"name"`
	Description      string                       `json:"description"`
	Password         string                       `json:"password"`
	PlanID           int                          `json:"plan_id"`
	OSImageVersionID int                          `json:"os_image_version_id,omitempty"`
	ApplicationID    int                          `json:"application_id,omitempty"`
	ApplicationData  map[string]string            `json:"application_data,omitempty"`
	SSHKeys          []int                        `json:"ssh_keys,omitempty"`
	UserData         string                       `json:"user_data,omitempty"`
	FQDNs            []string                     `json:"fqdns,omitempty"`
	UserID           int                          `json:"user_id"`
	ProjectID        int                          `json:"project_id"`
	BackupSettings   *VirtualServerBackupSettings `json:"backup_settings,omitempty"`
}

ComputeResourceServerCreateRequest represents available properties for creating a new servers on a compute resource.

type ComputeResourceSettings

type ComputeResourceSettings struct {
	CachePath           string                         `json:"cache_path"`
	ISOPath             string                         `json:"iso_path"`
	BackupTmpPath       string                         `json:"backup_tmp_path"`
	VNCProxyPort        int                            `json:"vnc_proxy_port"`
	Limits              ComputeResourceSettingsLimits  `json:"limits"`
	Network             ComputeResourceSettingsNetwork `json:"network"`
	BalanceStrategy     ComputeResourceBalanceStrategy `json:"balance_strategy"`
	VirtualizationTypes []VirtualizationType           `json:"virtualization_types"`
}

ComputeResourceSettings represents available compute resource's settings.

type ComputeResourceSettingsLimit

type ComputeResourceSettingsLimit struct {
	Unlimited bool    `json:"unlimited"`
	Total     float32 `json:"total"`
	Used      float32 `json:"used,omitempty"`
}

ComputeResourceSettingsLimit represents single compute resources limit.

type ComputeResourceSettingsLimits

type ComputeResourceSettingsLimits struct {
	VM   ComputeResourceSettingsLimit `json:"vm"`
	HDD  ComputeResourceSettingsLimit `json:"hdd"`
	RAM  ComputeResourceSettingsLimit `json:"ram"`
	VCPU ComputeResourceSettingsLimit `json:"vcpu"`
}

ComputeResourceSettingsLimits represents available compute resources limits for virtual machines.

type ComputeResourceSettingsNetwork

type ComputeResourceSettingsNetwork struct {
	Type    ComputeResourceSettingsNetworkType     `json:"type"`
	Bridges []ComputeResourceSettingsNetworkBridge `json:"bridges"`
}

ComputeResourceSettingsNetwork represents compute resource's network.

type ComputeResourceSettingsNetworkBridge

type ComputeResourceSettingsNetworkBridge struct {
	Type ComputeResourceSettingsNetworkType `json:"type"`
	Name string                             `json:"name"`
}

ComputeResourceSettingsNetworkBridge represents one of compute resource's network bridge.

type ComputeResourceSettingsNetworkType

type ComputeResourceSettingsNetworkType string

ComputeResourceSettingsNetworkType represents available network types on a compute resource.

const (
	// ComputeResourceSettingsNetworkTypeRouted indicates virtual servers don't
	// connect directly to the physical network. The compute resource's operating
	// system routes the servers' traffic to the physical network (the compute
	// resource works as the gateway).
	// The server's MAC address isn’t exposed to the physical network.
	ComputeResourceSettingsNetworkTypeRouted ComputeResourceSettingsNetworkType = "routed"

	// ComputeResourceSettingsNetworkTypeBridged indicates virtual servers get
	// direct access to the physical network. In the bridged network, the IP addresses
	// of a server and the gateway must be within the same IP network. For example,
	// if the gateway's IP address 192.168.1.1 is within the IP network 192.168.1.0/24,
	// then the server's IP address must be also within the 192.168.1.0/24 network
	// (for example, 192.168.1.2).
	// The server's MAC address is exposed to the physical network.
	// Use a bridged network if you have the large network of IP addresses with
	// the gateway.
	ComputeResourceSettingsNetworkTypeBridged ComputeResourceSettingsNetworkType = "bridged"
)

type ComputeResourceStorageCreateRequest

type ComputeResourceStorageCreateRequest struct {
	Type                    StorageTypeName `json:"type"`
	Path                    string          `json:"path"`
	ThinPool                string          `json:"thin_pool,omitempty"`
	IsAvailableForBalancing bool            `json:"is_available_for_balancing"`
}

ComputeResourceStorageCreateRequest represents available properties for creating a new storage on a compute resource.

type ComputeResourceThinPool

type ComputeResourceThinPool struct {
	ConvertLV       string `json:"convert_lv"`
	CopyPercent     string `json:"copy_percent"`
	DataPercent     string `json:"data_percent"`
	LVAttr          string `json:"lv_attr"`
	LVLayout        string `json:"lv_layout"`
	LVMetadataSize  string `json:"lv_metadata_size"`
	LVName          string `json:"lv_name"`
	LVSize          string `json:"lv_size"`
	MetadataPrecent string `json:"metadata_percent"`
	MirrorLog       string `json:"mirror_log"`
	MovePV          string `json:"move_pv"`
	Origin          string `json:"origin"`
	PoolLV          string `json:"pool_lv"`
	VGName          string `json:"vg_name"`
}

ComputeResourceThinPool represents a compute resource's ThinLVM pool.

type ComputeResourcesResponse

type ComputeResourcesResponse struct {
	Data []ComputeResource `json:"data"`
	// contains filtered or unexported fields
}

ComputeResourcesResponse represents paginated list of compute resources. This cursor can be used for iterating over all available compute resources.

func (*ComputeResourcesResponse) Err

func (r *ComputeResourcesResponse) Err() error

Err return an error which is occurred during fetching next page data.

func (*ComputeResourcesResponse) Next

Next using for iterating through all data entities.

Examples:

	ctx, cancelFunc := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancelFunc()

 for {
		for _, datum := range resp.Data {
			doSmthWithDatum(datum)
		}

		if !resp.Next(ctx) {
			break
		}
	}

 if resp.Err() != nil {
		handleAnError(resp.Err())
	}

type ComputeResourcesService

type ComputeResourcesService service

ComputeResourcesService handles all available methods with compute resources.

func (*ComputeResourcesService) Create

Create creates new compute resource.

func (*ComputeResourcesService) Delete

func (s *ComputeResourcesService) Delete(ctx context.Context, id int, force bool) error

Delete deletes specified compute resource.

func (*ComputeResourcesService) Get

Get gets specified compute resource.

func (*ComputeResourcesService) InstallSteps

InstallSteps lists specified compute resource's install steps.

func (*ComputeResourcesService) List

List lists compute resource.

func (*ComputeResourcesService) Networks

Networks lists specified compute resource's networks.

func (*ComputeResourcesService) Patch

Patch patches specified compute resource.

func (*ComputeResourcesService) PhysicalVolumes

func (s *ComputeResourcesService) PhysicalVolumes(
	ctx context.Context,
	id int,
) ([]ComputeResourcePhysicalVolume, error)

PhysicalVolumes lists physical volume on the specified compute resource. Return available LVM volume groups.

func (*ComputeResourcesService) ServersCreate

ServersCreate creates a new server on the specified compute resource.

func (*ComputeResourcesService) SetUpNetwork

func (s *ComputeResourcesService) SetUpNetwork(ctx context.Context, id int, data SetupNetworkRequest) error

SetUpNetwork setups a network on the specified compute resource.

func (*ComputeResourcesService) SettingsUpdate

SettingsUpdate updates compute resource's settings.

func (*ComputeResourcesService) StorageCreate

StorageCreate creates a new storage for the specified compute resource.

func (*ComputeResourcesService) StorageList

func (s *ComputeResourcesService) StorageList(ctx context.Context, id int) ([]Storage, error)

StorageList lists storages for the specified compute resource.

func (*ComputeResourcesService) ThinPools

ThinPools lists ThinLVM pools on the specified compute resource.

type ComputerResourceCreateRequest

type ComputerResourceCreateRequest struct {
	Name  string `json:"name,omitempty"`
	Host  string `json:"host,omitempty"`
	Login string `json:"login,omitempty"`
	// SSH port number
	Port     int                     `json:"port,omitempty"`
	Type     ComputeResourceAuthType `json:"type,omitempty"`
	Password string                  `json:"password,omitempty"`
	// SSH private key
	Key         string      `json:"key,omitempty"`
	AgentPort   int         `json:"agent_port,omitempty"`
	IPBlocks    []int       `json:"ip_blocks,omitempty"`
	Locations   []int       `json:"locations,omitempty"`
	LicenseType LicenseType `json:"license_type,omitempty"`
}

ComputerResourceCreateRequest represents available properties for creating a new compute resource.

type ComputerResourceStatus

type ComputerResourceStatus string

ComputerResourceStatus represents available compute resource's statuses.

const (
	// ComputeResourceStatusActive indicates compute resource is active and ready
	// to handle requests.
	ComputeResourceStatusActive ComputerResourceStatus = "active"

	// ComputeResourceStatusCommissioning indicates compute resource is still
	// commissioning.
	ComputeResourceStatusCommissioning ComputerResourceStatus = "commissioning"

	// ComputeResourceStatusConfigureNetwork indicates compute resource is ready
	// for setting up a network.
	ComputeResourceStatusConfigureNetwork ComputerResourceStatus = "configure_network"

	// ComputeResourceStatusFailed indicates compute resource commissioning
	// was failed.
	ComputeResourceStatusFailed ComputerResourceStatus = "failed"

	// ComputeResourceStatusUnavailable indicates compute resource is unavailable
	// due to some reason.
	ComputeResourceStatusUnavailable ComputerResourceStatus = "unavailable"
)

type ComputerResourceUpdateRequest

type ComputerResourceUpdateRequest struct {
	Name  string `json:"name,omitempty"`
	Host  string `json:"host,omitempty"`
	Login string `json:"login,omitempty"`
	// SSH port number
	Port     int                     `json:"port,omitempty"`
	Type     ComputeResourceAuthType `json:"type,omitempty"`
	Password string                  `json:"password,omitempty"`
	// SSH private key
	Key       string `json:"key,omitempty"`
	AgentPort int    `json:"agent_port,omitempty"`
	IPBlocks  []int  `json:"ip_blocks,omitempty"`
	Locations []int  `json:"locations,omitempty"`
	IsLocked  bool   `json:"is_locked,omitempty"`
}

ComputerResourceUpdateRequest represents available properties for updating a compute resource.

type Credentials

type Credentials struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresAt   string `json:"expires_at"`
}

Credentials represents obtained credentials.

type Disk

type Disk struct {
	ID         int     `json:"id"`
	IsPrimary  bool    `json:"is_primary"`
	Name       string  `json:"name"`
	Size       int     `json:"size"`
	ActualSize int     `json:"actual_size"`
	Path       string  `json:"path"`
	FullPath   string  `json:"full_path"`
	Storage    Storage `json:"storage"`
	Offer      Offer   `json:"offer,omitempty"`
}

type DiskBandwidthPlanLimit

type DiskBandwidthPlanLimit struct {
	IsEnabled bool                       `json:"is_enabled"`
	Limit     int                        `json:"limit"`
	Unit      DiskBandwidthPlanLimitUnit `json:"unit"`
}

DiskBandwidthPlanLimit represents disk bandwidth specific limit.

type DiskBandwidthPlanLimitUnit

type DiskBandwidthPlanLimitUnit string

DiskBandwidthPlanLimitUnit represents available units for disk bandwidth limit.

const (
	// DiskBandwidthPlanLimitUnitBps indicates bytes per second unit.
	DiskBandwidthPlanLimitUnitBps DiskBandwidthPlanLimitUnit = "Bps"
)

type DiskCacheMode

type DiskCacheMode string

DiskCacheMode represents available disk cache modes.

type DiskDriver

type DiskDriver string

DiskDriver represents available disk drivers.

type DiskIOPSPlanLimit

type DiskIOPSPlanLimit struct {
	IsEnabled bool                  `json:"is_enabled"`
	Limit     int                   `json:"limit"`
	Unit      DiskIOPSPlanLimitUnit `json:"unit"`
}

DiskIOPSPlanLimit represents disk IOPS specific limit.

type DiskIOPSPlanLimitUnit

type DiskIOPSPlanLimitUnit string

DiskIOPSPlanLimitUnit represents available units for disk IOPS limit.

const (
	// DiskIOPSPlanLimitUnitIOPS indicates input/output operations per second unit.
	DiskIOPSPlanLimitUnitIOPS DiskIOPSPlanLimitUnit = "iops"
)

type EmailAndPasswordAuthenticator

type EmailAndPasswordAuthenticator struct {
	Email    string
	Password string
}

EmailAndPasswordAuthenticator authenticate with specified email and password.

func (EmailAndPasswordAuthenticator) Authenticate

func (a EmailAndPasswordAuthenticator) Authenticate(c *Client) (Credentials, error)

Authenticate authenticates by email and password.

type FilterActivityLogs

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

FilterActivityLogs represent available filters for fetching list of Activity Logs.

func (*FilterActivityLogs) ByEvent

ByEvent filter Activity Logs by event type.

func (*FilterActivityLogs) ByUserID

func (f *FilterActivityLogs) ByUserID(id int) *FilterActivityLogs

ByUserID filter Activity Logs by specified User ID.

type FilterComputeResources

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

FilterComputeResources represent available filters for fetching list of compute resources.

func (*FilterComputeResources) ByName

ByName filter compute resources by specified name.

type FilterIPBlocks

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

FilterIPBlocks represent available filters for fetching list of ip blocks.

func (*FilterIPBlocks) ByName

func (f *FilterIPBlocks) ByName(name string) *FilterIPBlocks

ByName filter ip blocks by specified name.

type FilterIcons

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

FilterIcons represent available filters for fetching list of icons.

func (*FilterIcons) ByName

func (f *FilterIcons) ByName(name string) *FilterIcons

ByName filter icons by specified name.

func (*FilterIcons) ByType

func (f *FilterIcons) ByType(t IconType) *FilterIcons

ByType filter icons by specified type.

type FilterLocations

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

FilterLocations represent available filters for fetching list of Locations.

func (*FilterLocations) ByName

func (f *FilterLocations) ByName(name string) *FilterLocations

ByName filter Locations by specified name.

type FilterOsImages

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

FilterOsImages represent available filters for fetching list of os images.

func (*FilterOsImages) ByName

func (f *FilterOsImages) ByName(name string) *FilterOsImages

ByName filter os images by specified name.

type FilterPlans

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

FilterPlans represent available filters for fetching list of plans.

func (*FilterPlans) ByDiskSize

func (f *FilterPlans) ByDiskSize(v int) *FilterPlans

ByDiskSize filter plans by specified disk size.

func (*FilterPlans) ByImageFormat

func (f *FilterPlans) ByImageFormat(v ImageFormat) *FilterPlans

ByImageFormat filter plans by specified image format.

func (*FilterPlans) ByName

func (f *FilterPlans) ByName(name string) *FilterPlans

ByName filter plans by specified name.

func (*FilterPlans) ByStorageType

func (f *FilterPlans) ByStorageType(t StorageTypeName) *FilterPlans

ByStorageType filter plans by specified storage type.

type FilterProjects

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

FilterProjects represent available filters for fetching list of Projects.

func (*FilterProjects) ByName

func (f *FilterProjects) ByName(name string) *FilterProjects

ByName baseFilter Projects by specified name.

type FilterSSHKeys

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

FilterSSHKeys represent available filters for fetching list of SSH keys.

func (*FilterSSHKeys) ByName

func (f *FilterSSHKeys) ByName(name string) *FilterSSHKeys

ByName filter SSH keys by specified name.

type FilterTasks

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

FilterTasks represent available filters for fetching list of tasks.

func (*FilterTasks) ByAction

func (f *FilterTasks) ByAction(action string) *FilterTasks

ByAction filter Tasks by specified action.

func (*FilterTasks) ByComputeResourceID

func (f *FilterTasks) ByComputeResourceID(id int) *FilterTasks

ByComputeResourceID filter Tasks by specified Compute Resource ID.

func (*FilterTasks) ByComputeResourceVMID

func (f *FilterTasks) ByComputeResourceVMID(id int) *FilterTasks

ByComputeResourceVMID filter Tasks by specified Compute Resource VM ID.

func (*FilterTasks) ByStatus

func (f *FilterTasks) ByStatus(status string) *FilterTasks

ByStatus filter Tasks by specified status.

type FilterUsers

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

FilterUsers represent available filters for fetching list of users.

func (*FilterUsers) ByStatus

func (f *FilterUsers) ByStatus(status string) *FilterUsers

ByStatus filter Users by specified status.

type FilterVirtualServers

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

FilterVirtualServers represent available filters for fetching list of virtual servers.

func (*FilterVirtualServers) ByComputeResourceID

func (f *FilterVirtualServers) ByComputeResourceID(id int) *FilterVirtualServers

ByComputeResourceID filter virtual servers by specified Compute Resource ID.

func (*FilterVirtualServers) ByStatus

func (f *FilterVirtualServers) ByStatus(status string) *FilterVirtualServers

ByStatus filter virtual servers by specified status.

func (*FilterVirtualServers) ByUserID

ByUserID filter virtual servers by specified User ID.

func (*FilterVirtualServers) ByVirtualizationType

func (f *FilterVirtualServers) ByVirtualizationType(virtualizationType VirtualizationType) *FilterVirtualServers

ByVirtualizationType filter virtual servers by virtualization type.

type Firmware

type Firmware string

Firmware represents available firmware.

type HTTPError

type HTTPError struct {
	Method   string
	Path     string
	HTTPCode int                 `json:"http_code"`
	Message  string              `json:"message"`
	Errors   map[string][]string `json:"errors"`
}

HTTPError represents errors occurred when some action failed due to some problem with request.

func (HTTPError) Error

func (e HTTPError) Error() string

type IPBlock

type IPBlock struct {
	ID               int                `json:"id"`
	Name             string             `json:"name"`
	Type             IPVersion          `json:"type"`
	ListType         ListType           `json:"list_type"`
	Gateway          string             `json:"gateway"`
	Netmask          string             `json:"netmask"`
	Ns1              string             `json:"ns_1"`
	Ns2              string             `json:"ns_2"`
	From             string             `json:"from"`
	To               string             `json:"to"`
	Subnet           int                `json:"subnet"`
	Range            string             `json:"range"`
	ComputeResources []ComputeResource  `json:"compute_resources[]"`
	IPs              []IPBlockIPAddress `json:"ips[]"`
	ReverseDNS       IPBlockReverseDNS  `json:"reverse_dns"`
}

IPBlock represents an IP block.

type IPBlockIPAddress

type IPBlockIPAddress struct {
	ID      int     `json:"id"`
	IP      string  `json:"ip"`
	IPBlock IPBlock `json:"ip_block"`
}

IPBlockIPAddress represents an IP block's IP address.

type IPBlockRequest

type IPBlockRequest struct {
	ComputeResources []int             `json:"compute_resources,omitempty"`
	Name             string            `json:"name"`
	Type             IPVersion         `json:"type"`
	ListType         ListType          `json:"list_type"`
	Gateway          string            `json:"gateway"`
	Ns1              string            `json:"ns_1"`
	Ns2              string            `json:"ns_2"`
	ReverseDNS       IPBlockReverseDNS `json:"reverse_dns"`

	// IPv4 related fields
	Netmask string `json:"netmask,omitempty"`
	From    string `json:"from,omitempty"`
	To      string `json:"to,omitempty"`

	// IPv6 related fields
	Range  string `json:"range,omitempty"`
	Subnet int    `json:"subnet,omitempty"`
}

IPBlockRequest represents available properties for creating new or updating existing IP block.

type IPBlockReverseDNS

type IPBlockReverseDNS struct {
	Zone    string `json:"zone"`
	Enabled bool   `json:"enabled"`
}

IPBlockReverseDNS represents an IP block's reverse DNS settings.

type IPBlocksResponse

type IPBlocksResponse struct {
	Data []IPBlock `json:"data"`
	// contains filtered or unexported fields
}

IPBlocksResponse represents paginated list of IP blocks. This cursor can be used for iterating over all available IP blocks.

func (*IPBlocksResponse) Err

func (r *IPBlocksResponse) Err() error

Err return an error which is occurred during fetching next page data.

func (*IPBlocksResponse) Next

func (r *IPBlocksResponse) Next(ctx context.Context) bool

Next using for iterating through all data entities.

Examples:

	ctx, cancelFunc := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancelFunc()

 for {
		for _, datum := range resp.Data {
			doSmthWithDatum(datum)
		}

		if !resp.Next(ctx) {
			break
		}
	}

 if resp.Err() != nil {
		handleAnError(resp.Err())
	}

type IPBlocksService

type IPBlocksService service

IPBlocksService handles all available methods with IP blocks.

func (*IPBlocksService) Create

func (s *IPBlocksService) Create(ctx context.Context, data IPBlockRequest) (IPBlock, error)

Create creates new IP block.

func (*IPBlocksService) Delete

func (s *IPBlocksService) Delete(ctx context.Context, id int) error

Delete deletes specified IP block.

func (*IPBlocksService) Get

func (s *IPBlocksService) Get(ctx context.Context, id int) (IPBlock, error)

Get gets specified IP block.

func (*IPBlocksService) IPAddressCreate

func (s *IPBlocksService) IPAddressCreate(ctx context.Context, ipBlockID int) (IPBlockIPAddress, error)

IPAddressCreate creates a new IP address in the specified IP block.

func (*IPBlocksService) IPAddressDelete

func (s *IPBlocksService) IPAddressDelete(ctx context.Context, id int) error

IPAddressDelete deletes a provided IP address in the specified IP block.

func (*IPBlocksService) List

List lists IP blocks.

func (*IPBlocksService) Update

func (s *IPBlocksService) Update(ctx context.Context, id int, data IPBlockRequest) (IPBlock, error)

Update updates specified IP block.

type IPVersion

type IPVersion string

IPVersion represents available IP versions.

const (
	// IPv4 indicates IP v4 address.
	IPv4 IPVersion = "IPv4"

	// IPv6 indicates IP v6 address.
	IPv6 IPVersion = "IPv6"
)

type Icon

type Icon struct {
	ID   int      `json:"id"`
	Name string   `json:"name"`
	URL  string   `json:"url"`
	Type IconType `json:"type"`
}

Icon represents an icon.

type IconType

type IconType string

IconType represents available icon types.

const (
	// IconTypeOS indicated OS specific icon.
	// OSes like AlmaLinux, Ubuntu, and etc.
	IconTypeOS IconType = "os"

	// IconTypeApplication indicates application specific icon.
	// Applications likes Plesk, Nginx, and etc.
	IconTypeApplication IconType = "application"

	// IconTypeFlags indicates countries flags.
	IconTypeFlags IconType = "flags"
)

type IconsResponse

type IconsResponse struct {
	Data []Icon `json:"data"`
	// contains filtered or unexported fields
}

IconsResponse represents paginated list of icons. This cursor can be used for iterating over all available icons.

func (*IconsResponse) Err

func (r *IconsResponse) Err() error

Err return an error which is occurred during fetching next page data.

func (*IconsResponse) Next

func (r *IconsResponse) Next(ctx context.Context) bool

Next using for iterating through all data entities.

Examples:

	ctx, cancelFunc := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancelFunc()

 for {
		for _, datum := range resp.Data {
			doSmthWithDatum(datum)
		}

		if !resp.Next(ctx) {
			break
		}
	}

 if resp.Err() != nil {
		handleAnError(resp.Err())
	}

type IconsService

type IconsService service

IconsService handles all available methods with icons.

func (*IconsService) Get

func (s *IconsService) Get(ctx context.Context, id int) (Icon, error)

Get gets specified icon.

func (*IconsService) List

func (s *IconsService) List(ctx context.Context, filter *FilterIcons) (IconsResponse, error)

List lists icons.

type ImageFormat

type ImageFormat string

ImageFormat represents available image formats. Image formats is format of VM's disk.

const (
	// ImageFormatQCOW2 indicates QCOW2 disk image.
	ImageFormatQCOW2 ImageFormat = "qcow2"

	// ImageFormatRaw indicates RAW disk image.
	ImageFormatRaw ImageFormat = "raw"

	// ImageFormatPLOOP indicates PLOOP disk image.
	ImageFormatPLOOP ImageFormat = "ploop"
)

type License

type License struct {
	CPUCores       int    `json:"cpu_cores"`
	CPUCoresInUse  int    `json:"cpu_cores_in_use"`
	IsActive       bool   `json:"is_active"`
	Key            string `json:"key"`
	KeyType        string `json:"key_type"`
	Product        string `json:"product"`
	ExpirationDate string `json:"expiration_date"`
	UpdateDate     string `json:"update_date"`
}

License represent a license.

type LicenseActivateRequest

type LicenseActivateRequest struct {
	ActivationCode string `json:"activation_code"`
}

LicenseActivateRequest represents available properties for activating the license.

type LicenseService

type LicenseService service

LicenseService handles all available methods with license.

func (*LicenseService) Activate

Activate activates the license.

type LicenseType

type LicenseType string

LicenseType represents available compute resource license types.

const (
	// LicenseTypeStandard indicates Standard license type.
	LicenseTypeStandard LicenseType = "standard"

	// LicenseTypeMini indicates Mini license type.
	LicenseTypeMini LicenseType = "mini"

	// LicenseTypeMicro indicates Micro license type.
	LicenseTypeMicro LicenseType = "micro"
)

type LimitGroup

type LimitGroup struct {
	ID                    int             `json:"id"`
	Name                  string          `json:"name"`
	CreatedAt             string          `json:"created_at"`
	UpdatedAt             string          `json:"updated_at"`
	VirtualServers        LimitGroupLimit `json:"vms"`
	RunningVirtualServers LimitGroupLimit `json:"running_vms"`
	AdditionalIPs         LimitGroupLimit `json:"additional_ips"`
}

LimitGroup represent limit group.

type LimitGroupLimit

type LimitGroupLimit struct {
	Limit     int  `json:"limit"`
	IsEnabled bool `json:"is_enabled"`
}

LimitGroupLimit represent limit's group limit.

type ListType

type ListType string

ListType represents the type of list of IP addresses

const (
	// IpBlockListTypeRange indicates a range of IP addresses.
	IpBlockListTypeRange ListType = "range"

	// IpBlockListTypeSet indicates a set of IP addresses.
	IpBlockListTypeSet ListType = "set"
)

type Location

type Location struct {
	ID               int               `json:"id"`
	Name             string            `json:"name"`
	Icon             Icon              `json:"icon"`
	Description      string            `json:"description"`
	IsDefault        bool              `json:"is_default"`
	IsVisible        bool              `json:"is_visible"`
	ComputeResources []ComputeResource `json:"compute_resources"`
	AvailablePlans   []ShortPlan       `json:"available_plans"`
}

Location represents a location.

type LocationCreateRequest

type LocationCreateRequest struct {
	Name             string   `json:"name"`
	Description      string   `json:"description"`
	IconID           null.Int `json:"icon_id"`
	IsDefault        bool     `json:"is_default"`
	IsVisible        bool     `json:"is_visible"`
	ComputeResources []int    `json:"compute_resources,omitempty"`
	AvailablePlans   []int    `json:"available_plans,omitempty"`
}

LocationCreateRequest represents available properties for creating a new location.

type LocationPatchRequest

type LocationPatchRequest struct {
	IsDefault bool `json:"is_default"`
	IsVisible bool `json:"is_visible"`
}

LocationPatchRequest represents available properties for patching an existing location.

type LocationsResponse

type LocationsResponse struct {
	Data []Location `json:"data"`
	// contains filtered or unexported fields
}

LocationsResponse represents paginated list of locations. This cursor can be used for iterating over all available location.

func (*LocationsResponse) Err

func (r *LocationsResponse) Err() error

Err return an error which is occurred during fetching next page data.

func (*LocationsResponse) Next

func (r *LocationsResponse) Next(ctx context.Context) bool

Next using for iterating through all data entities.

Examples:

	ctx, cancelFunc := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancelFunc()

 for {
		for _, datum := range resp.Data {
			doSmthWithDatum(datum)
		}

		if !resp.Next(ctx) {
			break
		}
	}

 if resp.Err() != nil {
		handleAnError(resp.Err())
	}

type LocationsService

type LocationsService service

LocationsService handles all available methods with locations.

func (*LocationsService) Create

Create creates new location.

func (*LocationsService) Delete

func (s *LocationsService) Delete(ctx context.Context, id int) error

Delete deletes specified location.

func (*LocationsService) Get

func (s *LocationsService) Get(ctx context.Context, id int) (Location, error)

Get gets specified location.

func (*LocationsService) List

List lists locations.

func (*LocationsService) Patch

Patch specified location.

func (*LocationsService) Update

Update updates specified location.

type Logger

type Logger interface {
	Debugf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
}

Logger represents a logger for the client.

type LoginLink struct {
	Type    LoginLinkType `json:"type"`
	Content string        `json:"content"`
}

LoginLink represents an application login link.

type LoginLinkType

type LoginLinkType string

LoginLinkType a type of login link to the application.

const (
	// LoginLinkTypeNone indicates application without login link.
	LoginLinkTypeNone LoginLinkType = "none"

	// LoginLinkTypeURL indicates application with URL pattern login link.
	LoginLinkTypeURL LoginLinkType = "url"

	// LoginLinkTypeJSCode indicates application with custom JS code auth code.
	LoginLinkTypeJSCode LoginLinkType = "js_code"

	// LoginLinkTypeInfo indicates application with custom information in popup.
	LoginLinkTypeInfo LoginLinkType = "info"
)

type Netfilter

type Netfilter struct {
	Value      NetfilterStatus `json:"value"`
	IsEditable bool            `json:"is_editable"`
}

type NetfilterStatus

type NetfilterStatus string

NetfilterStatus represents available netfilter statuses.

const (
	NetfilterStatusDisabled  NetfilterStatus = "disabled"
	NetfilterStatusStateless NetfilterStatus = "stateless"
	NetfilterStatusStateful  NetfilterStatus = "stateful"
	NetfilterStatusFull      NetfilterStatus = "full"
)

type NullLogger

type NullLogger struct{}

NullLogger represents a logger which don't log anything. Useful when you don't want to see any logs from the client or in tests.

func (NullLogger) Debugf

func (NullLogger) Debugf(string, ...interface{})

Debugf logs message with debug level.

func (NullLogger) Errorf

func (NullLogger) Errorf(string, ...interface{})

Errorf logs message with error level.

type Offer

type Offer struct {
	ID                 int        `json:"id"`
	Name               string     `json:"name"`
	Description        string     `json:"description,omitempty"`
	Type               OfferType  `json:"type"`
	IsVisible          bool       `json:"is_visible"`
	AvailablePlans     []Plan     `json:"available_plans"`
	AvailableLocations []Location `json:"available_locations"`
}

type OfferType

type OfferType string
const (
	// OfferTypeAdditionalDisk is a constant for additional disk offer type.
	OfferTypeAdditionalDisk OfferType = "additional_disk"
)

type OsImage

type OsImage struct {
	ID        int              `json:"id"`
	Name      string           `json:"name"`
	Icon      Icon             `json:"icon"`
	Versions  []OsImageVersion `json:"versions,omitempty"`
	IsDefault bool             `json:"is_default,omitempty"`
	IsVisible bool             `json:"is_visible,omitempty"`
	Position  float32          `json:"position"`
}

OsImage represent an OS image.

type OsImageRequest

type OsImageRequest struct {
	Name      string   `json:"name"`
	IconID    null.Int `json:"icon_id"`
	IsVisible bool     `json:"is_visible"`
}

OsImageRequest represents available properties for creating a new OS image.

type OsImageVersion

type OsImageVersion struct {
	ID                 int                `json:"id"`
	VirtualizationType VirtualizationType `json:"virtualization_type"`
	Position           float64            `json:"position"`
	Version            string             `json:"version"`
	URL                string             `json:"url"`
	CloudInitVersion   CloudInitVersion   `json:"cloud_init_version,omitempty"`
	OsImageID          int                `json:"os_image_id"`
	IsVisible          bool               `json:"is_visible"`
	IsSSHKeysSupported bool               `json:"is_ssh_keys_supported"`
	AvailablePlans     []ShortPlan        `json:"available_plans"`
}

OsImageVersion represents an OS image version.

type OsImageVersionRequest

type OsImageVersionRequest struct {
	Position           float64            `json:"position,omitempty"`
	Version            string             `json:"version"`
	VirtualizationType VirtualizationType `json:"virtualization_type"`
	URL                string             `json:"url"`
	CloudInitVersion   CloudInitVersion   `json:"cloud_init_version,omitempty"`
	IsVisible          bool               `json:"is_visible"`
	AvailablePlans     []int              `json:"available_plans,omitempty"`
}

OsImageVersionRequest represents available properties for creating a new OS image version.

type OsImageVersionsService

type OsImageVersionsService service

OsImageVersionsService handles all available methods with OS image versions.

func (*OsImageVersionsService) Delete

func (s *OsImageVersionsService) Delete(ctx context.Context, id int) error

Delete deletes specified OS image version.

func (*OsImageVersionsService) Get

Get gets specified OS image version.

func (*OsImageVersionsService) Update

Update updates specified OS image version.

type OsImagesResponse

type OsImagesResponse struct {
	Data []OsImage `json:"data"`
	// contains filtered or unexported fields
}

OsImagesResponse represents paginated list of OS images. This cursor can be used for iterating over all available OS images.

func (*OsImagesResponse) Err

func (r *OsImagesResponse) Err() error

Err return an error which is occurred during fetching next page data.

func (*OsImagesResponse) Next

func (r *OsImagesResponse) Next(ctx context.Context) bool

Next using for iterating through all data entities.

Examples:

	ctx, cancelFunc := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancelFunc()

 for {
		for _, datum := range resp.Data {
			doSmthWithDatum(datum)
		}

		if !resp.Next(ctx) {
			break
		}
	}

 if resp.Err() != nil {
		handleAnError(resp.Err())
	}

type OsImagesService

type OsImagesService service

OsImagesService handles all available methods with OS image.

func (*OsImagesService) Create

func (s *OsImagesService) Create(ctx context.Context, data OsImageRequest) (OsImage, error)

Create creates specified OS image.

func (*OsImagesService) CreateVersion

func (s *OsImagesService) CreateVersion(
	ctx context.Context,
	osImageID int,
	data OsImageVersionRequest,
) (OsImageVersion, error)

CreateVersion creates a new version for the specified OS image.

func (*OsImagesService) Delete

func (s *OsImagesService) Delete(ctx context.Context, id int) error

Delete deletes specified OS image.

func (*OsImagesService) Get

func (s *OsImagesService) Get(ctx context.Context, id int) (OsImage, error)

Get gets specified OS image.

func (*OsImagesService) List

List lists OS images.

func (*OsImagesService) ListVersion

func (s *OsImagesService) ListVersion(ctx context.Context, osImageID int) ([]OsImageVersion, error)

ListVersion lists specified OS image versions.

func (*OsImagesService) Update

func (s *OsImagesService) Update(ctx context.Context, id int, data OsImageRequest) (OsImage, error)

Update updates specified OS image.

type PPP

type PPP struct {
	Value      bool `json:"value"`
	IsEditable bool `json:"is_editable"`
}

type Permission

type Permission struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

Permission represents a permission.

type PermissionResponse

type PermissionResponse struct {
	Data []Permission `json:"data"`
	// contains filtered or unexported fields
}

PermissionResponse represents paginated list of permissions. This cursor can be used for iterating over all available permissions.

func (*PermissionResponse) Err

func (r *PermissionResponse) Err() error

Err return an error which is occurred during fetching next page data.

func (*PermissionResponse) Next

func (r *PermissionResponse) Next(ctx context.Context) bool

Next using for iterating through all data entities.

Examples:

	ctx, cancelFunc := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancelFunc()

 for {
		for _, datum := range resp.Data {
			doSmthWithDatum(datum)
		}

		if !resp.Next(ctx) {
			break
		}
	}

 if resp.Err() != nil {
		handleAnError(resp.Err())
	}

type PermissionsService

type PermissionsService service

PermissionsService handles all available methods with permissions.

func (*PermissionsService) List

List lists permissions.

type Plan

type Plan struct {
	ID                       int                         `json:"id"`
	Name                     string                      `json:"name"`
	VirtualizationType       VirtualizationType          `json:"virtualization_type"`
	Params                   PlanParams                  `json:"params"`
	StorageType              string                      `json:"storage_type"`
	ImageFormat              string                      `json:"image_format"`
	IsDefault                bool                        `json:"is_default"`
	IsSnapshotAvailable      bool                        `json:"is_snapshot_available"`
	IsSnapshotsEnabled       bool                        `json:"is_snapshots_enabled"`
	IsBackupAvailable        bool                        `json:"is_backup_available"`
	IsAdditionalIPsAvailable bool                        `json:"is_additional_ips_available"`
	BackupSettings           PlanBackupSettings          `json:"backup_settings"`
	BackupPrice              float64                     `json:"backup_price"`
	IsVisible                bool                        `json:"is_visible"`
	Limits                   PlanLimits                  `json:"limits"`
	TokensPerHour            int                         `json:"tokens_per_hour"`
	TokensPerMonth           int                         `json:"tokens_per_month"`
	IPTokensPerHour          int                         `json:"ip_tokens_per_hour"`
	IPTokensPerMonth         int                         `json:"ip_tokens_per_month"`
	Position                 float64                     `json:"position"`
	Price                    PlanPrice                   `json:"price"`
	ResetLimitPolicy         PlanResetLimitPolicy        `json:"reset_limit_policy"`
	NetworkTotalTrafficType  PlanNetworkTotalTrafficType `json:"network_traffic_limit_type"`
	AvailableLocations       []ShortLocation             `json:"available_locations"`
	AvailableOsImageVersions []ShortOsImageVersion       `json:"available_os_image_versions"`
	AvailableApplications    []ShortOsImageVersion       `json:"available_applications"`
	Netfilter                Netfilter                   `json:"netfilter"`
	PPP                      PPP                         `json:"ppp"`
	TUNTAP                   TUNTAP                      `json:"tun_tap"`
}

Plan represents a plan.

type PlanBackupSettings

type PlanBackupSettings struct {
	IsIncrementalBackupEnabled bool `json:"is_incremental_backup_enabled"`
	IncrementalBackupsLimit    int  `json:"incremental_backups_limit"`
}

PlanBackupSettings represents a plan's backup settings.

type PlanCreateRequest

type PlanCreateRequest struct {
	Name                     string                      `json:"name"`
	VirtualizationType       VirtualizationType          `json:"virtualization_type"`
	Params                   PlanParams                  `json:"params"`
	StorageType              StorageTypeName             `json:"storage_type"`
	ImageFormat              ImageFormat                 `json:"image_format"`
	Limits                   PlanLimits                  `json:"limits"`
	TokensPerHour            int                         `json:"tokens_per_hour"`
	TokensPerMonth           int                         `json:"tokens_per_month"`
	IPTokensPerHour          int                         `json:"ip_tokens_per_hour"`
	IPTokensPerMonth         int                         `json:"ip_tokens_per_month"`
	IsVisible                bool                        `json:"is_visible"`
	IsDefault                bool                        `json:"is_default"`
	IsSnapshotsEnabled       bool                        `json:"is_snapshots_enabled"`
	IsBackupAvailable        bool                        `json:"is_backup_available"`
	IsAdditionalIPsAvailable bool                        `json:"is_additional_ips_available"`
	BackupSettings           PlanBackupSettings          `json:"backup_settings"`
	BackupPrice              float64                     `json:"backup_price"`
	ResetLimitPolicy         PlanResetLimitPolicy        `json:"reset_limit_policy"`
	NetworkTotalTrafficType  PlanNetworkTotalTrafficType `json:"network_traffic_limit_type"`
	AvailableLocations       []int                       `json:"available_locations,omitempty"`
	AvailableOsImageVersions []int                       `json:"available_os_image_versions,omitempty"`
	AvailableApplications    []int                       `json:"available_applications,omitempty"`
	Netfilter                Netfilter                   `json:"netfilter,omitempty"`
	PPP                      PPP                         `json:"ppp,omitempty"`
	TUNTAP                   TUNTAP                      `json:"tun_tap,omitempty"`
}

PlanCreateRequest represents available properties for creating a new plan.

type PlanLimitUnit

type PlanLimitUnit string

PlanLimitUnit represents available generic units.

const (
	// PlanLimitUnits indicates generic unit.
	PlanLimitUnits PlanLimitUnit = "units"
)

type PlanLimits

type PlanLimits struct {
	DiskBandwidth            DiskBandwidthPlanLimit `json:"disk_bandwidth"`
	DiskIOPS                 DiskIOPSPlanLimit      `json:"disk_iops"`
	NetworkIncomingBandwidth BandwidthPlanLimit     `json:"network_incoming_bandwidth"`
	NetworkOutgoingBandwidth BandwidthPlanLimit     `json:"network_outgoing_bandwidth"`
	NetworkIncomingTraffic   TrafficPlanLimit       `json:"network_incoming_traffic"`
	NetworkOutgoingTraffic   TrafficPlanLimit       `json:"network_outgoing_traffic"`
	NetworkTotalTraffic      TrafficPlanLimit       `json:"network_total_traffic"`
	NetworkReduceBandwidth   BandwidthPlanLimit     `json:"network_reduce_bandwidth"`
	BackupsNumber            UnitPlanLimit          `json:"backups_number"`
}

PlanLimits represents all available limits for creating a new plan.

type PlanNetworkTotalTrafficType

type PlanNetworkTotalTrafficType string

PlanNetworkTotalTrafficType represent available total traffic types.

const (
	// PlanNetworkTotalTrafficTypeSeparate indicates we should count incoming and
	// outgoing traffic separately.
	PlanNetworkTotalTrafficTypeSeparate PlanNetworkTotalTrafficType = "separate"

	// PlanNetworkTotalTrafficTypeTotal indicates we should count incoming and
	// outgoing traffic together.
	PlanNetworkTotalTrafficTypeTotal PlanNetworkTotalTrafficType = "total"
)

type PlanParams

type PlanParams struct {
	Disk       int `json:"disk"`
	RAM        int `json:"ram"`
	VCPU       int `json:"vcpu"`
	VCPUUnits  int `json:"vcpu_units"`
	VCPULimit  int `json:"vcpu_limit"`
	IOPriority int `json:"io_priority"`
	Swap       int `json:"swap"`
}

PlanParams represents a plan's parameters.

type PlanPrice

type PlanPrice struct {
	AdditionalIPsPerHour     string        `json:"additional_ips_per_hour"`
	AdditionalIPsPerMonth    string        `json:"additional_ips_per_month"`
	PerHour                  string        `json:"per_hour"`
	PerMonth                 string        `json:"per_month"`
	CurrencyCode             string        `json:"currency_code"`
	TaxesInclusive           bool          `json:"taxes_inclusive"`
	Taxes                    []interface{} `json:"taxes"`
	TotalPriceWithoutBackups string        `json:"total_price_without_backups"`
	TotalPrice               string        `json:"total_price"`
	BackupPrice              string        `json:"backup_price"`
}

PlanPrice represents plan price information.

type PlanResetLimitPolicy

type PlanResetLimitPolicy string

PlanResetLimitPolicy represent available a limit reset policies.

const (
	// PlanResetLimitPolicyNever indicates we shouldn't reset a limit at all.
	PlanResetLimitPolicyNever PlanResetLimitPolicy = "never"

	// PlanResetLimitPolicyFirstDayOfMonth indicates we should reset a limit at the
	// first day of month.
	PlanResetLimitPolicyFirstDayOfMonth PlanResetLimitPolicy = "first_day_of_month"

	// PlanResetLimitPolicyVMCreatedDay indicates we should reset a limit at the VM's
	// created day.
	PlanResetLimitPolicyVMCreatedDay PlanResetLimitPolicy = "vm_created_day"
)

type PlanUpdateLimits

type PlanUpdateLimits struct {
	NetworkIncomingBandwidth BandwidthPlanLimit `json:"network_incoming_bandwidth"`
	NetworkOutgoingBandwidth BandwidthPlanLimit `json:"network_outgoing_bandwidth"`
	NetworkIncomingTraffic   TrafficPlanLimit   `json:"network_incoming_traffic"`
	NetworkOutgoingTraffic   TrafficPlanLimit   `json:"network_outgoing_traffic"`
	NetworkTotalTraffic      TrafficPlanLimit   `json:"network_total_traffic"`
	NetworkReduceBandwidth   BandwidthPlanLimit `json:"network_reduce_bandwidth"`
	BackupsNumber            UnitPlanLimit      `json:"backups_number"`
}

PlanUpdateLimits represents all available limits for updating a plan.

type PlanUpdateRequest

type PlanUpdateRequest struct {
	Name                     string                      `json:"name"`
	Limits                   PlanUpdateLimits            `json:"limits"`
	TokensPerHour            int                         `json:"tokens_per_hour"`
	TokensPerMonth           int                         `json:"tokens_per_month"`
	IPTokensPerHour          int                         `json:"ip_tokens_per_hour"`
	IPTokensPerMonth         int                         `json:"ip_tokens_per_month"`
	IsVisible                bool                        `json:"is_visible"`
	IsDefault                bool                        `json:"is_default"`
	IsSnapshotsEnabled       bool                        `json:"is_snapshots_enabled"`
	IsBackupAvailable        bool                        `json:"is_backup_available"`
	IsAdditionalIPsAvailable bool                        `json:"is_additional_ips_available"`
	BackupSettings           PlanBackupSettings          `json:"backup_settings"`
	BackupPrice              float64                     `json:"backup_price"`
	ResetLimitPolicy         PlanResetLimitPolicy        `json:"reset_limit_policy"`
	NetworkTotalTrafficType  PlanNetworkTotalTrafficType `json:"network_traffic_limit_type"`
	AvailableLocations       []int                       `json:"available_locations,omitempty"`
	AvailableOsImageVersions []int                       `json:"available_os_image_versions,omitempty"`
	AvailableApplications    []int                       `json:"available_applications,omitempty"`
	Netfilter                Netfilter                   `json:"netfilter,omitempty"`
	PPP                      PPP                         `json:"ppp,omitempty"`
	TUNTAP                   TUNTAP                      `json:"tun_tap,omitempty"`
}

PlanUpdateRequest represents available properties for updating an existing plan.

type PlansResponse

type PlansResponse struct {
	Data []Plan `json:"data"`
	// contains filtered or unexported fields
}

PlansResponse represents paginated list of plans. This cursor can be used for iterating over all available plans.

func (*PlansResponse) Err

func (r *PlansResponse) Err() error

Err return an error which is occurred during fetching next page data.

func (*PlansResponse) Next

func (r *PlansResponse) Next(ctx context.Context) bool

Next using for iterating through all data entities.

Examples:

	ctx, cancelFunc := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancelFunc()

 for {
		for _, datum := range resp.Data {
			doSmthWithDatum(datum)
		}

		if !resp.Next(ctx) {
			break
		}
	}

 if resp.Err() != nil {
		handleAnError(resp.Err())
	}

type PlansService

type PlansService service

PlansService handles all available methods with plans.

func (*PlansService) Create

func (s *PlansService) Create(ctx context.Context, data PlanCreateRequest) (Plan, error)

Create creates new plan.

func (*PlansService) Delete

func (s *PlansService) Delete(ctx context.Context, id int) error

Delete deletes specified plan.

func (*PlansService) Get

func (s *PlansService) Get(ctx context.Context, id int) (Plan, error)

Get gets specified plan.

func (*PlansService) List

func (s *PlansService) List(ctx context.Context, filter *FilterPlans) (PlansResponse, error)

List lists plans.

func (*PlansService) Update

func (s *PlansService) Update(ctx context.Context, id int, data PlanUpdateRequest) (Plan, error)

Update updates specified plan.

type Project

type Project struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Members     int    `json:"members"`
	IsOwner     bool   `json:"is_owner"`
	IsDefault   bool   `json:"is_default"`
	Owner       User   `json:"owner"`
	Servers     int    `json:"servers"`
}

Project represents a project.

type ProjectRequest

type ProjectRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

ProjectRequest represents available properties for creating or updating a project.

type ProjectServersCreateRequest

type ProjectServersCreateRequest struct {
	Name             string                       `json:"name"`
	PlanID           int                          `json:"plan_id"`
	LocationID       int                          `json:"location_id"`
	OsImageVersionID int                          `json:"os_image_version_id,omitempty"`
	ApplicationID    int                          `json:"application_id,omitempty"`
	ApplicationData  string                       `json:"application_data,omitempty"`
	SSHKeys          []int                        `json:"ssh_keys,omitempty"`
	UserData         string                       `json:"user_data,omitempty"`
	FQDNs            []string                     `json:"fqdns,omitempty"`
	BackupSettings   *VirtualServerBackupSettings `json:"backup_settings,omitempty"`
}

ProjectServersCreateRequest represents available properties for creating a new server on a project.

type ProjectServersResponse

type ProjectServersResponse struct {
	Data []VirtualServer `json:"data"`
	// contains filtered or unexported fields
}

ProjectServersResponse represents paginated list of project's servers. This cursor can be used for iterating over all available project's servers.

func (*ProjectServersResponse) Err

func (r *ProjectServersResponse) Err() error

Err return an error which is occurred during fetching next page data.

func (*ProjectServersResponse) Next

Next using for iterating through all data entities.

Examples:

	ctx, cancelFunc := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancelFunc()

 for {
		for _, datum := range resp.Data {
			doSmthWithDatum(datum)
		}

		if !resp.Next(ctx) {
			break
		}
	}

 if resp.Err() != nil {
		handleAnError(resp.Err())
	}

type ProjectsResponse

type ProjectsResponse struct {
	Data []Project `json:"data"`
	// contains filtered or unexported fields
}

ProjectsResponse represents paginated list of projects. This cursor can be used for iterating over all available projects.

func (*ProjectsResponse) Err

func (r *ProjectsResponse) Err() error

Err return an error which is occurred during fetching next page data.

func (*ProjectsResponse) Next

func (r *ProjectsResponse) Next(ctx context.Context) bool

Next using for iterating through all data entities.

Examples:

	ctx, cancelFunc := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancelFunc()

 for {
		for _, datum := range resp.Data {
			doSmthWithDatum(datum)
		}

		if !resp.Next(ctx) {
			break
		}
	}

 if resp.Err() != nil {
		handleAnError(resp.Err())
	}

type ProjectsService

type ProjectsService service

ProjectsService handles all available methods with projects.

func (*ProjectsService) Create

func (s *ProjectsService) Create(ctx context.Context, data ProjectRequest) (Project, error)

Create creates new project.

func (*ProjectsService) Delete

func (s *ProjectsService) Delete(ctx context.Context, id int) error

Delete deletes specified project.

func (*ProjectsService) Get

func (s *ProjectsService) Get(ctx context.Context, id int) (Project, error)

Get gets specified project.

func (*ProjectsService) List

List lists projects.

func (*ProjectsService) Servers

Servers lists all servers on the specified project.

func (*ProjectsService) ServersCreate

func (s *ProjectsService) ServersCreate(
	ctx context.Context,
	projectID int,
	data ProjectServersCreateRequest,
) (VirtualServer, error)

ServersCreate creates a server on the specified project.

func (*ProjectsService) ServersListAll

func (s *ProjectsService) ServersListAll(ctx context.Context, id int) ([]VirtualServer, error)

ServersListAll lists all servers on the specified project. Deprecated: use Servers instead.

func (*ProjectsService) Update

func (s *ProjectsService) Update(ctx context.Context, id int, data ProjectRequest) (Project, error)

Update updates specified project.

type ResponseLinks struct {
	First string `json:"first"`
	Last  string `json:"last"`
	Prev  string `json:"prev"`
	Next  string `json:"next"`
}

ResponseLinks represent useful links which is returned with paginated response.

type ResponseMeta

type ResponseMeta struct {
	CurrentPage int    `json:"current_page"`
	From        int    `json:"from"`
	LastPage    int    `json:"last_page"`
	Path        string `json:"path"`
	PerPage     int    `json:"per_page"`
	To          int    `json:"to"`
	Total       int    `json:"total"`
}

ResponseMeta represent response metadata which is returned with paginated response.

type Role

type Role struct {
	ID         int    `json:"id"`
	Name       string `json:"name"`
	IsDefault  bool   `json:"is_default"`
	UsersCount int    `json:"users_count"`
}

Role represents a role.

type RoleCreateRequest

type RoleCreateRequest struct {
	Name        string `json:"name"`
	Permissions []int  `json:"permissions,omitempty"`
}

RoleCreateRequest represents available properties for creating a new role.

type RolesResponse

type RolesResponse struct {
	Data []Role `json:"data"`
	// contains filtered or unexported fields
}

RolesResponse represents paginated list of roles. This cursor can be used for iterating over all available roles.

func (*RolesResponse) Err

func (r *RolesResponse) Err() error

Err return an error which is occurred during fetching next page data.

func (*RolesResponse) Next

func (r *RolesResponse) Next(ctx context.Context) bool

Next using for iterating through all data entities.

Examples:

	ctx, cancelFunc := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancelFunc()

 for {
		for _, datum := range resp.Data {
			doSmthWithDatum(datum)
		}

		if !resp.Next(ctx) {
			break
		}
	}

 if resp.Err() != nil {
		handleAnError(resp.Err())
	}

type RolesService

type RolesService service

RolesService handles all available methods with roles.

func (*RolesService) Create

func (s *RolesService) Create(ctx context.Context, data RoleCreateRequest) (Role, error)

Create creates new role.

func (*RolesService) Get

func (s *RolesService) Get(ctx context.Context, id int) (Role, error)

Get gets specified role.

func (*RolesService) GetByName

func (s *RolesService) GetByName(ctx context.Context, name string) (Role, error)

GetByName gets specified role by name.

func (*RolesService) List

List lists roles.

type SSHKey

type SSHKey struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
	Body string `json:"body"`
}

SSHKey represents a SSH key.

type SSHKeyCreateRequest

type SSHKeyCreateRequest struct {
	Name   string `json:"name"`
	Body   string `json:"body"`
	UserID int    `json:"user_id"`
}

SSHKeyCreateRequest represents available properties for creating a new SSH key.

type SSHKeysResponse

type SSHKeysResponse struct {
	Data []SSHKey `json:"data"`
	// contains filtered or unexported fields
}

SSHKeysResponse represents paginated list of SSH keys. This cursor can be used for iterating over all available SSH keys.

func (*SSHKeysResponse) Err

func (r *SSHKeysResponse) Err() error

Err return an error which is occurred during fetching next page data.

func (*SSHKeysResponse) Next

func (r *SSHKeysResponse) Next(ctx context.Context) bool

Next using for iterating through all data entities.

Examples:

	ctx, cancelFunc := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancelFunc()

 for {
		for _, datum := range resp.Data {
			doSmthWithDatum(datum)
		}

		if !resp.Next(ctx) {
			break
		}
	}

 if resp.Err() != nil {
		handleAnError(resp.Err())
	}

type SSHKeysService

type SSHKeysService service

SSHKeysService handles all available methods with SSH keys.

func (*SSHKeysService) Create

Create creates new SSH key.

func (*SSHKeysService) Delete

func (s *SSHKeysService) Delete(ctx context.Context, id int) error

Delete deletes specified SSH key.

func (*SSHKeysService) Get

func (s *SSHKeysService) Get(ctx context.Context, id int) (SSHKey, error)

Get gets specified SSH key.

func (*SSHKeysService) List

List lists SSH keys.

type ServersMigration

type ServersMigration struct {
	ID                         int             `json:"id"`
	DestinationComputeResource ComputeResource `json:"destination_compute_resource"`
	Task                       Task            `json:"task"`
	Children                   []Task          `json:"children"`
}

ServersMigration represents a server's migration.

type ServersMigrationRequest

type ServersMigrationRequest struct {
	IsLive                       bool  `json:"is_live"`
	PreserveIPs                  bool  `json:"preserve_ips"`
	DestinationComputeResourceID int   `json:"destination_compute_resource_id"`
	Servers                      []int `json:"servers"`
}

ServersMigrationRequest represents available properties for creating a new server's migration.

type ServersMigrationsService

type ServersMigrationsService service

ServersMigrationsService handles all available methods with server's migrations.

func (*ServersMigrationsService) Create

Create creates new server's migration.

type Settings

type Settings struct {
	Hostname              string                        `json:"hostname"`
	Mail                  SettingsMail                  `json:"mail"`
	SendStatistics        bool                          `json:"send_statistics"`
	LimitGroup            LimitGroup                    `json:"limit_group"`
	Registration          SettingsRegistration          `json:"registration"`
	Theme                 SettingsTheme                 `json:"theme"`
	NetworkRules          SettingsNetworkRules          `json:"network_rules"`
	Notifications         SettingsNotifications         `json:"notifications"`
	ComputeResource       SettingsComputeResource       `json:"compute_resource"`
	NonExistentVMSRemover SettingsNonExistentVMSRemover `json:"non_existent_vms_remover"`
	BillingIntegration    SettingsBillingIntegration    `json:"billing_integration"`
	DNS                   SettingsDNS                   `json:"dns"`
	Update                SettingsUpdate                `json:"update"`
	Features              SettingsFeatures              `json:"features"`
}

Settings represents application settings.

type SettingsBillingIntegration

type SettingsBillingIntegration struct {
	Type    string                            `json:"type,omitempty"`
	Drivers SettingsBillingIntegrationDrivers `json:"drivers,omitempty"`
}

SettingsBillingIntegration represents settings for billing.

type SettingsBillingIntegrationDrivers

type SettingsBillingIntegrationDrivers struct {
	WHMCS SettingsBillingIntegrationDriversWHMCS `json:"whmcs,omitempty"`
}

SettingsBillingIntegrationDrivers represents billing drivers.

type SettingsBillingIntegrationDriversWHMCS

type SettingsBillingIntegrationDriversWHMCS struct {
	URL   string `json:"url,omitempty"`
	Token string `json:"token,omitempty"`
}

SettingsBillingIntegrationDriversWHMCS represents WHMCS driver.

type SettingsComputeResource

type SettingsComputeResource struct {
	RescueISOURL    string `json:"rescue_iso_url,omitempty"`
	BalanceStrategy string `json:"balance_strategy,omitempty"`
}

SettingsComputeResource represents compute resource settings.

type SettingsDNS

type SettingsDNS struct {
	Type                       string             `json:"type,omitempty"`
	ServerHostnameTemplate     string             `json:"server_hostname_template,omitempty"`
	RegisterFQDNOnServerCreate bool               `json:"register_fqdn_on_server_create,omitempty"`
	ReverseDNSDomainTemplate   string             `json:"reverse_dns_domain_template,omitempty"`
	Drivers                    SettingsDNSDrivers `json:"drivers,omitempty"`
}

SettingsDNS represents DNS settings.

type SettingsDNSDrivers

type SettingsDNSDrivers struct {
	PowerDNS SettingsDNSDriversPowerDNS `json:"power_dns,omitempty"`
}

SettingsDNSDrivers represents DNS drivers.

type SettingsDNSDriversPowerDNS

type SettingsDNSDriversPowerDNS struct {
	Host   string `json:"host,omitempty"`
	APIKey string `json:"api_key,omitempty"`
}

SettingsDNSDriversPowerDNS represents PowerDNS driver.

type SettingsFeatures

type SettingsFeatures struct {
	HidePlanName             bool `json:"hide_plan_name"`
	HideUserData             bool `json:"hide_user_data"`
	HidePlanSection          bool `json:"hide_plan_section"`
	HideLocationSection      bool `json:"hide_location_section"`
	AllowRegistration        bool `json:"allow_registration"`
	AllowPasswordRecovery    bool `json:"allow_password_recovery"`
	HideApiDocumentationLink bool `json:"hide_api_documentation_link"`
}

SettingsFeatures represents application features settings.

type SettingsMail

type SettingsMail struct {
	Host string `json:"host,omitempty"`
	// Port       string `json:"port,omitempty"` todo uncomment after fix SIO-3682.
	Username   string `json:"username,omitempty"`
	Password   string `json:"password,omitempty"`
	FromEmail  string `json:"from_email,omitempty"`
	FromName   string `json:"from_name,omitempty"`
	Encryption bool   `json:"encryption,omitempty"`
}

SettingsMail represents mail settings.

type SettingsNetworkRules

type SettingsNetworkRules struct {
	ARP       bool `json:"arp,omitempty"`
	DHCP      bool `json:"dhcp,omitempty"`
	CloudInit bool `json:"cloud_init,omitempty"`
	SMTP      bool `json:"smtp,omitempty"`
	ICMP      bool `json:"icmp,omitempty"`
	ICMPReply bool `json:"icmp_reply"`
}

SettingsNetworkRules represents network rules settings.

type SettingsNonExistentVMSRemover

type SettingsNonExistentVMSRemover struct {
	Enabled  bool `json:"enabled,omitempty"`
	Interval int  `json:"interval,omitempty"`
}

SettingsNonExistentVMSRemover represents settings for virtual server remover.

type SettingsNotifications

type SettingsNotifications struct {
	ServerCreate                  SettingsNotificationsTemplate `json:"server_create,omitempty"`
	ServerResetPassword           SettingsNotificationsTemplate `json:"server_reset_password,omitempty"`
	UserResetPassword             SettingsNotificationsTemplate `json:"user_reset_password,omitempty"`
	UserVerifyEmail               SettingsNotificationsTemplate `json:"user_verify_email,omitempty"`
	ProjectUserInvite             SettingsNotificationsTemplate `json:"project_user_invite,omitempty"`
	ProjectUserLeft               SettingsNotificationsTemplate `json:"project_user_left,omitempty"`
	ServerIncomingTrafficExceeded SettingsNotificationsTemplate `json:"server_incoming_traffic_exceeded,omitempty"`
	ServerOutgoingTrafficExceeded SettingsNotificationsTemplate `json:"server_outgoing_traffic_exceeded,omitempty"`
}

SettingsNotifications represents notification settings.

type SettingsNotificationsTemplate

type SettingsNotificationsTemplate struct {
	Enabled          bool              `json:"enabled,omitempty"`
	SubjectTemplates map[string]string `json:"subject_templates,omitempty"`
	BodyTemplated    map[string]string `json:"body_templated,omitempty"`
}

SettingsNotificationsTemplate represents notification template.

type SettingsRegistration

type SettingsRegistration struct {
	Role string `json:"role,omitempty"`
}

SettingsRegistration represents registration settings.

type SettingsService

type SettingsService service

SettingsService handles all available methods with settings.

func (*SettingsService) Get

func (s *SettingsService) Get(ctx context.Context) (Settings, error)

Get gets settings.

func (*SettingsService) Patch

Patch patches settings.

type SettingsTheme

type SettingsTheme struct {
	PrimaryColor          string `json:"primary_color,omitempty"`
	SecondaryColor        string `json:"secondary_color,omitempty"`
	BrandName             string `json:"brand_name,omitempty"`
	Favicon               string `json:"favicon,omitempty"`
	TermsAndConditionsURL string `json:"terms_and_conditions_url,omitempty"`
}

SettingsTheme represents application theme setting.

type SettingsUpdate

type SettingsUpdate struct {
	Method        string `json:"method,omitempty"`
	Channel       string `json:"channel,omitempty"`
	ScheduledDays []int  `json:"scheduled_days,omitempty"`
	ScheduledTime string `json:"scheduled_time,omitempty"`
}

SettingsUpdate represents application update settings.

type SettingsUpdateRequest

type SettingsUpdateRequest struct {
	Hostname              *string                        `json:"hostname,omitempty"`
	Mail                  *SettingsMail                  `json:"mail,omitempty"`
	SendStatistics        *bool                          `json:"send_statistics,omitempty"`
	LimitGroup            *LimitGroup                    `json:"limit_group,omitempty"`
	Registration          *SettingsRegistration          `json:"registration,omitempty"`
	Theme                 *SettingsTheme                 `json:"theme,omitempty"`
	NetworkRules          *SettingsNetworkRules          `json:"network_rules,omitempty"`
	Notifications         *SettingsNotifications         `json:"notifications,omitempty"`
	ComputeResource       *SettingsComputeResource       `json:"compute_resource,omitempty"`
	NonExistentVMSRemover *SettingsNonExistentVMSRemover `json:"non_existent_vms_remover,omitempty"`
	BillingIntegration    *SettingsBillingIntegration    `json:"billing_integration,omitempty"`
	DNS                   *SettingsDNS                   `json:"dns,omitempty"`
	Update                *SettingsUpdate                `json:"update,omitempty"`
	Features              *SettingsFeatures              `json:"features,omitempty"`
}

SettingsUpdateRequest represents available properties for updating settings.

type SetupNetworkRequest

type SetupNetworkRequest struct {
	ID   string                             `json:"id"`
	Type ComputeResourceSettingsNetworkType `json:"type"`
}

SetupNetworkRequest represents available properties for setting up network for the compute resource.

type ShortApplication

type ShortApplication struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

ShortApplication represents only ID and name of application.

type ShortLocation

type ShortLocation struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

ShortLocation represents only ID and name of location.

type ShortOsImageVersion

type ShortOsImageVersion struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

ShortOsImageVersion represents only ID and name of OS image version.

type ShortPlan

type ShortPlan struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

ShortPlan represents only ID and name of plan.

type Snapshot

type Snapshot struct {
	ID   int    `json:"id"`
	Name string `json:"name"`

	// Size a size of snapshot in GiB.
	Size      float64        `json:"size"`
	Status    SnapshotStatus `json:"status"`
	CreatedAt string         `json:"created_at"`
}

Snapshot represents a snapshot.

type SnapshotRequest

type SnapshotRequest struct {
	Name string `json:"name"`
}

SnapshotRequest represents available properties for creating a new snapshot.

type SnapshotStatus

type SnapshotStatus string

SnapshotStatus represents available snapshot statuses.

const (
	// SnapshotStatusAvailable indicates snapshot is available for reverting.
	SnapshotStatusAvailable SnapshotStatus = "available"

	// SnapshotStatusProcessing indicates snapshot still creating.
	SnapshotStatusProcessing SnapshotStatus = "processing"

	// SnapshotStatusFailed indicates snapshot is failed.
	SnapshotStatusFailed SnapshotStatus = "failed"
)

type SnapshotsService

type SnapshotsService service

SnapshotsService handles all available methods with storages.

func (*SnapshotsService) Delete

func (s *SnapshotsService) Delete(ctx context.Context, id int) (Task, error)

Delete deletes specified snapshot.

func (*SnapshotsService) Get

func (s *SnapshotsService) Get(ctx context.Context, id int) (Snapshot, error)

Get gets specified snapshot.

func (*SnapshotsService) Revert

func (s *SnapshotsService) Revert(ctx context.Context, id int) (Task, error)

Revert reverts VM from specified snapshot.

type Storage

type Storage struct {
	ID                      int                    `json:"id"`
	Name                    string                 `json:"name"`
	Type                    StorageType            `json:"type"`
	Path                    string                 `json:"path"`
	Mount                   string                 `json:"mount"`
	ThinPool                string                 `json:"thin_pool"`
	IsAvailableForBalancing bool                   `json:"is_available_for_balancing"`
	ServersCount            int                    `json:"servers_count"`
	ComputeResourcesCount   int                    `json:"compute_resources_count"`
	FreeSpace               float64                `json:"free_space"`
	Credentials             map[string]interface{} `json:"credentials"`
}

Storage represents a storage.

type StorageService

type StorageService service

SnapshotsService handles all available methods with snapshots.

func (*StorageService) Delete

func (s *StorageService) Delete(ctx context.Context, id int) error

Delete deletes specified storage.

func (*StorageService) Get

func (s *StorageService) Get(ctx context.Context, id int) (Storage, error)

Get gets specified storage.

type StorageType

type StorageType struct {
	ID      int             `json:"id"`
	Name    StorageTypeName `json:"name"`
	Formats []ImageFormat   `json:"formats"`
}

StorageType represents a storage type.

type StorageTypeName

type StorageTypeName string

StorageTypeName represents available storage types.

const (
	// StorageTypeNameFB indicates File Based storage.
	StorageTypeNameFB StorageTypeName = "fb"

	// StorageTypeNameLVM indicates LVM storage.
	StorageTypeNameLVM StorageTypeName = "lvm"

	// StorageTypeNameThinLVM indicates ThinLVM storage.
	StorageTypeNameThinLVM StorageTypeName = "thinlvm"

	// StorageTypeNameNFS indicates NFS storage.
	StorageTypeNameNFS StorageTypeName = "nfs"

	// StorageTypeNameVZ indicates VZ storage.
	StorageTypeNameVZ StorageTypeName = "vz"
)

type StorageTypesService

type StorageTypesService service

StorageTypesService handles all available methods with storage types.

func (*StorageTypesService) List

List lists storage types.

type TUNTAP

type TUNTAP struct {
	Value      bool `json:"value"`
	IsEditable bool `json:"is_editable"`
}

type Task

type Task struct {
	ID                int        `json:"id"`
	ComputeResourceID int        `json:"compute_resource_id"`
	Queue             string     `json:"queue"`
	Action            TaskAction `json:"action"`
	Status            TaskStatus `json:"status"`
	Output            string     `json:"output"`
	Progress          int        `json:"progress"`
	Duration          int        `json:"duration"`
}

Task represents a task.

func (Task) IsFinished

func (t Task) IsFinished() bool

IsFinished returns true if the task is finished, successfully or not.

type TaskAction

type TaskAction string

TaskAction represents available task actions.

const (
	// TaskActionServerCreate indicates server create task.
	TaskActionServerCreate TaskAction = "vm-create"

	// TaskActionServerReinstall indicates server reinstall task.
	TaskActionServerReinstall TaskAction = "vm-reinstall"

	// TaskActionServerDelete indicates server delete task.
	TaskActionServerDelete TaskAction = "vm-delete"

	// TaskActionServerUpdate indicates server update task.
	TaskActionServerUpdate TaskAction = "vm-update"

	// TaskActionServerPasswordChange indicates server password change task.
	TaskActionServerPasswordChange TaskAction = "vm-password-change"

	// TaskActionServerStart indicates server create task.
	TaskActionServerStart TaskAction = "vm-start"

	// TaskActionServerStop indicates server stop task.
	TaskActionServerStop TaskAction = "vm-stop"

	// TaskActionServerRestart indicates server restart task.
	TaskActionServerRestart TaskAction = "vm-restart"

	// TaskActionServerSuspend indicates server suspend task.
	TaskActionServerSuspend TaskAction = "vm-suspend"

	// TaskActionServerResume indicates server resume task.
	TaskActionServerResume TaskAction = "vm-resume"

	// TaskActionServerResize indicates server resize task.
	TaskActionServerResize TaskAction = "vm-resize"

	// TaskActionServersMigrate indicates servers migrate task.
	// This is the main task which is a group of TaskActionServerMigrate tasks.
	TaskActionServersMigrate TaskAction = "vms-migrate"

	// TaskActionServerMigrate indicates server migrate task.
	TaskActionServerMigrate TaskAction = "vm-migrate"

	// TaskActionServerUpdateNetwork indicates server update network task.
	TaskActionServerUpdateNetwork TaskAction = "vm-update-network"

	// TaskActionServerUpdateLimits indicates server update limits task.
	TaskActionServerUpdateLimits TaskAction = "vm-update-limits"

	// TaskActionServersUpdateLimits indicates servers update limits task.
	// Task for batch limits updates.
	TaskActionServersUpdateLimits TaskAction = "vms-update-limits"

	// TaskActionDNSRecordRegister indicates DNS record register task.
	TaskActionDNSRecordRegister TaskAction = "dns-record-register"

	// TaskActionDNSRecordsUnregister indicates DNS record unregister task.
	TaskActionDNSRecordsUnregister TaskAction = "dns-records-unregister"

	// TaskActionDNSRecordsUpdate indicates DNS record update task.
	TaskActionDNSRecordsUpdate TaskAction = "dns-record-update"

	// TaskActionReverseDNSRecordRegister indicates reverse DNS record register
	// task.
	TaskActionReverseDNSRecordRegister TaskAction = "reverse-dns-record-register"

	// TaskActionSnapshotCreate indicates snapshot create task.
	TaskActionSnapshotCreate TaskAction = "snapshot-create"

	// TaskActionSnapshotDelete indicates snapshot delete task.
	TaskActionSnapshotDelete TaskAction = "snapshot-delete"

	// TaskActionSnapshotRevert indicates snapshot revert task.
	TaskActionSnapshotRevert TaskAction = "snapshot-revert"

	// TaskActionPrepareInstallerForUpdate indicates prepare installer before update
	// task.
	TaskActionPrepareInstallerForUpdate TaskAction = "prepare installer for version update"

	// TaskActionRunVersionUpdate indicates application update task.
	TaskActionRunVersionUpdate TaskAction = "run version update"

	// TaskActionBackupCreate indicates backup create task.
	TaskActionBackupCreate TaskAction = "backup-create"

	// TaskActionBackupRestore indicates restore from backup task.
	TaskActionBackupRestore TaskAction = "backup-restore"

	// TaskActionBackupDelete indicates backup delete task.
	TaskActionBackupDelete TaskAction = "backup-delete"

	// TaskActionBackupRotate indicates backups rotate task.
	TaskActionBackupRotate TaskAction = "backup-rotate"

	// TaskActionPurgeComputeResourceVM indicates purging server backups task.
	TaskActionPurgeComputeResourceVM TaskAction = "backup-purge-compute-resource-vm"

	// TaskActionConfigureNetwork indicates compute resource network configuring
	// task.
	TaskActionConfigureNetwork TaskAction = "configure network"

	// TaskActionUpdateNetworkRules indicates compute resource network rules update
	// task.
	TaskActionUpdateNetworkRules TaskAction = "update network rules"

	// TaskActionUpgradeComputeResource indicates compute resource upgrade task.
	TaskActionUpgradeComputeResource TaskAction = "upgrade compute resource"

	// TaskActionClearImageCache indicates compute resource OS image cache clear
	// task.
	TaskActionClearImageCache TaskAction = "clear image cache"

	// TaskActionChangeHostname indicates server hostname change task.
	TaskActionChangeHostname TaskAction = "change hostname"
)

type TaskStatus

type TaskStatus string

TaskStatus represents available task's statuses.

const (
	// TaskStatusPending indicates task is just created but not dispatched.
	TaskStatusPending TaskStatus = "pending"

	// TaskStatusQueued indicates task is already dispatched but didn't started.
	TaskStatusQueued TaskStatus = "queued"

	// TaskStatusRunning indicates task is running.
	TaskStatusRunning TaskStatus = "running"

	// TaskStatusDone indicates task successfully finished.
	TaskStatusDone TaskStatus = "done"

	// TaskStatusDoneWithErrors indicates task group finished but at least one of
	// children task is failed.
	TaskStatusDoneWithErrors TaskStatus = "done_with_errors"

	// TaskStatusFailed indicates task is failed.
	TaskStatusFailed TaskStatus = "failed"

	// TaskStatusCanceled indicates task is canceled.
	TaskStatusCanceled TaskStatus = "canceled"
)

type TasksResponse

type TasksResponse struct {
	Data []Task `json:"data"`
	// contains filtered or unexported fields
}

TasksResponse represents paginated list of tasks. This cursor can be used for iterating over all available users.

func (*TasksResponse) Err

func (r *TasksResponse) Err() error

Err return an error which is occurred during fetching next page data.

func (*TasksResponse) Next

func (r *TasksResponse) Next(ctx context.Context) bool

Next using for iterating through all data entities.

Examples:

	ctx, cancelFunc := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancelFunc()

 for {
		for _, datum := range resp.Data {
			doSmthWithDatum(datum)
		}

		if !resp.Next(ctx) {
			break
		}
	}

 if resp.Err() != nil {
		handleAnError(resp.Err())
	}

type TasksService

type TasksService service

TasksService handles all available methods with tasks.

func (*TasksService) Get

func (s *TasksService) Get(ctx context.Context, id int) (Task, error)

Get gets specified task.

func (*TasksService) List

func (s *TasksService) List(ctx context.Context, filter *FilterTasks) (TasksResponse, error)

List lists tasks.

type TrafficPlanLimit

type TrafficPlanLimit struct {
	IsEnabled bool                 `json:"is_enabled"`
	Limit     int                  `json:"limit"`
	Unit      TrafficPlanLimitUnit `json:"unit"`
}

TrafficPlanLimit represents network traffic specific limit.

type TrafficPlanLimitUnit

type TrafficPlanLimitUnit string

TrafficPlanLimitUnit represents available units for network traffic specific limit.

const (
	// TrafficPlanLimitUnitKiB indicates kibibytes unit.
	TrafficPlanLimitUnitKiB TrafficPlanLimitUnit = "KiB"

	// TrafficPlanLimitUnitMiB indicates mebibytes unit.
	TrafficPlanLimitUnitMiB TrafficPlanLimitUnit = "MiB"

	// TrafficPlanLimitUnitGiB indicates gibibytes unit.
	TrafficPlanLimitUnitGiB TrafficPlanLimitUnit = "GiB"

	// TrafficPlanLimitUnitTiB indicates tebibytes unit.
	TrafficPlanLimitUnitTiB TrafficPlanLimitUnit = "TiB"

	// TrafficPlanLimitUnitPiB indicates pebibytes unit.
	TrafficPlanLimitUnitPiB TrafficPlanLimitUnit = "PiB"
)

type UnitPlanLimit

type UnitPlanLimit struct {
	IsEnabled bool          `json:"is_enabled"`
	Limit     int           `json:"limit"`
	Unit      PlanLimitUnit `json:"unit"`
}

UnitPlanLimit represents generic units limit.

type User

type User struct {
	ID       int    `json:"id"`
	Email    string `json:"email"`
	Password string `json:"password"`
	// CreatedAt for date in RFC3339Nano format
	CreatedAt     string     `json:"created_at"`
	Status        UserStatus `json:"status"`
	Roles         []Role     `json:"roles"`
	BillingUserID int        `json:"billing_user_id"`
	BillingToken  string     `json:"billing_token"`
}

User represents a user.

type UserCreateRequest

type UserCreateRequest struct {
	Password      string `json:"password,omitempty"`
	Email         string `json:"email,omitempty"`
	Status        string `json:"status,omitempty"`
	LanguageID    int    `json:"language_id,omitempty"`
	Roles         []int  `json:"roles,omitempty"`
	LimitGroupID  int    `json:"limit_group_id,omitempty"`
	BillingUserID int    `json:"billing_user_id,omitempty"`
	BillingToken  string `json:"billing_token,omitempty"`
}

UserCreateRequest represents available properties for creating a new user.

type UserStatus

type UserStatus string

UserStatus represents available user's statuses.

const (
	// UserStatusActive indicates user is active.
	UserStatusActive UserStatus = "active"

	// UserStatusLocked indicates user is locked.
	UserStatusLocked UserStatus = "locked"

	// UserStatusSuspended indicates user is suspended.
	UserStatusSuspended UserStatus = "suspended"
)

type UserUpdateRequest

type UserUpdateRequest struct {
	Password   string `json:"password,omitempty"`
	Status     string `json:"status,omitempty"`
	LanguageID int    `json:"language_id,omitempty"`
	Roles      []int  `json:"roles,omitempty"`
}

UserUpdateRequest represents available properties for updating exists user.

type UsersResponse

type UsersResponse struct {
	Data []User `json:"data"`
	// contains filtered or unexported fields
}

UsersResponse represents paginated list of users. This cursor can be used for iterating over all available users.

func (*UsersResponse) Err

func (r *UsersResponse) Err() error

Err return an error which is occurred during fetching next page data.

func (*UsersResponse) Next

func (r *UsersResponse) Next(ctx context.Context) bool

Next using for iterating through all data entities.

Examples:

	ctx, cancelFunc := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancelFunc()

 for {
		for _, datum := range resp.Data {
			doSmthWithDatum(datum)
		}

		if !resp.Next(ctx) {
			break
		}
	}

 if resp.Err() != nil {
		handleAnError(resp.Err())
	}

type UsersService

type UsersService service

UsersService handles all available methods with users.

func (*UsersService) Create

func (s *UsersService) Create(ctx context.Context, data UserCreateRequest) (User, error)

Create creates new user.

func (*UsersService) Delete

func (s *UsersService) Delete(ctx context.Context, id int) error

Delete deletes specified user.

func (*UsersService) List

func (s *UsersService) List(ctx context.Context, filter *FilterUsers) (UsersResponse, error)

List lists users.

func (*UsersService) Update

func (s *UsersService) Update(ctx context.Context, id int, data UserUpdateRequest) (User, error)

Update updates specified user.

type VirtualServer

type VirtualServer struct {
	ID                    int                         `json:"id"`
	Name                  string                      `json:"name"`
	Description           string                      `json:"description"`
	VirtualizationType    VirtualizationType          `json:"virtualization_type"`
	UUID                  string                      `json:"uuid"`
	Specifications        VirtualServerSpecifications `json:"specifications"`
	Status                VirtualServerStatus         `json:"status"`
	IPs                   []IPBlockIPAddress          `json:"ips"`
	Location              Location                    `json:"location"`
	Plan                  Plan                        `json:"plan"`
	FQDNs                 []string                    `json:"fqdns"`
	BootMode              BootMode                    `json:"boot_mode"`
	IsSuspended           bool                        `json:"is_suspended"`
	IsProcessing          bool                        `json:"is_processing"`
	User                  User                        `json:"user"`
	Project               Project                     `json:"project"`
	Usage                 VirtualServerUsage          `json:"usage"`
	BackupSettings        VirtualServerBackupSettings `json:"backup_settings"`
	NextScheduledBackupAt string                      `json:"next_scheduled_backup_at"`
	SSHKeys               []SSHKey                    `json:"ssh_keys"`
	CreatedAt             string                      `json:"created_at"`
}

VirtualServer represents a virtual server.

type VirtualServerBackupSettings

type VirtualServerBackupSettings struct {
	Enabled  bool                                `json:"enabled,omitempty"`
	Schedule VirtualServerBackupSettingsSchedule `json:"schedule,omitempty"`
	Limit    UnitPlanLimit                       `json:"limit,omitempty"`
}

VirtualServerBackupSettings represents virtual server backup settings.

type VirtualServerBackupSettingsSchedule

type VirtualServerBackupSettingsSchedule struct {
	Type VirtualServerBackupSettingsScheduleType `json:"type"`
	Time VirtualServerBackupSettingsScheduleTime `json:"time"`
	Days []int                                   `json:"days,omitempty"`
}

VirtualServerBackupSettingsSchedule represents virtual server backup settings schedule.

type VirtualServerBackupSettingsScheduleTime

type VirtualServerBackupSettingsScheduleTime struct {
	Hour    int `json:"hour"`
	Minutes int `json:"minutes"`
}

VirtualServerBackupSettingsScheduleTime represents backup settings schedule time.

type VirtualServerBackupSettingsScheduleType

type VirtualServerBackupSettingsScheduleType string

VirtualServerBackupSettingsScheduleType represents available server backup scheduling types.

const (
	// ServerBackupSettingsScheduleTypeMonthly indicates backing up every month.
	ServerBackupSettingsScheduleTypeMonthly VirtualServerBackupSettingsScheduleType = "monthly"

	// ServerBackupSettingsScheduleTypeWeekly indicates backing up every week.
	ServerBackupSettingsScheduleTypeWeekly VirtualServerBackupSettingsScheduleType = "weekly"

	// ServerBackupSettingsScheduleTypeDaily indicates backing up every day.
	ServerBackupSettingsScheduleTypeDaily VirtualServerBackupSettingsScheduleType = "daily"
)

type VirtualServerCreateRequest

type VirtualServerCreateRequest struct {
	Name                string                        `json:"name"`
	BootMode            BootMode                      `json:"boot_mode"`
	Description         string                        `json:"description,omitempty"`
	UserData            string                        `json:"user_data,omitempty"`
	FQDNs               []string                      `json:"fqdns,omitempty"`
	Password            string                        `json:"password,omitempty"`
	SSHKeys             []int                         `json:"ssh_keys"`
	PlanID              int                           `json:"plan,omitempty"`
	CustomPlan          *Plan                         `json:"custom_plan,omitempty"`
	ProjectID           int                           `json:"project"`
	LocationID          int                           `json:"location"`
	ComputeResourceID   int                           `json:"compute_resource,omitempty"`
	OSImageVersionID    int                           `json:"os,omitempty"`
	ApplicationID       int                           `json:"application,omitempty"`
	ApplicationData     map[string]interface{}        `json:"applicationData,omitempty"`
	AdditionalDisks     []AdditionalDiskCreateRequest `json:"additional_disks,omitempty"`
	PrimaryIP           *string                       `json:"primary_ip,omitempty"`
	IPTypes             []IPVersion                   `json:"ip_types,omitempty"`
	AdditionalIPCount   *int                          `json:"additional_ip_count,omitempty"`
	AdditionalIPv6Count *int                          `json:"additional_ipv6_count,omitempty"`
	MacAddress          *string                       `json:"mac_address,omitempty"`
	Firmware            *Firmware                     `json:"firmware,omitempty"`
}

type VirtualServerResizeRequest

type VirtualServerResizeRequest struct {
	PreserveDisk   bool                         `json:"preserve_disk"`
	PlanID         int                          `json:"plan_id"`
	BackupSettings *VirtualServerBackupSettings `json:"backup_settings,omitempty"`
}

type VirtualServerSpecifications

type VirtualServerSpecifications struct {
	Disk int `json:"disk"`
	RAM  int `json:"ram"`
	VCPU int `json:"vcpu"`
}

VirtualServerSpecifications represent virtual server specification.

type VirtualServerStatus

type VirtualServerStatus string

VirtualServerStatus represents available virtual server statuses.

const (
	// VirtualServerStatusNotExists indicates virtual server didn't exists.
	VirtualServerStatusNotExists VirtualServerStatus = "not exists"

	// VirtualServerStatusProcessing indicates some action is performed right now
	// on a virtual server.
	VirtualServerStatusProcessing VirtualServerStatus = "processing"

	// VirtualServerStatusStarted indicates virtual server is started.
	VirtualServerStatusStarted VirtualServerStatus = "started"

	// VirtualServerStatusStopped indicates virtual server is stopped.
	VirtualServerStatusStopped VirtualServerStatus = "stopped"

	// VirtualServerStatusPaused indicates virtual server is paused.
	VirtualServerStatusPaused VirtualServerStatus = "paused"

	// VirtualServerStatusUnavailable indicates virtual server is unavailable.
	// This may happen due to some problem with a compute resource or a server.
	VirtualServerStatusUnavailable VirtualServerStatus = "unavailable"
)

type VirtualServerUpdateRequest

type VirtualServerUpdateRequest struct {
	Name           string                       `json:"name,omitempty"`
	BootMode       BootMode                     `json:"boot_mode,omitempty"`
	Description    string                       `json:"description,omitempty"`
	UserData       string                       `json:"user_data,omitempty"`
	FQDNs          []string                     `json:"fqdns,omitempty"`
	BackupSettings *VirtualServerBackupSettings `json:"backup_settings,omitempty"`
}

VirtualServerUpdateRequest represents available properties for updating an existing virtual server.

type VirtualServerUpdateSettingsRequest

type VirtualServerUpdateSettingsRequest struct {
	DiskCacheMode DiskCacheMode `json:"disk_cache_mode,omitempty"`
	DiskDriver    DiskDriver    `json:"disk_driver,omitempty"`
	Firmware      Firmware      `json:"firmware,omitempty" `
}

VirtualServerUpdateSettingsRequest represents available settings for updating an existing virtual server.

type VirtualServerUsage

type VirtualServerUsage struct {
	CPU float64 `json:"cpu"`
}

VirtualServerUsage represent virtual server usage.

type VirtualServersResponse

type VirtualServersResponse struct {
	Data []VirtualServer `json:"data"`
	// contains filtered or unexported fields
}

VirtualServersResponse represents paginated list of servers. This cursor can be used for iterating over all available server.

func (*VirtualServersResponse) Err

func (r *VirtualServersResponse) Err() error

Err return an error which is occurred during fetching next page data.

func (*VirtualServersResponse) Next

Next using for iterating through all data entities.

Examples:

	ctx, cancelFunc := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancelFunc()

 for {
		for _, datum := range resp.Data {
			doSmthWithDatum(datum)
		}

		if !resp.Next(ctx) {
			break
		}
	}

 if resp.Err() != nil {
		handleAnError(resp.Err())
	}

type VirtualServersService

type VirtualServersService service

VirtualServersService handles all available methods with virtual servers.

func (*VirtualServersService) Backup

func (s *VirtualServersService) Backup(ctx context.Context, id int) (Backup, error)

Backup backing up specified virtual server.

func (*VirtualServersService) Create

Create creates virtual server.

func (*VirtualServersService) Delete

func (s *VirtualServersService) Delete(ctx context.Context, id int) (Task, error)

Delete deletes specified virtual server.

func (*VirtualServersService) Disks

func (s *VirtualServersService) Disks(ctx context.Context, id int) ([]Disk, error)

Disks gets a list of disks for the specified virtual server.

func (*VirtualServersService) Get

Get gets specified virtual server.

func (*VirtualServersService) List

List lists virtual servers.

func (*VirtualServersService) Patch

Patch patches specified virtual server.

func (*VirtualServersService) Resize

Resize resizes specified virtual server.

func (*VirtualServersService) Restart

func (s *VirtualServersService) Restart(ctx context.Context, id int) (Task, error)

Restart restarts specified virtual server.

func (*VirtualServersService) SnapshotsCreate

func (s *VirtualServersService) SnapshotsCreate(ctx context.Context, vmID int, data SnapshotRequest) (Snapshot, error)

SnapshotsCreate creates a snapshot for the specified virtual server.

func (*VirtualServersService) Start

func (s *VirtualServersService) Start(ctx context.Context, id int) (Task, error)

Start starts specified virtual server.

func (*VirtualServersService) Stop

func (s *VirtualServersService) Stop(ctx context.Context, id int) (Task, error)

Stop stops specified virtual server.

func (*VirtualServersService) UpdateSettings

UpdateSettings updates specified virtual server settings.

type VirtualizationType

type VirtualizationType string

VirtualizationType represents available virtualization types.

const (
	// VirtualizationTypeKVM indicates KVM virtualization type.
	VirtualizationTypeKVM VirtualizationType = "kvm"

	// VirtualizationTypeVZ indicates VZ virtualization type.
	VirtualizationTypeVZ VirtualizationType = "vz"
)

Jump to

Keyboard shortcuts

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