コード例 #1
0
ファイル: main.go プロジェクト: ibmendoza/dgtk
func main() {
	router := cli.NewRouter()

	router.Register("import", &actImportTemplateVM{}, "Import template VM used for cloning.")
	router.Register("get/template", &actDownloadTemplateVM{}, "Get template VM used for cloning.")

	router.Register("list", &actListVMs{}, "List available VMs.")

	router.Register("vm/info", &vmBase{Action: "info"}, "Show information on the given VM.")

	router.Register("vm/config/mem", &actConfigMemVM{}, "Configure the VM to have given amount of memory.")
	router.Register("vm/config/cpu", &actConfigCPUsVM{}, "Configure the VM to have given amount of CPUs.")
	router.Register("vm/config/boot", &actConfigBootOrderVM{}, "Configure the boot order of the VM.")
	router.Register("vm/config/nic", &actConfigNetworkIFacesVM{}, "Configure the according NIC of the VM.")

	router.Register("vm/share", &actShareFolder{}, "Share a folder with the given VM.")
	router.Register("vm/unshare", &actUnshareFolder{}, "Unshare a folder with the given VM.")

	router.Register("clone", &actCloneVM{}, "Clone a new VM from a template VM.")
	router.Register("delete", &vmBase{Action: "delete"}, "Delete the VM with the given name.")

	router.Register("start", &actStartVM{}, "Start the VM with the given name.")
	router.Register("save", &vmBase{Action: "save"}, "Stop the VM with the given name (saving the current state).")
	router.Register("stop", &vmBase{Action: "stop"}, "Stop the VM with the given name (unplug the VM).")
	router.Register("shutdown", &vmBase{Action: "shutdown"}, "Send the VM the ACPI shutdown signal.")

	router.Register("vm/props", &vmBase{Action: "props"}, "List properties of given VM.")

	router.Register("ssh/into", &sshInto{}, "Connect to the VM using SSH.")

	if e := router.RunWithArgs(); e != nil {
		log.Fatal(e)
	}
}
コード例 #2
0
ファイル: router.go プロジェクト: rajthilakmca/urknall
func router() *cli.Router {
	router := cli.NewRouter()
	router.Register("init", &initProject{}, "Initialize a basic urknall project.")
	router.Register("templates/add", &templatesAdd{}, "Add templates to project.")
	router.Register("templates/list", &templatesList{}, "List all available templates.")
	return router
}
コード例 #3
0
ファイル: router.go プロジェクト: ibmendoza/dgtk
func router() *cli.Router {
	router := cli.NewRouter()

	router.Register("image/current", &currentImage{}, "get the current image")
	router.Register("env/current", &currentEnv{}, "get the current env")
	return router
}
コード例 #4
0
ファイル: main.go プロジェクト: himanshugpt/evergreen
func main() {
	router := cli.NewRouter()
	router.Register("prices", &ec2.Prices{Region: os.Getenv("AWS_DEFAULT_REGION")}, "List ec2 prices")
	e := router.Run(append([]string{"prices"}, os.Args[1:]...)...)
	if e != nil {
		log.Fatal(e.Error())
	}
}
コード例 #5
0
ファイル: router.go プロジェクト: ibmendoza/dgtk
func router() *cli.Router {
	r := cli.NewRouter()

	r.Register("test", &testNotification{}, "test the hipchat notification mechanism")
	r.Register("notify", &sendNotification{}, "send notification if given command failed")

	return r
}
コード例 #6
0
ファイル: router.go プロジェクト: ibmendoza/dgtk
func router() *cli.Router {
	r := cli.NewRouter()

	r.Register("snapshots/list", &list{}, "list all RDS snapshots")
	r.Register("snapshots/backup", &backup{}, "backup latest RDS snapshot")

	return r
}
コード例 #7
0
ファイル: main.go プロジェクト: robmorgan/admiral
func main() {
	router := cli.NewRouter()
	router.Register("hosts/list", &hostsList{}, "List Hosts")
	switch err := router.RunWithArgs(); err {
	case nil, cli.ErrorHelpRequested, cli.ErrorNoRoute:
		// ignore
		return
	default:
		logger.Fatal(err)
	}
}
コード例 #8
0
ファイル: main.go プロジェクト: ibmendoza/dgtk
func main() {
	router := cli.NewRouter()

	router.Register("entities/show", &ShowEntity{w: "foog"}, "an example action")
	router.Register("entities/list", &ShowEntity{w: "foog"}, "an example action")
	router.Register("entit/list", &ShowEntity{w: "foog", Option: "barz"}, "an example action")
	router.RegisterFunc("version", func() error { log.Printf("x.y"); return nil }, "show the apps version")

	if e := router.RunWithArgs(); e != nil {
		log.Fatal(e)
	}
}
コード例 #9
0
ファイル: main.go プロジェクト: himanshugpt/evergreen
func main() {
	router := cli.NewRouter()
	router.Register("images/list", &imagesList{}, "List Images")
	router.Register("regions/list", &regionsList{}, "List Regions")
	router.Register("keys/list", &keysList{}, "List Keys")
	router.Register("droplets/delete", &dropletDelete{}, "Delete Droplet")
	router.Register("droplets/list", &dropletsList{}, "List Droplets")
	router.Register("droplets/show", &dropletShow{}, "Show Droplet")
	router.Register("droplets/create", &dropletCreate{}, "Create Droplet")
	switch e := router.RunWithArgs(); e {
	case nil, cli.ErrorHelpRequested, cli.ErrorNoRoute:
		// ignore
		return
	default:
		logger.Fatal(e)
	}
}
コード例 #10
0
ファイル: routes.go プロジェクト: ibmendoza/dgtk
func router() *cli.Router {
	router := cli.NewRouter()
	router.Register("browse", &Browse{}, "Browse github repository")
	router.Register("commits", &Commits{}, "List github commits")
	router.Register("gists/browse", &BrowseGists{}, "Browse Gists")
	router.Register("gists/create", &CreateGist{}, "Create a new")
	router.Register("gists/delete", &DeleteGist{}, "Create a new")
	router.Register("gists/list", &ListGists{}, "List Gists")
	router.Register("gists/open", &OpenGist{}, "Open a Gist")
	router.Register("issues/list", &issuesList{}, "List github issues")
	router.Register("issues/browse", &issuesBrowse{}, "List github issues")
	router.Register("issues/create", &issuesCreate{}, "List github issues")
	router.Register("issues/open", &issueOpen{}, "Open github issues")
	router.Register("issues/label", &issueLabel{}, "Label issue")
	router.Register("issues/close", &issueClose{}, "Close github issues")
	router.Register("issues/assign", &issueAssign{}, "Assign gitbub issue")
	router.Register("notifications", &GithubNotifications{}, "Browse github notifications")
	router.Register("pulls", &GithubPulls{}, "List github pull requests")
	return router
}
コード例 #11
0
ファイル: main.go プロジェクト: ibmendoza/dgtk
func main() {
	router := cli.NewRouter()
	router.Register("aliases/create", &aliasCreate{}, "Create alias")
	router.Register("aliases/ls", &esAliases{}, "List Aliases")
	router.Register("aliases/rm", &aliasDelete{}, "Delete alias")
	router.Register("aliases/swap", &swapIndex{}, "Swap Alias")
	router.Register("index/dump", &dump{}, "Dump an index")
	router.Register("index/ls", &esIndexes{}, "List es indexes")
	router.Register("index/rm", &indexDelete{}, "Delete index")
	router.Register("nodes/ls", &nodesLS{}, "Nodes List")
	router.Register("spy", &spy{}, "Spy on es requests")

	switch e := router.RunWithArgs(); e {
	case nil, cli.ErrorHelpRequested, cli.ErrorNoRoute:
		// ignore
		return
	default:
		logger.Fatal(e)
	}
}
コード例 #12
0
ファイル: main.go プロジェクト: himanshugpt/evergreen
	"os"

	"github.com/dynport/dgtk/cli"
	"github.com/dynport/gocloud/cli/aws/cloudformation"
	"github.com/dynport/gocloud/cli/aws/cloudwatch"
	"github.com/dynport/gocloud/cli/aws/ec2"
	"github.com/dynport/gocloud/cli/aws/elb"
	"github.com/dynport/gocloud/cli/aws/iam"
	"github.com/dynport/gocloud/cli/aws/route53"
	"github.com/dynport/gocloud/cli/digitalocean"
	"github.com/dynport/gocloud/cli/hetzner"
	"github.com/dynport/gocloud/cli/jiffybox"
	"github.com/dynport/gocloud/cli/profitbricks"
)

var router = cli.NewRouter()

func init() {
	ec2.Register(router)
	cloudformation.Register(router)
	elb.Register(router)
	digitalocean.Register(router)
	hetzner.Register(router)
	jiffybox.Register(router)
	route53.Register(router)
	iam.Register(router)
	cloudwatch.Register(router)
	profitbricks.Register(router)
}

func init() {