commands

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2016 License: Apache-2.0 Imports: 36 Imported by: 26

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DoitCmd = &Command{
	Command: &cobra.Command{
		Use:   "doctl",
		Short: "doctl is a command line interface for the DigitalOcean API.",
	},
}

DoitCmd is the base command.

View Source
var ErrUnknownTerminal = errors.New("unknown terminal")

ErrUnknownTerminal signies an unknown terminal. It is returned when doit can't ascertain the current terminal type with requesting an auth token.

View Source
var Output string

Output holds the global output format.

View Source
var Token string

Token holds the global authorization token.

View Source
var Trace bool

Trace toggles http tracing output.

View Source
var Verbose bool

Verbose toggles verbose output.

View Source
var Writer = os.Stdout

Writer is where output should be written to.

Functions

func AddBoolFlag added in v1.0.0

func AddBoolFlag(cmd *Command, name string, def bool, desc string, opts ...flagOpt)

AddBoolFlag adds a boolean flag to a command.

func AddIntFlag added in v1.0.0

func AddIntFlag(cmd *Command, name string, def int, desc string, opts ...flagOpt)

AddIntFlag adds an integr flag to a command.

func AddStringFlag added in v1.0.0

func AddStringFlag(cmd *Command, name, dflt, desc string, opts ...flagOpt)

AddStringFlag adds a string flag to a command.

func AddStringSliceFlag added in v1.0.0

func AddStringSliceFlag(cmd *Command, name string, def []string, desc string, opts ...flagOpt)

AddStringSliceFlag adds a string slice flag to a command.

func Execute

func Execute()

Execute executes the current command using DoitCmd.

func RunAccountGet

func RunAccountGet(c *CmdConfig) error

RunAccountGet runs account get.

func RunAccountRateLimit added in v1.0.0

func RunAccountRateLimit(c *CmdConfig) error

RunAccountRateLimit retrieves API rate limits for the account.

func RunAuthLogin added in v0.6.0

func RunAuthLogin(c *CmdConfig) error

RunAuthLogin runs auth login. It communicates with doit-server to perform auth.

func RunCmdActionGet

func RunCmdActionGet(c *CmdConfig) error

RunCmdActionGet runs action get.

func RunCmdActionList

func RunCmdActionList(c *CmdConfig) error

RunCmdActionList run action list.

func RunCmdActionWait added in v1.0.0

func RunCmdActionWait(c *CmdConfig) error

RunCmdActionWait waits for an action to complete or error.

func RunCmdTagCreate added in v1.1.0

func RunCmdTagCreate(c *CmdConfig) error

RunCmdTagCreate runs tag create.

func RunCmdTagDelete added in v1.1.0

func RunCmdTagDelete(c *CmdConfig) error

RunCmdTagDelete runs tag delete.

func RunCmdTagGet added in v1.1.0

func RunCmdTagGet(c *CmdConfig) error

RunCmdTagGet runs tag get.

func RunCmdTagList added in v1.1.0

func RunCmdTagList(c *CmdConfig) error

RunCmdTagList runs tag list.

func RunCmdTagUpdate added in v1.1.0

func RunCmdTagUpdate(c *CmdConfig) error

RunCmdTagUpdate runs tag update.

func RunDomainCreate

func RunDomainCreate(c *CmdConfig) error

RunDomainCreate runs domain create.

func RunDomainDelete

func RunDomainDelete(c *CmdConfig) error

RunDomainDelete deletes a domain by name.

func RunDomainGet

func RunDomainGet(c *CmdConfig) error

RunDomainGet retrieves a domain by name.

func RunDomainList

func RunDomainList(c *CmdConfig) error

RunDomainList runs domain create.

func RunDriveAttach added in v1.1.0

func RunDriveAttach(c *CmdConfig) error

RunDriveAttach attaches a drive to a droplet.

func RunDriveCreate added in v1.1.0

func RunDriveCreate(c *CmdConfig) error

RunDriveCreate creates a drive.

func RunDriveDelete added in v1.1.0

func RunDriveDelete(c *CmdConfig) error

RunDriveDelete deletes a drive.

func RunDriveDetach added in v1.1.0

func RunDriveDetach(c *CmdConfig) error

RunDriveDetach detaches a drive from the droplet it's attached to.

