dockercloud

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Time allowed to write a message to the peer.
	WRITE_WAIT = 5 * time.Second
	// Time allowed to read the next pong message from the peer.
	PONG_WAIT = 10 * time.Second
	// Send pings to client with this period. Must be less than PONG_WAIT.
	PING_PERIOD = PONG_WAIT / 2
)

Variables

View Source
var (
	User       string
	Password   string
	ApiKey     string
	BasicAuth  string
	AuthHeader string
	BaseUrl    = "https://cloud.docker.com/"
	StreamUrl  = "wss://cloud.docker.com/"
)

Functions

func DockerCloudCall

func DockerCloudCall(url string, requestType string, requestBody []byte) ([]byte, error)

func Events

func Events(c chan Event, e chan error)

func IsAuthenticated

func IsAuthenticated() bool

func LoadAuth

func LoadAuth() error

func MockupResponse

func MockupResponse(response_file string) (string, error)

func SetBaseUrl

func SetBaseUrl() string

func SetUserAgent

func SetUserAgent(name string) string

Types

type AZ

type AZ struct {
	Available    bool   `json:"available"`
	Name         string `json:"name"`
	Resource_uri string `json:"resource_uri"`
}

func GetAZ

func GetAZ(az string) (AZ, error)

type AZListResponse

type AZListResponse struct {
	Meta    Meta `json:"meta"`
	Objects []AZ `json:"objects"`
}

func ListAZ

func ListAZ() (AZListResponse, error)

type Action

type Action struct {
	Action       string `json:"action"`
	Body         string `json:"body"`
	End_date     string `json:"end_date"`
	Ip           string `json:"ip"`
	Location     string `json:"location"`
	Logs         string `json:"logs"`
	Method       string `json:"method"`
	Object       string `json:"object"`
	Path         string `json:"path"`
	Resource_uri string `json:"resource_uri"`
	Start_date   string `json:"start_date"`
	State        string `json:"state"`
	Uuid         string `json:"uuid"`
}

func GetAction

func GetAction(uuid string) (Action, error)

func (*Action) Cancel

func (self *Action) Cancel() (Action, error)

func (*Action) GetLogs

func (self *Action) GetLogs(c chan Logs)

func (*Action) Retry

func (self *Action) Retry() (Action, error)

type ActionListResponse

type ActionListResponse struct {
	Meta    Meta     `json:"meta"`
	Objects []Action `json:"objects"`
}

func ListActions

func ListActions() (ActionListResponse, error)

type AuthConfig

type AuthConfig struct {
	Auths Config `json:"auths"`
}

type AuthObject

type AuthObject struct {
	Email string `json:"email"`
	Auth  string `json:"auth"`
}

type BuildSettings

type BuildSettings struct {
	Autobuild    bool   `json:"autobuild,omitempty"`
	Branch       string `json:"branch"`
	Dockerfile   string `json:"dockerfile"`
	Image        string `json:"image"`
	Resource_uri string `json:"resource_uri"`
	State        string `json:"state"`
	Tag          string `json:"tag"`
}

type BuildSource

type BuildSource struct {
	Autotest       string   `json:"autotest,omitempty"`
	Build_Settings []string `json:"build_settings,omitempty"`
	Image          []string `json:"Image"`
	Owner          string   `json:"owner,omitempty"`
	Repository     string   `json:"repository,omitempty"`
	Type           string   `json:"type,omitempty"`
	Uuid           string   `json:"uuid"`
}

type CListResponse

type CListResponse struct {
	Meta    Meta        `json:"meta"`
	Objects []Container `json:"objects"`
}

func ListContainers

func ListContainers() (CListResponse, error)

type Config

type Config map[string]AuthObject

type Container

