composeapi

package module
v0.0.0-...-19a218f Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

README

gocomposeapi

A Go wrapper for the Compose API

This is a basic wrapper around the Compose API as documented on apidocs.compose.com

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"`
	Slug string `json:"slug"`
	Name string `json:"name"`
}

Account structure

type Alert

type Alert struct {
	CapsuleID    string `json:"capsule_id"`
	DeploymentID string `json:"deployment_id"`
	Message      string `json:"message"`
	Status       string `json:"status"`
}

Alert type which holds each Alert

type Alerts

type Alerts struct {
	Summary  string `json:"summary"`
	Embedded struct {
		Alerts []Alert `json:"alerts"`
	} `json:"_embedded"`
}

Alerts type which contains all the Alerts and a summary

type Backup

type Backup struct {
	ID           string `json:"id"`
	Deploymentid string `json:"deployment_id"`
	Name         string `json:"name"`
	Type         string `json:"type"`
	Status       string `json:"status"`
	DownloadLink string `json:"download_link"`
}

Backup structure

type Client

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

Client is a structure that holds session information for the API

func NewClient

func NewClient(apiToken string) (*Client, error)

NewClient returns a Client for further interaction with the API

func (*Client) CreateDeployment

func (c *Client) CreateDeployment(params DeploymentParams) (*Deployment, []error)

CreateDeployment creates a deployment

func (*Client) CreateDeploymentJSON

func (c *Client) CreateDeploymentJSON(params DeploymentParams) (string, []error)

CreateDeploymentJSON performs the call

func (*Client) DeprovisionDeployment

func (c *Client) DeprovisionDeployment(deploymentID string) (*Recipe, []error)

DeprovisionDeployment deletes a deployment

func (*Client) DeprovisionDeploymentJSON

func (c *Client) DeprovisionDeploymentJSON(deploymentID string) (string, []error)

DeprovisionDeploymentJSON performs the call

func (*Client) GetAccount

func (c *Client) GetAccount() (*Account, []error)

GetAccount Gets first Account struct from account endpoint

func (*Client) GetAccountJSON

func (c *Client) GetAccountJSON() (string, []error)

GetAccountJSON gets JSON string from endpoint

func (*Client) GetAlertsForDeployment

func (c *Client) GetAlertsForDeployment(deploymentid string) (*Alerts, []error)

GetAlertsForDeployment gets deployment recipe life

func (*Client) GetAlertsForDeploymentJSON

func (c *Client) GetAlertsForDeploymentJSON(deploymentid string) (string, []error)

GetAlertsForDeploymentJSON returns raw JSON for getAlertsforDeployment

func (*Client) GetBackupDetailsForDeployment

func (c *Client) GetBackupDetailsForDeployment(deploymentid string, backupid string) (*Backup, []error)

GetBackupDetailsForDeployment returns backup details for deployment

func (*Client) GetBackupDetailsForDeploymentJSON

func (c *Client) GetBackupDetailsForDeploymentJSON(deploymentid string, backupid string) (string, []error)

GetBackupDetailsForDeploymentJSON returns the details and download link for a backup

func (*Client) GetBackupsForDeployment

func (c *Client) GetBackupsForDeployment(deploymentid string) (*[]Backup, []error)

GetBackupsForDeployment returns backup details for deployment

func (*Client) GetBackupsForDeploymentJSON

func (c *Client) GetBackupsForDeploymentJSON(deploymentid string) (string, []error)

GetBackupsForDeploymentJSON returns backup details for deployment

func (*Client) GetClusterByName

func (c *Client) GetClusterByName(clusterName string) (*Cluster, []error)

GetClusterByName returns a cluster of a given name

func (*Client) GetClusters

func (c *Client) GetClusters() (*[]Cluster, []error)

GetClusters gets clusters available

func (*Client) GetClustersJSON

func (c *Client) GetClustersJSON() (string, []error)

GetClustersJSON gets clusters available

func (*Client) GetDatabases

func (c *Client) GetDatabases() (*[]Database, []error)

GetDatabases gets databases available as a Go struct

func (*Client) GetDatabasesJSON

func (c *Client) GetDatabasesJSON() (string, []error)

GetDatabasesJSON gets databases available as a string

func (*Client) GetDatacenters

func (c *Client) GetDatacenters() (*[]Datacenter, []error)

GetDatacenters gets datacenters available as a Go struct

