dockerapi

package
v0.0.0-...-157ed56 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2014 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("Not found")
	ErrConflict = errors.New("Already Exist")
)
View Source
var CommandExecutors = map[string]DockerExec{
	"DockerCommandExec": DockerCommandExec{},
}

Functions

func DeleteItem

func DeleteItem(inta myint, val int) []int

func FindNextNum

func FindNextNum(inta myint, minnum, maxnum int) int

Types

type AgentManager

type AgentManager struct {
	Dispatcher brokerapi.DispatcherInterface
	// contains filtered or unexported fields
}

func NewAgentManager

func NewAgentManager(config BrokerConfiguration, dispatcher brokerapi.DispatcherInterface) (*AgentManager, error)

func (*AgentManager) AddCerts

func (am *AgentManager) AddCerts(certs brokerapi.BrokerCerts) error

func (*AgentManager) AddImage

func (am *AgentManager) AddImage(catalog string, img brokerapi.ImageDefinition) error

func (*AgentManager) Catalog

func (am *AgentManager) Catalog() (brokerapi.Catalog, error)

func (*AgentManager) DeleteCerts

func (am *AgentManager) DeleteCerts(host string) error

func (*AgentManager) DeleteImage

func (am *AgentManager) DeleteImage(catalog, name string) error

func (*AgentManager) GetCerts

func (am *AgentManager) GetCerts(host string) ([]brokerapi.BrokerCerts, error)

func (*AgentManager) GetImage

func (am *AgentManager) GetImage(catalog, name string) ([]brokerapi.ImageDefinition, error)

func (*AgentManager) GetServiceAgent

func (am *AgentManager) GetServiceAgent(instanceid string) (brokerapi.BrokerService, error)

func (*AgentManager) Ping

type BrokerConfiguration

type BrokerConfiguration struct {
	Services    brokerapi.ServiceDefinition
	Persister   brokerapi.Persister
	ListenIP    string
	Port        int
	Dispatcher  string
	BrokerCerts []brokerapi.BrokerCerts
}

func NewConfiguration

func NewConfiguration(configFile string) (*BrokerConfiguration, error)

func (*BrokerConfiguration) AddOrUpdateCertificates

func (cm *BrokerConfiguration) AddOrUpdateCertificates(certs brokerapi.BrokerCerts) error

func (*BrokerConfiguration) AddOrUpdateImageDefinition

func (cm *BrokerConfiguration) AddOrUpdateImageDefinition(catalog string, img brokerapi.ImageDefinition) error

func (*BrokerConfiguration) DeleteCertificate

func (cm *BrokerConfiguration) DeleteCertificate(name string) error

func (*BrokerConfiguration) DeleteImageDefinition

func (cm *BrokerConfiguration) DeleteImageDefinition(catalog, name string) error

func (*BrokerConfiguration) GetCertificates

func (cm *BrokerConfiguration) GetCertificates(name string) ([]brokerapi.BrokerCerts, error)

func (*BrokerConfiguration) GetImageDefinition

func (cm *BrokerConfiguration) GetImageDefinition(imagename string) *brokerapi.ImageDefinition

func (*BrokerConfiguration) GetImageDefinitions

func (cm *BrokerConfiguration) GetImageDefinitions(name string) ([]brokerapi.ImageDefinition, error)

func (*BrokerConfiguration) GetOpts

func (cm *BrokerConfiguration) GetOpts() brokerapi.Options

func (*BrokerConfiguration) GetSSL

func (cm *BrokerConfiguration) GetSSL(host string) *SSLConfig

func (*BrokerConfiguration) GetServices

func (cm *BrokerConfiguration) GetServices() []brokerapi.Service

func (*BrokerConfiguration) MarshalImageMaps

func (cm *BrokerConfiguration) MarshalImageMaps(imgdef brokerapi.ImageDefinition) (string, string, error)

func (*BrokerConfiguration) UseSSL

func (cm *BrokerConfiguration) UseSSL(host string) bool

type CFError

