Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand() cmd.Command

NewCommand returns a new backups super-command.

Types

type APIClient

type APIClient interface {
	io.Closer
	// Create sends an RPC request to create a new backup.
	Create(notes string) (*params.BackupsMetadataResult, error)
	// Info gets the backup's metadata.
	Info(id string) (*params.BackupsMetadataResult, error)
	// List gets all stored metadata.
	List() (*params.BackupsListResult, error)
	// Download pulls the backup archive file.
	Download(id string) (io.ReadCloser, error)
	// Upload pushes a backup archive to storage.
	Upload(ar io.Reader, meta params.BackupsMetadataResult) (string, error)
	// Remove removes the stored backup.
	Remove(id string) error
	// Restore will restore a backup with the given id into the state server.
	Restore(string, backups.ClientConnection) error
	// Restore will restore a backup file into the state server.
	RestoreReader(io.Reader, *params.BackupsMetadataResult, backups.ClientConnection) error
}

APIClient represents the backups API client functionality used by the backups command.

type Command

type Command struct {
	cmd.SuperCommand
}

Command is the top-level command wrapping all backups functionality.

type CommandBase

type CommandBase struct {
	envcmd.EnvCommandBase
}

CommandBase is the base type for backups sub-commands.

func (*CommandBase) NewAPIClient

func (c *CommandBase) NewAPIClient() (APIClient, error)

NewAPIClient returns a client for the backups api endpoint.

type CreateCommand

type CreateCommand struct {
	CommandBase
	// Quiet indicates that the full metadata should not be dumped.
	Quiet bool
	// NoDownload means the backups archive should not be downloaded.
	NoDownload bool
	// Filename is where the backup should be downloaded.
	Filename string
	// Notes is the custom message to associated with the new backup.
	Notes string
}

CreateCommand is the sub-command for creating a new backup.

func (*CreateCommand) Info

func (c *CreateCommand) Info() *cmd.Info

Info implements Command.Info.

func (*CreateCommand) Init

func (c *CreateCommand) Init(args []string) error

Init implements Command.Init.

func (*CreateCommand) Run

func (c *CreateCommand) Run(ctx *cmd.Context) error

Run implements Command.Run.

func (*CreateCommand) SetFlags

func (c *CreateCommand) SetFlags(f *gnuflag.FlagSet)

SetFlags implements Command.SetFlags.

type DownloadCommand

type DownloadCommand struct {
	CommandBase
	// Filename is where to save the downloaded archive.
	Filename string
	// ID is the backup ID to download.
	ID string
}

DownloadCommand is the sub-command for downloading a backup archive.

func (*DownloadCommand) Info

func (c *DownloadCommand) Info() *cmd.Info

Info implements Command.Info.

func (*DownloadCommand) Init

func (c *DownloadCommand) Init(args []string) error

Init implements Command.Init.

func (*DownloadCommand) ResolveFilename

func (c *DownloadCommand) ResolveFilename() string

ResolveFilename returns the filename used by the command.

func (*DownloadCommand) Run

func (c *DownloadCommand) Run(ctx *cmd.Context) error

Run implements Command.Run.

func (*DownloadCommand) SetFlags

func (c *DownloadCommand) SetFlags(f *gnuflag.FlagSet)

SetFlags implements Command.SetFlags.

type InfoCommand

type InfoCommand struct {
	CommandBase
	// ID is the backup ID to get.
	ID string
}

InfoCommand is the sub-command for creating a new backup.

func (*InfoCommand) Info

func (c *InfoCommand) Info() *cmd.Info

Info implements Command.Info.

func (*InfoCommand) Init

func (c *InfoCommand) Init(args []string) error

Init implements Command.Init.

func (*InfoCommand) Run

func (c *InfoCommand) Run(ctx *cmd.Context) error

Run implements Command.Run.

type ListCommand

type ListCommand struct {
	CommandBase
	// Brief means only IDs will be printed.
	Brief bool
}

ListCommand is the sub-command for listing all available backups.

func (*ListCommand) Info

func (c *ListCommand) Info() *cmd.Info

Info implements Command.Info.

func (*ListCommand) Init

func (c *ListCommand) Init(args []string) error

Init implements Command.Init.

func (*ListCommand) Run

func (c *ListCommand) Run(ctx *cmd.Context) error

Run implements Command.Run.

func (*ListCommand) SetFlags

func (c *ListCommand) SetFlags(f *gnuflag.FlagSet)

SetFlags implements Command.SetFlags.

type RemoveCommand

type RemoveCommand struct {
	CommandBase
	// ID refers to the backup to be removed.
	ID string
}

CreateCommand is the sub-command for creating a new backup.

func (*RemoveCommand) Info

func (c *RemoveCommand) Info() *cmd.Info

Info implements Command.Info.

func (*RemoveCommand) Init

func (c *RemoveCommand) Init(args []string) error

Init implements Command.Init.

func (*RemoveCommand) Run

func (c *RemoveCommand) Run(ctx *cmd.Context) error

Run implements Command.Run.

type RestoreCommand

type RestoreCommand struct {
	CommandBase
	// contains filtered or unexported fields
}

RestoreCommand is a subcommand of backups that implement the restore behaior it is invoked with "juju backups restore".

func (*RestoreCommand) Info

func (c *RestoreCommand) Info() *cmd.Info

Info returns the content for --help.

func (*RestoreCommand) Init

func (c *RestoreCommand) Init(args []string) error

Init is where the preconditions for this commands can be checked.

func (*RestoreCommand) Run

func (c *RestoreCommand) Run(ctx *cmd.Context) error

Run is the entry point for this command.

func (*RestoreCommand) SetFlags

func (c *RestoreCommand) SetFlags(f *gnuflag.FlagSet)

SetFlags handles known option flags.

type UploadCommand

type UploadCommand struct {
	CommandBase
	// Filename is where to find the archive to upload.
	Filename string
	// ShowMeta indicates that the uploaded metadata should be printed.
	ShowMeta bool
	// Quiet indicates that the new backup ID should not be printed.
	Quiet bool
}

UploadCommand is the sub-command for uploading a backup archive.

func (*UploadCommand) Info

func (c *UploadCommand) Info() *cmd.Info

Info implements Command.Info.

func (*UploadCommand) Init

func (c *UploadCommand) Init(args []string) error

Init implements Command.Init.

func (*UploadCommand) Run

func (c *UploadCommand) Run(ctx *cmd.Context) error

Run implements Command.Run.

func (*UploadCommand) SetFlags

func (c *UploadCommand) SetFlags(f *gnuflag.FlagSet)

SetFlags implements Command.SetFlags.