cherrygo

package module
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 License: MIT Imports: 12 Imported by: 0

README

README

Cherry Servers golang API for Cherry Servers RESTful API.

You can view the client API docs here: https://pkg.go.dev/github.com/cherryservers/cherrygo

You can view Cherry Servers API docs here: https://api.cherryservers.com/doc

Table of Contents

Installation

Download the library to you GOPATH:

go get github.com/cherryservers/cherrygo

Then import the library in your Go code:

import cherrygo
Authentication

In order to authenticate you need to export CHERRY_AUTH_TOKEN variable:

export CHERRY_AUTH_TOKEN="4bdc0acb8f7af4bdc0acb8f7afe78522e6dae9b7e03b0e78522e6dae9b7e03b0"
Examples
Get teams

You will need team ID for later calls, for example to get projects for specified team, you will need to provide team ID.

c, err := cherrygo.NewClient()
if err != nil {
    log.Fatal(err)
}

teams, _, err := c.Teams.List(nil)
if err != nil {
    log.Fatal("Error", err)
}

for _, t := range teams {

    fmt.Fprintf("%v\t%v\t%v\t%v\t%v\n",
        t.ID, t.Name, t.Credit.Promo.Remaining, t.Credit.Promo.Usage, t.Credit.Resources.Pricing.Price)
}
Get projects

After you have your team ID, you can list your projects. You will need your project ID to list your servers or order new ones.

c, err := cherrygo.NewClient()
if err != nil {
    log.Fatal(err)
}

projects, _, err := c.Projects.List(teamID, nil)
if err != nil {
    log.Fatal("Error", err)
}

for _, p := range projects {
    fmt.Fprintf(tw, "%v\t%v\t%v\n",
        p.ID, p.Name, p.Href)
}
Get plans

You know your project ID, so next thing in order to get new server is to choose one, we call it plans

c, err := cherrygo.NewClient()
if err != nil {
    log.Fatal(err)
}

plans, _, err := c.Plans.List(projectID, nil)
if err != nil {
    log.Fatalf("Plans error: %v", err)
}

for _, p := range plans {

    fmt.Fprintf(tw, "%v\t%v\t%v\t%v\n",
        p.ID, p.Name, p.Specs.Cpus.Name, p.Specs.Memory.Total)
}
Get images

After you manage to know desired plan, you need to get available images for that plan

c, err := cherrygo.NewClient()
if err != nil {
    log.Fatal(err)
}

images, _, err := c.Images.List(planID, nil)
if err != nil {
    log.Fatal("Error", err)
}

for _, i := range images {
    fmt.Fprintf(tw, "%v\t%v\t%v\n",
        i.ID, i.Name, i.Pricing.Price)
}
Order new server

Now you are ready to order new server

c, err := cherrygo.NewClient()
if err != nil {
    log.Fatal(err)
}

addServerRequest := cherrygo.CreateServer{
    ProjectID:   projectID,
    Hostname:    hostname,
    Image:       image,
    Region:      region,
    SSHKeys:     sshKeys,
    IPAddresses: ipaddresses,
    PlanID:      planID,
}

server, _, err := c.Server.Create(projectID, &addServerRequest)
if err != nil {
    log.Fatal("Error while creating new server: ", err)
}

Debug

In case you want to debug this library and get requests and responses from API you need to export CHERRY_DEBUG variable

export CHERRY_DEBUG="true"

When you done, just unset that variable:

unset CHERRY_DEBUG

License

See the LICENSE file for license rights and limitations.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Remaining float32 `json:"remaining,omitempty"`
	Usage     float32 `json:"usage,omitempty"`
	Currency  string  `json:"currency,omitempty"`
}

Account fields

type AssignedTo

type AssignedTo struct {
	ID       int     `json:"id,omitempty"`
	Name     string  `json:"name,omitempty"`
	Href     string  `json:"href,omitempty"`
	Hostname string  `json:"hostname,omitempty"`
	Image    string  `json:"image,omitempty"`
	Region   Region  `json:"region,omitempty"`
	State    string  `json:"state,omitempty"`
	Pricing  Pricing `json:"pricing,omitempty"`
}

AssignedTo fields

type AttachTo

type AttachTo struct {
	ProjectID string `json:"project_id"`
	StorageID string `json:"storage_id"`
	AttachTo  int    `json:"attach_to"`
}

type AttachedTo