type Container struct {
	Autodestroy         string              `json:"autodestroy"`
	Autorestart         string              `json:"autorestart"`
	Bindings            []ContainerBinding  `json:"bindings"`
	Container_envvars   []ContainerEnvvar   `json:"container_envvars"`
	Container_ports     []ContainerPortInfo `json:"container_ports"`
	Cpu_shares          int                 `json:"cpu_shares"`
	Deployed_datetime   string              `json:"deployed_datetime"`
	Destroyed_datetime  string              `json:"destroyed_datetime"`
	Entrypoint          string              `json:"entrypoint"`
	Exit_code           int                 `json:"exit_code"`
	Exit_code_message   string              `json:"exit_code_message"`
	Image_name          string              `json:"image_name"`
	Image_tag           string              `json:"image_tag"`
	Last_metric         Metric              `json:"last_metric"`
	Link_variables      map[string]string   `json:"link_variables"`
	Linked_to_container []ContainerLinkInfo `json:"linked_to_container"`
	Memory              int                 `json:"memory"`
	Name                string              `json:"name"`
	Net                 string              `json:"net"`
	Node                string              `json:"node"`
	Pid                 string              `json:"pid"`
	Private_ip          string              `json:"private_ip"`
	Privileged          bool                `json:"privileged"`
	Public_dns          string              `json:"public_dns"`
	Resource_uri        string              `json:"resource_uri"`
	Roles               []string            `json:"roles"`
	Run_command         string              `json:"run_command"`
	Service             string              `json:"service"`
	Started_datetime    string              `json:"started_datetime"`
	State               string              `json:"state"`
	Stopped_datetime    string              `json:"stopped_datetime"`
	Synchronized        bool                `json:"synchronized"`
	Uuid                string              `json:"uuid"`
	Working_dir         string              `json:"working_dir"`
}

func GetContainer

func GetContainer(uuid string) (Container, error)

func (*Container) Exec

func (self *Container) Exec(command string, c chan Exec)

func (*Container) Logs

func (self *Container) Logs(c chan Logs)

func (*Container) Redeploy

func (self *Container) Redeploy(reuse_volume ReuseVolumesOption) error

func (*Container) Run

func (self *Container) Run(command string, c chan Exec)

func (*Container) Start

func (self *Container) Start() error

func (*Container) Stop

func (self *Container) Stop() error

func (*Container) Terminate

func (self *Container) Terminate() error

type ContainerBinding

type ContainerBinding struct {
	Container_path string `json:"container_path"`
	Host_path      string `json:"host_path"`
	Rewritable     bool   `json:"rewritable"`
	Volume         string `json:"volume"`
}

type ContainerEnvvar

type ContainerEnvvar struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type ContainerLinkInfo

type ContainerLinkInfo struct {
	Endpoints      map[string]string `json:"endpoints"`
	From_container string            `json:"from_container"`
	Name           string            `json:"name"`
	To_container   string            `json:"to_container"`
}

type ContainerPortInfo

type ContainerPortInfo struct {
	Container  string `json:"container"`
	Inner_port int    `json:"inner_port"`
	Outer_port int    `json:"outer_port"`
	Protocol   string `json:"protocol"`
}

type Event

type Event struct {
	Type         string   `json:"type"`
	Action       string   `json:"action"`
	Parents      []string `json:"parents"`
	Resource_uri string   `json:"resource_uri"`
	State        string   `json:"state"`
}

type Exec

type Exec struct {
	Type       string `json:"type"`
	Output     string `json:"output"`
	StreamType string `json:"streamType"`
}

type IAM

type IAM struct {
	Instance_profile_name string `json:"instance_profile_name,omitempty"`
}

type LayerStruct

type LayerStruct struct {
	Author       string            `json:"author"`
	Creation     string            `json:"creation"`
	Docker_id    string            `json:"docker_id"`
	Entrypoint   string            `json:"entrypoint"`
	Envvars      []ContainerEnvvar `json:"envvars"`
	Ports        []Port            `json:"ports"`
	Resource_uri string            `json:"resource_uri"`
	Run_command  string            `json:"run_command"`
	Volumes      []VolumePath      `json:"volumes"`
}

type Logs

type Logs struct {
	Type       string `json:"type"`
	Log        string `json:"log"`
	StreamType string `json:"streamType"`
	Timestamp  int    `json:"timestamp"`
}

type Meta

type Meta struct {
	Limit      int    `json:"limit"`
	Next       string `json:"next"`
	TotalCount int    `json:"total_count"`
}

type Metric

