commands

package
Version: v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2016 License: Apache-2.0 Imports: 17 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAclRule added in v0.3.0

func NewAclRule() *aclRule

func NewConsul

func NewConsul() *consul

func ParseCheckConfig

func ParseCheckConfig(s string) (*consulapi.AgentServiceCheck, error)

Types

type Acl

type Acl struct {
	*Cmd
}

func (*Acl) AddCloneSub

func (a *Acl) AddCloneSub(c *cobra.Command)

func (*Acl) AddCreateSub

func (a *Acl) AddCreateSub(c *cobra.Command)

func (*Acl) AddDestroySub

func (a *Acl) AddDestroySub(c *cobra.Command)

func (*Acl) AddInfoSub

func (a *Acl) AddInfoSub(c *cobra.Command)

func (*Acl) AddListSub

func (a *Acl) AddListSub(c *cobra.Command)

func (*Acl) AddUpdateSub

func (a *Acl) AddUpdateSub(c *cobra.Command)

func (*Acl) CheckIdArg

func (a *Acl) CheckIdArg(args []string) error

func (*Acl) Clone

func (a *Acl) Clone(args []string) error

func (*Acl) Create

func (a *Acl) Create(args []string, aco *AclCreateOptions) error

func (*Acl) Destroy

func (a *Acl) Destroy(args []string) error

func (*Acl) GetRulesString

func (a *Acl) GetRulesString(rs []*ConfigRule) (string, error)

Convert a list of Rules to a JSON string

func (*Acl) Info

func (a *Acl) Info(args []string) error

func (*Acl) List

func (a *Acl) List(args []string) error

func (*Acl) ParseRuleConfig

func (a *Acl) ParseRuleConfig(s string) (*ConfigRule, error)

func (*Acl) Update

func (a *Acl) Update(args []string, auo *AclUpdateOptions) error

type AclCreateOptions

type AclCreateOptions struct {
	IsManagement bool
	Name         string
	ConfigRules  []*ConfigRule
}

type AclUpdateOptions

type AclUpdateOptions struct {
	IsManagement bool
	Name         string
	ConfigRules  []*ConfigRule
}

type Agent

type Agent struct {
	*Cmd
}

func (*Agent) AddChecksSub

func (a *Agent) AddChecksSub(c *cobra.Command)

func (*Agent) AddForceLeaveSub

func (a *Agent) AddForceLeaveSub(c *cobra.Command)

func (*Agent) AddJoinSub

func (a *Agent) AddJoinSub(c *cobra.Command)

func (*Agent) AddMaintenanceSub

func (a *Agent) AddMaintenanceSub(c *cobra.Command)

func (*Agent) AddMembersSub

func (a *Agent) AddMembersSub(c *cobra.Command)

func (*Agent) AddSelfSub

func (a *Agent) AddSelfSub(c *cobra.Command)

func (*Agent) AddServicesSub

func (a *Agent) AddServicesSub(c *cobra.Command)

func (*Agent) Checks

func (a *Agent) Checks(args []string) error

func (*Agent) ForceLeave

func (a *Agent) ForceLeave(args []string) error

func (*Agent) Join

func (a *Agent) Join(args []string, ajo *AgentJoinOptions) error

func (*Agent) Maintenance

func (a *Agent) Maintenance(args []string, amo *AgentMaintenanceOptions) error

func (*Agent) Members

func (a *Agent) Members(args []string, amo *AgentMembersOptions) error

func (*Agent) Self

func (a *Agent) Self(args []string) error

func (*Agent) Services

func (a *Agent) Services(args []string) error

type AgentJoinOptions

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

type AgentMaintenanceOptions

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

type AgentMembersOptions

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

type Catalog

type Catalog struct {
	*Cmd
}

func (*Catalog) AddDatacentersSub

func (c *Catalog) AddDatacentersSub(cmd *cobra.Command)

func (*Catalog) AddNodeSub

func (c *Catalog) AddNodeSub(cmd *cobra.Command)

func (*Catalog) AddNodesSub

func (c *Catalog) AddNodesSub(cmd *cobra.Command)

func (*Catalog) AddServiceSub

func (c *Catalog) AddServiceSub(cmd *cobra.Command)

func (*Catalog) AddServicesSub

func (c *Catalog) AddServicesSub(cmd *cobra.Command)

