api

package
Version: v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Slug string `json:"slug"`
}

type Accounts

type Accounts []Account

type Client

type Client struct {
	Config           config.API
	Mutex            *sync.Mutex
	HTTPClient       *http.Client
	Retries          int
	RetryInterval    time.Duration
	RetryStatusCodes []int
}

func NewClient

func NewClient(c *config.Config) *Client

func (*Client) CreateDeployment

func (c *Client) CreateDeployment(newDeployment NewDeployment) (*Deployment, error)

func (*Client) Delete

func (c *Client) Delete(endpoint string) (string, error)

func (*Client) DeleteDeployment

func (c *Client) DeleteDeployment(deploymentID string) (*Recipe, error)

func (*Client) Do

func (c *Client) Do(method, endpoint, payload string, code int) (string, error)

func (*Client) Get

func (c *Client) Get(endpoint string) (string, error)

func (*Client) GetAccounts

func (c *Client) GetAccounts() (Accounts, error)

func (*Client) GetDatabases

func (c *Client) GetDatabases() (Databases, error)

func (*Client) GetDeployment

func (c *Client) GetDeployment(deploymentID string) (*Deployment, error)

func (*Client) GetDeploymentByName

func (c *Client) GetDeploymentByName(name string) (*Deployment, error)

func (*Client) GetDeployments

func (c *Client) GetDeployments() (Deployments, error)

func (*Client) GetRecipe

func (c *Client) GetRecipe(recipeID string) (*Recipe, error)

func (*Client) GetRecipes

func (c *Client) GetRecipes(deploymentID string) (Recipes, error)

func (*Client) GetScaling

func (c *Client) GetScaling(deploymentID string) (*Scaling, error)

func (*Client) Post

func (c *Client) Post(endpoint, payload string) (string, error)

func (*Client) PostAsync

func (c *Client) PostAsync(endpoint, payload string) (string, error)

func (*Client) UpdateScaling

func (c *Client) UpdateScaling(deploymentID string, units int) (*Recipe, error)

type Database

type Database struct {
	DatabaseType string `json:"type"`
	Status       string `json:"status"`
	Embedded     struct {
		Versions []Version `json:"versions"`
	} `json:"_embedded"`
}

type Databases

type Databases []Database

type Deployment

type Deployment struct {
	ID                  string    `json:"id"`
	AccountID           string    `json:"account_id"`
	Name                string    `json:"name"`
	Type                string    `json:"type"`
	Notes               string    `json:"notes"`
	CustomerBillingCode string    `json:"customer_billing_code"`
	ClusterID           string    `json:"cluster_id"`
	Version             string    `json:"version"`
	CACertificateBase64 string    `json:"ca_certificate_base64,omitempty"`
	ProvisionRecipeID   string    `json:"provision_recipe_id,omitempty"`
	CreatedAt           time.Time `json:"created_at"`
	ConnectionStrings   struct {
		Direct []string    `json:"direct"`
		CLI    interface{} `json:"cli,omitempty"`
		Maps   interface{} `json:"maps,omitempty"`
		SSH    interface{} `json:"ssh,omitempty"`
		Health interface{} `json:"health,omitempty"`
		Admin  interface{} `json:"admin,omitempty"`
	} `json:"connection_strings"`
	Links struct {
		ComposeWebUI struct {
			HREF      string `json:"href"`
			Templated bool   `json:"templated"`
		} `json:"compose_web_ui"`
	} `json:"_links"`
}

type Deployments

type Deployments []Deployment

type NewDeployment

type NewDeployment struct {
	Name       string `json:"name"`
	AccountID  string `json:"account_id"`
	Datacenter string `json:"datacenter"`
	Type       string `json:"type"`
	Version    string `json:"version,omitempty"`
	Units      int    `json:"units,omitempty"`
	CacheMode  bool   `json:"cache_mode,omitempty"`
	Notes      string `json:"notes,omitempty"`
}

type Recipe

type Recipe struct {
	ID                 string    `json:"id"`
	Name               string    `json:"name"`
	Template           string    `json:"template"`
	Status             string    `json:"status"` // can be running, waiting, complete or failed
	StatusDetail       string    `json:"status_detail"`
	AccountID          string    `json:"account_id"`
	DeploymentID       string    `json:"deployment_id"`
	ParentID           string    `json:"parent_id"`
	CreatedAt          time.Time `json:"created_at"`
	UpdatedAt          time.Time `json:"updated_at"`
	OperationsComplete int       `json:"operations_complete"`
	OperationsTotal    int       `json:"operations_total"`
	Embedded           struct {
		Recipes []Recipe `json:"recipes"`
	} `json:"_embedded"`
}

type Recipes

type Recipes []Recipe

func (Recipes) SortByCreatedAt

func (r Recipes) SortByCreatedAt()

func (Recipes) SortByUpdatedAt

func (r Recipes) SortByUpdatedAt()

type Scaling

type Scaling struct {
	AllocatedUnits     int    `json:"allocated_units,omitempty"`
	UsedUnits          int    `json:"used_units,omitempty"`
	StartingUnits      int    `json:"starting_units,omitempty"`
	MinimumUnits       int    `json:"minimum_units,omitempty"`
	MemoryPerUnitInMB  int    `json:"memory_per_unit_in_mb,omitempty"`
	StoragePerUnitInMB int    `json:"storage_per_unit_in_mb,omitempty"`
	UnitSizeInMB       int    `json:"unit_size_in_mb,omitempty"`
	UnitType           string `json:"unit_type,omitempty"`
}

type Version

type Version struct {
	Application string `json:"application"`
	Status      string `json:"status"`
	Preferred   bool   `json:"preferred"`
	Version     string `json:"version"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL