Esempio n. 1
0
File: list.go Progetto: bewiwi/sail
func domainList(namespace, service string) {
	var apps []string

	// TODO: rewrite whithout the m(n+1)+1... (needs API)
	if len(namespace) > 0 {
		apps = append(apps, namespace)
	} else {
		apps = internal.GetListApplications(nil)
	}

	for _, namespace := range apps {
		domainListNamespace(namespace, service)
	}
}
Esempio n. 2
0
func domainList(app string) {
	var apps []string

	// TODO: rewrite whithout the n+1... (needs API)
	if len(app) > 0 {
		apps = append(apps, app)
	} else {
		apps = internal.GetListApplications(nil)
	}

	for _, app := range apps {
		domainListApplication(app)
	}
}
Esempio n. 3
0
File: list.go Progetto: bewiwi/sail
	"fmt"
	"net/http"
	"os"
	"strings"
	"text/tabwriter"

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

var cmdServiceList = &cobra.Command{
	Use:     "list",
	Short:   "List the docker services: sail service list [applicationName]",
	Aliases: []string{"ls", "ps"},
	Run: func(cmd *cobra.Command, args []string) {
		serviceList(internal.GetListApplications(args))
	},
}

func serviceList(apps []string) {
	w := tabwriter.NewWriter(os.Stdout, 27, 1, 2, ' ', 0)
	titles := []string{"NAME", "REPOSITORY", "IMAGE ID", "STATE", "CONTAINERS", "CREATED", "NETWORK"}
	fmt.Fprintln(w, strings.Join(titles, "\t"))

	services := []string{}
	var service map[string]interface{}
	for _, app := range apps {
		b := internal.ReqWant("GET", http.StatusOK, fmt.Sprintf("/applications/%s/services", app), nil)
		internal.Check(json.Unmarshal(b, &services))
		for _, serviceID := range services {
			b := internal.ReqWant("GET", http.StatusOK, fmt.Sprintf("/applications/%s/services/%s", app, serviceID), nil)
Esempio n. 4
0
	"fmt"
	"net/http"
	"os"
	"strings"
	"text/tabwriter"

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

var cmdNetworkList = &cobra.Command{
	Use:     "list",
	Short:   "List the docker private networks: sail network list [applicationName]",
	Aliases: []string{"ls", "ps"},
	Run: func(cmd *cobra.Command, args []string) {
		networkList(internal.GetListApplications(args))
	},
}

func networkList(apps []string) {
	w := tabwriter.NewWriter(os.Stdout, 30, 1, 3, ' ', 0)
	titles := []string{"NAME", "SUBNET"}
	fmt.Fprintln(w, strings.Join(titles, "\t"))

	networks := []string{}
	var network map[string]interface{}
	for _, app := range apps {
		b := internal.ReqWant("GET", http.StatusOK, fmt.Sprintf("/applications/%s/networks", app), nil)
		internal.Check(json.Unmarshal(b, &networks))
		for _, networkID := range networks {
			b := internal.ReqWant("GET", http.StatusOK, fmt.Sprintf("/applications/%s/networks/%s", app, networkID), nil)
Esempio n. 5
0
	"fmt"
	"net/http"
	"os"
	"strings"
	"text/tabwriter"

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

var cmdRepositoryList = &cobra.Command{
	Use:     "list",
	Short:   "List the docker repository: sail repository list [applicationName]",
	Aliases: []string{"ls", "ps"},
	Run: func(cmd *cobra.Command, args []string) {
		repositoryList(internal.GetListApplications(args))
	},
}

func repositoryList(apps []string) {
	w := tabwriter.NewWriter(os.Stdout, 30, 1, 3, ' ', 0)
	titles := []string{"NAME", "TAG", "TYPE", "PRIVACY", "SOURCE"}
	fmt.Fprintln(w, strings.Join(titles, "\t"))

	repositories := []string{}
	var repository map[string]interface{}
	for _, app := range apps {
		b := internal.ReqWant("GET", http.StatusOK, fmt.Sprintf("/repositories/%s", app), nil)
		internal.Check(json.Unmarshal(b, &repositories))
		for _, repositoryID := range repositories {
			b := internal.ReqWant("GET", http.StatusOK, fmt.Sprintf("/repositories/%s/%s", app, repositoryID), nil)
Esempio n. 6
0
	"fmt"
	"net/http"
	"os"
	"strings"
	"text/tabwriter"

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

var cmdContainerList = &cobra.Command{
	Use:     "list",
	Short:   "List docker containers: sail container list [applicationName]",
	Aliases: []string{"ls", "ps"},
	Run: func(cmd *cobra.Command, args []string) {
		containerList(internal.GetListApplications(args))
	},
}

func containerList(apps []string) {
	w := tabwriter.NewWriter(os.Stdout, 20, 1, 3, ' ', 0)
	titles := []string{"APPLICATION", "SERVICE", "CONTAINER", "STATE", "DEPLOYED"}
	fmt.Fprintln(w, strings.Join(titles, "\t"))

	containers := []string{}
	var container map[string]interface{}
	for _, app := range apps {
		b := internal.ReqWant("GET", http.StatusOK, fmt.Sprintf("/applications/%s/containers", app), nil)
		internal.Check(json.Unmarshal(b, &containers))
		for _, containerID := range containers {
			b := internal.ReqWant("GET", http.StatusOK, fmt.Sprintf("/applications/%s/containers/%s", app, containerID), nil)