func (*Catalog) Datacenters

func (c *Catalog) Datacenters(args []string) error

func (*Catalog) Node

func (c *Catalog) Node(args []string) error

func (*Catalog) Nodes

func (c *Catalog) Nodes(args []string) error

func (*Catalog) Service

func (c *Catalog) Service(args []string, cso *CatalogServiceOptions) error

func (*Catalog) Services

func (c *Catalog) Services(args []string) error

type CatalogServiceOptions

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

type Check

type Check struct {
	*Cmd
}

func (*Check) AddDeregisterSub

func (c *Check) AddDeregisterSub(cmd *cobra.Command)

func (*Check) AddFailSub

func (c *Check) AddFailSub(cmd *cobra.Command)

func (*Check) AddPassSub

func (c *Check) AddPassSub(cmd *cobra.Command)

func (*Check) AddRegisterSub

func (c *Check) AddRegisterSub(cmd *cobra.Command)

func (*Check) AddWarnSub

func (c *Check) AddWarnSub(cmd *cobra.Command)

func (*Check) CheckIdArg

func (c *Check) CheckIdArg(args []string) error

func (*Check) Deregister

func (c *Check) Deregister(args []string) error

func (*Check) Fail

func (c *Check) Fail(args []string, cfo *CheckFailOptions) error

func (*Check) Pass

func (c *Check) Pass(args []string, cfo *CheckPassOptions) error

func (*Check) Register

func (c *Check) Register(args []string, cro *CheckRegisterOptions) error

func (*Check) Warn

func (c *Check) Warn(args []string, cfo *CheckWarnOptions) error

type CheckFailOptions

type CheckFailOptions struct {
	Note string
}

type CheckPassOptions

type CheckPassOptions struct {
	Note string
}

type CheckRegisterOptions

type CheckRegisterOptions struct {
	Id        string
	Script    string
	Http      string
	Ttl       string
	Interval  string
	Notes     string
	ServiceId string
}

type CheckWarnOptions

type CheckWarnOptions struct {
	Note string
}

type Cmd

type Cmd struct {
	Err io.Writer
	Out io.Writer

	Template string
	// contains filtered or unexported fields
}

func Init

func Init(name, version string) *Cmd

func (*Cmd) ACL

func (c *Cmd) ACL() (*consulapi.ACL, error)

func (*Cmd) AddCommand

func (c *Cmd) AddCommand(cmd *cobra.Command)

func (*Cmd) AddDatacenterOption

func (c *Cmd) AddDatacenterOption(cmd *cobra.Command)

func (*Cmd) AddTemplateOption

func (c *Cmd) AddTemplateOption(cmd *cobra.Command)

func (*Cmd) AddWaitIndexOption

func (c *Cmd) AddWaitIndexOption(cmd *cobra.Command)

func (*Cmd) Agent

func (c *Cmd) Agent() (*consulapi.Agent, error)

func (*Cmd) Catalog

func (c *Cmd) Catalog() (*consulapi.Catalog, error)

func (*Cmd) Client

func (c *Cmd) Client() (*consulapi.Client, error)

func (*Cmd) Coordinate

func (c *Cmd) Coordinate() (*consulapi.Coordinate, error)

func (*Cmd) Execute

func (c *Cmd) Execute() error

func (*Cmd) Health

func (c *Cmd) Health() (*consulapi.Health, error)

func (*Cmd) Help

func (c *Cmd) Help() error

func (*Cmd) KV

func (c *Cmd) KV() (*consulapi.KV, error)

func (*Cmd) Output

func (c *Cmd) Output(v interface{}) error

func (*Cmd) OutputJSON

func (c *Cmd) OutputJSON(v interface{}, prettyFlag bool) error

func (*Cmd) OutputTemplate

func (c *Cmd) OutputTemplate(v interface{}) error

func (*Cmd) QueryOptions

func (c *Cmd) QueryOptions() *consulapi.QueryOptions

func (*Cmd) Session

func (c *Cmd) Session() (*consulapi.Session, error)

func (*Cmd) Status

func (c *Cmd) Status() (*consulapi.Status, error)

func (*Cmd) WriteOptions

func (c *Cmd) WriteOptions() *consulapi.WriteOptions

type ConfigRule

type ConfigRule struct {
	PathType string
	Path     string
	Policy   string
}

