本文整理汇总了Golang中github.com/absolutedevops/civo/config.URL函数的典型用法代码示例。如果您正苦于以下问题:Golang URL函数的具体用法?Golang URL怎么用?Golang URL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了URL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: InstancesList
func InstancesList(tags string) (json *gabs.Container, err error) {
if tags != "" {
return makeJSONCall(config.URL()+"/v1/instances?tags="+tags, HTTPGet, "")
} else {
return makeJSONCall(config.URL()+"/v1/instances", HTTPGet, "")
}
}
示例2: QuotaGet
func QuotaGet(account string) (json *gabs.Container, err error) {
if account != "" {
return makeJSONCall(config.URL()+"/v1/quota?username="+account, HTTPGet, "")
} else {
return makeJSONCall(config.URL()+"/v1/quota", HTTPGet, "")
}
}
示例3: InstanceReboot
func InstanceReboot(id string, hard bool) (json *gabs.Container, err error) {
if hard {
return makeJSONCall(config.URL()+"/v1/instances/"+id+"/hard_reboots", HTTPPost, "")
} else {
return makeJSONCall(config.URL()+"/v1/instances/"+id+"/soft_reboots", HTTPPost, "")
}
}
示例4: SnapshotCreate
func SnapshotCreate(name, instance_id string, safe bool) (json *gabs.Container, err error) {
saveVal := "false"
if safe {
saveVal = "true"
}
return makeJSONCall(config.URL()+"/v1/snapshots/"+name, HTTPPut, "instance_id="+instance_id+"&safe="+saveVal)
}
示例5: IPCreate
func IPCreate(instanceID string, public bool) (json *gabs.Container, err error) {
params := ""
if public {
params = "public=true"
}
return makeJSONCall(config.URL()+"/v1/instances/"+instanceID+"/ip", HTTPPost, params)
}
示例6: AccountFindByToken
func AccountFindByToken(token string) string {
accounts, err := makeJSONCall(config.URL()+"/v1/accounts", HTTPGet, "")
if err != nil {
fmt.Println(err)
return ""
}
items, _ := accounts.Children()
for _, child := range items {
if child.S("api_key").Data().(string) == token {
return child.S("username").Data().(string)
}
}
return ""
}
示例7: InstanceDestroy
func InstanceDestroy(id string) (json *gabs.Container, err error) {
return makeJSONCall(config.URL()+"/v1/instances/"+id, HTTPDelete, "")
}
示例8: AccountDelete
func AccountDelete(name string) (json *gabs.Container, err error) {
return makeJSONCall(config.URL()+"/v1/accounts/"+name, HTTPDelete, "")
}
示例9: AccountReset
func AccountReset(name string) (json *gabs.Container, err error) {
return makeJSONCall(config.URL()+"/v1/accounts/"+name, HTTPPut, fmt.Sprintf("name=%s", name))
}
示例10: RegionsList
func RegionsList() (json *gabs.Container, err error) {
return makeJSONCall(config.URL()+"/v1/regions", HTTPGet, "")
}
示例11: AccountCreate
func AccountCreate(name string) (json *gabs.Container, err error) {
return makeJSONCall(config.URL()+"/v1/accounts", HTTPPost, fmt.Sprintf("name=%s", name))
}
示例12: FirewallRuleDelete
func FirewallRuleDelete(name, id string) (json *gabs.Container, err error) {
return makeJSONCall(config.URL()+"/v1/firewalls/"+name+"/rules/"+id, HTTPDelete, "")
}
示例13: SshKeyCreate
func SshKeyCreate(params SshKeyParams) (json *gabs.Container, err error) {
v, _ := query.Values(params)
return makeJSONCall(config.URL()+"/v1/sshkeys", HTTPPost, v.Encode())
}
示例14: FirewallCreate
func FirewallCreate(name string) (json *gabs.Container, err error) {
return makeJSONCall(config.URL()+"/v1/firewalls", HTTPPost, "name="+name)
}
示例15: FirewallRules
func FirewallRules(name string) (json *gabs.Container, err error) {
return makeJSONCall(config.URL()+"/v1/firewalls/"+name+"/rules", HTTPGet, "")
}