type Metric struct {
	Cpu    float64 `json:"cpu"`
	Disk   float64 `json:"disk"`
	Memory float64 `json:"memory"`
}

type Network

type Network struct {
	Name string `json:"name"`
	CIDR string `json:"cidr"`
}

type Node

type Node struct {
	Availability_zone  string    `json:"availability_zone,omniempty"`
	Deployed_datetime  string    `json:"deployed_datetime,omitempty"`
	Destroyed_datetime string    `json:"destroyed_datetime,omitempty"`
	Docker_version     string    `json:"docker_version,omitempty"`
	Last_seen          string    `json:"last_seen,omitempty"`
	Node_cluster       string    `json:"node_cluster,omitempty"`
	Public_ip          string    `json:"public_ip,omitempty"`
	Private_ips        []Network `json:"private_ips,omitempty"`
	Region             string    `json:"region,omitempty"`
	Resource_uri       string    `json:"resource_uri,omitempty"`
	State              string    `json:"state,omitempty"`
	Tags               []NodeTag `json:"tags,omitempty"`
	Uuid               string    `json:"uuid,omitempty"`
}

func GetNode

func GetNode(uuid string) (Node, error)

func (*Node) Events

func (self *Node) Events(c chan NodeEvent)

func (*Node) Terminate

func (self *Node) Terminate() error

func (*Node) Update

func (self *Node) Update(createRequest Node) error

func (*Node) Upgrade

func (self *Node) Upgrade() error

type NodeCluster

type NodeCluster struct {
	Current_num_nodes  int            `json:"current_num_nodes"`
	Deployed_datetime  string         `json:"deployed_datetime"`
	Destroyed_datetime string         `json:"destroyed_datetime"`
	Disk               int            `json:"disk"`
	Name               string         `json:"name"`
	Nodes              []string       `json:"nodes"`
	NodeType           string         `json:"node_type"`
	Provider_options   ProviderOption `json:"provider_options"`
	Region             string         `json:"region"`
	Resource_uri       string         `json:"resource_uri"`
	State              string         `json:"state"`
	Tags               []NodeTag      `json:"tags,omitempty"`
	Target_num_nodes   int            `json:"target_num_nodes"`
	Uuid               string         `json:"uuid"`
}

func CreateNodeCluster

func CreateNodeCluster(createRequest NodeCreateRequest) (NodeCluster, error)

func GetNodeCluster

func GetNodeCluster(uuid string) (NodeCluster, error)

func (*NodeCluster) Deploy

func (self *NodeCluster) Deploy() error

func (*NodeCluster) Terminate

func (self *NodeCluster) Terminate() error

func (*NodeCluster) Update

func (self *NodeCluster) Update(createRequest NodeCreateRequest) error

func (*NodeCluster) Upgrade

func (self *NodeCluster) Upgrade() error

type NodeClusterListResponse

type NodeClusterListResponse struct {
	Meta    Meta          `json:"meta"`
	Objects []NodeCluster `json:"objects"`
}

func ListNodeClusters

func ListNodeClusters() (NodeClusterListResponse, error)

type NodeCreateRequest

type NodeCreateRequest struct {
	Disk             int       `json:"disk,omitempty"`
	Name             string    `json:"name,omitempty"`
	NodeType         string    `json:"node_type,omitempty"`
	Region           string    `json:"region,omitempty"`
	Target_num_nodes int       `json:"target_num_nodes,omitempty"`
	Tags             []NodeTag `json:"tags,omitempty"`
}

type NodeEvent

type NodeEvent struct {
	Type string `json:"type"`
	Log  string `json:"log"`
}

type NodeListResponse

type NodeListResponse struct {
	Meta    Meta   `json:"meta"`
	Objects []Node `json:"objects"`
}

func ListNodes

func ListNodes() (NodeListResponse, error)

type NodeTag

type NodeTag struct {
	Name string `json:"name"`
}

type NodeType

type NodeType struct {
	Available    bool     `json:"available"`
	Label        string   `json:"label"`
	Name         string   `json:"name"`
	Provider     string   `json:"provider"`
	Regions      []string `json:"regions"`
	Resource_uri string   `json:"resource_uri"`
}