type AttachedTo struct {
	Href string `json:"href"`
}

type AvailableRegions

type AvailableRegions struct {
	ID         int    `json:"id,omitempty"`
	Name       string `json:"name,omitempty"`
	RegionIso2 string `json:"region_iso_2,omitempty"`
	StockQty   int    `json:"stock_qty,omitempty"`
}

AvailableRegions specifies fields for specs

type BGPRoute

type BGPRoute struct {
	Subnet  string `json:"subnet,omitempty"`
	Active  bool   `json:"active,omitempty"`
	Router  string `json:"router,omitempty"`
	Age     string `json:"age,omitempty"`
	Updated string `json:"updated,omitempty"`
}

type Bandwidth

type Bandwidth struct {
	Name string `json:"name,omitempty"`
}

Bandwidth fields

type Billing

type Billing struct {
	Type        string `json:"type,omitempty"`
	CompanyName string `json:"company_name,ommitempty"`
	CompanyCode string `json:"company_code,omitempty"`
	FirstName   string `json:"first_name,omitempty"`
	LastName    string `json:"last_name,omitempty"`
	Address1    string `json:"address_1,omitempty"`
	Address2    string `json:"address_2,omitempty"`
	CountryIso2 string `json:"country_iso_2,omitempty"`
	City        string `json:"city,omitempty"`
	Vat         Vat    `json:"vat,omitempty"`
	Currency    string `json:"currency,omitempty"`
}

Billing fields

type BlockStorage

type BlockStorage struct {
	ID            int        `json:"id"`
	Name          string     `json:"name"`
	Href          string     `json:"href"`
	Size          int        `json:"size"`
	AllowEditSize bool       `json:"allow_edit_size"`
	Unit          string     `json:"unit"`
	Description   string     `json:"description,omitempty"`
	AttachedTo    AttachedTo `json:"attached_to,omitempty"`
	VlanID        string     `json:"vlan_id"`
	VlanIP        string     `json:"vlan_ip"`
	Initiator     string     `json:"initiator"`
	DiscoveryIP   string     `json:"discovery_ip"`
}

type Client

type Client struct {
	BaseURL *url.URL

	UserAgent string
	AuthToken string

	Teams       GetTeams
	Plans       GetPlans
	Images      GetImages
	Project     GetProject
	Projects    GetProjects
	SSHKeys     GetSSHKeys
	SSHKey      GetSSHKey
	Servers     GetServers
	Server      GetServer
	IPAddresses GetIPS
	IPAddress   GetIP
	Storages    GetStorages
	Storage     GetStorage
	// contains filtered or unexported fields
}

Client returns struct for client

func NewClient

func NewClient(opts ...ClientOpt) (*Client, error)

NewClient initialization

func (*Client) MakeRequest

func (c *Client) MakeRequest(method, path string, body, v interface{}) (*Response, error)

MakeRequest makes request to API

type ClientOpt

type ClientOpt func(*options) error

func WithAuthToken

func WithAuthToken(authToken string) ClientOpt

WithAuthToken use provided auth token to make requests, defaults to environment variable CHERRY_AUTH_TOKEN

func WithHTTPClient

func WithHTTPClient(client *http.Client) ClientOpt

WithHTTPClient use client as the http.Client to make API requests

func WithURL

func WithURL(url string) ClientOpt

WithURL use url as endpoint for API requests

func WithUserAgent

func WithUserAgent(ua string) ClientOpt

WithUserAgent set user agent when making requests

type Cpus

type Cpus struct {
	Count     int     `json:"count,omitempty"`
	Name      string  `json:"name,omitempty"`
	Cores     int     `json:"cores,omitempty"`
	Frequency float32 `json:"frequency,omitempty"`
	Unit      string  `json:"unit,omitempty"`
}

Cpus fields

type CreateIPAddress

type CreateIPAddress struct {
	Type       string             `json:"type,omitempty"`
	Region     string             `json:"region,omitempty"`
	PtrRecord  string             `json:"ptr_record,omitempty"`
	ARecord    string             `json:"a_record,omitempty"`
	RoutedTo   string             `json:"routed_to,omitempty"`
	AssignedTo string             `json:"assigned_to,omitempty"`
	TargetedTo string             `json:"targeted_to,omitempty"`
	Tags       *map[string]string `json:"tags,omitempty"`
}

CreateIPAddress fields for adding addition IP address

