Esempio n. 1
0
File: show.go Progetto: bewiwi/sail
func serviceShow(serviceID string) {
	t := strings.Split(serviceID, "/")
	if len(t) != 2 {
		fmt.Fprintln(os.Stderr, "Invalid usage. sail service show <applicationName>/<serviceId>. Please see sail service show --help")
	} else {
		internal.FormatOutputDef(internal.GetWantJSON(fmt.Sprintf("/applications/%s/services/%s", t[0], t[1])))
	}
}
Esempio n. 2
0
File: logs.go Progetto: Alkorin/sail
func containerLogs(args Logs) {
	queryArgs, err := query.Values(args)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Fatal: %s\n", err)
		return
	}
	path := fmt.Sprintf("/applications/%s/containers/%s/logs?%s", args.Application, args.Container, queryArgs.Encode())

	b := internal.GetWantJSON(path)
	internal.FormatOutput(b, containerLogsFormatter)
}
Esempio n. 3
0
File: env.go Progetto: runabove/sail
func cmdListEnv(cmd *cobra.Command, args []string) {
	var applicationName string

	switch len(args) {
	case 0:
		applicationName = internal.GetUserName()
	case 1:
		applicationName = args[0]
	default:
		fmt.Fprintln(os.Stderr, "Invalid usage. Please see sail application env list --help")
		return
	}

	internal.FormatOutputDef(internal.GetWantJSON(fmt.Sprintf("/applications/%s/env", applicationName)))
}
Esempio n. 4
0
	Run: func(cmd *cobra.Command, args []string) {
		var applicationName string
		switch len(args) {
		case 0:
			applicationName = internal.GetUserName()
		case 1:
			applicationName = args[0]
		default:
			fmt.Fprintln(os.Stderr, "Invalid usage. Please see sail application webhook list --help")
			return
		}
		// Sanity
		err := internal.CheckName(applicationName)
		internal.Check(err)

		internal.FormatOutputDef(internal.GetWantJSON(fmt.Sprintf("/applications/%s/hook", applicationName)))
	},
}

var cmdApplicationWebhookAdd = &cobra.Command{
	Use:   "add",
	Short: "Add a webhook to an application ; sail application webhook add [<applicationName>] <WebhookURL>",
	Long: `Add a webhook to an application ; sail application webhook add [<applicationName>] <WebhookURL>
example:
	sail application webhook add http://www.endpoint.com/hook
	sail application webhook add my-app http://www.endpoint.com/hook
Endpoint url must accept POST with json body.
		`,
	Run: func(cmd *cobra.Command, args []string) {
		var applicationName string
		var webhookURL string
Esempio n. 5
0
func init() {
	Cmd.AddCommand(cmdContainerList)
	Cmd.AddCommand(cmdContainerShow)
	Cmd.AddCommand(cmdContainerAttach)
	Cmd.AddCommand(cmdContainerLogs())
}

// Cmd container
var Cmd = &cobra.Command{
	Use:     "container",
	Short:   "Container commands: sail container --help",
	Long:    `Container commands: sail container <command>`,
	Aliases: []string{"c", "containers"},
}

var cmdContainerShow = &cobra.Command{
	Use:     "show",
	Aliases: []string{"inspect"},
	Short:   "Show a docker container: sail container show <applicationName> <containerId>",
	Long: `Show a docker container: sail container show <applicationName> <containerId>
	\"example: sail container show my-app my-container"
	`,
	Run: func(cmd *cobra.Command, args []string) {
		if len(args) != 2 {
			fmt.Fprintln(os.Stderr, "Invalid usage. sail container show <applicationName> <containerId>. Please see sail container show --help")
		} else {
			internal.FormatOutputDef(internal.GetWantJSON(fmt.Sprintf("/applications/%s/containers/%s", args[0], args[1])))
		}
	},
}
Esempio n. 6
0
// Cmd container
var Cmd = &cobra.Command{
	Use:     "container",
	Short:   "Container commands: sail container --help",
	Long:    `Container commands: sail container <command>`,
	Aliases: []string{"c", "containers"},
}

var cmdContainerShow = &cobra.Command{
	Use:     "show",
	Aliases: []string{"inspect"},
	Short:   "Show a docker container: sail container show <containerId>",
	Long: `Show a docker container: sail container show <containerId>
	\"example: sail container show my-app my-container"
	`,
	Run: func(cmd *cobra.Command, args []string) {
		var container string

		switch len(args) {
		case 1:
			container = args[0]
		case 2:
			container = args[1]
		default:
			fmt.Fprintln(os.Stderr, "Invalid usage. sail container show <containerId>. Please see sail container show --help")
			os.Exit(1)
		}
		internal.FormatOutputDef(internal.GetWantJSON(fmt.Sprintf("/containers/%s", container)))
	},
}
Esempio n. 7
0
package application

import (
	"github.com/runabove/sail/internal"
	"github.com/spf13/cobra"
)

var cmdApplicationList = &cobra.Command{
	Use:     "list",
	Short:   "List granted apps: sail application list",
	Aliases: []string{"ls", "ps"},
	Run: func(cmd *cobra.Command, args []string) {
		internal.FormatOutputDef(internal.GetWantJSON("/applications"))
	},
}
Esempio n. 8
0
package me

import (
	"github.com/runabove/sail/internal"
	"github.com/spf13/cobra"
)

var cmdMeShow = &cobra.Command{
	Use:   "show",
	Short: "Show account details: sail me show",
	Run: func(cmd *cobra.Command, args []string) {
		internal.FormatOutputDef(internal.GetWantJSON("/users"))
	},
}