sl

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2016 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datacenter

type Datacenter struct {
	ID       int    `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
	StatusID int    `json:"statusId,omitempty"`
}

Datacenter represents a Softlayer datacenter.

type Error

type Error struct {
	Text string `json:"error,omitepty"`
	Code string `json:"code,omitempty"`
}

Error represents and error object response payload.

func (Error) Error

func (err Error) Error() string

Error implements the builtin error interface.

type Image

type Image struct {
	ID          int           `json:"id,omitempty"`
	ParentID    int           `json:"parentId,omitempty"`
	GlobalID    string        `json:"globalIdentifier,omitempty"`
	CreateDate  time.Time     `json:"createDate,omitempty"`
	Name        string        `json:"name,omitempty"`
	Note        string        `json:"note,omitempty"`
	Datacenter  *Datacenter   `json:"datacenter,omitempty"`
	Datacenters []*Datacenter `json:"datacenters,omitempty"`

	Tags        Tags `json:"-"`
	NotTaggable bool `json:"-"`
}

Image

type Images

type Images []*Image

Images defines and represents regions to images

func (Images) Len

func (img Images) Len() int

Len, Less and Swap implements the sort.Interface interface.

func (Images) Less

func (img Images) Less(i, j int) bool

func (Images) Print

func (img Images) Print(mode utils.OutputMode) error

Print prints the images to standard output.

func (Images) Swap

func (img Images) Swap(i, j int)

type SLCommand

type SLCommand struct {
	*SLImages
}

SLCommand implements the images various interfaces, such as Fetcher, Deleter, Modifier, etc..

func NewCommand

func NewCommand(args []string) (*SLCommand, []string, error)

NewCommand returns a new instance of SLCommand

func (*SLCommand) Copy

func (cmd *SLCommand) Copy(args []string) error

Copy copies the image to different datacenters.

func (*SLCommand) Delete

func (cmd *SLCommand) Delete(args []string) error

Delete deletes Block Device Templates by the given ids.

func (*SLCommand) Help

func (a *SLCommand) Help(command string) string

Help prints the help message for the given command

func (*SLCommand) List

func (cmd *SLCommand) List(args []string) error

List implements the command.Lister interface

func (*SLCommand) Modify

func (cmd *SLCommand) Modify(args []string) error

Modify manages the tags of the given images. It can create, override or delete tags associated with the given Template ids.

type SLConfig

type SLConfig struct {
	Username string `toml:"username" json:"username"`
	APIKey   string `toml:"api_key" json:"api_key"`
}

SLConfig represents a configuration section of .imagesrc for sl provider.

type SLImages

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

SLImages is responsible of managing Softlayer Virtual Disk Images.

func New

func New(conf *SLConfig) (*SLImages, error)

New creates new Softlayer command client.

func (*SLImages) Children

func (img *SLImages) Children(id int) (Images, error)

Children returns children images for the one given by the id.

It returns nil Images and nil error if the images has no children.

func (*SLImages) CopyToDatacenters

func (img *SLImages) CopyToDatacenters(id int, datacenters ...string) error

func (*SLImages) DeleteImages

func (img *SLImages) DeleteImages(ids ...int) error

Delete deletes the given images.

func (*SLImages) EditImage

func (img *SLImages) EditImage(id int, fields *Image) error

EditImage edits non-zero fields of the image given by the id.

func (*SLImages) ImageByID

func (img *SLImages) ImageByID(id int) (*Image, error)

ImageByID looks up an image by the given ID.

func (*SLImages) Images

func (img *SLImages) Images() (Images, error)

Images returns all images. If not images are found, it returns non-nil error.

func (*SLImages) ImagesByIDs

func (img *SLImages) ImagesByIDs(ids ...int) (Images, error)

ImagesByIDs looks up all images and then it filters them by the given IDs. If at least one image is not found, it returns non-nil error.

func (*SLImages) Parent

func (img *SLImages) Parent(id int) (*Image, error)

Parent returns a parent image for the one given by the id.

It returns nil Image and nil error if the image has no parent.

func (*SLImages) Transaction

func (img *SLImages) Transaction(id int) (*Transaction, error)

Transaction returns an ongoing transaction for the image given by the id.

It returns non-nil error when querying the service failed. It return nil Transaction and nil error when there are no ongoing transactions.

func (*SLImages) WaitReady

func (img *SLImages) WaitReady(id int, d time.Duration) error

WaitReady waits at most d until all ongoing transactions for image given by the id are finished.

type Tags

type Tags map[string]string

Tags holds key-value tags for an image.

func (Tags) String

func (t Tags) String() string

String gives key-value tags representation.

type Transaction

type Transaction struct {
	ID int `json:"id,omitempty"`
}

Transaction represents an ongoing resource transaction.

Jump to

Keyboard shortcuts

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