func GetNodeType

func GetNodeType(provider string, name string) (NodeType, error)

type NodeTypeListResponse

type NodeTypeListResponse struct {
	Meta    Meta       `json:"meta"`
	Objects []NodeType `json:"objects"`
}

func ListNodeTypes

func ListNodeTypes() (NodeTypeListResponse, error)

type Port

type Port struct {
	Port     int    `json:"port"`
	Protocol string `json:"protocol"`
}

type Provider

type Provider struct {
	Available    bool     `json:"available"`
	Label        string   `json:"label"`
	Name         string   `json:"name"`
	Regions      []string `json:"regions"`
	Resource_uri string   `json:"resource_uri"`
}

func GetProvider

func GetProvider(name string) (Provider, error)

type ProviderListResponse

type ProviderListResponse struct {
	Meta    Meta       `json:"meta"`
	Objects []Provider `json:"objects"`
}

func ListProviders

func ListProviders() (ProviderListResponse, error)

type ProviderOption

type ProviderOption struct {
	Vpc VPC `json:"vpc,omitempty"`
	Iam IAM `json:"iam,omitempty"`
}

type Region

type Region struct {
	Available    bool     `json:"available"`
	Label        string   `json:"label"`
	Name         string   `json:"name"`
	Node_types   []string `json:"node_types"`
	Provider     string   `json:"provider"`
	Resource_uri string   `json:"resource_uri"`
}

func GetRegion

func GetRegion(id string) (Region, error)

type RegionListResponse

type RegionListResponse struct {
	Meta    Meta     `json:"meta"`
	Objects []Region `json:"objects"`
}

func ListRegions

func ListRegions() (RegionListResponse, error)

type Registry

type Registry struct {
	Host              string `json:"host"`
	Icon_url          string `json:"icon_url"`
	Is_ssl            bool   `json:"is_ssl"`
	Is_tutum_registry bool   `json:"is_tutum_registry"`
	Name              string `json:"name"`
	Resource_uri      string `json:"resource_uri"`
}

type RegistryListResponse

type RegistryListResponse struct {
	Meta    Meta       `json:"meta"`
	Objects []Registry `json:"objects"`
}

type Repository

type Repository struct {
	Build_Source     BuildSource `json:"build_source,omitempty"`
	Description      string      `json:"description"`
	Icon_url         string      `json:"icon_url"`
	In_use           bool        `json:"in_use"`
	Is_private_image bool        `json:"is_private_image"`
	Jumpstart        bool        `json:"jumpstart"`
	Last_build_date  string      `json:"last_build_date"`
	Name             string      `json:"name"`
	Public_url       string      `json:"public_url"`
	Registry         string      `json:"registry"`
	Resource_uri     string      `json:"resource_uri"`
	Star_count       int         `json:"star_count"`
	State            string      `json:"state"`
	Tags             []string    `json:"tags"`
}

func CreateRepository

func CreateRepository(createRequest RepositoryCreateRequest) (Repository, error)

func GetRepository

func GetRepository(name string) (Repository, error)

func (*Repository) Remove

func (self *Repository) Remove() error

func (*Repository) Update

func (self *Repository) Update(createRequest RepositoryCreateRequest) error

type RepositoryCreateRequest