type CreateProject

type CreateProject struct {
	Name string `json:"name,omitempty"`
	Bgp  bool   `json:"bgp,omitempty"`
}

CreateProject fields for adding new project with specified name

type CreateSSHKey

type CreateSSHKey struct {
	Label string `json:"label,omitempty"`
	Key   string `json:"key,omitempty"`
}

CreateSSHKey fields for adding new key with label and raw key

type CreateServer

type CreateServer struct {
	ProjectID    string             `json:"project_id,omitempty"`
	PlanID       string             `json:"plan_id,omitempty"`
	Hostname     string             `json:"hostname,omitempty"`
	Image        string             `json:"image,omitempty"`
	Region       string             `json:"region,omitempty"`
	SSHKeys      []string           `json:"ssh_keys"`
	IPAddresses  []string           `json:"ip_addresses"`
	UserData     string             `json:"user_data,omitempty"`
	Tags         *map[string]string `json:"tags,omitempty"`
	SpotInstance bool               `json:"spot_market"`
}

CreateServer fields for ordering new server

type CreateStorage

type CreateStorage struct {
	ProjectID   string `json:"project_id"`
	Description string `json:"description"`
	Size        int    `json:"size"`
	Region      string `json:"region"`
}

type Credit

type Credit struct {
	Account   Account   `json:"account,omitempty"`
	Promo     Promo     `json:"promo,omitempty"`
	Resources Resources `json:"resources,omitempty"`
}

Credit fields

type DeleteProject

type DeleteProject struct {
	ID string `json:"id,omitempty"`
}

DeleteProject fields for key delition by its ID

type DeleteSSHKey

type DeleteSSHKey struct {
	ID string `json:"id,omitempty"`
}

DeleteSSHKey fields for key delition by its ID

type DeleteServer

type DeleteServer struct {
	ID string `json:"id,omitempty"`
}

DeleteServer field for removing server

type DeleteStorage

type DeleteStorage struct {
	ProjectID string `json:"project_id"`
	StorageID string `json:"storage_id"`
}

type DetachFrom

type DetachFrom struct {
	ProjectID string `json:"project_id"`
	StorageID string `json:"storage_id"`
}

type ErrorResponse

type ErrorResponse struct {
	Response    *http.Response
	Errors      []string `json:"errors"`
	SingleError string   `json:"error"`
}

ErrorResponse fields

type GetIP

type GetIP interface {
	List(projectID string, ipID string, opts *GetOptions) (IPAddresses, *Response, error)
	Create(projectID string, request *CreateIPAddress) (IPAddresses, *Response, error)
	Remove(projectID string, request *RemoveIPAddress) (IPAddresses, *Response, error)
	Update(projectID string, ipID string, request *UpdateIPAddress) (IPAddresses, *Response, error)
}

GetIP interface metodas isgauti team'sus

type GetIPS

type GetIPS interface {
	List(projectID string) ([]IPAddresses, *Response, error)
}

GetIPS interface metodas isgauti team'sus

type GetImages

type GetImages interface {
	List(planID int, opts *GetOptions) ([]Images, *Response, error)
}

GetImages interface metodas isgauti team'sus

type GetOptions

type GetOptions struct {
	Fields []string `url:"fields,omitempty,comma"`
	Limit  int      `url:"limit,omitempty"`
	Offset int      `url:"offset,omitempty"`
	Type   []string `url:"type,ommitempty"`
	Status []string `url:"status,ommitempty"`
}

func (*GetOptions) Encode

func (g *GetOptions) Encode() string

func (*GetOptions) WithQuery

func (g *GetOptions) WithQuery(apiPath string) string

type GetPlans

type GetPlans interface {
	List(teamID int, opts *GetOptions) ([]Plans, *Response, error)
}

GetPlans interface metodas isgauti team'sus

type GetProject

type GetProject interface {
	List(projectID string) (Project, *Response, error)
	Create(teamID int, request *CreateProject) (Project, *Response, error)
	Update(projectID string, request *UpdateProject) (Project, *Response, error)
	Delete(projectID string, request *DeleteProject) (Project, *Response, error)
}

GetProject interface metodas isgauti team'sus

type GetProjects

type GetProjects interface {
	List(teamID int, opts *GetOptions) ([]Project, *Response, error)
}

GetProjects interface metodas isgauti team'sus

type GetSSHKey