type CFError struct {
	ErrorCode int
	ErrorDesc string
}

func (*CFError) Code

func (cfe *CFError) Code() int

func (*CFError) Error

func (cfe *CFError) Error() string

type Container

type Container struct {
	Id         string
	Names      []string
	Image      string
	Command    string
	Created    int
	Status     string
	Ports      []Port
	SizeRw     int
	SizeRootFs int
}

type ContainerConfig

type ContainerConfig struct {
	Hostname        string
	Domainname      string
	User            string
	Memory          int
	MemorySwap      int
	CpuShares       int
	Cpuset          string
	AttachStdin     bool
	AttachStdout    bool
	AttachStderr    bool
	PortSpecs       []string
	ExposedPorts    map[string]struct{}
	Tty             bool
	OpenStdin       bool
	StdinOnce       bool
	Env             []string
	Cmd             []string
	Image           string
	Volumes         map[string]struct{}
	WorkingDir      string
	Entrypoint      []string
	NetworkDisabled bool
	OnBuild         []string
}

func (*ContainerConfig) CreateContainer

func (config *ContainerConfig) CreateContainer(docker DockerClient, name string) (string, error)

type ContainerInfo

type ContainerInfo struct {
	Id      string
	Created string
	Path    string
	Name    string
	Args    []string
	Config  *ContainerConfig
	State   struct {
		Running   bool
		Pid       int
		ExitCode  int
		StartedAt string
		Ghost     bool
	}
	Image           string
	NetworkSettings struct {
		IpAddress   string
		IpPrefixLen int
		Gateway     string
		Bridge      string
		Ports       map[string][]PortBinding
	}
	SysInitPath    string
	ResolvConfPath string
	Volumes        map[string]string
	HostConfig     HostConfig
}

type CopyFromContainerOptions

type CopyFromContainerOptions struct {
	Resource string
}

type DockerClient

type DockerClient struct {
	URL          *url.URL
	HTTPClient   *http.Client
	ServiceAgent brokerapi.ServiceAgent
	// contains filtered or unexported fields
}

func NewDockerClient

func NewDockerClient(sa brokerapi.ServiceAgent, config BrokerConfiguration) (*DockerClient, error)

func (*DockerClient) Bind

func (*DockerClient) Catalog

func (client *DockerClient) Catalog() (brokerapi.Catalog, error)

func (*DockerClient) Deprovision

func (client *DockerClient) Deprovision(pr brokerapi.ProvisioningRequest) error

func (*DockerClient) DoRequest

func (client *DockerClient) DoRequest(method string, path string, body []byte) ([]byte, error)

func (*DockerClient) InspectContainer

func (client *DockerClient) InspectContainer(id string) (ContainerInfo, error)

func (*DockerClient) InspectImage

func (docker *DockerClient) InspectImage(imageName string) (ImageConfig, error)

func (*DockerClient) Provision

func (client *DockerClient) Provision(pr brokerapi.ProvisioningRequest) (string, error)

func (*DockerClient) ReadFile

func (client *DockerClient) ReadFile(id, filename string) (map[string]interface{}, error)

func (*DockerClient) RemoveContainer

func (client *DockerClient) RemoveContainer(id string) error

func (*DockerClient) StartContainer

func (client *DockerClient) StartContainer(id string, config *HostConfig) error

func (*DockerClient) StopContainer

func (client *DockerClient) StopContainer(id string, timeout int) error

func (*DockerClient) Unbind

func (client *DockerClient) Unbind(br brokerapi.BindingRequest) error

type DockerCommandExec

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

func (DockerCommandExec) Bind

func (dcexec DockerCommandExec) Bind() (map[string]interface{}, error)

func (DockerCommandExec) Deprovision

func (dcexec DockerCommandExec) Deprovision() (map[string]interface{}, error)

func (*DockerCommandExec) ExecIn

func (dcexec *DockerCommandExec) ExecIn(command []string) (map[string]interface{}, error)

func (DockerCommandExec) Init