func (*Client) GetDatacentersJSON

func (c *Client) GetDatacentersJSON() (string, []error)

GetDatacentersJSON gets datacenters available as a string

func (*Client) GetDeployment

func (c *Client) GetDeployment(deploymentid string) (*Deployment, []error)

GetDeployment returns deployment structure

func (*Client) GetDeploymentByName

func (c *Client) GetDeploymentByName(deploymentName string) (*Deployment, []error)

GetDeploymentByName returns a deployment of a given name

func (*Client) GetDeploymentJSON

func (c *Client) GetDeploymentJSON(deploymentid string) (string, []error)

GetDeploymentJSON returns raw deployment

func (*Client) GetDeployments

func (c *Client) GetDeployments() (*[]Deployment, []error)

GetDeployments returns deployment structure

func (*Client) GetDeploymentsJSON

func (c *Client) GetDeploymentsJSON() (string, []error)

GetDeploymentsJSON returns raw deployment

func (*Client) GetRecipe

func (c *Client) GetRecipe(recipeid string) (*Recipe, []error)

GetRecipe gets status of Recipe

func (*Client) GetRecipeJSON

func (c *Client) GetRecipeJSON(recipeid string) (string, []error)

GetRecipeJSON Gets raw JSON for recipeid

func (*Client) GetRecipesForDeployment

func (c *Client) GetRecipesForDeployment(deploymentid string) (*[]Recipe, []error)

GetRecipesForDeployment gets deployment recipe life

func (*Client) GetRecipesForDeploymentJSON

func (c *Client) GetRecipesForDeploymentJSON(deploymentid string) (string, []error)

GetRecipesForDeploymentJSON returns raw JSON for getRecipesforDeployment

func (*Client) GetScalings

func (c *Client) GetScalings(deploymentid string) (*Scalings, []error)

GetScalings returns deployment structure

func (*Client) GetScalingsJSON

func (c *Client) GetScalingsJSON(deploymentid string) (string, []error)

GetScalingsJSON returns raw scalings

func (*Client) GetUser

func (c *Client) GetUser() (*User, []error)

GetUser Gets information about user

func (*Client) GetUserJSON

func (c *Client) GetUserJSON() (string, []error)

GetUserJSON returns user JSON string

func (*Client) GetVersionsForDeployment

func (c *Client) GetVersionsForDeployment(deploymentid string) (*[]VersionTransition, []error)

GetVersionsForDeployment gets deployment recipe life

func (*Client) GetVersionsForDeploymentJSON

func (c *Client) GetVersionsForDeploymentJSON(deploymentid string) (string, []error)

GetVersionsForDeploymentJSON returns raw JSON for getVersionsforDeployment

func (*Client) RestoreBackup

func (c *Client) RestoreBackup(params RestoreBackupParams) (*Deployment, []error)

RestoreBackup creates a deployment

func (*Client) RestoreBackupJSON

func (c *Client) RestoreBackupJSON(params RestoreBackupParams) (string, []error)

RestoreBackupJSON performs the call

func (*Client) SetAPIToken

func (c *Client) SetAPIToken(newtoken string)

SetAPIToken overrides the API token

func (*Client) SetScalings

func (c *Client) SetScalings(scalingsParams ScalingsParams) (*Recipe, []error)

SetScalings sets scale and returns recipe for scaling

func (*Client) SetScalingsJSON

func (c *Client) SetScalingsJSON(params ScalingsParams) (string, []error)

SetScalingsJSON sets JSON scaling and returns string respones

func (*Client) StartBackupForDeployment

func (c *Client) StartBackupForDeployment(deploymentid string) (*Recipe, []error)

StartBackupForDeployment starts backup and returns recipe

func (*Client) StartBackupForDeploymentJSON

func (c *Client) StartBackupForDeploymentJSON(deploymentid string) (string, []error)

StartBackupForDeploymentJSON starts backup and returns JSON response

type Cluster

type Cluster struct {
	ID          string    `json:"id"`
	AccountID   string    `json:"account_id"`
	Name        string    `json:"name"`
	Type        string    `json:"type"`
	Provider    string    `json:"provider"`
	Region      string    `json:"region"`
	Multitenant bool      `json:"multitenant"`
	AccountSlug string    `json:"account_slug"`
	CreatedAt   time.Time `json:"created_at"`
	Subdomain   string    `json:"subdomain"`
}

Cluster structure