type GetSSHKey interface {
	List(sshKeyID string, opts *GetOptions) (SSHKey, *Response, error)
	Create(request *CreateSSHKey) (SSHKeys, *Response, error)
	Delete(request *DeleteSSHKey) (SSHKeys, *Response, error)
	Update(sshKeyID string, request *UpdateSSHKey) (SSHKeys, *Response, error)
}

GetSSHKey interface

type GetSSHKeys

type GetSSHKeys interface {
	List(opts *GetOptions) ([]SSHKeys, *Response, error)
}

GetSSHKeys interface metodas isgauti team'sus

type GetServer

type GetServer interface {
	List(serverID string, opts *GetOptions) (Server, *Response, error)
	PowerOff(serverID string) (Server, *Response, error)
	PowerOn(serverID string) (Server, *Response, error)
	Create(projectID string, request *CreateServer) (Server, *Response, error)
	Delete(request *DeleteServer) (Server, *Response, error)
	PowerState(serverID string) (PowerState, *Response, error)
	Reboot(serverID string) (Server, *Response, error)
	Update(serverID string, request *UpdateServer) (Server, *Response, error)
}

GetServer interface metodas isgauti team'sus

type GetServers

type GetServers interface {
	List(projectID string, opts *GetOptions) ([]Server, *Response, error)
}

GetServers interface metodas isgauti team'sus

type GetStorage

type GetStorage interface {
	List(projectID string, storageID string, opts *GetOptions) (BlockStorage, *Response, error)
	Create(request *CreateStorage) (BlockStorage, *Response, error)
	Delete(request *DeleteStorage) (*Response, error)
	Attach(request *AttachTo) (BlockStorage, *Response, error)
	Detach(*DetachFrom) (*Response, error)
}

type GetStorages

type GetStorages interface {
	List(projectID string, opts *GetOptions) ([]BlockStorage, *Response, error)
}

type GetTeams

type GetTeams interface {
	List(opts *GetOptions) ([]Teams, *Response, error)
}

GetTeams interface metodas isgauti team'sus

type IPAddresses

type IPAddresses struct {
	ID            string            `json:"id,omitempty"`
	Address       string            `json:"address,omitempty"`
	AddressFamily int               `json:"address_family,omitempty"`
	Cidr          string            `json:"cidr,omitempty"`
	Gateway       string            `json:"gateway,omitempty"`
	Type          string            `json:"type,omitempty"`
	Region        Region            `json:"region,omitempty"`
	RoutedTo      RoutedTo          `json:"routed_to,omitempty"`
	AssignedTo    AssignedTo        `json:"assigned_to,omitempty"`
	TargetedTo    AssignedTo        `json:"targeted_to,omitempty"`
	Project       Project           `json:"project,omitempty"`
	PtrRecord     string            `json:"ptr_record,omitempty"`
	ARecord       string            `json:"a_record,omitempty"`
	Tags          map[string]string `json:"tags,omitempty"`
	Href          string            `json:"href,omitempty"`
}

IPAddresses fields

type IPClient

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

IPClient paveldi client

func (*IPClient) Create

func (i *IPClient) Create(projectID string, request *CreateIPAddress) (IPAddresses, *Response, error)

Create function orders new floating IP address

func (*IPClient) List

func (i *IPClient) List(projectID string, ipID string, opts *GetOptions) (IPAddresses, *Response, error)

List func lists teams

func (*IPClient) Remove

func (i *IPClient) Remove(projectID string, request *RemoveIPAddress) (IPAddresses, *Response, error)

Remove function remove existing floating IP address

func (*IPClient) Update

func (i *IPClient) Update(projectID string, ipID string, request *UpdateIPAddress) (IPAddresses, *Response, error)

Update function updates existing floating IP address

type IPSClient

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

IPSClient paveldi client

func (*IPSClient) List

func (i *IPSClient) List(projectID string) ([]IPAddresses, *Response, error)

List func lists teams

type Images

type Images struct {
	ID      int       `json:"id,omitempty"`
	Name    string    `json:"name,omitempty"`
	Pricing []Pricing `json:"pricing,omitempty"`
}

Images tai ka grazina api

type ImagesClient

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

ImagesClient paveldi client

func (*ImagesClient) List

func (i *ImagesClient) List(planID int, opts *GetOptions) ([]Images, *Response, error)

List func lists teams