func RunDriveGet added in v1.1.0

func RunDriveGet(c *CmdConfig) error

RunDriveGet gets a drive.

func RunDriveList added in v1.1.0

func RunDriveList(c *CmdConfig) error

RunDriveList returns a list of drives.

func RunDropletActionChangeKernel

func RunDropletActionChangeKernel(c *CmdConfig) error

RunDropletActionChangeKernel changes the kernel for a droplet.

func RunDropletActionDisableBackups

func RunDropletActionDisableBackups(c *CmdConfig) error

RunDropletActionDisableBackups disables backups for a droplet.

func RunDropletActionEnableIPv6

func RunDropletActionEnableIPv6(c *CmdConfig) error

RunDropletActionEnableIPv6 enables IPv6 for a droplet.

func RunDropletActionEnablePrivateNetworking

func RunDropletActionEnablePrivateNetworking(c *CmdConfig) error

RunDropletActionEnablePrivateNetworking enables private networking for a droplet.

func RunDropletActionGet

func RunDropletActionGet(c *CmdConfig) error

RunDropletActionGet returns a droplet action by id.

func RunDropletActionPasswordReset

func RunDropletActionPasswordReset(c *CmdConfig) error

RunDropletActionPasswordReset resets the droplet root password.

func RunDropletActionPowerCycle

func RunDropletActionPowerCycle(c *CmdConfig) error

RunDropletActionPowerCycle power cycles a droplet.

func RunDropletActionPowerOff

func RunDropletActionPowerOff(c *CmdConfig) error

RunDropletActionPowerOff turns droplet power off.

func RunDropletActionPowerOn

func RunDropletActionPowerOn(c *CmdConfig) error

RunDropletActionPowerOn turns droplet power on.

func RunDropletActionReboot

func RunDropletActionReboot(c *CmdConfig) error

RunDropletActionReboot reboots a droplet.

func RunDropletActionRebuild

func RunDropletActionRebuild(c *CmdConfig) error

RunDropletActionRebuild rebuilds a droplet using an image id or slug.

func RunDropletActionRename

func RunDropletActionRename(c *CmdConfig) error

RunDropletActionRename renames a droplet.

func RunDropletActionResize

func RunDropletActionResize(c *CmdConfig) error

RunDropletActionResize resizesx a droplet giving a size slug and optionally expands the disk.

func RunDropletActionRestore

func RunDropletActionRestore(c *CmdConfig) error

RunDropletActionRestore restores a droplet using an image id.

func RunDropletActionShutdown

func RunDropletActionShutdown(c *CmdConfig) error

RunDropletActionShutdown shuts a droplet down.

func RunDropletActionSnapshot

func RunDropletActionSnapshot(c *CmdConfig) error

RunDropletActionSnapshot creates a snapshot for a droplet.

func RunDropletActionUpgrade

func RunDropletActionUpgrade(c *CmdConfig) error

RunDropletActionUpgrade upgrades a droplet.

func RunDropletActions

func RunDropletActions(c *CmdConfig) error

RunDropletActions returns a list of actions for a droplet.

func RunDropletBackups

func RunDropletBackups(c *CmdConfig) error

RunDropletBackups returns a list of backup images for a droplet.

func RunDropletCreate

func RunDropletCreate(c *CmdConfig) error

RunDropletCreate creates a droplet.

func RunDropletDelete

func RunDropletDelete(c *CmdConfig) error

RunDropletDelete destroy a droplet by id.

func RunDropletGet

func RunDropletGet(c *CmdConfig) error

RunDropletGet returns a droplet.

func RunDropletKernels

func RunDropletKernels(c *CmdConfig) error

RunDropletKernels returns a list of available kernels for a droplet.

func RunDropletList

func RunDropletList(c *CmdConfig) error

RunDropletList returns a list of droplets.

func RunDropletNeighbors

func RunDropletNeighbors(c *CmdConfig) error

RunDropletNeighbors returns a list of droplet neighbors.

func RunDropletSnapshots

func RunDropletSnapshots(c *CmdConfig) error

RunDropletSnapshots returns a list of available kernels for a droplet.

func RunDropletTag added in v1.1.0

func RunDropletTag(c *CmdConfig) error

RunDropletTag adds a tag to a droplet.

