harmonyclient

package module
v0.0.0-...-bc27253 Latest Latest
Warning

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

Go to latest
Published: May 15, 2015 License: MIT Imports: 10 Imported by: 3

README

harmony-client-go

Harmony's go client.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// The client configuration
	Config Config
	// contains filtered or unexported fields
}

Client the main Harmony Client

func NewHarmonyClient

func NewHarmonyClient(conf Config) (c *Client, err error)

NewHarmonyClient returns a new Harmony Client instance

func (*Client) Container

func (C *Client) Container(ID string) (*Container, error)

Container gets a container by ID

func (*Client) ContainerByName

func (C *Client) ContainerByName(name string) (*Container, error)

ContainerByName will fetch a container by its name

func (*Client) ContainerDns

func (C *Client) ContainerDns(ID string) (*ContainerDns, error)

ContainerDns gets an DNS resource by ID

func (*Client) ContainerEnv

func (C *Client) ContainerEnv(ID string) (*ContainerEnv, error)

ContainerEnv gets an env resource by ID

func (*Client) ContainerVolume

func (C *Client) ContainerVolume(ID string) (*ContainerVolume, error)

ContainerVolume gets a volume resource by ID

func (*Client) Containers

func (C *Client) Containers() (*[]Container, error)

Containers gets a list of all the containers

func (*Client) ContainersAdd

func (C *Client) ContainersAdd(c *Container) (*Container, error)

ContainersAdd will create a new Container resource

func (*Client) ContainersCIDUpdate

func (C *Client) ContainersCIDUpdate(containerID, cID string) error

FIXME: ref to json-api/json-api#588 ContainersCIDUpdate will update a container with the propper cID

func (*Client) ContainersEnabledUpdate

func (C *Client) ContainersEnabledUpdate(containerID string, enabled bool) error

FIXME: ref to json-api/json-api#588 ContainersEnabledUpdate will update a container's enabled state

func (*Client) Machine

func (C *Client) Machine(ID string) (*Machine, error)

Machine gets a machine by ID

func (*Client) MachineByName

func (C *Client) MachineByName(name string) (*Machine, error)

MachineByName will fetch a machine by its name

func (*Client) Machines

func (C *Client) Machines() (*[]Machine, error)

Machines gets a list of all the machines

func (*Client) MachinesAdd

func (C *Client) MachinesAdd(c *Machine) (*Machine, error)

MachinesAdd will create a Harmony Machine resource

func (*Client) MachinesEsClientIdUpdate

func (C *Client) MachinesEsClientIdUpdate(machineID, es_client_id string) error

MachinesEsClientIdUpdate will update a machine's es_client_id

type Config

type Config struct {
	APIHost       string
	APIVersion    string
	APITestingURL string
	APIVerifySSL  bool
}

Config the config construct

type Container

type Container struct {
	ID          string `jsonapi:"name=id"`
	MachineID   string `jsonapi:"name=machine_id"`
	CID         string `jsonapi:"name=cid"`
	Name        string `jsonapi:"name=name"`
	Hostname    string `jsonapi:"name=hostname"`
	Restart     string `jsonapi:"name=restart"`
	Image       string `jsonapi:"name=image"`
	EntryPoint  string `jsonapi:"name=entry_point"`
	Cmd         string `jsonapi:"name=cmd"`
	Tty         bool   `jsonapi:"name=enabled"`
	Interactive bool   `jsonapi:"name=interactive"`
	Enabled     bool   `jsonapi:"name=enabled"`
	CreatedAt   string `jsonapi:"name=created_at"`
	UpdatedAt   string `jsonapi:"name=updated_at"`

	ContainerDns          []ContainerDns     `json:"-"`
	ContainerDnsIDs       []string           `json:"-"`
	ContainerEnvs         []ContainerEnv     `json:"-"`
	ContainerEnvsIDs      []string           `json:"-"`
	ContainerExposes      []ContainerExpose  `json:"-"`
	ContainerExposesIDs   []string           `json:"-"`
	ContainerLinks        []ContainerLink    `json:"-"`
	ContainerLinksIDs     []string           `json:"-"`
	ContainerNics         []ContainerNic     `json:"-"`
	ContainerNicsIDs      []string           `json:"-"`
	ContainerPublishes    []ContainerPublish `json:"-"`
	ContainerPublishesIDs []string           `json:"-"`
	ContainerVolumes      []ContainerVolume  `json:"-"`
	ContainerVolumesIDs   []string           `json:"-"`
	Machine               Machine            `json:"-"`
}

Container is a generic database user

