image

package
v0.0.0-...-b1baf6d Latest Latest
Warning

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

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

README

Image

Manage private images from the d2k8 cli.

Create an image

Create a private image to be managed by d2k8.

d2k8 image create name -user user -pwd pwd -url url

Argument Meaning
name name of the image to be identified in d2k8 cli commands
user username to access the private image
pwd password to access the private image
url url to access the private image

Inspect a private image

Retrive image information.

d2k8 image inspect name

Argument Meaning
name name of the image to be retrieved

List private images

Retrieve all private images information.

d2k8 image list

Update a private image

Update a private image managed by d2k8.

d2k8 image update name --user user -pwd pwd -url url

Argument Meaning
name name of the node to be updated
user new username to access the private image (optional)
pwd new password to access the private image (optional)
url new url to access the private image (optional)

Delete a private image

Remove a private image from d2k8.

d2k8 image remove name

Argument Meaning
name name of the image to be deleted

Documentation

Index

Constants

View Source
const (
	FILL_SIZE = 30
)

Variables

View Source
var Commands = cli.Command{
	Name:  "image",
	Usage: "manage d2k8 images",
	Subcommands: []cli.Command{
		{
			Name:  "create",
			Usage: "create a private image",
			Flags: []cli.Flag{
				cli.StringFlag{
					Name:  "user, u",
					Usage: "Specify the username of the image",
				},
				cli.StringFlag{
					Name:  "pwd, p",
					Usage: "Specify the password to access the image",
				},
				cli.StringFlag{
					Name:  "url",
					Usage: "Specify the url where the image is available",
				},
			},
			Action: func(c *cli.Context) {
				if len(c.Args()) != 1 {
					log.Fatal("'create' command only needs the name of the image to be created as a positional argument")
				}
				if c.String("user") == "" {
					log.Fatal("flag 'user' is mandatory")
				}
				if c.String("pwd") == "" {
					log.Fatal("flag 'pwd' is mandatory")
				}
				if c.String("url") == "" {
					log.Fatal("flag 'url' is mandatory")
				}
				if !filepath.IsAbs(c.String("cert")) {
					log.Fatal("'cert' must be an absolute path")
				}
				err := CreateCmd(c.Args().First(), c.String("user"), c.String("pwd"), c.String("url"))
				if err != nil {
					log.Fatal(err)
				}
			},
		},
		{
			Name:      "inspect",
			ShortName: "get",
			Usage:     "get the information of a private image",
			Action: func(c *cli.Context) {
				if len(c.Args()) != 1 {
					log.Fatal("'inspect' command only needs the name of the image to retrieve as a postional argument")
				}
				err := InspectCmd(c.Args().First())
				if err != nil {
					log.Fatal(err)
				}
			},
		},
		{
			Name:      "list",
			ShortName: "ls",
			Usage:     "list the elora current private images",
			Action: func(c *cli.Context) {
				err := ListCmd()
				if err != nil {
					log.Fatal(err)
				}
			},
		},
		{
			Name:      "update",
			ShortName: "up",
			Usage:     "update a private image",
			Flags: []cli.Flag{
				cli.StringFlag{
					Name:  "user, u",
					Usage: "Specify the username of the image",
				},
				cli.StringFlag{
					Name:  "pwd, p",
					Usage: "Specify the password to access the image",
				},
				cli.StringFlag{
					Name:  "url",
					Usage: "Specify the url where the image is available",
				},
			},
			Action: func(c *cli.Context) {
				if len(c.Args()) != 1 {
					log.Fatal("'update' command only needs the name of the image to be updated as a positional argument")
				}
				err := UpdateCmd(c.Args().First(), c.String("user"), c.String("pwd"), c.String("url"))
				if err != nil {
					log.Fatal(err)
				}
			},
		},
		{
			Name:      "remove",
			ShortName: "rm",
			Usage:     "remove a private image",
			Action: func(c *cli.Context) {
				if len(c.Args()) != 1 {
					log.Fatal("'remove' command only needs the name of the image to be removed as a positional argument")
				}
				err := RemoveCmd(c.Args().First())
				if err != nil {
					log.Fatal(err)
				}
			},
		},
	},
}

Functions

func CreateCmd

func CreateCmd(name string, user string, pwd string, url string) error

func Delete

func Delete(name string) error

func Exists

func Exists(name string) bool

func FileFolder

func FileFolder() string

func FilePath

func FilePath(name string) string

func InspectCmd

func InspectCmd(name string) error

func List

func List() ([]string, error)

func ListCmd

func ListCmd() error

func RemoveCmd

func RemoveCmd(name string) error

func UpdateCmd

func UpdateCmd(name string, user string, pwd string, url string) error

func Write

func Write(image Image) error

Types

type Image

type Image struct {
	Name string
	User string
	Pwd  string
	Url  string
}

func Read

func Read(name string) (Image, error)

Jump to

Keyboard shortcuts

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