func RunDropletUntag added in v1.1.0

func RunDropletUntag(c *CmdConfig) error

RunDropletUntag untags a droplet.

func RunFloatingIPActionsAssign

func RunFloatingIPActionsAssign(c *CmdConfig) error

RunFloatingIPActionsAssign assigns a floating IP to a droplet.

func RunFloatingIPActionsGet

func RunFloatingIPActionsGet(c *CmdConfig) error

RunFloatingIPActionsGet retrieves an action for a floating IP.

func RunFloatingIPActionsUnassign

func RunFloatingIPActionsUnassign(c *CmdConfig) error

RunFloatingIPActionsUnassign unassigns a floating IP to a droplet.

func RunFloatingIPCreate

func RunFloatingIPCreate(c *CmdConfig) error

RunFloatingIPCreate runs floating IP create.

func RunFloatingIPDelete

func RunFloatingIPDelete(c *CmdConfig) error

RunFloatingIPDelete runs floating IP delete.

func RunFloatingIPGet

func RunFloatingIPGet(c *CmdConfig) error

RunFloatingIPGet retrieves a floating IP's details.

func RunFloatingIPList

func RunFloatingIPList(c *CmdConfig) error

RunFloatingIPList runs floating IP create.

func RunImageActionsGet

func RunImageActionsGet(c *CmdConfig) error

RunImageActionsGet retrieves an action for an image.

func RunImageActionsTransfer

func RunImageActionsTransfer(c *CmdConfig) error

RunImageActionsTransfer an image.

func RunImagesDelete

func RunImagesDelete(c *CmdConfig) error

RunImagesDelete deletes an image.

func RunImagesGet

func RunImagesGet(c *CmdConfig) error

RunImagesGet retrieves an image by id or slug.

func RunImagesList

func RunImagesList(c *CmdConfig) error

RunImagesList images.

func RunImagesListApplication

func RunImagesListApplication(c *CmdConfig) error

RunImagesListApplication lists application iamges.

func RunImagesListDistribution

func RunImagesListDistribution(c *CmdConfig) error

RunImagesListDistribution lists distributions that are available.

func RunImagesListUser

func RunImagesListUser(c *CmdConfig) error

RunImagesListUser lists user images.

func RunImagesUpdate

func RunImagesUpdate(c *CmdConfig) error

RunImagesUpdate updates an image.

func RunKeyCreate

func RunKeyCreate(c *CmdConfig) error

RunKeyCreate uploads a SSH key.

func RunKeyDelete

func RunKeyDelete(c *CmdConfig) error

RunKeyDelete deletes a key.

func RunKeyGet

func RunKeyGet(c *CmdConfig) error

RunKeyGet retrieves a key.

func RunKeyImport

func RunKeyImport(c *CmdConfig) error

RunKeyImport imports a key from a file

func RunKeyList

func RunKeyList(c *CmdConfig) error

RunKeyList lists keys.

func RunKeyUpdate

func RunKeyUpdate(c *CmdConfig) error

RunKeyUpdate updates a key.

func RunPluginList added in v1.0.0

func RunPluginList(c *CmdConfig) error

RunPluginList is a command for listing available plugins.

func RunPluginRun added in v1.0.0

func RunPluginRun(c *CmdConfig) error

RunPluginRun is a command for running a plugin.

func RunRecordCreate

func RunRecordCreate(c *CmdConfig) error

RunRecordCreate creates a domain record.

func RunRecordDelete

func RunRecordDelete(c *CmdConfig) error

RunRecordDelete deletes a domain record.

func RunRecordList

func RunRecordList(c *CmdConfig) error

RunRecordList list records for a domain.

func RunRecordUpdate

func RunRecordUpdate(c *CmdConfig) error

RunRecordUpdate updates a domain record.

func RunRegionList

func RunRegionList(c *CmdConfig) error

RunRegionList all regions.

func RunSSH

func RunSSH(c *CmdConfig) error

RunSSH finds a droplet to ssh to given input parameters (name or id).

func RunSizeList

func RunSizeList(c *CmdConfig) error

RunSizeList all sizes.

Types

type CmdConfig added in v1.0.0

