api

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	API    config.API
	Mutex  *sync.Mutex
	Client *http.Client
}

func NewClient

func NewClient(c *config.Config) *Client

func (*Client) CreateInstance

func (c *Client) CreateInstance(name, plan, region string) (*CreateInstanceResponse, error)

func (*Client) DeleteInstance

func (c *Client) DeleteInstance(instance InstanceInfo) error

func (*Client) Do

func (c *Client) Do(req *http.Request) (int, []byte, error)

func (*Client) GetInstance

func (c *Client) GetInstance(name string) (*InstanceInfo, error)

func (*Client) GetInstanceInfo

func (c *Client) GetInstanceInfo(id int) (*InstanceInfo, error)

func (*Client) GetRegion

func (c *Client) GetRegion(key string) (*Region, error)

func (*Client) ListInstances

func (c *Client) ListInstances() (Instances, error)

func (*Client) ListRegions

func (c *Client) ListRegions() (Regions, error)

type CreateInstanceResponse

type CreateInstanceResponse struct {
	ID      int    `json:"id"`
	Message string `json:"message"`
	URL     string `json:"url"`
	APIKey  string `json:"apikey"`
}

type Instance

type Instance struct {
	ID     int    `json:"id"`
	Name   string `json:"name"`
	Plan   string `json:"plan"`
	Region string `json:"region"`
	URL    string `json:"url"`
}

type InstanceInfo

type InstanceInfo struct {
	ID     int    `json:"id"`
	Name   string `json:"name"`
	Plan   string `json:"plan"`
	Region string `json:"region"`
	URL    string `json:"url"`
	APIKey string `json:"apikey"`
	Ready  bool   `json:"ready"`
}

type Instances

type Instances []Instance

type Region

type Region struct {
	Provider    string `json:"provider"`
	Region      string `json:"region"`
	Name        string `json:"name"`
	SharedPlans bool   `json:"has_shared_plans"`
}

type Regions

type Regions []Region

Jump to

Keyboard shortcuts

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