type Coordinate

type Coordinate struct {
	*Cmd
}

func (*Coordinate) AddDatacentersSub

func (c *Coordinate) AddDatacentersSub(cmd *cobra.Command)

func (*Coordinate) AddNodesSub

func (c *Coordinate) AddNodesSub(cmd *cobra.Command)

func (*Coordinate) Datacenters

func (c *Coordinate) Datacenters(args []string) error

func (*Coordinate) Nodes

func (c *Coordinate) Nodes(args []string) error

type Health

type Health struct {
	*Cmd
}

func (*Health) AddChecksSub

func (h *Health) AddChecksSub(cmd *cobra.Command)

func (*Health) AddNodeSub

func (h *Health) AddNodeSub(cmd *cobra.Command)

func (*Health) AddServiceSub

func (h *Health) AddServiceSub(cmd *cobra.Command)

func (*Health) AddStateSub

func (h *Health) AddStateSub(cmd *cobra.Command)

func (*Health) Checks

func (h *Health) Checks(args []string) error

func (*Health) Node

func (h *Health) Node(args []string) error

func (*Health) Service

func (h *Health) Service(args []string, hso *HealthServiceOptions) error

func (*Health) State

func (h *Health) State(args []string) error

type HealthServiceOptions

type HealthServiceOptions struct {
	Tag         string
	PassingOnly bool
}

type KVJson

type KVJson struct {
	Key         string
	CreateIndex uint64
	ModifyIndex uint64
	LockIndex   uint64
	Flags       uint64
	Value       string
	Session     string
}

Conveninece structure for JSON

type KVOutput

type KVOutput struct {
	Out io.Writer
	Err io.Writer

	All         bool
	Key         bool
	CreateIndex bool
	ModifyIndex bool
	LockIndex   bool
	Flags       bool
	Value       bool
	Session     bool
}

Output structure

func NewKVOutput

func NewKVOutput(out, err io.Writer, fields string) *KVOutput

func (*KVOutput) Output

func (kvo *KVOutput) Output(kv *consulapi.KVPair, of OutputFormat) error

func (*KVOutput) OutputHeader

func (kvo *KVOutput) OutputHeader(of OutputFormat)

func (*KVOutput) OutputJSON

func (kvo *KVOutput) OutputJSON(kv *consulapi.KVPair, prettyFlag bool) error

func (*KVOutput) OutputJSONList

func (kvo *KVOutput) OutputJSONList(kvs *consulapi.KVPairs, prettyFlag bool) error

func (*KVOutput) OutputList

func (kvo *KVOutput) OutputList(kvs *consulapi.KVPairs, of OutputFormat) error

func (*KVOutput) OutputText

func (kvo *KVOutput) OutputText(kv *consulapi.KVPair, of OutputFormat) error

func (*KVOutput) OutputTextList

func (kvo *KVOutput) OutputTextList(kvs *consulapi.KVPairs, of OutputFormat) error

type Kv

type Kv struct {
	*Cmd
}

func (*Kv) AddBulkloadSub

func (k *Kv) AddBulkloadSub(cmd *cobra.Command)

func (*Kv) AddDeleteSub

func (k *Kv) AddDeleteSub(cmd *cobra.Command)

func (*Kv) AddKeysSub

func (k *Kv) AddKeysSub(cmd *cobra.Command)

func (*Kv) AddLockSub

func (k *Kv) AddLockSub(cmd *cobra.Command)

func (*Kv) AddReadSub

func (k *Kv) AddReadSub(cmd *cobra.Command)

func (*Kv) AddUnlockSub

func (k *Kv) AddUnlockSub(cmd *cobra.Command)

func (*Kv) AddWatchSub

func (k *Kv) AddWatchSub(cmd *cobra.Command)

func (*Kv) AddWriteSub

func (k *Kv) AddWriteSub(cmd *cobra.Command)

func (*Kv) Bulkload

func (k *Kv) Bulkload(args []string, kbo *KvBulkloadOptions) error

func (*Kv) Delete

func (k *Kv) Delete(args []string, kdo *KvDeleteOptions) error

func (*Kv) Keys

func (k *Kv) Keys(args []string, kko *KvKeysOptions) error

func (*Kv) Lock

func (k *Kv) Lock(args []string, klo *KvLockOptions) error

