當前位置: 首頁>>代碼示例>>Golang>>正文


Golang webservice.Get函數代碼示例

本文整理匯總了Golang中github.com/flexiant/concerto/webservice.Get函數的典型用法代碼示例。如果您正苦於以下問題:Golang Get函數的具體用法?Golang Get怎麽用?Golang Get使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Get函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: cmdShow

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()

}
開發者ID:odacremolbap,項目名稱:concerto,代碼行數:29,代碼來源:reports.go

示例2: cmdList

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()
}
開發者ID:odacremolbap,項目名稱:concerto,代碼行數:38,代碼來源:cloud_accounts.go

示例3: cmdShow

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()
}
開發者ID:odacremolbap,項目名稱:concerto,代碼行數:19,代碼來源:ssh_profiles.go

示例4: cmdShow

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()
}
開發者ID:odacremolbap,項目名稱:concerto,代碼行數:20,代碼來源:servers.go

示例5: cmdShowDomainRecords

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()
}
開發者ID:odacremolbap,項目名稱:concerto,代碼行數:20,代碼來源:domains.go

示例6: cmdShow

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()
}
開發者ID:odacremolbap,項目名稱:concerto,代碼行數:20,代碼來源:workspaces.go

示例7: get

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
}
開發者ID:odacremolbap,項目名稱:concerto,代碼行數:20,代碼來源:firewall.go

示例8: cmdShow

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()
}
開發者ID:odacremolbap,項目名稱:concerto,代碼行數:20,代碼來源:load_balancers.go

示例9: cmdShow

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()
}
開發者ID:odacremolbap,項目名稱:concerto,代碼行數:20,代碼來源:scripts.go

示例10: cmdShowTemplateScript

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()
}
開發者ID:odacremolbap,項目名稱:concerto,代碼行數:20,代碼來源:templates.go

示例11: cmdShow

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()
}
開發者ID:odacremolbap,項目名稱:concerto,代碼行數:20,代碼來源:server_plan.go

示例12: cmdShow

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()
}
開發者ID:odacremolbap,項目名稱:concerto,代碼行數:20,代碼來源:services.go

示例13: cmdList

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()
}
開發者ID:odacremolbap,項目名稱:concerto,代碼行數:22,代碼來源:apps.go

示例14: cmdList

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()
}
開發者ID:odacremolbap,項目名稱:concerto,代碼行數:22,代碼來源:scripts.go

示例15: cmdList

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()
}
開發者ID:odacremolbap,項目名稱:concerto,代碼行數:22,代碼來源:saas_accounts.go


注:本文中的github.com/flexiant/concerto/webservice.Get函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。