当前位置: 首页>>代码示例>>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;未经允许,请勿转载。