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


Golang backend.Request函數代碼示例

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


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

示例1: PutGTMPoolStatus

// PutGTMPoolStatus modify status of wideip pool
func PutGTMPoolStatus(host string, poolmodify *ModifyPoolStatus) (*backend.Response, *errors.Error) {
	u, errParse := url.Parse(host)
	if errParse != nil {
		return nil, &errors.ErrorCodeBadRequestParse
	}
	u.Scheme = common.Protocol
	u.Path = path.Join(u.Path, common.Gtmpoolsuri)
	u.Path = path.Join(u.Path, fmt.Sprintf("/~%s~%s", gtmPartition, poolmodify.Name))
	var poolstatus interface{}
	switch poolmodify.Status {
	case true:
		{
			poolstatus = EnablePoolStatus{Enabled: true}
		}
	case false:
		{
			poolstatus = DisablePoolStatus{Disabled: true}
		}
	}

	r, err := backend.Request(common.PUT, u.String(), &poolstatus)
	if err != nil {
		return nil, err
	}
	return r, nil
}
開發者ID:zalando,項目名稱:baboon-proxy,代碼行數:27,代碼來源:pool.go

示例2: PutLTMPoolMember

// PutLTMPoolMember modify status of pool member
func PutLTMPoolMember(host, poolname, member, status string) (*backend.Response, *errors.Error) {
	u, errParse := url.Parse(host)
	if errParse != nil {
		return nil, &errors.ErrorCodeBadRequestParse
	}
	u.Path = path.Join(u.Path, fmt.Sprintf("pool/~%s~%s/members/~%s~%s", ltmPartition, poolname, ltmPartition, member))
	memberstatus := ModifyPoolMemberStatus{}
	switch status {
	case "enabled":
		{
			memberstatus = ModifyPoolMemberStatus{State: "user-up", Session: "user-enabled"}
		}
	case "disabled":
		{
			memberstatus = ModifyPoolMemberStatus{State: "user-up", Session: "user-disabled"}
		}
	case "offline":
		{
			memberstatus = ModifyPoolMemberStatus{State: "user-down", Session: "user-disabled"}
		}
	}

	r, err := backend.Request(common.PUT, u.String(), &memberstatus)
	if err != nil {
		return nil, err
	}
	return r, nil
}
開發者ID:zalando,項目名稱:baboon-proxy,代碼行數:29,代碼來源:pool.go

示例3: ShowLTMDevice

// ShowLTMDevice returns information
// of loadbalancer devices
func ShowLTMDevice(inputURL string) (*backend.Response, *Devices, *errors.Error) {
	// Declaration LTM Device
	ltmdevice := new(Devices)
	deviceURL := util.ReplaceLTMUritoDeviceURI(inputURL)
	fmt.Println(deviceURL)
	res, err := backend.Request(common.GET, deviceURL, &ltmdevice)
	if err != nil {
		return nil, nil, err
	}
	return res, ltmdevice, nil
}
開發者ID:zalando,項目名稱:baboon-proxy,代碼行數:13,代碼來源:device.go

示例4: PostLTMDataGroup

// PostLTMDataGroup creates a new datagroup
func PostLTMDataGroup(host, direction string, json *CreateDataGroup) (*backend.Response, *errors.Error) {
	u, errParse := url.Parse(host)
	if errParse != nil {
		return nil, &errors.ErrorCodeBadRequestParse
	}
	u.Path = path.Join(u.Path, common.Dg, direction)
	r, err := backend.Request(common.POST, u.String(), &json)
	if err != nil {
		return nil, err
	}
	return r, nil
}
開發者ID:zalando,項目名稱:baboon-proxy,代碼行數:13,代碼來源:datagroup.go

示例5: PostLTMSSLCert

// PostLTMSSLCert create a new ssl certificate
func PostLTMSSLCert(host string, json interface{}) (*backend.Response, *errors.Error) {
	u, errParse := url.Parse(host)
	if errParse != nil {
		return nil, &errors.ErrorCodeBadRequestParse
	}
	u.Path = path.Join(u.Path, "cert")
	r, err := backend.Request(common.POST, u.String(), &json)
	if err != nil {
		return nil, err
	}
	return r, nil
}
開發者ID:zalando,項目名稱:baboon-proxy,代碼行數:13,代碼來源:ssl.go

示例6: DeleteLTMDataGroup

// DeleteLTMDataGroup deletes a specific datagroup
func DeleteLTMDataGroup(host, direction, datagroupname string) (*backend.Response, *errors.Error) {
	u, errParse := url.Parse(host)
	if errParse != nil {
		return nil, &errors.ErrorCodeBadRequestParse
	}
	u.Path = path.Join(u.Path, common.Dg, direction, "/", datagroupname)
	r, err := backend.Request(common.DELETE, u.String(), nil)
	if err != nil {
		return nil, err
	}
	return r, nil
}
開發者ID:zalando,項目名稱:baboon-proxy,代碼行數:13,代碼來源:datagroup.go

示例7: PostLTMPoolMember

// PostLTMPoolMember add member to a pool
func PostLTMPoolMember(host, poolname string, json *CreatePoolMember) (*backend.Response, *errors.Error) {
	u, errParse := url.Parse(host)
	if errParse != nil {
		return nil, &errors.ErrorCodeBadRequestParse
	}
	u.Path = path.Join(u.Path, fmt.Sprintf("pool/~%s~%s/members", ltmPartition, poolname))
	r, err := backend.Request(common.POST, u.String(), &json)
	if err != nil {
		return nil, err
	}
	return r, nil
}
開發者ID:zalando,項目名稱:baboon-proxy,代碼行數:13,代碼來源:pool.go