type CmdConfig struct {
	NS   string
	Doit doctl.Config
	Out  io.Writer
	Args []string

	// services
	Keys              func() do.KeysService
	Sizes             func() do.SizesService
	Regions           func() do.RegionsService
	Images            func() do.ImagesService
	ImageActions      func() do.ImageActionsService
	FloatingIPs       func() do.FloatingIPsService
	FloatingIPActions func() do.FloatingIPActionsService
	Droplets          func() do.DropletsService
	DropletActions    func() do.DropletActionsService
	Domains           func() do.DomainsService
	Actions           func() do.ActionsService
	Account           func() do.AccountService
	Tags              func() do.TagsService
	Drives            func() do.DrivesService
	DriveActions      func() do.DriveActionsService
}

CmdConfig is a command configuration.

func NewCmdConfig added in v1.0.0

func NewCmdConfig(ns string, dc doctl.Config, out io.Writer, args []string) (*CmdConfig, error)

NewCmdConfig creates an instance of a CmdConfig.

func (*CmdConfig) Display added in v1.0.0

func (c *CmdConfig) Display(d Displayable) error

Display displayes the output from a command.

type CmdRunner added in v1.0.0

type CmdRunner func(*CmdConfig) error

CmdRunner runs a command and passes in a cmdConfig.

type Command added in v1.0.0

type Command struct {
	*cobra.Command

	// DocCategories are the documentation categories this command belongs to.
	DocCategories []string

	IsIndex bool
	// contains filtered or unexported fields
}

Command is a wrapper around cobra.Command that adds doctl specific functionality.

func Account

func Account() *Command

Account creates the account commands heirarchy.

func Actions

func Actions() *Command

Actions creates the action commands heirarchy.

func Auth added in v0.6.0

func Auth() *Command

Auth creates auth commands for doctl.

func CmdBuilder added in v1.0.0

func CmdBuilder(parent *Command, cr CmdRunner, cliText, desc string, out io.Writer, options ...cmdOption) *Command

CmdBuilder builds a new command.

func Domain

func Domain() *Command

Domain creates the domain commands heirarchy.

func Drive added in v1.1.0

func Drive() *Command

Drive creates the Drive command NOTE: This command will currently only work for those in the block storage private beta on DigitalOcean.

func DriveAction added in v1.1.0

func DriveAction() *Command

DriveAction creates the drive command NOTE: This command will only work for those accepted into the block storage private beta on DigitalOcean

func Droplet

func Droplet() *Command

Droplet creates the droplet command.

func DropletAction

func DropletAction() *Command

DropletAction creates the droplet-action command.

func FloatingIP

func FloatingIP() *Command

FloatingIP creates the command heirarchy for floating ips.

func FloatingIPAction

func FloatingIPAction() *Command

FloatingIPAction creates the floating IP action commmand.

func ImageAction

func ImageAction() *Command

ImageAction creates the image action commmand.

func Images

func Images() *Command

Images creates an image command.

func Plugin added in v1.0.0

func Plugin() *Command

Plugin creates the plugin commands heirarchy.

func Region

func Region() *Command

Region creates the region commands heirarchy.

func SSH

func SSH(parent *Command) *Command

SSH creates the ssh commands heirarchy

func SSHKeys

func SSHKeys() *Command

SSHKeys creates the ssh key commands heirarchy.

func Size

func Size() *Command

Size creates the size commands heirarchy.

func Tags added in v1.1.0

func Tags() *Command

Tags creates the tag commands heirarchy.

func Version added in v1.0.0

func Version() *Command

Version creates a version command.

func (*Command) AddCommand added in v1.0.0

func (c *Command) AddCommand(commands ...*Command)

AddCommand adds child commands and adds child commands for cobra as well.

func (*Command) ChildCommands added in v1.0.0

func (c *Command) ChildCommands() []*Command

ChildCommands returns the child commands.

type Displayable added in v1.0.0

type Displayable interface {
	Cols() []string
	ColMap() map[string]string
	KV() []map[string]interface{}
	JSON(io.Writer) error
}

Displayable is a displable entity. These are used for printing results.

type UnknownSchemeError added in v0.6.0

type UnknownSchemeError struct {
	Scheme string
}

UnknownSchemeError signifies an unknown HTTP scheme.

func (*UnknownSchemeError) Error added in v0.6.0

func (use *UnknownSchemeError) Error() string

Jump to

Keyboard shortcuts

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