type ConnectionStrings

type ConnectionStrings struct {
	Health   string      `json:"health,omitempty"`
	SSH      string      `json:"ssh,omitempty"`
	Admin    string      `json:"admin,omitempty"`
	SSHAdmin string      `json:"ssh_admin,omitempty"`
	CLI      []string    `json:"cli,omitempty"`
	Direct   []string    `json:"direct,omitempty"`
	Misc     interface{} `json:"misc,omitempty"`
}

ConnectionStrings structure, part of the Deployment struct

type CreateDeploymentParams

type CreateDeploymentParams struct {
	Deployment DeploymentParams `json:"deployment"`
}

CreateDeploymentParams Parameters to be completed before creating a deployment

type Database

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

Database structure

type Datacenter

type Datacenter struct {
	Region   string `json:"region"`
	Provider string `json:"provider"`
	Slug     string `json:"slug"`
}

Datacenter structure

type Deployment

type Deployment struct {
	ID                  string            `json:"id"`
	Name                string            `json:"name"`
	Type                string            `json:"type"`
	CreatedAt           time.Time         `json:"created_at"`
	ProvisionRecipeID   string            `json:"provision_recipe_id,omitempty"`
	CACertificateBase64 string            `json:"ca_certificate_base64,omitempty"`
	Connection          ConnectionStrings `json:"connection_strings,omitempty"`
	Notes               string            `json:"notes,omitempty"`
	CustomerBillingCode string            `json:"customer_billing_code,omitempty"`
	Links               Links             `json:"_links"`
}

Deployment structure

type DeploymentParams

type DeploymentParams struct {
	Name         string `json:"name"`
	AccountID    string `json:"account_id"`
	ClusterID    string `json:"cluster_id,omitempty"`
	Datacenter   string `json:"datacenter,omitempty"`
	DatabaseType string `json:"type"`
	Version      string `json:"version,omitempty"`
	Units        int    `json:"units,omitempty"`
	SSL          bool   `json:"ssl,omitempty"`
	WiredTiger   bool   `json:"wired_tiger,omitempty"`
}

DeploymentParams core parameters for a new deployment

type Errors

type Errors struct {
	Error map[string][]string `json:"errors,omitempty"`
}

Errors struct for parsing error returns

type Link struct {
	HREF      string `json:"href"`
	Templated bool   `json:"templated"`
}

Link structure for JSON+HAL links

type Links struct {
	ComposeWebUILink Link `json:"compose_web_ui"`
	ScalingsLink     Link `json:"scalings"`
	BackupsLink      Link `json:"backups"`
	AlertsLink       Link `json:"alerts"`
	ClusterLink      Link `json:"cluster"`
}

Links structure, part of the Deployment struct

type Recipe

type Recipe struct {
	ID           string    `json:"id"`
	Template     string    `json:"template"`
	Status       string    `json:"status"`
	StatusDetail string    `json:"status_detail"`
	AccountID    string    `json:"account_id"`
	DeploymentID string    `json:"deployment_id"`
	Name         string    `json:"name"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
	Embedded     struct {
		Recipes []Recipe `json:"recipes"`
	} `json:"_embedded"`
}

Recipe structure

type RestoreBackupParams

type RestoreBackupParams struct {
	DeploymentID string
	BackupID     string
	Name         string
	ClusterID    string
	Datacenter   string
	Version      string
	SSL          bool
}

RestoreBackupParams Parameters to be completed before creating a deployment

type Scalings

type Scalings struct {
	AllocatedUnits int `json:"allocated_units"`
	UsedUnits      int `json:"used_units"`
	StartingUnits  int `json:"starting_units"`
	MinimumUnits   int `json:"minimum_units"`
	UnitSizeInMB   int `json:"unit_size_in_mb"`
}

Scalings represents the used, allocated, starting and minimum unit scale of a deployment

type ScalingsParams

type ScalingsParams struct {
	DeploymentID string
	Units        int
}

ScalingsParams represents the parameters needed to scale a deployment

type User

type User struct {
	ID string `json:"id"`
}

User structure

type Version

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

Version structure

type VersionTransition

type VersionTransition struct {
	Application string `json:"application"`
	Method      string `json:"method"`
	FromVersion string `json:"from_version"`
	ToVersion   string `json:"to_version"`
}

VersionTransition a struct wrapper for version transition information

Jump to

Keyboard shortcuts

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