type Memory

type Memory struct {
	Count int    `json:"count,omitempty"`
	Total int    `json:"total,omitempty"`
	Unit  string `json:"unit,omitempty"`
	Name  string `json:"name,omitempty"`
}

Memory fields

type Meta

type Meta struct {
	Total int
}

type Nics

type Nics struct {
	Name string `json:"name,omitempty"`
}

Nics fields

type Plans

type Plans struct {
	ID               int                `json:"id,omitempty"`
	Name             string             `json:"name,omitempty"`
	Custom           bool               `json:"custom,omitempty"`
	Specs            Specs              `json:"specs,omitempty"`
	Pricing          []Pricing          `json:"pricing,omitempty"`
	AvailableRegions []AvailableRegions `json:"available_regions,omitempty"`
}

Plans tai ka grazina api

type PlansClient

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

PlansClient paveldi client

func (*PlansClient) List

func (p *PlansClient) List(teamID int, opts *GetOptions) ([]Plans, *Response, error)

List func lists teams

type PowerState

type PowerState struct {
	Power string `json:"power,omitempty"`
}

PowerState fields

type Pricing

type Pricing struct {
	Price    float32 `json:"price,omitempty"`
	Taxed    bool    `json:"taxed,omitempty"`
	Currency string  `json:"currency,omitempty"`
	Unit     string  `json:"unit,omitempty"`
}

Pricing for resources

type Pricing2

type Pricing2 struct {
	Price    float32 `json:"price,omitempty"`
	Currency string  `json:"currency,omitempty"`
	Taxed    bool    `json:"taxed,omitempty"`
	Unit     string  `json:"unit,omitempty"`
}

Pricing2 specifies fields for specs

type Project

type Project struct {
	ID   int        `json:"id,omitempty"`
	Name string     `json:"name,omitempty"`
	Bgp  ProjectBGP `json:"bgp,omitempty"`
	Href string     `json:"href,omitempty"`
}

Project tai ka grazina api

type ProjectBGP

type ProjectBGP struct {
	Enabled  bool `json:"enabled,omitempty"`
	LocalASN int  `json:"local_asn,omitempty"`
}

type ProjectClient

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

ProjectClient paveldi client

func (*ProjectClient) Create

func (p *ProjectClient) Create(teamID int, request *CreateProject) (Project, *Response, error)

Create func will create new Project for specified team

func (*ProjectClient) Delete

func (p *ProjectClient) Delete(projectID string, request *DeleteProject) (Project, *Response, error)

Delete func will delete a project

func (*ProjectClient) List

func (p *ProjectClient) List(projectID string) (Project, *Response, error)

List project

func (*ProjectClient) Update

func (p *ProjectClient) Update(projectID string, request *UpdateProject) (Project, *Response, error)

Update func will update a project

type ProjectsClient

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

ProjectsClient paveldi client

func (*ProjectsClient) List

func (p *ProjectsClient) List(teamID int, opts *GetOptions) ([]Project, *Response, error)

List func lists teams

type Promo

type Promo struct {
	Remaining float32 `json:"remaining,omitempty"`
	Usage     float32 `json:"usage,omitempty"`
	Currency  string  `json:"currency,omitempty"`
}

Promo fields

type Raid

type Raid struct {
	Name string `json:"name,omitempty"`
}

Raid fields

type Region

type Region struct {
	ID         int       `json:"id,omitempty"`
	Name       string    `json:"name,omitempty"`
	RegionIso2 string    `json:"region_iso_2,omitempty"`
	BGP        RegionBGP `json:"bgp,omitempty"`
	Href       string    `json:"href,omitempty"`
}

Region fields

type RegionBGP

type RegionBGP struct {
	Hosts []string `json:"hosts,omitempty"`
	Asn   int      `json:"asn,omitempty"`
}

type RemoveIPAddress

type RemoveIPAddress struct {
	ID string `json:"id,omitempty"`
}

RemoveIPAddress fields for removing IP address

type Resources

type Resources struct {
	Pricing Pricing `json:"pricing,omitempty"`
}

Resources fields

type Response

type Response struct {
	*http.Response
	Meta
}

Response is the http response from api calls

type RoutedTo

