client

package
v0.0.0-...-3899d99 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2016 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultVersion = "1.23"
	DefaultHost    = "tcp://127.0.0.1:3380"
)

Variables

View Source
var ErrConnectionFailed = errors.New("Cannot connect to the Daolinet server. Is the daolinet server running on this host?")

ErrConnectionFailed is a error raised when the connection between the client and the server failed.

Functions

func ParseFlags

func ParseFlags(fs *flag.FlagSet, args []string, withHelp bool) error

func ParseHost

func ParseHost(host string) (string, string, string, error)

ParseHost verifies that that the given host strings is valid.

Types

type APIClient

type APIClient interface {
	GroupList() ([]string, error)
	GroupShow(string) ([]string, error)
	GroupCreate(string) (string, error)
	GroupDelete(string) error
	MemberAdd(string, string) error
	MemberRemove(string, string) error
	PolicyList() ([]string, error)
	PolicyCreate(string) error
	PolicyDelete(string) error
	FirewallList() ([]Firewall, error)
	FirewallShow(string) ([]Firewall, error)
	FirewallCreate(Firewall) (Firewall, error)
	FirewallDelete(string) error
}

APIClient is an interface that clients that talk with a daolinet server must implement.

type Client

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

func NewClient

func NewClient(host string, version string, client *http.Client, httpHeaders map[string]string) (*Client, error)

NewClient initialize a new API client for the given host and API version.

func (*Client) FirewallCreate

func (cli *Client) FirewallCreate(fw Firewall) (Firewall, error)

func (*Client) FirewallDelete

func (cli *Client) FirewallDelete(name string) error

func (*Client) FirewallList

func (cli *Client) FirewallList() ([]Firewall, error)

func (*Client) FirewallShow

func (cli *Client) FirewallShow(name string) ([]Firewall, error)

func (*Client) GroupCreate

func (cli *Client) GroupCreate(name string) (string, error)

func (*Client) GroupDelete

func (cli *Client) GroupDelete(name string) error

func (*Client) GroupList

func (cli *Client) GroupList() ([]string, error)

func (*Client) GroupShow

func (cli *Client) GroupShow(name string) ([]string, error)

func (*Client) MemberAdd

func (cli *Client) MemberAdd(name, group string) error

func (*Client) MemberRemove

func (cli *Client) MemberRemove(name, group string) error

func (*Client) PolicyCreate

func (cli *Client) PolicyCreate(peer string) error

func (*Client) PolicyDelete

func (cli *Client) PolicyDelete(peer string) error

func (*Client) PolicyList

func (cli *Client) PolicyList() ([]string, error)

type DaoliCli

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

DaoliCli represents the daolictl command line client. instances of the client can be returned from NewDaoliCli.

func NewDaoliCli

func NewDaoliCli(in io.ReadCloser, out, err io.Writer, clientFlags *cli.ClientFlags) *DaoliCli

func (*DaoliCli) CmdCut

func (cli *DaoliCli) CmdCut(args ...string) error

// Usage: daolictl policy create <CONTAINER:CONTAINER>

func (cli *DaoliCli) CmdPolicyCreate(args ...string) error {
	cmd := Cli.Subcmd("policy create", []string{"CONTAINER:CONTAINER"}, "Creates a policy with container peer", false)

Usage: daolictl cut <CONTAINER:CONTAINER>

func (*DaoliCli) CmdCutls

func (cli *DaoliCli) CmdCutls(args ...string) error

//Usage: daolictl policy list

func (cli *DaoliCli) CmdPolicyList(args ...string) error {
	cmd := Cli.Subcmd("policy list", nil, "Lists policies", true)

Usage: daolictl cutls

func (*DaoliCli) CmdFirewall

func (cli *DaoliCli) CmdFirewall(args ...string) error

Usage: daolictl firewall <COMMAND> [OPTIONS]

func (*DaoliCli) CmdFirewallCreate

func (cli *DaoliCli) CmdFirewallCreate(args ...string) error

Usage: daolictl firewall create <NAME> --rule <GATEWAYPORT:SERVICEPORT> --container <CONTAINER>

func (*DaoliCli) CmdFirewallDelete

func (cli *DaoliCli) CmdFirewallDelete(args ...string) error

Usage: daolictl firewall delete <FIREWALL-NAME>

func (*DaoliCli) CmdFirewallList

func (cli *DaoliCli) CmdFirewallList(args ...string) error

Usage: daolictl firewall list

func (*DaoliCli) CmdFirewallShow

func (cli *DaoliCli) CmdFirewallShow(args ...string) error

Usage: daolictl firewall show <CONTAINER>

func (*DaoliCli) CmdGroup

func (cli *DaoliCli) CmdGroup(args ...string) error

CmdGroup is the parent subcommand for all group commands

Usage: daolictl group <COMMAND> [OPTIONS]

func (*DaoliCli) CmdGroupCreate

func (cli *DaoliCli) CmdGroupCreate(args ...string) error

CmdGroupCreate creates a new group with a given name

Usage: daolictl group create <GROUP-NAME>

func (*DaoliCli) CmdGroupDelete

func (cli *DaoliCli) CmdGroupDelete(args ...string) error

CmdGroupDelete creates a new group with a given name

Usage: daolictl group delete <GROUP-NAME>

func (*DaoliCli) CmdGroupList

func (cli *DaoliCli) CmdGroupList(args ...string) error

CmdGroupList lists all the groups managed by daolictl

Usage: daolictl group list

func (*DaoliCli) CmdGroupShow

func (cli *DaoliCli) CmdGroupShow(args ...string) error

Usage: daolictl group show <GROUP-NAME>

func (*DaoliCli) CmdMember

func (cli *DaoliCli) CmdMember(args ...string) error

Usage: daolictl member

func (*DaoliCli) CmdMemberAdd

func (cli *DaoliCli) CmdMemberAdd(args ...string) error

Usage: daolictl member add <NETWORK-NAME> --group <GROUP-NAME>

func (*DaoliCli) CmdMemberRm

func (cli *DaoliCli) CmdMemberRm(args ...string) error

Usage: daolictl member rm <NETWORK-NAME> --group <GROUP-NAME>

func (*DaoliCli) CmdPolicy

func (cli *DaoliCli) CmdPolicy(args ...string) error

Usage: daolictl policy

func (*DaoliCli) CmdUncut

func (cli *DaoliCli) CmdUncut(args ...string) error

// Usage: daolictl policy delete <CONTAINER:CONTAINER>

func (cli *DaoliCli) CmdPolicyDelete(args ...string) error {
	cmd := Cli.Subcmd("policy delete", []string{"CONTAINER:CONTAINER"}, "Delete a policy with container peer", false)

Usage: daolictl uncut <CONTAINER:CONTAINER>

func (*DaoliCli) CmdVersion

func (cli *DaoliCli) CmdVersion(args ...string) (err error)

CmdVersion shows Daolictl version information Usage: daolictl version

func (*DaoliCli) Initialize

func (cli *DaoliCli) Initialize() error

Initialize calls the init function that will setup the configuration for the client such as the TLS, tcp and other parameters used to run the client.

type Firewall

type Firewall struct {
	Name        string
	Container   string
	DatapathID  string
	GatewayIP   string
	GatewayPort int
	ServicePort int
}

Directories

Path Synopsis
Copy from github.com/docker/engine-api/client/transport/client.go
Copy from github.com/docker/engine-api/client/transport/client.go
cancellable
Package cancellable provides helper function to cancel http requests.
Package cancellable provides helper function to cancel http requests.

Jump to

Keyboard shortcuts

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