示例#1
0
func cmdShow(c *cli.Context) {
	var vals LicenseeReport

	utils.FlagsRequired(c, []string{"id"})

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get(fmt.Sprintf("/v1/licensee/reports/%s", c.String("id")))
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &vals)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)

	fmt.Fprintln(w, "REPORT ID\tYEAR\tMONTH\tSTART TIME\tEND TIME\tSERVER SECONDS\tCLOSED\r")
	fmt.Fprintf(w, "%s\t%d\t%s\t%s\t%s\t%g\t%t\n", vals.Id, vals.Year, vals.Month, vals.StartTime, vals.EndTime, vals.ServerSeconds, vals.Closed)

	fmt.Fprintln(w, "LINES:\r")
	fmt.Fprintln(w, "ID\tCOMMISSIONED AT\tDECOMMISSIONED AT\tINSTANCE ID\tINSTANCE NAME\tINSTANCE FQDN\tCONSUMPTION\r")

	for _, l := range vals.Li {
		fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%g\n", l.Id, l.Commissioned_at, l.Decommissioned_at, l.Instance_id, l.Instance_name, l.Instance_fqdn, l.Consumption)
	}
	w.Flush()

}
示例#2
0
func cmdList(c *cli.Context) {
	var accounts []Account

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get("/v1/settings/cloud_accounts")
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &accounts)
	utils.CheckError(err)

	err, data, res = webservice.Get("/v1/cloud/cloud_providers")
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	var cloudProviders []providers.CloudProvider
	err = json.Unmarshal(data, &cloudProviders)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tCLOUD PROVIDER ID\tNAME\r")

	for _, ac := range accounts {
		acName := ""
		for _, cp := range cloudProviders {
			if ac.CloudProvId == cp.Id {
				acName = cp.Name
				break
			}
		}

		fmt.Fprintf(w, "%s\t%s\t%s\n", ac.Id, ac.CloudProvId, acName)
	}

	w.Flush()
}
示例#3
0
func cmdShow(c *cli.Context) {
	utils.FlagsRequired(c, []string{"id"})
	var sshProfile SSHProfile

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get(fmt.Sprintf("/v1/cloud/ssh_profiles/%s", c.String("id")))
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &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()
}
示例#4
0
func cmdShow(c *cli.Context) {
	utils.FlagsRequired(c, []string{"id"})
	var server Server

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get(fmt.Sprintf("/v1/cloud/servers/%s", c.String("id")))
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &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()
}
示例#5
0
func cmdShowDomainRecords(c *cli.Context) {
	utils.FlagsRequired(c, []string{"domain_id", "id"})
	var dr DomainRecord

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get(fmt.Sprintf("/v1/dns/domains/%s/records/%s", c.String("domain_id"), c.String("id")))
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &dr)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tTYPE\tNAME\tCONTENT\tTTL\tPRIORITY\tSERVER ID\tDOMAIN ID\r")
	fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%d\t%d\t%s\t%s\n", dr.Id, dr.Type, dr.Name, dr.Content, dr.Ttl, dr.Prio, dr.Server_id, dr.Domain_id)

	w.Flush()
}
示例#6
0
func cmdShow(c *cli.Context) {
	utils.FlagsRequired(c, []string{"id"})
	var workspace Workspace

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get(fmt.Sprintf("/v1/cloud/workspaces/%s", c.String("id")))
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &workspace)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\tDEFAULT\tDOMAIN ID\tSSH PROFILE ID\tFIREWALL PROFILE ID\r")
	fmt.Fprintf(w, "%s\t%s\t%t\t%s\t%s\t%s\n", workspace.Id, workspace.Name, workspace.Default, workspace.Domain_id, workspace.Ssh_profile_id, workspace.Firewall_profile_id)

	w.Flush()
}
示例#7
0
func get() Policy {
	var policy Policy
	webservice, err := webservice.NewWebService()
	if err != nil {
		log.Fatal(err)
	}

	log.Debugf("Current firewall driver %s", driverName())
	err, data, _ := webservice.Get(endpoint)
	if err != nil {
		log.Fatal(err)
	}

	err = json.Unmarshal(data, &policy)
	if err != nil {
		log.Fatal(err)
	}
	policy.Md5 = fmt.Sprintf("%x", md5.Sum(data))
	return policy
}
示例#8
0
func cmdShow(c *cli.Context) {
	utils.FlagsRequired(c, []string{"id"})
	var lb LoadBalancer

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get(fmt.Sprintf("/v1/network/load_balancers/%s", c.String("id")))
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &lb)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\tFQDN\tPROTOCOL\tPORT\tALGORITHM\tSSL CERTIFICATE\tSSL CERTIFICATE PRIVATE KEY\tDOMAIN ID\tCLOUD PROVIDER ID\tTRAFFIC IN\tTRAFFIC OUT\r")
	fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%d\t%s\t%s\t%s\t%s\t%s\t%d\t%d\n", lb.Id, lb.Name, lb.Fqdn, lb.Protocol, lb.Port, lb.Algorithm, lb.SslCertificate, lb.Ssl_certificate_private_key, lb.Domain_id, lb.Cloud_provider_id, lb.Traffic_in, lb.Traffic_out)

	w.Flush()
}
示例#9
0
func cmdShow(c *cli.Context) {
	utils.FlagsRequired(c, []string{"id"})
	var script Script

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get(fmt.Sprintf("/v1/blueprint/scripts/%s", c.String("id")))
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &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", script.Id, script.Name, script.Description, script.Code, script.Parameters)

	w.Flush()
}
示例#10
0
func cmdShowTemplateScript(c *cli.Context) {
	utils.FlagsRequired(c, []string{"id", "template_id"})
	var templateScript TemplateScript

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get(fmt.Sprintf("/v1/blueprint/templates/%s/scripts/%s", c.String("template_id"), c.String("id")))
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &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()
}
示例#11
0
func cmdShow(c *cli.Context) {
	utils.FlagsRequired(c, []string{"id"})
	var sp ServerPlan

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get(fmt.Sprintf("/v1/cloud/server_plans/%s", c.String("id")))
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &sp)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\tMEMORY\tCPUS\tSTORAGE\tLOCATION ID\tCLOUD PROVIDER ID\r")
	fmt.Fprintf(w, "%s\t%s\t%d\t%g\t%d\t%s\t%s\n", sp.Id, sp.Name, sp.Memory, sp.CPUs, sp.Storage, sp.LocationId, sp.CloudProviderId)

	w.Flush()
}
示例#12
0
func cmdShow(c *cli.Context) {
	utils.FlagsRequired(c, []string{"id"})
	var service Service

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get(fmt.Sprintf("/v1/blueprint/services/%s", c.String("id")))
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &service)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\tDESCRIPTION\tPUBLIC\tLICENSE\tRECIPES\r")
	fmt.Fprintf(w, "%s\t%s\t%s\t%t\t%s\t%s\n", service.Id, service.Name, service.Description, service.Public, service.License, service.Recipes)

	w.Flush()
}
示例#13
0
func cmdList(c *cli.Context) {
	var wizzApps []WizardApp

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get("/v1/wizard/apps")
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &wizzApps)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\tFLAVOUR REQUIREMENTS\tGENERIC IMAGE ID\r")

	for _, wa := range wizzApps {
		fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", wa.Id, wa.Name, wa.Flavour_requirements, wa.Generic_image_id)
	}

	w.Flush()
}
示例#14
0
func cmdList(c *cli.Context) {
	var scripts []Script

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get("/v1/blueprint/scripts")
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &scripts)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\tDESCRIPTION\tCODE\tPARAMETERS\r")

	for _, script := range scripts {
		fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", script.Id, script.Name, script.Description, script.Code, script.Parameters)
	}

	w.Flush()
}
示例#15
0
func cmdList(c *cli.Context) {
	var accounts []Account

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get("/v1/settings/saas_accounts")
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &accounts)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tSAAS PROVIDER ID\r")

	for _, ac := range accounts {
		fmt.Fprintf(w, "%s\t%s\n", ac.Id, ac.SaasProvId)
	}

	w.Flush()
}
示例#16
0
func cmdList(c *cli.Context) {
	var templates []Template

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get("/v1/blueprint/templates")
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &templates)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\tGENERIC IMAGE ID\r")

	for _, template := range templates {
		fmt.Fprintf(w, "%s\t%s\t%s\n", template.Id, template.Name, template.GenericImgId)
	}

	w.Flush()
}
示例#17
0
func cmdList(c *cli.Context) {
	var cloudProviders []CloudProvider

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get("/v1/cloud/cloud_providers")
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &cloudProviders)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\tREQUIRED CREDENTIALS\tPROVIDED SERVICES\r")

	for _, cl := range cloudProviders {
		fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", cl.Id, cl.Name, cl.RequiredCredentials, cl.ProvidedServices)
	}

	w.Flush()
}
示例#18
0
func cmdListNodes(c *cli.Context) {
	var nodes []Node

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get(fmt.Sprintf("/v1/network/load_balancers/%s/nodes", c.String("balancer_id")))
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &nodes)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\tPUBLIC IP\tSTATE\tSERVER ID\tPORT\r")

	for _, n := range nodes {
		fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%d\n", n.Id, n.Name, n.PublicIp, n.State, n.ServerId, n.Port)
	}

	w.Flush()
}
示例#19
0
func cmdList(c *cli.Context) {
	var sshProfiles []SSHProfile

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get("/v1/cloud/ssh_profiles")
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &sshProfiles)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\tPUBLIC KEY\tPRIVATE KEY\r")

	for _, sshProfile := range sshProfiles {
		fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", sshProfile.Id, sshProfile.Name, sshProfile.Public_key, sshProfile.Private_key)
	}

	w.Flush()
}
示例#20
0
func cmdList(c *cli.Context) {
	var services []Service

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get("/v1/blueprint/services")
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &services)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\tDESCRIPTION\tPUBLIC\tLICENSE\tRECIPES\r")

	for _, service := range services {
		fmt.Fprintf(w, "%s\t%s\t%s\t%t\t%s\t%s\n", service.Id, service.Name, service.Description, service.Public, service.License, service.Recipes)
	}

	w.Flush()
}
示例#21
0
func cmdListTemplateServers(c *cli.Context) {
	var templateServers []TemplateServer

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get(fmt.Sprintf("/v1/blueprint/templates/%s/servers", c.String("template_id")))
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &templateServers)
	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")

	for _, templateServer := range templateServers {
		fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", templateServer.Id, templateServer.Name, templateServer.Fqdn, templateServer.State, templateServer.Public_ip, templateServer.Workspace_id, templateServer.Template_id, templateServer.Server_plan_id, templateServer.Ssh_profile_id)
	}

	w.Flush()
}
示例#22
0
func cmdShow(c *cli.Context) {
	utils.FlagsRequired(c, []string{"id"})
	var template Template

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get(fmt.Sprintf("/v1/blueprint/templates/%s", c.String("id")))
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &template)
	utils.CheckError(err)
	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\tGENERIC IMAGE ID\tSERVICE LIST\tCONFIGURATION ATTRIBUTES\r")
	if template.Id != "" {
		serviceList, err := json.Marshal(template.ServiceList)
		utils.CheckError(err)
		fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", template.Id, template.Name, template.GenericImgId, serviceList, *template.ConfigurationAttributes)
	}
	w.Flush()
}
示例#23
0
func cmdList(c *cli.Context) {
	var saasProviders []SAASProvider

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get("/v1/cloud/saas_providers")
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &saasProviders)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\tREQUIRED ACCOUNT DATA\r")

	for _, sp := range saasProviders {
		fmt.Fprintf(w, "%s\t%s\t%s\n", sp.Id, sp.Name, sp.Required_account_data)
	}

	w.Flush()
}
示例#24
0
func cmdList(c *cli.Context) {
	var locs []Location

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get("/v1/wizard/locations")
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &locs)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\r")

	for _, loc := range locs {
		fmt.Fprintf(w, "%s\t%s\n", loc.Id, loc.Name)
	}

	w.Flush()
}
示例#25
0
func cmdList(c *cli.Context) {
	var licenseeReports []LicenseeReport

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get("/v1/licensee/reports")
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &licenseeReports)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tYEAR\tMONTH\tSTART TIME\tEND TIME\tSERVER SECONDS\tCLOSED\r")

	for _, lr := range licenseeReports {
		fmt.Fprintf(w, "%s\t%d\t%s\t%s\t%s\t%g\t%t\n", lr.Id, lr.Year, lr.Month, lr.StartTime, lr.EndTime, lr.ServerSeconds, lr.Closed)
	}

	w.Flush()
}
示例#26
0
func cmdList(c *cli.Context) {
	var images []GenericImage

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get("/v1/cloud/generic_images")
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &images)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\r")

	for _, image := range images {
		fmt.Fprintf(w, "%s\t%s\n", image.Id, image.Name)
	}

	w.Flush()
}
示例#27
0
func cmdList(c *cli.Context) {
	var firewallProfiles []FirewallProfile

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get("/v1/network/firewall_profiles")
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &firewallProfiles)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\tDESCRIPTION\tDEFAULT\r")

	for _, firewallProfile := range firewallProfiles {
		fmt.Fprintf(w, "%s\t%s\t%s\t%t\n", firewallProfile.Id, firewallProfile.Name, firewallProfile.Description, firewallProfile.Default)
	}

	w.Flush()
}
示例#28
0
func cmdList(c *cli.Context) {
	var workspaces []Workspace

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get("/v1/cloud/workspaces")
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &workspaces)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\tDEFAULT\tDOMAIN ID\tSSH PROFILE ID\tFIREWALL PROFILE ID\r")

	for _, workspace := range workspaces {
		fmt.Fprintf(w, "%s\t%s\t%t\t%s\t%s\t%s\n", workspace.Id, workspace.Name, workspace.Default, workspace.Domain_id, workspace.Ssh_profile_id, workspace.Firewall_profile_id)
	}

	w.Flush()
}
示例#29
0
func cmdList(c *cli.Context) {
	var reports []Report

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get("/v1/admin/reports")
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &reports)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "REPORT ID\tYEAR\tMONTH\tSTART TIME\tEND TIME\tSERVER SECONDS\tCLOSED\r")

	for _, report := range reports {
		fmt.Fprintf(w, "%s\t%d\t%s\t%s\t%s\t%g\t%t\n", report.Id, report.Year, report.Month, report.Start_time, report.End_time, report.Server_seconds, report.Closed)
	}

	w.Flush()
}
示例#30
0
func cmdList(c *cli.Context) {
	utils.FlagsRequired(c, []string{"app_id", "location_id"})
	var cps []CloudProviders

	webservice, err := webservice.NewWebService()
	utils.CheckError(err)

	err, data, res := webservice.Get(fmt.Sprintf("/v1/wizard/cloud_providers?app_id=%s&location_id=%s", c.String("app_id"), c.String("location_id")))
	utils.CheckError(err)
	utils.CheckReturnCode(res, data)

	err = json.Unmarshal(data, &cps)
	utils.CheckError(err)

	w := tabwriter.NewWriter(os.Stdout, 15, 1, 3, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\tREQUIRED CREDENTIALS\tPROVIDED SERVICES\r")

	for _, cp := range cps {
		fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", cp.Id, cp.Name, cp.RequiredCredentials, cp.ProvidedServices)
	}

	w.Flush()
}