func (*Container) AddToManyIDs

func (c *Container) AddToManyIDs(name string, IDs []string) error

AddToManyIDs adds some new sweets that a users loves so much

func (*Container) DeleteToManyIDs

func (c *Container) DeleteToManyIDs(name string, IDs []string) error

DeleteToManyIDs removes some sweets from a users because they made him very sick

func (Container) GetID

func (c Container) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (Container) GetReferencedIDs

func (c Container) GetReferencedIDs() []jsonapi.ReferenceID

GetReferencedIDs to satisfy the jsonapi.MarshalLinkedRelations interface

func (Container) GetReferencedStructs

func (c Container) GetReferencedStructs() []jsonapi.MarshalIdentifier

GetReferencedStructs to satisfy the jsonapi.MarhsalIncludedRelations interface

func (Container) GetReferences

func (c Container) GetReferences() []jsonapi.Reference

GetReferences to satisfy the jsonapi.MarshalReferences interface

func (*Container) SetID

func (c *Container) SetID(id string) error

SetID to satisfy jsonapi.UnmarshalIdentifier interface

func (*Container) SetToManyReferenceIDs

func (c *Container) SetToManyReferenceIDs(name string, IDs []string) error

SetToManyReferenceIDs sets the sweets reference IDs and satisfies the jsonapi.UnmarshalToManyRelations interface

func (*Container) SetToOneReferenceID

func (c *Container) SetToOneReferenceID(name, ID string) error

SetToOneReferenceID sets the reference ID and satifices jsonapi.UnmarshalToOneRelations interface

type ContainerDns

type ContainerDns struct {
	ID          string `jsonapi:"name=id"`
	ContainerID string `jsonapi:"name=container_id"`
	Nameserver  string `jsonapi:"name=nameserver"`
}

ContainerDns holds a container's dns resource

func (ContainerDns) GetID

func (c ContainerDns) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (*ContainerDns) SetID

func (c *ContainerDns) SetID(id string) error

SetID to satisfy jsonapi.UnmarshalIdentifier interface

func (*ContainerDns) SetToOneReferenceID

func (c *ContainerDns) SetToOneReferenceID(name, ID string) error

SetToOneReferenceID sets the reference ID and satifices jsonapi.UnmarshalToOneRelations interface

type ContainerEnv

type ContainerEnv struct {
	ID          string `jsonapi:"name=id"`
	ContainerID string `jsonapi:"name=container_id"`
	Name        string `jsonapi:"name=name"`
	Value       string `jsonapi:"name=value"`
}

ContainerEnv holds a container's environment variable

func (ContainerEnv) GetID

func (c ContainerEnv) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (*ContainerEnv) SetID

func (c *ContainerEnv) SetID(id string) error

SetID to satisfy jsonapi.UnmarshalIdentifier interface

func (*ContainerEnv) SetToOneReferenceID

func (c *ContainerEnv) SetToOneReferenceID(name, ID string) error

SetToOneReferenceID sets the reference ID and satifices jsonapi.UnmarshalToOneRelations interface

type ContainerExpose

type ContainerExpose struct {
	ID          string `jsonapi:"name=id"`
	ContainerID string `jsonapi:"name=container_id"`
	RangeStart  string `jsonapi:"name=range_start"`
	RangeEnd    string `jsonapi:"name=range_end"`
}

ContainerExpose holds a container's expose resource

func (ContainerExpose) GetID

func (c ContainerExpose) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (*ContainerExpose) SetID

func (c *ContainerExpose) SetID(id string) error

SetID to satisfy jsonapi.UnmarshalIdentifier interface

func (*ContainerExpose) SetToOneReferenceID

func (c *ContainerExpose) SetToOneReferenceID(name, ID string) error

SetToOneReferenceID sets the reference ID and satifices jsonapi.UnmarshalToOneRelations interface

type ContainerLink struct {
	ID              string `jsonapi:"name=id"`
	ContainerID     string `jsonapi:"name=container_id"`
	ContainerFromID string `jsonapi:"name=container_from_id"`
}

ContainerLink holds a container's link resource

func (ContainerLink) GetID

func (c ContainerLink) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (*ContainerLink) SetID

func (c *ContainerLink) SetID(id string) error

SetID to satisfy jsonapi.UnmarshalIdentifier interface

func (*ContainerLink) SetToOneReferenceID

func (c *ContainerLink) SetToOneReferenceID(name, ID string) error

SetToOneReferenceID sets the reference ID and satifices jsonapi.UnmarshalToOneRelations interface

type ContainerNic

