Documentation ¶
Index ¶
- func CheckResponse(r *http.Response) error
- type AdditionalUser
- type Brand
- type Client
- func (c *Client) AddMachineIP(name string) (string, []*Job, error)
- func (c *Client) CancelJob(id int) error
- func (c *Client) ChangeMachinePassword(name, pass string) (bool, error)
- func (c *Client) CreateMachine(opt *CreateMachineOptions) (string, []*Job, error)
- func (c *Client) DeleteMachine(name string) ([]*Job, error)
- func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)
- func (c *Client) GetBrands(opts ...*RequestOptions) ([]*Brand, *Pagination, error)
- func (c *Client) GetJob(id int) (*Job, error)
- func (c *Client) GetJobs(opts ...*RequestOptions) ([]*Job, *Pagination, error)
- func (c *Client) GetLocations(opts ...*RequestOptions) ([]*Location, *Pagination, error)
- func (c *Client) GetMachine(name string) (*MachineFull, error)
- func (c *Client) GetMachineJobs(name string, opts ...*RequestOptions) ([]*Job, *Pagination, error)
- func (c *Client) GetMachineUsers(name string, opts ...*RequestOptions) ([]*User, *Pagination, error)
- func (c *Client) GetMachines(opts ...*RequestOptions) ([]*Machine, *Pagination, error)
- func (c *Client) GetMachinesFull(opts ...*RequestOptions) ([]*MachineFull, *Pagination, error)
- func (c *Client) GetMachinesRunning(opts ...*RequestOptions) ([]*Machine, *Pagination, error)
- func (c *Client) GetMachinesStopped(opts ...*RequestOptions) ([]*Machine, *Pagination, error)
- func (c *Client) GetPendingJobs(opts ...*RequestOptions) ([]*Job, *Pagination, error)
- func (c *Client) GetProducts(opts ...*RequestOptions) ([]*Product, *Pagination, error)
- func (c *Client) GetTemplates(opts ...*RequestOptions) ([]*Template, *Pagination, error)
- func (c *Client) NewRequest(method, path string, opt interface{}, opts []*RequestOptions) (*http.Request, error)
- func (c *Client) ReinstallMachine(name string, opt *ReinstallMachineOptions) ([]*Job, error)
- func (c *Client) SendMachineCommand(name, command string) ([]*Job, error)
- func (c *Client) UpdateMachine(name string, opt *UpdateMachineOptions) ([]*Job, error)
- type CreateMachineOptions
- type IP
- type Job
- type Limits
- type Location
- type Machine
- type MachineFull
- type OS
- type Option
- type Pagination
- type Product
- type ReinstallMachineOptions
- type RequestOptions
- type Response
- type Template
- type UpdateMachineOptions
- type UpdateStatus
- type User
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AdditionalUser ¶
type Client ¶
type Client struct { UserAgent string // contains filtered or unexported fields }
Represents api client
func (*Client) AddMachineIP ¶
Add IP to specified machine returns new IP address and Jobs list
func (*Client) ChangeMachinePassword ¶ added in v1.0.1
Change VPS machine password
func (*Client) CreateMachine ¶
func (c *Client) CreateMachine(opt *CreateMachineOptions) (string, []*Job, error)
Create a new machine with specified CreateMachineOptions returns new machine name and Jobs list
func (*Client) DeleteMachine ¶
Create machine deletion job
func (*Client) GetBrands ¶
func (c *Client) GetBrands(opts ...*RequestOptions) ([]*Brand, *Pagination, error)
Returns all available brands. Info from Pagination can be used to get brands using RequestOptions default Limit 50
func (*Client) GetJobs ¶
func (c *Client) GetJobs(opts ...*RequestOptions) ([]*Job, *Pagination, error)
Returns all planned and completed jobs. Info from Pagination can be used to get jobs using RequestOptions default Limit 50
func (*Client) GetLocations ¶
func (c *Client) GetLocations(opts ...*RequestOptions) ([]*Location, *Pagination, error)
Returns all available locations. Info from Pagination can be used to get locations using RequestOptions default Limit 50
func (*Client) GetMachine ¶
func (c *Client) GetMachine(name string) (*MachineFull, error)
Return specific machine full info
func (*Client) GetMachineJobs ¶
func (c *Client) GetMachineJobs(name string, opts ...*RequestOptions) ([]*Job, *Pagination, error)
Returns all jobs assigned to machine. Info from Pagination can be used to get jobs using RequestOptions default Limit 50
func (*Client) GetMachineUsers ¶
func (c *Client) GetMachineUsers(name string, opts ...*RequestOptions) ([]*User, *Pagination, error)
Returns list of additional system users. Info from Pagination can be used to get users using RequestOptions default Limit 50
func (*Client) GetMachines ¶
func (c *Client) GetMachines(opts ...*RequestOptions) ([]*Machine, *Pagination, error)
Returns all machines. Limit and Page can be set via RequestOptions default Limit 50
func (*Client) GetMachinesFull ¶
func (c *Client) GetMachinesFull(opts ...*RequestOptions) ([]*MachineFull, *Pagination, error)
Returns all machines with full info. Info from Pagination can be used to get machines using RequestOptions default Limit 50
func (*Client) GetMachinesRunning ¶
func (c *Client) GetMachinesRunning(opts ...*RequestOptions) ([]*Machine, *Pagination, error)
Returns all running machines. Info from Pagination can be used to get machines using RequestOptions default Limit 50
func (*Client) GetMachinesStopped ¶
func (c *Client) GetMachinesStopped(opts ...*RequestOptions) ([]*Machine, *Pagination, error)
Returns all stopped machines. Info from Pagination can be used to get machines using RequestOptions default Limit 50
func (*Client) GetPendingJobs ¶
func (c *Client) GetPendingJobs(opts ...*RequestOptions) ([]*Job, *Pagination, error)
Returns all planned jobs. Info from Pagination can be used to get jobs using RequestOptions default Limit 50
func (*Client) GetProducts ¶
func (c *Client) GetProducts(opts ...*RequestOptions) ([]*Product, *Pagination, error)
Returns all available products. Info from Pagination can be used to get products using RequestOptions default Limit 50
func (*Client) GetTemplates ¶
func (c *Client) GetTemplates(opts ...*RequestOptions) ([]*Template, *Pagination, error)
Returns all available templates. Info from Pagination can be used to get templates using RequestOptions default Limit 50
func (*Client) NewRequest ¶
func (c *Client) NewRequest(method, path string, opt interface{}, opts []*RequestOptions) (*http.Request, error)
Creates and validates a new request sets required headers
func (*Client) ReinstallMachine ¶
func (c *Client) ReinstallMachine(name string, opt *ReinstallMachineOptions) ([]*Job, error)
Reinstall machine with specified ReinstallMachineOptions
func (*Client) SendMachineCommand ¶
Send command to machine. Available commands is: start, stop, restart, enable_rdp, enable_network, restart_mt, run_updates_install
func (*Client) UpdateMachine ¶
func (c *Client) UpdateMachine(name string, opt *UpdateMachineOptions) ([]*Job, error)
Update machine with specified UpdateMachineOptions
type CreateMachineOptions ¶
type CreateMachineOptions struct { Description string `json:"description,omitempty"` Password string `json:"password,omitempty"` ProductID int `json:"product_id,omitempty"` TemplateID int `json:"template_id,omitempty"` BrandID int `json:"brand_id,omitempty"` DiskType string `json:"disk_type,omitempty"` LocationID int `json:"location_id,omitempty"` AddDisk int `json:"add_disk,omitempty"` AddRam int `json:"add_ram,omitempty"` AddCpu int `json:"add_cpu,omitempty"` AddBand int `json:"add_band,omitempty"` AutoStart int `json:"auto_start,omitempty"` AddIPv6 int `json:"add_ipv6,omitempty"` UiLanguage string `json:"ui_language,omitempty"` }
List of available CreateMachine() options
func (*CreateMachineOptions) Validate ¶
func (t *CreateMachineOptions) Validate() error
Validate CreateMachineOptions for required options
type Job ¶
type Job struct { ID int `json:"id"` ParentID int `json:"parent_id"` MachineID int `json:"machine_id"` Type string `json:"type"` Status string `json:"status"` StartTime string `json:"start_time"` }
Represents a winvps job
type Limits ¶
type Limits struct { CpuPercent int `json:"cpu_percent"` CpuCores int `json:"cpu_cores"` RamMin int `json:"ram_min"` RamMax int `json:"ram_max"` DiskSize int `json:"disk_size"` Bandwidth int `json:"bandwidth"` Traffic int `json:"traffic"` }
Represents product limits
type Machine ¶
type Machine struct { Name string `json:"name"` Status string `json:"status"` Notes string `json:"notes"` }
Represents a winvps machine info
type MachineFull ¶
type MachineFull struct { *Machine IPs []*IP `json:"ips"` OS *OS `json:"os"` Config *Limits `json:"config"` }
Represents a full winvps machine info
type OS ¶
type OS struct { TemplateID string `json:"template_id"` BrandID int `json:"brand_id"` UpdateStatus *UpdateStatus `json:"update_status"` }
Represents a winvps OS info
type Pagination ¶
type Pagination struct { Total int `json:"total"` Limit int `json:"limit"` Page int `json:"page"` Pages int `json:"pages"` }
Represents pagination info
func (*Pagination) NextPage ¶
func (p *Pagination) NextPage() int
Method returns next page if available
func (*Pagination) PreviousPage ¶
func (p *Pagination) PreviousPage() int
Method returns previous page if available
type ReinstallMachineOptions ¶
type ReinstallMachineOptions struct { Password string `json:"password,omitempty"` TemplateID int `json:"template_id,omitempty"` BrandID int `json:"brand_id,omitempty"` AutoStart int `json:"auto_start,omitempty"` }
List of available ReinstallMachine() options
type RequestOptions ¶
Represents pagination options
type Response ¶
type Response struct { Data json.RawMessage `json:"data"` Pagination Pagination `json:"pagination"` Error string `json:"error,omitempty"` }
Represents api response
type UpdateMachineOptions ¶
type UpdateMachineOptions struct { Password string `json:"password,omitempty"` ProductID int `json:"product_id,omitempty"` AddDisk int `json:"add_disk,omitempty"` AddRam int `json:"add_ram,omitempty"` AddCpu int `json:"add_cpu,omitempty"` AddBand int `json:"add_band,omitempty"` }
List of available UpdateMachine() options