func (*Kv) Read

func (k *Kv) Read(args []string, kro *KvReadOptions) error

func (*Kv) Unlock

func (k *Kv) Unlock(args []string, kuo *KvUnlockOptions) error

func (*Kv) Watch

func (k *Kv) Watch(args []string, kwo *KvWatchOptions) error

func (*Kv) Write

func (k *Kv) Write(args []string, kwo *KvWriteOptions) error

type KvBulkloadOptions

type KvBulkloadOptions struct {
	Json   string
	Prefix string
}

type KvDeleteOptions

type KvDeleteOptions struct {
	ModifyIndex string
	DoRecurse   bool
}

type KvKeysOptions

type KvKeysOptions struct {
	Separator string
}

type KvLockOptions

type KvLockOptions struct {
	Behavior  string
	Ttl       string
	LockDelay time.Duration
	Session   string
	// contains filtered or unexported fields
}

type KvReadOptions

type KvReadOptions struct {
	Format    OutputFormat
	FieldsRaw string
	Recurse   bool
}

type KvUnlockOptions

type KvUnlockOptions struct {
	Session   string
	NoDestroy bool
}

type KvWatchOptions

type KvWatchOptions struct {
	Format    OutputFormat
	FieldsRaw string
}

type KvWriteOptions

type KvWriteOptions struct {
	ModifyIndex string
	DataFlags   string
}

type OutputFormat

type OutputFormat struct {
	Type      string
	Delimiter string
	Header    bool
}

Output format structure

type Service

type Service struct {
	*Cmd
}

func (*Service) AddDeregisterSub

func (s *Service) AddDeregisterSub(cmd *cobra.Command)

func (*Service) AddMaintenanceSub

func (s *Service) AddMaintenanceSub(cmd *cobra.Command)

func (*Service) AddRegisterSub

func (s *Service) AddRegisterSub(cmd *cobra.Command)

func (*Service) CheckIdArg

func (s *Service) CheckIdArg(args []string) error

func (*Service) Deregister

func (s *Service) Deregister(args []string) error

func (*Service) Maintenance

func (s *Service) Maintenance(args []string, smo *ServiceMaintenanceOptions) error

func (*Service) Register

func (s *Service) Register(args []string, sro *ServiceRegisterOptions) error

type ServiceMaintenanceOptions

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

type ServiceRegisterOptions

type ServiceRegisterOptions struct {
	Id      string
	Tags    []string
	Address string
	Port    int
	Checks  consulapi.AgentServiceChecks
}

type Session

type Session struct {
	*Cmd
}

func (*Session) AddCreateSub

func (s *Session) AddCreateSub(cmd *cobra.Command)

func (*Session) AddDestroySub

func (s *Session) AddDestroySub(cmd *cobra.Command)

func (*Session) AddInfoSub

func (s *Session) AddInfoSub(cmd *cobra.Command)

func (*Session) AddListSub

func (s *Session) AddListSub(cmd *cobra.Command)

func (*Session) AddNodeSub

func (s *Session) AddNodeSub(cmd *cobra.Command)

func (*Session) AddRenewSub

func (s *Session) AddRenewSub(cmd *cobra.Command)

func (*Session) CheckIdArg

func (s *Session) CheckIdArg(args []string) error

func (*Session) Create

func (s *Session) Create(args []string, sco *SessionCreateOptions) error

func (*Session) Destroy

func (s *Session) Destroy(args []string) error

func (*Session) Info

func (s *Session) Info(args []string) error

func (*Session) List

func (s *Session) List(args []string) error

func (*Session) Node

func (s *Session) Node(args []string) error

func (*Session) Renew

func (s *Session) Renew(args []string) error

type SessionCreateOptions

type SessionCreateOptions struct {
	LockDelay time.Duration
	NodeName  string
	Name      string
	Checks    []string
	Behavior  string
	Ttl       time.Duration
}

type Status

type Status struct {
	*Cmd
}

func (*Status) AddLeaderSub

func (s *Status) AddLeaderSub(cmd *cobra.Command)

func (*Status) AddPeersSub

func (s *Status) AddPeersSub(cmd *cobra.Command)

func (*Status) Leader

func (s *Status) Leader(args []string) error

func (*Status) Peers

func (s *Status) Peers(args []string) error

Jump to

Keyboard shortcuts

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