type RepositoryCreateRequest struct {
	Name     string `json:"name,omitempty"`
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

type RepositoryListResponse

type RepositoryListResponse struct {
	Meta    Meta              `json:"meta"`
	Objects []RepositoryShort `json:"objects"`
}

func ListRepositories

func ListRepositories() (RepositoryListResponse, error)

type RepositoryShort

type RepositoryShort struct {
	Build_Source     string   `json:"build_source"`
	Description      string   `json:"description"`
	Icon_url         string   `json:"icon_url"`
	In_use           bool     `json:"in_use"`
	Is_private_image bool     `json:"is_private_image"`
	Jumpstart        bool     `json:"jumpstart"`
	Last_build_date  string   `json:"last_build_date"`
	Name             string   `json:"name"`
	Public_url       string   `json:"public_url"`
	Registry         string   `json:"registry"`
	Resource_uri     string   `json:"resource_uri"`
	Star_count       int      `json:"star_count"`
	State            string   `json:"state"`
	Tags             []string `json:"tags"`
}

type ReuseVolumesOption

type ReuseVolumesOption struct {
	Reuse bool
}

type SListResponse

type SListResponse struct {
	Meta    Meta      `json:"meta"`
	Objects []Service `json:"objects"`
}

func ListServices

func ListServices() (SListResponse, error)

type Service

type Service struct {
	Autodestroy            string              `json:"autodestroy"`
	Autoredeploy           bool                `json:"autoredeploy"`
	Autorestart            string              `json:"autorestart"`
	Bindings               []ServiceBinding    `json:"bindings"`
	Container_envvars      []ContainerEnvvar   `json:"container_envvars"`
	Container_ports        []ContainerPortInfo `json:"container_ports"`
	Containers             []string            `json:"containers"`
	Cpu_shares             int                 `json:"cpu_shares"`
	Current_num_containers int                 `json:"current_num_containers"`
	Deployed_datetime      string              `json:"deployed_datetime"`
	Deployment_strategy    string              `json:"deployment_strategy"`
	Destroyed_datetime     string              `json:"destroyed_datetime"`
	Entrypoint             string              `json:"entrypoint"`
	Image_name             string              `json:"image_name"`
	Image_tag              string              `json:"image_tag"`
	Link_variables         map[string]string   `json:"link_variables"`
	Linked_from_service    []ServiceLinkInfo   `json:"linked_from_service"`
	Linked_to_service      []ServiceLinkInfo   `json:"linked_to_service"`
	Memory                 int                 `json:"memory"`
	Name                   string              `json:"name"`
	Net                    string              `json:"net"`
	Pid                    string              `json:"pid"`
	Privileged             bool                `json:"privileged"`
	Public_dns             string              `json:"public_dns"`
	Resource_uri           string              `json:"resource_uri"`
	Roles                  []string            `json:"roles"`
	Run_command            string              `json:"run_command"`
	Running_num_containers int                 `json:"running_num_containers"`
	Sequential_deployment  bool                `json:"sequential_deployment"`
	Stack                  string              `json:"stack"`
	Started_datetime       string              `json:"started_datetime"`
	State                  string              `json:"state"`
	Stopped_datetime       string              `json:"stopped_datetime"`
	Stopped_num_containers int                 `json:"stopped_num_containers"`
	Synchronized           bool                `json:"synchronized"`
	Tags                   []ServiceTag        `json:"tags"`
	Target_num_containers  int                 `json:"target_num_containers"`
	Uuid                   string              `json:"uuid"`
	Working_dir            string              `json:"working_dir"`
}

func CreateService

func CreateService(createRequest ServiceCreateRequest) (Service, error)

func GetService

func GetService(uuid string) (Service, error)

func (*Service) CallTrigger

func (self *Service) CallTrigger(trigger_uuid string) (Trigger, error)

func (*Service) CreateTrigger

func (self *Service) CreateTrigger(createRequest TriggerCreateRequest) (Trigger, error)

func (*Service) DeleteTrigger

func (self *Service) DeleteTrigger(trigger_uuid string) error

func (*Service) GetTrigger

func (self *Service) GetTrigger(trigger_uuid string) (Trigger, error)

func (*Service) ListTriggers

func (self *Service) ListTriggers() (TriggerListResponse, error)

func (*Service) Logs

func (self *Service) Logs(c chan Logs)

func (*Service) Redeploy

func (self *Service) Redeploy(reuse_volume ReuseVolumesOption) error

func (*Service) Scale

func (self *Service) Scale() error

func (*Service) Start

func (self *Service) Start() error

func (*Service) StopService

func (self *Service) StopService() error

func (*Service) TerminateService

func (self *Service) TerminateService() error

func (*Service) Update

func (self *Service) Update(createRequest ServiceCreateRequest) error

type ServiceBinding

type ServiceBinding struct {
	Container_path string `json:"container_path"`
	Host_path      string `json:"host_path"`
	Rewritable     bool   `json:"rewritable"`
	Volumes_from   string `json:"volume_from"`
}

type ServiceCreateRequest

type ServiceCreateRequest struct {
	Autodestroy           string              `json:"autodestroy,omitempty"`
	Autoredeploy          bool                `json:"autoredeploy,omitempty"`
	Autorestart           string              `json:"autorestart,omitempty"`
	Bindings              []ServiceBinding    `json:"bindings,omitempty"`
	Container_envvars     []ContainerEnvvar   `json:"container_envvars,omitempty"`
	Container_ports       []ContainerPortInfo `json:"container_ports,omitempty"`
	Deployment_strategy   string              `json:"deployment_strategy,omitempty"`
	Entrypoint            string              `json:"entrypoint,omitempty"`
	Image                 string              `json:"image,omitempty"`
	Linked_to_service     []ServiceLinkInfo   `json:"linked_to_service,omitempty"`
	Name                  string              `json:"name,omitempty"`
	Net                   string              `json:"net,omitempty"`
	Pid                   string              `json:"pid,omitempty"`
	Privileged            bool                `json:"privileged,omitempty"`
	Roles                 []string            `json:"roles,omitempty"`
	Run_command           string              `json:"run_command,omitempty"`
	Sequential_deployment bool                `json:"sequential_deployment,omitempty"`
	Tags                  []string            `json:"tags,omitempty"`
	Target_num_containers int                 `json:"target_num_containers,omitempty"`
	Working_dir           string              `json:"working_dir,omitempty"`
}

type ServiceLinkInfo

type ServiceLinkInfo struct {
	From_service string `json:"from_service"`
	Name         string `json:"name"`
	To_service   string `json:"to_service"`
}

type ServiceTag

type ServiceTag struct {
	Name string `json:"name"`
}

type Stack

type Stack struct {
	Deployed_datetime  string   `json:"deployed_datetime"`
	Destroyed_datetime string   `json:"destroyed_datetime"`
	Name               string   `json:"name"`
	Resource_uri       string   `json:"resource_uri"`
	Services           []string `json:"services"`
	State              string   `json:"state"`
	Synchronized       bool     `json:"synchronized"`
	Uuid               string   `json:"uuid"`
}

func CreateStack

func CreateStack(createRequest StackCreateRequest) (Stack, error)

func GetStack

func GetStack(uuid string) (Stack, error)

func (*Stack) ExportStack

func (self *Stack) ExportStack() (string, error)

func (*Stack) Redeploy

func (self *Stack) Redeploy(reuse_volume ReuseVolumesOption) error

func (*Stack) Start

func (self *Stack) Start() error

func (*Stack) Stop

func (self *Stack) Stop() error

func (*Stack) Terminate

func (self *Stack) Terminate() error

func (*Stack) Update

func (self *Stack) Update(createRequest StackCreateRequest) error

type StackCreateRequest

type StackCreateRequest struct {
	Name     string                 `json:"name,omitempty"`
	Services []ServiceCreateRequest `json:"services,omitempty"`
}

type StackListResponse

type StackListResponse struct {
	Meta    Meta    `json:"meta"`
	Objects []Stack `json:"objects"`
}

func ListStacks

func ListStacks() (StackListResponse, error)

type Token

type Token struct {
	Token string `json:"token"`
}

type Trigger

type Trigger struct {
	Url          string `json:"url,omitempty"`
	Name         string `json:"name"`
	Operation    string `json:"operation"`
	Resource_uri string `json:"resource_uri,omitempty"`
}

type TriggerCreateRequest

type TriggerCreateRequest struct {
	Name      string `json:"name"`
	Operation string `json:"operation"`
}

type TriggerListResponse

type TriggerListResponse struct {
	Meta    Meta      `json:"meta"`
	Objects []Trigger `json:"objects"`
}

type VPC

type VPC struct {
	Id              string   `json:"id"`
	Subnets         []string `json:"subnets,omitempty"`
	Security_groups []string `json:"security_groups,omitempty"`
}

type VolumePath

type VolumePath struct {
	Container_path string `json:"container_path"`
}

Jump to

Keyboard shortcuts

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