api

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CLIENT_VERSION = "0.7.1"

Functions

This section is empty.

Types

type BillingDetails

type BillingDetails struct {
	Balance            float32 `json:"balance"`
	HourlySpendingRate float32 `json:"hourly_spending_rate"`
}

type Client

type Client struct {
	BaseUrl  string
	ApiKey   string
	ApiToken string
	Debug    bool
}

func NewClient

func NewClient(baseUrl string, apiKey string, apiToken string, debug bool) *Client

func (*Client) DeleteServer added in v0.2.0

func (client *Client) DeleteServer(server string) (*Response, error)

func (*Client) DeployServer added in v0.2.0

func (client *Client) DeployServer(req DeployServerRequest) (*DeployServerResponse, error)

func (*Client) GetBillingDetails

func (client *Client) GetBillingDetails() (*GetBillingDetailsResponse, error)

func (*Client) GetServer

func (client *Client) GetServer(server string) (*GetServerResponse, error)

func (*Client) GetServerStatus added in v0.7.0

func (client *Client) GetServerStatus(server string) (*GetServerStatusResponse, error)

func (*Client) ListCpuStock added in v0.4.0

func (client *Client) ListCpuStock() (*ListCpuStockResponse, error)

func (*Client) ListGpuStock added in v0.4.0

func (client *Client) ListGpuStock() (*ListGpuStockResponse, error)

func (*Client) ListServers

func (client *Client) ListServers() (*ListServersResponse, error)

func (*Client) ModifyServer added in v0.6.1

func (client *Client) ModifyServer(req ModifyServerRequest) (*Response, error)

func (*Client) RestartServer added in v0.3.1

func (client *Client) RestartServer(server string) (*Response, error)

func (*Client) StartServer

func (client *Client) StartServer(server string) (*Response, error)

func (*Client) StopServer

func (client *Client) StopServer(server string) (*Response, error)

type DeployServerRequest added in v0.3.1

type DeployServerRequest struct {
	AdminUser    string `mapstructure:"admin_user"`
	AdminPass    string `mapstructure:"admin_pass"`
	InstanceType string `mapstructure:"instance_type"`
	GPUModel     string `mapstructure:"gpu_model,omitempty"`
	GPUCount     int    `mapstructure:"gpu_count,omitempty"`
	CPUModel     string `mapstructure:"cpu_model,omitempty"`
	VCPUs        int    `mapstructure:"vcpus"`
	RAM          int    `mapstructure:"ram"`
	Storage      int    `mapstructure:"storage"`
	StorageClass string `mapstructure:"storage_class"`
	OS           string `mapstructure:"os"`
	Location     string `mapstructure:"location"`
	Name         string `mapstructure:"name"`
}

type DeployServerResponse added in v0.2.1

type DeployServerResponse struct {
	Response
	Server struct {
		Id    string              `json:"id"`
		Ip    string              `json:"ip"`
		Links []map[string]string `json:"links"`
	} `json:"server"`
}

type GetBillingDetailsResponse added in v0.3.1

type GetBillingDetailsResponse struct {
	Response
	BillingDetails
}

type GetServerResponse added in v0.3.1

type GetServerResponse struct {
	Response
	Server Server `json:"server"`
}

type GetServerStatusResponse added in v0.7.0

type GetServerStatusResponse struct {
	Response
	Status string `json:"status"`
}

type ListCpuStockResponse added in v0.4.0

type ListCpuStockResponse struct {
	Response
	Stock map[string]map[string]struct {
		AvailableNow string `json:"available_now"`
	} `json:"stock"`
}

type ListGpuStockResponse added in v0.4.0

type ListGpuStockResponse struct {
	Response
	Stock map[string]map[string]struct {
		AvailableNow     int `json:"available_now"`
		AvailableReserve int `json:"available_reserve"`
	} `json:"stock"`
}

type ListServersResponse added in v0.3.1

type ListServersResponse struct {
	Response
	Servers map[string]Server `json:"servers"`
}

type ModifyServerRequest added in v0.6.1

type ModifyServerRequest struct {
	ServerId     string  `mapstructure:"server_id"`
	InstanceType *string `mapstructure:"instance_type"`
	GPUModel     *string `mapstructure:"gpu_model,omitempty"`
	GPUCount     *int    `mapstructure:"gpu_count,omitempty"`
	CPUModel     *string `mapstructure:"cpu_model,omitempty"`
	VCPUs        *int    `mapstructure:"vcpus"`
	RAM          *int    `mapstructure:"ram"`
	Storage      *int    `mapstructure:"storage"`
}

type Response

type Response struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
}

type Server

type Server struct {
	Cost struct {
		Charged    float32 `json:"charged"`
		HourOff    float32 `json:"hour_off"`
		HourOn     float32 `json:"hour_on"`
		MinutesOff float32 `json:"minutes_off"`
		MinutesOn  float32 `json:"minutes_on"`
	} `json:"cost"`
	CPUModel     string                       `json:"cpu_model"`
	GPUCount     int                          `json:"gpu_count"`
	GPUModel     string                       `json:"gpu_model"`
	Id           string                       `json:"id"`
	Ip           string                       `json:"ip"`
	Links        map[string]map[string]string `json:"links"`
	Location     string                       `json:"location"`
	Name         string                       `json:"name"`
	Ram          int                          `json:"ram"`
	Status       string                       `json:"status"`
	Storage      int                          `json:"storage"`
	StorageClass string                       `json:"storage_class"`
	Type         string                       `json:"type"`
	VCPUs        int                          `json:"vcpus"`
}

Jump to

Keyboard shortcuts

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