示例8: PostLTMPool

// PostLTMPool create a new pool
func PostLTMPool(host string, json *CreatePool) (*backend.Response, *errors.Error) {
	u, errParse := url.Parse(host)
	if errParse != nil {
		return nil, &errors.ErrorCodeBadRequestParse
	}
	u.Path = path.Join(u.Path, "pool")
	r, err := backend.Request(common.POST, u.String(), &json)
	if err != nil {
		return nil, err
	}
	return r, nil
}
開發者ID:zalando,項目名稱:baboon-proxy,代碼行數:13,代碼來源:pool.go

示例9: DeleteLTMPoolMember

// DeleteLTMPoolMember delete pool member
func DeleteLTMPoolMember(host, poolname, poolmember string) (*backend.Response, *errors.Error) {
	u, errParse := url.Parse(host)
	if errParse != nil {
		return nil, &errors.ErrorCodeBadRequestParse
	}
	u.Path = path.Join(u.Path, fmt.Sprintf("pool/~%s~%s/members/~%s~%s", ltmPartition, poolname, ltmPartition, poolmember))
	r, err := backend.Request(common.DELETE, u.String(), nil)
	if err != nil {
		return nil, err
	}
	return r, nil
}
開發者ID:zalando,項目名稱:baboon-proxy,代碼行數:13,代碼來源:pool.go

示例10: ShowLTMFWRules

// ShowLTMFWRules shows firewall profile
func ShowLTMFWRules(host, vserver string) (*backend.Response, *FirewallRules, *errors.Error) {
	fwrules := new(FirewallRules)
	u, errParse := url.Parse(host)
	if errParse != nil {
		return nil, nil, &errors.ErrorCodeBadRequestParse
	}
	u.Path = path.Join(u.Path, fmt.Sprintf("virtual/~%s~%s/fw-rules", ltmPartition, vserver))
	res, err := backend.Request(common.GET, u.String(), &fwrules)
	if err != nil {
		return nil, nil, err
	}
	return res, fwrules, nil
}
開發者ID:zalando,項目名稱:baboon-proxy,代碼行數:14,代碼來源:rule.go

示例11: ShowLTMAddressListName

// ShowLTMAddressListName returns a specific address list on LB
func ShowLTMAddressListName(host, address string) (*backend.Response, *AddressList, *errors.Error) {
	addresslist := new(AddressList)
	u, errParse := url.Parse(host)
	if errParse != nil {
		return nil, nil, &errors.ErrorCodeBadRequestParse
	}
	u.Path = path.Join(u.Path, address)
	res, err := backend.Request(common.GET, u.String(), addresslist)
	if err != nil {
		return nil, nil, err
	}
	return res, addresslist, nil
}
開發者ID:zalando,項目名稱:baboon-proxy,代碼行數:14,代碼來源:firewall.go

示例12: ShowLTMIRules

// ShowLTMIRules shows iRules
func ShowLTMIRules(host string) (*backend.Response, *IRules, *errors.Error) {
	iRs := new(IRules)
	u, errParse := url.Parse(host)
	if errParse != nil {
		return nil, nil, &errors.ErrorCodeBadRequestParse
	}
	u.Path = path.Join(u.Path, "rule")
	res, err := backend.Request(common.GET, u.String(), &iRs)
	if err != nil {
		return nil, nil, err
	}
	return res, iRs, nil
}
開發者ID:zalando,項目名稱:baboon-proxy,代碼行數:14,代碼來源:rule.go

示例13: ShowLTMIRule

// ShowLTMIRule shows a specific iRule
func ShowLTMIRule(host, iRuleName string) (*backend.Response, *IRule, *errors.Error) {
	iR := new(IRule)
	u, errParse := url.Parse(host)
	if errParse != nil {
		return nil, nil, &errors.ErrorCodeBadRequestParse
	}
	u.Path = path.Join(u.Path, fmt.Sprintf("rule/~%s~%s", ltmPartition, iRuleName))
	res, err := backend.Request(common.GET, u.String(), &iR)
	if err != nil {
		return nil, nil, err
	}
	return res, iR, nil
}
開發者ID:zalando,項目名稱:baboon-proxy,代碼行數:14,代碼來源:rule.go

示例14: ShowLTMPools

// ShowLTMPools show all declared pools
func ShowLTMPools(host string) (*backend.Response, *Pools, *errors.Error) {
	// Declaration LTM Pools
	ltmpools := new(Pools)
	u, errParse := url.Parse(host)
	if errParse != nil {
		return nil, nil, &errors.ErrorCodeBadRequestParse
	}
	u.Path = path.Join(u.Path, "pool")
	res, err := backend.Request(common.GET, u.String(), &ltmpools)
	if err != nil {
		return nil, nil, err
	}
	return res, ltmpools, nil
}
開發者ID:zalando,項目名稱:baboon-proxy,代碼行數:15,代碼來源:pool.go

示例15: ShowLTMPool

// ShowLTMPool show specific pool
func ShowLTMPool(host, pool string) (*backend.Response, *Pool, *errors.Error) {
	// Declaration LTM Pool
	ltmpool := new(Pool)
	u, errParse := url.Parse(host)
	if errParse != nil {
		return nil, nil, &errors.ErrorCodeBadRequestParse
	}
	u.Path = path.Join(u.Path, fmt.Sprintf("pool/~%s~%s", ltmPartition, pool))
	res, err := backend.Request(common.GET, u.String(), &ltmpool)
	if err != nil {
		return nil, nil, err
	}
	return res, ltmpool, nil
}
開發者ID:zalando,項目名稱:baboon-proxy,代碼行數:15,代碼來源:pool.go


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