type RoutedTo struct {
	ID            string `json:"id,omitempty"`
	Address       string `json:"address,omitempty"`
	AddressFamily int    `json:"address_family,omitempty"`
	Cidr          string `json:"cidr,omitempty"`
	Gateway       string `json:"gateway,omitempty"`
	Type          string `json:"type,omitempty"`
	Region        Region `json:"region,omitempty"`
}

RoutedTo fields

type SSHKey

type SSHKey struct {
	ID          int    `json:"id,omitempty"`
	Label       string `json:"label,omitempty"`
	Key         string `json:"key,omitempty"`
	Fingerprint string `json:"fingerprint,omitempty"`
	Updated     string `json:"updated,omitempty"`
	Created     string `json:"created,omitempty"`
	Href        string `json:"href,omitempty"`
}

SSHKey fields for return values after creation

type SSHKeyClient

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

SSHKeyClient paveldi client

func (*SSHKeyClient) Create

func (s *SSHKeyClient) Create(request *CreateSSHKey) (SSHKeys, *Response, error)

Create adds new SSH key

func (*SSHKeyClient) Delete

func (s *SSHKeyClient) Delete(request *DeleteSSHKey) (SSHKeys, *Response, error)

Delete removes desired SSH key by its ID

func (*SSHKeyClient) List

func (s *SSHKeyClient) List(sshKeyID string, opts *GetOptions) (SSHKey, *Response, error)

List func lists all available ssh keys

func (*SSHKeyClient) Update

func (s *SSHKeyClient) Update(sshKeyID string, request *UpdateSSHKey) (SSHKeys, *Response, error)

Update function updates keys Label or key itself

type SSHKeys

type SSHKeys struct {
	ID          int    `json:"id,omitempty"`
	Label       string `json:"label,omitempty"`
	Key         string `json:"key,omitempty"`
	Fingerprint string `json:"fingerprint,omitempty"`
	Updated     string `json:"updated,omitempty"`
	Created     string `json:"created,omitempty"`
	Href        string `json:"href,omitempty"`
}

SSHKeys fields for return values after creation

type SSHKeysClient

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

SSHKeysClient paveldi client

func (*SSHKeysClient) List

func (s *SSHKeysClient) List(opts *GetOptions) ([]SSHKeys, *Response, error)

List func lists all available ssh keys

type Server

type Server struct {
	ID               int               `json:"id,omitempty"`
	Name             string            `json:"name,omitempty"`
	Href             string            `json:"href,omitempty"`
	Hostname         string            `json:"hostname,omitempty"`
	Image            string            `json:"image,omitempty"`
	SpotInstance     bool              `json:"spot_instance"`
	BGP              ServerBGP         `json:"bgp,omitempty"`
	Project          Project           `json:"project,omitempty"`
	Region           Region            `json:"region,omitempty"`
	State            string            `json:"state,omitempty"`
	Plans            Plans             `json:"plan,omitempty"`
	AvailableRegions AvailableRegions  `json:"availableregions,omitempty"`
	Pricing          Pricing           `json:"pricing,omitempty"`
	IPAddresses      []IPAddresses     `json:"ip_addresses,omitempty"`
	SSHKeys          []SSHKeys         `json:"ssh_keys,omitempty"`
	Tags             map[string]string `json:"tags,omitempty"`
	Storage          BlockStorage      `json:"storage,omitempty"`
	Created          string            `json:"created_at,omitempty"`
	TerminationDate  string            `json:"termination_date,omitempty"`
}

Server response object

type ServerAction

type ServerAction struct {
	Type string `json:"type,omitempty"`
}

ServerAction fields for performed action on server

type ServerBGP

type ServerBGP struct {
	Enabled   bool       `json:"enabled"`
	Available bool       `json:"available,omitempty"`
	Status    string     `json:"status,omitempty"`
	Routers   int        `json:"routers,omitempty"`
	Connected int        `json:"connected,omitempty"`
	Limit     int        `json:"limit,omitempty"`
	Active    int        `json:"active,omitempty"`
	Routes    []BGPRoute `json:"routes,omitempty"`
	Updated   string     `json:"updated,omitempty"`
}

type ServerClient

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

ServerClient paveldi client

func (*ServerClient) Create

func (s *ServerClient) Create(projectID string, request *CreateServer) (Server, *Response, error)

Create function orders new floating IP address

func (*ServerClient) Delete

func (s *ServerClient) Delete(request *DeleteServer) (Server, *Response, error)

Delete removes desired SSH key by its ID

func (*ServerClient) List

