Beispiel #1
0
func parseOptions(c *cli.Context) {
	port = strconv.Itoa(c.Int("port"))

	if c.IsSet("config") {
		configFile = c.String("config")
	}
	config, err := readConfigurationFile(configFile)
	if err != nil {
		log.Fatalf("Could not read configuration file: %v", err)
		return
	}

	if c.IsSet("file") {
		// overwrite configuration file setting for todo.txt file, if given as commandline parameter
		config.TodoTxtFilename = c.String("file")
		if err := config.writeConfigurationFile(configFile); err != nil {
			log.Fatalf("Could not update configuration file: %v", err)
		}
	}

	// check if file actually exists, otherwise create new file
	if err := checkAndCreateFile(config.TodoTxtFilename); err != nil {
		log.Fatal(err)
	}
}
Beispiel #2
0
func add(c *cli.Context) {
	log.Debugln("[ENVMAN] - Work path:", envman.CurrentEnvStoreFilePath)

	key := c.String(KeyKey)
	expand := !c.Bool(NoExpandKey)
	replace := !c.Bool(AppendKey)

	var value string
	if stdinValue != "" {
		value = stdinValue
	} else if c.IsSet(ValueKey) {
		value = c.String(ValueKey)
	} else if c.String(ValueFileKey) != "" {
		if v, err := loadValueFromFile(c.String(ValueFileKey)); err != nil {
			log.Fatal("[ENVMAN] - Failed to read file value: ", err)
		} else {
			value = v
		}
	}

	if err := addEnv(key, value, expand, replace); err != nil {
		log.Fatal("[ENVMAN] - Failed to add env:", err)
	}

	log.Debugln("[ENVMAN] - Env added")

	if err := logEnvs(); err != nil {
		log.Fatal("[ENVMAN] - Failed to print:", err)
	}
}
Beispiel #3
0
func runUpdate(c *cli.Context) {
	if c.IsSet("config") {
		setting.CustomConf = c.String("config")
	}

	setup("update.log")

	if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 {
		log.GitLogger.Trace("SSH_ORIGINAL_COMMAND is empty")
		return
	}

	args := c.Args()
	if len(args) != 3 {
		log.GitLogger.Fatal(2, "Arguments received are not equal to three")
	} else if len(args[0]) == 0 {
		log.GitLogger.Fatal(2, "First argument 'refName' is empty, shouldn't use")
	}

	task := models.UpdateTask{
		UUID:        os.Getenv("uuid"),
		RefName:     args[0],
		OldCommitID: args[1],
		NewCommitID: args[2],
	}

	if err := models.AddUpdateTask(&task); err != nil {
		log.GitLogger.Fatal(2, "AddUpdateTask: %v", err)
	}
}
Beispiel #4
0
func cmdCreate(c *cli.Context) {
	utils.FlagsRequired(c, []string{"name", "description", "code"})
	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	v := make(map[string]string)

	v["name"] = c.String("name")
	v["description"] = c.String("description")
	v["code"] = c.String("code")
	if c.IsSet("parameters") {
		v["parameters"] = c.String("parameters")
	}

	jsonBytes, err := json.Marshal(v)
	utils.CheckError(err)
	err, res, code := webservice.Post("/v1/blueprint/scripts", jsonBytes)
	if res == nil {
		log.Fatal(err)
	}
	utils.CheckError(err)
	utils.CheckReturnCode(code, res)

	var new_script Script
	err = json.Unmarshal(res, &new_script)
	utils.CheckError(err)
	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\tDESCRIPTION\tCODE\tPARAMETERS\r")
	fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", new_script.Id, new_script.Name, new_script.Description, new_script.Code, new_script.Parameters)

	w.Flush()

}
Beispiel #5
0
func list(c *cli.Context) {
	var (
		err error
	)

	hosts := c.StringSlice("host")
	if c.IsSet("host") || c.IsSet("H") {
		hosts = hosts[1:]
	}

	client, err := proton.GetRaftClient(hosts[0], 2*time.Second)
	if err != nil {
		log.Fatal("couldn't initialize client connection")
	}

	resp, err := client.ListObjects(context.TODO(), &proton.ListObjectsRequest{})
	if err != nil {
		log.Fatal("Can't list objects in the cluster")
	}

	fmt.Println("Keys:")

	for _, obj := range resp.Objects {
		fmt.Println(":", obj.Key, ":", string(obj.Value))
	}
}
func getRequiredOption(ctx *cli.Context, flag string) string {
	option := ctx.String(flag)
	if !ctx.IsSet(flag) || strings.TrimSpace(option) == "" {
		exitOnError(fmt.Errorf("--%s option is required", flag))
	}
	return option
}
Beispiel #7
0
func cmdRackScale(c *cli.Context) {
	count := 0
	typ := ""

	if c.IsSet("count") {
		count = c.Int("count")
	}

	if c.IsSet("type") {
		typ = c.String("type")
	}

	system, err := rackClient(c).ScaleSystem(count, typ)

	if err != nil {
		stdcli.Error(err)
		return
	}

	fmt.Printf("Name     %s\n", system.Name)
	fmt.Printf("Status   %s\n", system.Status)
	fmt.Printf("Version  %s\n", system.Version)
	fmt.Printf("Count    %d\n", system.Count)
	fmt.Printf("Type     %s\n", system.Type)
}
Beispiel #8
0
func httpapiConfFromFlags(c *cli.Context) func(*dagger.HttpAPIConfig) {
	return func(conf *dagger.HttpAPIConfig) {
		if c.IsSet("api-port") {
			conf.Port = c.String("api-port")
		}
	}
}
Beispiel #9
0
func persisterConfFromFlags(c *cli.Context) func(*dagger.PersisterConfig) {
	return func(conf *dagger.PersisterConfig) {
		if c.IsSet("data-dir") {
			conf.Dir = c.String("data-dir")
		}
	}
}
Beispiel #10
0
func cmdUpdate(c *cli.Context) {
	utils.FlagsRequired(c, []string{"id"})
	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	v := make(map[string]string)

	if c.IsSet("name") {
		v["name"] = c.String("name")
	}
	if c.IsSet("fqdn") {
		v["fqdn"] = c.String("fqdn")
	}

	jsonBytes, err := json.Marshal(v)
	utils.CheckError(err)
	err, res, code := webservice.Put(fmt.Sprintf("/v1/cloud/servers/%s", c.String("id")), jsonBytes)
	utils.CheckError(err)
	utils.CheckReturnCode(code, res)

	var server Server
	err = json.Unmarshal(res, &server)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\tFQDN\tSTATE\tPUBLIC IP\tWORKSPACE ID\tTEMPLATE ID\tSERVER PLAN ID\tSSH PROFILE ID\r")
	fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", server.Id, server.Name, server.Fqdn, server.State, server.Public_ip, server.Workspace_id, server.Template_id, server.Server_plan_id, server.Ssh_profile_id)

	w.Flush()
}
Beispiel #11
0
func keypairsCreateCmd(c *CLI, ctx *cli.Context) {
	usage := func(msg string) {
		fmt.Printf("Usage: %s keypairs create --name=<keypair-name> <private-key-path> <certificate-path>\n", c.Name)
		fatal(msg)
	}
	if len(ctx.Args()) < 2 {
		usage("too few arguments")
	}
	if !ctx.IsSet("name") || ctx.String("name") == "" {
		usage("--name is required")
	}
	api := c.GetAPIClient(ctx)
	resourceGroup := c.GetResourceGroup(ctx)
	name := ctx.String("name")
	privateKeyPath := ctx.Args()[0]
	certPath := ctx.Args()[1]
	privateKey, err := ioutil.ReadFile(privateKeyPath)
	if err != nil {
		fatal(err.Error())
	}
	cert, err := ioutil.ReadFile(certPath)
	if err != nil {
		fatal(err.Error())
	}
	keypair := gondor.KeyPair{
		ResourceGroup: resourceGroup.URL,
		Name:          &name,
		Key:           privateKey,
		Certificate:   cert,
	}
	if err := api.KeyPairs.Create(&keypair); err != nil {
		fatal(err.Error())
	}
	success("keypair created.")
}
Beispiel #12
0
func configfile(c *cli.Context, have map[string]authCred, need map[string]string) error {
	dir, err := util.RackDir()
	if err != nil {
		// return fmt.Errorf("Error retrieving rack directory: %s\n", err)
		return nil
	}
	f := path.Join(dir, "config")
	cfg, err := ini.Load(f)
	if err != nil {
		// return fmt.Errorf("Error loading config file: %s\n", err)
		return nil
	}
	cfg.BlockMode = false
	var profile string
	if c.GlobalIsSet("profile") {
		profile = c.GlobalString("profile")
	} else if c.IsSet("profile") {
		profile = c.String("profile")
	}
	section, err := cfg.GetSection(profile)
	if err != nil && profile != "" {
		return fmt.Errorf("Invalid config file profile: %s\n", profile)
	}

	for opt := range need {
		if val := section.Key(opt).String(); val != "" {
			have[opt] = authCred{value: val, from: fmt.Sprintf("config file (profile: %s)", section.Name())}
			delete(need, opt)
		}
	}
	return nil
}
Beispiel #13
0
func (r *Request) SetParam(c *cli.Context) error {
	p := &r.Params
	if len(c.String("email")) != 0 {
		p.Email = c.String("email")
	}

	if len(c.String("password")) != 0 {
		p.Password = c.String("password")
	}

	if c.IsSet("token-timeout-seconds") {
		p.TokenTimeoutSeconds = c.Int("token-timeout-seconds")
	} else {
		p.TokenTimeoutSeconds = 86400
	}

	if len(c.String("token")) != 0 {
		p.OneTimeToken = c.String("token")
	}

	if len(c.String("new-password")) != 0 {
		p.NewPassword = c.String("new-password")
	}

	if len(c.String("verify-token")) != 0 {
		p.VerifyToken = c.String("verify-token")
	}

	return nil
}
func initClient(c *cli.Context) error {
	configFile := c.String("config_file")
	var config *gitkit.Config
	var err error
	if configFile != "" {
		config, err = gitkit.LoadConfig(configFile)
		if err != nil {
			return err
		}
	} else {
		config = &gitkit.Config{}
	}
	// It is required but not used.
	config.WidgetURL = "http://localhost"
	// Command line flags overwrite the values in config file.
	if c.IsSet("client_id") {
		config.ClientID = c.String("client_id")
	}
	if c.IsSet("google_app_credentials_path") {
		config.GoogleAppCredentialsPath = c.String("google_app_credentials_path")
	}

	if client, err = gitkit.New(context.Background(), config); err != nil {
		return err
	}
	return nil
}
Beispiel #15
0
func renew(c *cli.Context) {
	conf, _, client := setup(c)

	if len(c.GlobalStringSlice("domains")) <= 0 {
		logger().Fatal("Please specify at least one domain.")
	}

	domain := c.GlobalStringSlice("domains")[0]

	// load the cert resource from files.
	// We store the certificate, private key and metadata in different files
	// as web servers would not be able to work with a combined file.
	certPath := path.Join(conf.CertPath(), domain+".crt")
	privPath := path.Join(conf.CertPath(), domain+".key")
	metaPath := path.Join(conf.CertPath(), domain+".json")

	certBytes, err := ioutil.ReadFile(certPath)
	if err != nil {
		logger().Fatalf("Error while loading the certificate for domain %s\n\t%s", domain, err.Error())
	}

	if c.IsSet("days") {
		expTime, err := acme.GetPEMCertExpiration(certBytes)
		if err != nil {
			logger().Printf("Could not get Certification expiration for domain %s", domain)
		}

		if int(expTime.Sub(time.Now()).Hours()/24.0) > c.Int("days") {
			return
		}
	}

	metaBytes, err := ioutil.ReadFile(metaPath)
	if err != nil {
		logger().Fatalf("Error while loading the meta data for domain %s\n\t%s", domain, err.Error())
	}

	var certRes acme.CertificateResource
	err = json.Unmarshal(metaBytes, &certRes)
	if err != nil {
		logger().Fatalf("Error while marshalling the meta data for domain %s\n\t%s", domain, err.Error())
	}

	if c.Bool("reuse-key") {
		keyBytes, err := ioutil.ReadFile(privPath)
		if err != nil {
			logger().Fatalf("Error while loading the private key for domain %s\n\t%s", domain, err.Error())
		}
		certRes.PrivateKey = keyBytes
	}

	certRes.Certificate = certBytes

	newCert, err := client.RenewCertificate(certRes, true)
	if err != nil {
		logger().Fatalf("%s", err.Error())
	}

	saveCertRes(newCert, conf)
}
Beispiel #16
0
func dispatcherConfFromFlags(c *cli.Context) func(*dagger.DispatcherConfig) {
	return func(conf *dagger.DispatcherConfig) {
		if c.IsSet("pipelining-limit") {
			conf.PipeliningLimit = c.Int("pipelining-limit")
		}
	}
}
Beispiel #17
0
// It appends the set flags with the given command.
// `boolFlags` is a list of strings containing the names of the boolean
// command line options. These have to be handled in a slightly different
// way because zypper expects `--boolflag` instead of `--boolflag true`. Also
// boolean flags with a false value are ignored because zypper set all the
// undefined bool flags to false by default.
// `toIgnore` contains a list of flag names to not be passed to the final
//  command, this is useful to prevent zypper-docker only parameters to be
// forwarded to zypper (eg: `--author` or `--message`).
func cmdWithFlags(cmd string, ctx *cli.Context, boolFlags, toIgnore []string) string {
	for _, name := range ctx.FlagNames() {
		if arrayIncludeString(toIgnore, name) {
			continue
		}

		if value := ctx.String(name); ctx.IsSet(name) {
			var dash string
			if len(name) == 1 {
				dash = "-"
			} else {
				dash = "--"
			}

			if arrayIncludeString(boolFlags, name) {
				cmd += fmt.Sprintf(" %v%s", dash, name)
			} else {
				if arrayIncludeString(specialFlags, fmt.Sprintf("%v%s", dash, name)) && value != "" {
					cmd += fmt.Sprintf(" %v%s=%s", dash, name, value)
				} else {
					cmd += fmt.Sprintf(" %v%s %s", dash, name, value)
				}
			}
		}
	}

	return cmd
}
Beispiel #18
0
func ResolvConf(config *Config, ctx *cli.Context) error {
	// Get host resolv config
	resolvConf, err := dns.ClientConfigFromFile("/etc/resolv.conf")
	if err != nil {
		return err
	}

	if len(config.Nameservers) == 0 {
		for _, s := range resolvConf.Servers {
			config.Nameservers = append(config.Nameservers, net.JoinHostPort(s, resolvConf.Port))
		}
	}

	if !ctx.IsSet("ndots") && resolvConf.Ndots != 1 {
		log.Debugf("Setting ndots from resolv.conf: %d", resolvConf.Ndots)
		config.Ndots = resolvConf.Ndots
	}

	if config.EnableSearch && len(config.SearchDomains) == 0 {
		for _, s := range resolvConf.Search {
			s = dns.Fqdn(strings.ToLower(s))
			config.SearchDomains = append(config.SearchDomains, s)
		}
	}

	return nil
}
Beispiel #19
0
func getStringSliceOption(ctx *cli.Context, flag string, required bool) []string {
	slice := ctx.StringSlice(flag)
	if required && (!ctx.IsSet(flag) || len(slice) == 0) {
		exitOnError(fmt.Errorf("--%s must specify at least one string value", flag))
	}
	return slice
}
Beispiel #20
0
// Checks for authentication flags and returns a username/password
// from the specified settings
func checkForAuth(ctx *cli.Context) (username, password string) {
	if ctx.IsSet("password") {
		username = "******" // for now since username is unused but needs to exist for basicAuth
		// Prompt for password
		fmt.Print("Password:"******""
		} else {
			password = string(pass)
		}
		// Go to next line after password prompt
		fmt.Println()
		return
	}
	//Get config file path in the order:
	if ctx.IsSet("config") {
		cfg := &config{}
		if err := cfg.loadConfig(ctx.String("config")); err != nil {
			fmt.Println(err)
		}
		if cfg.RestAPI.Password != nil {
			password = *cfg.RestAPI.Password
		} else {
			fmt.Println("Error config password field 'rest-auth-pwd' is empty")
		}
	}
	return
}
Beispiel #21
0
func put(c *cli.Context) {
	var (
		err error
	)

	hosts := c.StringSlice("host")
	if c.IsSet("host") || c.IsSet("H") {
		hosts = hosts[1:]
	}

	key := c.String("key")
	if key == "" {
		log.Fatal("key flag must be set")
	}

	value := []byte(c.String("value"))
	if c.String("value") == "" {
		log.Fatal("value flag must be set")
	}

	client, err := proton.GetRaftClient(hosts[0], 2*time.Second)
	if err != nil {
		log.Fatal("couldn't initialize client connection")
	}

	resp, err := client.PutObject(context.TODO(), &proton.PutObjectRequest{Object: &proton.Pair{Key: key, Value: value}})
	if resp == nil || err != nil {
		log.Fatal("Can't put object in the cluster")
	}
}
Beispiel #22
0
func cmdUpdateTemplateScript(c *cli.Context) {
	utils.FlagsRequired(c, []string{"id", "template_id"})
	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	v := make(map[string]interface{})

	if c.IsSet("parameter_values") {
		var params TemplateScriptCredentials
		err = json.Unmarshal([]byte(c.String("credentials")), &params)
		v["parameter_values"] = params
	}

	jsonBytes, err := json.Marshal(v)
	utils.CheckError(err)
	err, res, code := webservice.Put(fmt.Sprintf("/v1/blueprint/templates/%s/scripts/%s", c.String("template_id"), c.String("id")), jsonBytes)
	utils.CheckError(err)
	utils.CheckReturnCode(code, res)

	var templateScript TemplateScript
	err = json.Unmarshal(res, &templateScript)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tTYPE\tEXECUTION ORDER\tTEMPLATE ID\tSCRIPT ID\tPARAMETER VALUES\r")
	fmt.Fprintf(w, "%s\t%s\t%d\t%s\t%s\t%s\n", templateScript.Id, templateScript.Type, templateScript.Execution_Order, templateScript.Template_Id, templateScript.Script_Id, templateScript.Parameter_Values)

	w.Flush()
}
Beispiel #23
0
func getMetric(ctx *cli.Context) error {
	if !ctx.IsSet("metric-namespace") {
		return newUsageError("namespace is required\n\n", ctx)
	}
	ns := ctx.String("metric-namespace")
	ver := ctx.Int("metric-version")
	metric := pClient.GetMetric(ns, ver)
	switch mtype := metric.(type) {
	case []*client.GetMetricResult:
		// Multiple metrics
		var merr error
		for i, m := range metric.([]*client.GetMetricResult) {
			err := printMetric(m, i)
			if err != nil {
				merr = err
			}
		}
		if merr != nil {
			return merr
		}
	case *client.GetMetricResult:
		// Single metric
		err := printMetric(metric.(*client.GetMetricResult), 0)
		if err != nil {
			return err
		}
	default:
		return fmt.Errorf("Unexpected response type %T\n", mtype)
	}
	return nil
}
func initClient(c *cli.Context) error {
	configFile := c.String("config_file")
	config := &gitkit.Config{}
	var err error
	if configFile != "" {
		var b []byte
		b, err = ioutil.ReadFile(configFile)
		if err != nil {
			return err
		}
		var c CliConfig
		if err = json.Unmarshal(b, &c); err != nil {
			return err
		}
		clientID = c.ClientID
		config.GoogleAppCredentialsPath = c.GoogleAppCredentialsPath
	}
	// It is required but not used.
	config.WidgetURL = "http://localhost"
	// Command line flags overwrite the values in config file.
	if c.IsSet("client_id") {
		clientID = c.String("client_id")
	}
	if c.IsSet("google_app_credentials_path") {
		config.GoogleAppCredentialsPath = c.String("google_app_credentials_path")
	}

	if client, err = gitkit.New(context.Background(), config); err != nil {
		return err
	}
	return nil
}
Beispiel #25
0
func runWeb(ctx *cli.Context) {
	if ctx.IsSet("config") {
		setting.CustomConf = ctx.String("config")
	}
	routers.GlobalInit()
	checkVersion()
}
Beispiel #26
0
func members(c *cli.Context) {
	var (
		err error
	)

	hosts := c.StringSlice("host")
	if c.IsSet("host") || c.IsSet("H") {
		hosts = hosts[1:]
	}

	client, err := proton.GetRaftClient(hosts[0], 2*time.Second)
	if err != nil {
		log.Fatal("couldn't initialize client connection")
	}

	resp, err := client.ListMembers(context.TODO(), &proton.ListMembersRequest{})
	if err != nil {
		log.Fatal("Can't list members in the cluster")
	}

	fmt.Println("Nodes:")

	for _, node := range resp.Members {
		fmt.Println(":", node.ID)
	}
}
Beispiel #27
0
// statusCommandFunc executes the "status" command.
func statusCommandFunc(c *cli.Context, client *client.Client) error {
	var host, owner, repo, branch string
	var args = c.Args()

	if len(args) != 0 {
		host, owner, repo = parseRepo(args[0])
	}

	if c.IsSet("branch") {
		branch = c.String("branch")
	} else {
		branch = "master"
	}

	builds, err := client.Commits.ListBranch(host, owner, repo, branch)
	if err != nil {
		return err
	} else if len(builds) == 0 {
		return nil
	}

	var build = builds[len(builds)-1]
	fmt.Printf("%s\t%s\t%s\t%s\t%v", build.Status, build.ShaShort(), build.Timestamp, build.Author, build.Message)
	return nil
}
Beispiel #28
0
func runWeb(c *cli.Context) {
	if c.IsSet("config") {
		setting.CustomConf = c.String("config")
	}
	controllers.GlobalInit()
	m := newMacaron()

	m.Get("/", controllers.Home)
	m.Get("/feed.json", catalog.AllFeedJSON)
	m.Get("/ok.json", func(c *macaron.Context) { c.JSON(200, "ok") })

	m.Group("/cat", func() {
		m.Get("/", catalog.Index)
		m.Get("/page/:p", catalog.Index)
		m.Get("/:id", catalog.Show).Name("cat_item")
		m.Get("/:id/feed", catalog.Feed)
		m.Get("/:id/feed/page/:p", catalog.Feed)
		m.Get("/:id/feed/:feedId", catalog.FeedShow)
		m.Get("/screen/:id", catalog.Screen)

		m.Get("/:id/setfeed", catalog.SetFeed).Name("set_feed")

		m.Any("/submit", catalog.Submit)
	})

	m.Get("/resize/*", catalog.Resize)

	m.Post("/upload", controllers.Upload)

	m.Run(5000)
}
Beispiel #29
0
func runUpdate(c *cli.Context) {
	if c.IsSet("config") {
		setting.CustomConf = c.String("config")
	}
	cmd := os.Getenv("SSH_ORIGINAL_COMMAND")
	if cmd == "" {
		return
	}

	setup("update.log")

	args := c.Args()
	if len(args) != 3 {
		log.GitLogger.Fatal(2, "received less 3 parameters")
	} else if args[0] == "" {
		log.GitLogger.Fatal(2, "refName is empty, shouldn't use")
	}

	task := models.UpdateTask{
		UUID:        os.Getenv("uuid"),
		RefName:     args[0],
		OldCommitID: args[1],
		NewCommitID: args[2],
	}

	if err := models.AddUpdateTask(&task); err != nil {
		log.GitLogger.Fatal(2, "AddUpdateTask: %v", err)
	}
}
Beispiel #30
0
func cmdCreate(c *cli.Context) {
	utils.FlagsRequired(c, []string{"name", "public_key"})
	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	v := make(map[string]string)

	v["name"] = c.String("name")
	v["public_key"] = c.String("public_key")

	if c.IsSet("private_key") {
		v["private_key"] = c.String("private_key")
	}

	jsonBytes, err := json.Marshal(v)
	utils.CheckError(err)
	err, res, code := webservice.Post("/v1/cloud/ssh_profiles", jsonBytes)
	if res == nil {
		log.Fatal(err)
	}
	utils.CheckError(err)
	utils.CheckReturnCode(code, res)

	var sshProfile SSHProfile
	err = json.Unmarshal(res, &sshProfile)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\rPUBLIC KEY\tPRIVATE KEY\r")
	fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", sshProfile.Id, sshProfile.Name, sshProfile.Public_key, sshProfile.Private_key)
	w.Flush()
}