本文整理汇总了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
}
示例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
}
示例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, <mdevice)
if err != nil {
return nil, nil, err
}
return res, ltmdevice, nil
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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(), <mpools)
if err != nil {
return nil, nil, err
}
return res, ltmpools, nil
}
示例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(), <mpool)
if err != nil {
return nil, nil, err
}
return res, ltmpool, nil
}