func (dcexec DockerCommandExec) Init(client *DockerClient, cId string, image *brokerapi.ImageDefinition) DockerExec

func (DockerCommandExec) Provision

func (dcexec DockerCommandExec) Provision() (map[string]interface{}, error)

func (DockerCommandExec) Unbind

func (dcexec DockerCommandExec) Unbind(serviceurl string) (map[string]interface{}, error)

type DockerExec

type DockerExec interface {
	Provision() (map[string]interface{}, error)
	Bind() (map[string]interface{}, error)
	Unbind(serviceurl string) (map[string]interface{}, error)
	Deprovision() (map[string]interface{}, error)

	Init(*DockerClient, string, *brokerapi.ImageDefinition) DockerExec
}

type HostConfig

type HostConfig struct {
	Binds           []string
	ContainerIDFile string
	LxcConf         []map[string]string
	Privileged      bool
	PortBindings    map[string][]PortBinding
	Links           []string
	PublishAllPorts bool
	Dns             []string
	DnsSearch       []string
	VolumesFrom     []string
	NetworkMode     string
	RestartPolicy   RestartPolicy
}

type ImageConfig

type ImageConfig struct {
	ID              string
	Parent          string
	Comment         string
	Created         time.Time
	Container       string
	ContainerConfig ImageRuntimeConfig
	DockerVersion   string
	Author          string
	Config          *ImageRuntimeConfig
	Architecture    string
	OS              string
	Size            int64
}

type ImageInfo

type ImageInfo struct {
	RepoTags    []string
	Id          string
	Parentid    string
	Created     uint64
	Size        uint64
	Virtualsize uint64
}

func FindImage

func FindImage(docker DockerClient, tag string) (ImageInfo, error)

func ListAll

func ListAll(docker DockerClient) ([]ImageInfo, error)

func (*ImageInfo) GetRepoTags

func (imageinfo *ImageInfo) GetRepoTags() []string

type ImageRuntimeConfig

type ImageRuntimeConfig struct {
	Hostname        string
	Domainname      string
	User            string
	Memory          int64  // Memory limit (in bytes)
	MemorySwap      int64  // Total memory usage (memory + swap); set `-1' to disable swap
	CpuShares       int64  // CPU shares (relative weight vs. other containers)
	Cpuset          string // Cpuset 0-2, 0,1
	AttachStdin     bool
	AttachStdout    bool
	AttachStderr    bool
	PortSpecs       []string // Deprecated - Can be in the format of 8080/tcp
	ExposedPorts    map[string]struct{}
	Tty             bool // Attach standard streams to a tty, including stdin if it is not closed.
	OpenStdin       bool // Open stdin
	StdinOnce       bool // If true, close stdin after the 1 attached client disconnects.
	Env             []string
	Cmd             []string
	Image           string // Name of the image as it was passed by the operator (eg. could be symbolic)
	Volumes         map[string]struct{}
	WorkingDir      string
	Entrypoint      []string
	NetworkDisabled bool
	OnBuild         []string
}

type Port

type Port struct {
	PrivatePort int
	PublicPort  int
	Type        string
}

type PortBinding

type PortBinding struct {
	HostIp   string
	HostPort string
}

type RespContainersCreate

type RespContainersCreate struct {
	Id       string
	Warnings []string
}

type RestartPolicy

type RestartPolicy struct {
	Name     string
	MaxRetry int `json:"MaximumRetryCount"`
}

func RestartOnFailure

func RestartOnFailure(maxRetry int) RestartPolicy

type SSLConfig

type SSLConfig struct {
	ClientCert []byte
	ClientKey  []byte
	CA         []byte
}

type SimpleDispatcher

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

func NewSimpleDispatcher

func NewSimpleDispatcher(config BrokerConfiguration) *SimpleDispatcher

func (*SimpleDispatcher) NewBrokerService

func (sd *SimpleDispatcher) NewBrokerService() (brokerapi.BrokerService, error)

Jump to

Keyboard shortcuts

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