func (s *ServerClient) List(serverID string, opts *GetOptions) (Server, *Response, error)

List func lists teams

func (*ServerClient) PowerOff

func (s *ServerClient) PowerOff(serverID string) (Server, *Response, error)

PowerOff function turns server off

func (*ServerClient) PowerOn

func (s *ServerClient) PowerOn(serverID string) (Server, *Response, error)

PowerOn function turns server on

func (*ServerClient) PowerState

func (s *ServerClient) PowerState(serverID string) (PowerState, *Response, error)

PowerState func

func (*ServerClient) Reboot

func (s *ServerClient) Reboot(serverID string) (Server, *Response, error)

Reboot function restarts desired server

func (*ServerClient) Update

func (s *ServerClient) Update(serverID string, request *UpdateServer) (Server, *Response, error)

Update update server with tags

type ServersClient

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

ServersClient paveldi client

func (*ServersClient) List

func (s *ServersClient) List(projectID string, opts *GetOptions) ([]Server, *Response, error)

List func lists teams

type Specs

type Specs struct {
	Cpus      Cpus      `json:"cpus,omitempty"`
	Memory    Memory    `json:"memory,omitempty"`
	Storage   []Storage `json:"storage,omitempty"`
	Raid      Raid      `json:"raid,omitempty"`
	Nics      Nics      `json:"nics,omitempty"`
	Bandwidth Bandwidth `json:"bandwidth,omitempty"`
}

Specs specifies fields for specs

type Storage

type Storage struct {
	Count int     `json:"count,omitempty"`
	Name  string  `json:"name,omitempty"`
	Size  float32 `json:"size,omitempty"`
	Unit  string  `json:"unit,omitempty"`
}

Storage fields

type StorageClient

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

func (*StorageClient) Attach

func (s *StorageClient) Attach(request *AttachTo) (BlockStorage, *Response, error)

func (*StorageClient) Create

func (s *StorageClient) Create(request *CreateStorage) (BlockStorage, *Response, error)

func (*StorageClient) Delete

func (s *StorageClient) Delete(request *DeleteStorage) (*Response, error)

func (*StorageClient) Detach

func (s *StorageClient) Detach(request *DetachFrom) (*Response, error)

func (*StorageClient) List

func (s *StorageClient) List(projectID string, storageID string, opts *GetOptions) (BlockStorage, *Response, error)

type StoragesClient

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

func (*StoragesClient) List

func (c *StoragesClient) List(projectID string, opts *GetOptions) ([]BlockStorage, *Response, error)

type Teams

type Teams struct {
	ID      int     `json:"id,omitempty"`
	Name    string  `json:"name,omitempty"`
	Credit  Credit  `json:"credit,omitempty"`
	Billing Billing `json:"billing,omitempty"`
	Href    string  `json:"href,omitempty"`
}

Teams tai ka grazina api

type TeamsClient

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

TeamsClient paveldi client

func (*TeamsClient) List

func (t *TeamsClient) List(opts *GetOptions) ([]Teams, *Response, error)

List func lists teams

type UpdateIPAddress

type UpdateIPAddress struct {
	PtrRecord  string             `json:"ptr_record,omitempty"`
	ARecord    string             `json:"a_record,omitempty"`
	RoutedTo   string             `json:"routed_to,omitempty"`
	AssignedTo string             `json:"assigned_to,omitempty"`
	TargetedTo string             `json:"targeted_to,omitempty"`
	Tags       *map[string]string `json:"tags,omitempty"`
}

UpdateIPAddress fields for updating IP address

type UpdateProject

type UpdateProject struct {
	Name string `json:"name,omitempty"`
	Bgp  bool   `json:"bgp,omitempty"`
}

UpdateProject fields for updating a project with specified name

type UpdateSSHKey

type UpdateSSHKey struct {
	Label string `json:"label,omitempty"`
	Key   string `json:"key,omitempty"`
}

UpdateSSHKey fields for label or key update

type UpdateServer

type UpdateServer struct {
	Tags *map[string]string `json:"tags,omitempty"`
	Bgp  bool               `json:"bgp"`
}

UpdateServer fields for updating a server with specified tags

type Vat

type Vat struct {
	Amount int    `json:"amount"`
	Number string `json:"number,omitempty"`
	Valid  bool   `json:"valid"`
}

Vat fields

Jump to

Keyboard shortcuts

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