type ContainerNic struct {
	ID           string `jsonapi:"name=id"`
	ContainerID  string `jsonapi:"name=container_id"`
	BridgeDev    string `jsonapi:"name=bridge_dev"`
	ContainerDev string `jsonapi:"name=container_dev"`
	IP           string `jsonapi:"name=ip"`
	Netmask      string `jsonapi:"name=netmask"`
	Gateway      string `jsonapi:"name=gateway"`
}

ContainerNic holds a container's nic

func (ContainerNic) GetID

func (c ContainerNic) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (*ContainerNic) SetID

func (c *ContainerNic) SetID(id string) error

SetID to satisfy jsonapi.UnmarshalIdentifier interface

func (*ContainerNic) SetToOneReferenceID

func (c *ContainerNic) SetToOneReferenceID(name, ID string) error

SetToOneReferenceID sets the reference ID and satifices jsonapi.UnmarshalToOneRelations interface

type ContainerPublish

type ContainerPublish struct {
	ID            string `jsonapi:"name=id"`
	ContainerID   string `jsonapi:"name=container_id"`
	ContainerPort string `jsonapi:"name=container_port"`
	HostPort      string `jsonapi:"name=host_port"`
	IP            string `jsonapi:"name=ip"`
}

ContainerPublish holds a container's publish resource

func (ContainerPublish) GetID

func (c ContainerPublish) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (*ContainerPublish) SetID

func (c *ContainerPublish) SetID(id string) error

SetID to satisfy jsonapi.UnmarshalIdentifier interface

func (*ContainerPublish) SetToOneReferenceID

func (c *ContainerPublish) SetToOneReferenceID(name, ID string) error

SetToOneReferenceID sets the reference ID and satifices jsonapi.UnmarshalToOneRelations interface

type ContainerVolume

type ContainerVolume struct {
	ID            string `jsonapi:"name=id"`
	ContainerID   string `jsonapi:"name=container_id"`
	PathHost      string `jsonapi:"name=path_host"`
	PathContainer string `jsonapi:"name=path_container"`
}

ContainerVolume holds a container's volume

func (ContainerVolume) GetID

func (c ContainerVolume) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (*ContainerVolume) SetID

func (c *ContainerVolume) SetID(id string) error

SetID to satisfy jsonapi.UnmarshalIdentifier interface

func (*ContainerVolume) SetToOneReferenceID

func (c *ContainerVolume) SetToOneReferenceID(name, ID string) error

SetToOneReferenceID sets the reference ID and satifices jsonapi.UnmarshalToOneRelations interface

type Machine

type Machine struct {
	ID           string `jsonapi:"name=id"`
	Name         string `jsonapi:"name=name"`
	Hostname     string `jsonapi:"name=hostname"`
	IP           string `jsonapi:"name=ip"`
	Es_client_id string `jsonapi:"name=es_client_id"`
	CreatedAt    string `jsonapi:"name=created_at"`
	UpdatedAt    string `jsonapi:"name=updated_at"`

	Containers   []Container `json:"-"`
	ContainerIDs []string    `json:"-"`
}

Machine holds a Harmony Machine

func (*Machine) AddToManyIDs

func (m *Machine) AddToManyIDs(name string, IDs []string) error

AddToManyIDs adds some new sweets that a users loves so much

func (*Machine) DeleteToManyIDs

func (m *Machine) DeleteToManyIDs(name string, IDs []string) error

DeleteToManyIDs removes some sweets from a users because they made him very sick

func (Machine) GetID

func (m Machine) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (Machine) GetReferencedIDs

func (m Machine) GetReferencedIDs() []jsonapi.ReferenceID

GetReferencedIDs to satisfy the jsonapi.MarshalLinkedRelations interface

func (Machine) GetReferencedStructs

func (m Machine) GetReferencedStructs() []jsonapi.MarshalIdentifier

GetReferencedStructs to satisfy the jsonapi.MarhsalIncludedRelations interface

func (Machine) GetReferences

func (m Machine) GetReferences() []jsonapi.Reference

GetReferences to satisfy the jsonapi.MarshalReferences interface

func (*Machine) SetID

func (m *Machine) SetID(id string) error

SetID to satisfy jsonapi.UnmarshalIdentifier interface

func (*Machine) SetToManyReferenceIDs

func (m *Machine) SetToManyReferenceIDs(name string, IDs []string) error

SetToManyReferenceIDs sets the sweets reference IDs and satisfies the jsonapi.UnmarshalToManyRelations interface

Jump to

Keyboard shortcuts

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