• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang ltm.Loadbalancer函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/zalando-techmonkeys/baboon-proxy/ltm.Loadbalancer函数的典型用法代码示例。如果您正苦于以下问题:Golang Loadbalancer函数的具体用法?Golang Loadbalancer怎么用?Golang Loadbalancer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Loadbalancer函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: LTMVirtualServerNameList

// LTMVirtualServerNameList show local traffic manager specific virtual server
func LTMVirtualServerNameList(c *gin.Context) {
	lbpair := c.Params.ByName("lbpair")
	vservername := c.Params.ByName("virtual")
	f5url, err := ltm.Loadbalancer(lbpair, conf.Ltmdevicenames)
	if err != nil {
		respondWithStatus(err.Status, vservername, nil, err.Message, conf.Documentation["ltmvirtualdocumentationuri"], c)
		return
	}
	res, virtualservernamelist, err := ltm.ShowLTMVirtualServerName(f5url, vservername)
	if err != nil {
		respondWithStatus(err.Status, vservername, nil, err.Message, conf.Documentation["ltmvirtualdocumentationuri"], c)
		return
	}
	json.Unmarshal([]byte(res.Body), &returnerror)
	u1 := new(url.URL)
	u1.Scheme = common.Protocol
	u1.Path = path.Join(c.Request.Host, c.Request.RequestURI, common.ProfilesURI)
	u2 := new(url.URL)
	u2.Scheme = common.Protocol
	u2.Path = path.Join(c.Request.Host, c.Request.RequestURI, common.FwURI)
	virtualservernamelist.ProfilesReference = u1.String()
	virtualservernamelist.FwRulesReference = u2.String()
	if len(virtualservernamelist.Pool) > 0 {
		u := new(url.URL)
		u.Scheme = common.Protocol
		u.Path = path.Join(c.Request.Host, "/api/ltms/", lbpair, common.PoolsURI, util.ReplaceCommon(virtualservernamelist.Pool))
		virtualservernamelist.PoolsReference = u.String()
	}
	respondWithStatus(res.Status, "", virtualservernamelist, returnerror.ErrorMessage(), conf.Documentation["ltmvirtualdocumentationuri"], c)
}
开发者ID:zalando,项目名称:baboon-proxy,代码行数:31,代码来源:client.go


示例2: LTMBlockIPPatch

// LTMBlockIPPatch add ips which will be blocked
func LTMBlockIPPatch(c *gin.Context) {
	var blockips ltm.CreateAddresses

	f5url, err := ltm.Loadbalancer(c.Params.ByName("lbpair"), conf.Ltmdevicenames)
	if err != nil {
		respondWithStatus(err.Status, "", nil, err.Message, conf.Documentation["ltmaddresslistdocumentationuri"], c)
		return
	}
	f5url = util.ReplaceLTMUritoAddressListURI(f5url)
	if err := c.BindJSON(&blockips); err != nil {
		respondWithStatus(http.StatusBadRequest, "Invalid JSON data", "Block IPs",
			fmt.Sprintf("%s", err), conf.Documentation["ltmaddresslistdocumentationuri"], c)
		return
	}
	res, err := ltm.PatchLTMBlockAddresses(f5url, &blockips)
	if err != nil {
		respondWithStatus(err.Status, "", nil, err.Message, conf.Documentation["ltmaddresslistdocumentationuri"], c)
		return
	}
	json.Unmarshal([]byte(res.Body), &returnerror)
	if res.Status == http.StatusOK {
		res.Status = http.StatusCreated
	}
	respondWithStatus(res.Status, "IP(s) blocked successfully", blockips,
		returnerror.ErrorMessage(), conf.Documentation["ltmaddresslistdocumentationuri"], c)
}
开发者ID:zalando,项目名称:baboon-proxy,代码行数:27,代码来源:client.go


示例3: LTMDataGroupItemPatch

// LTMDataGroupItemPatch add an item to a datagroup (ip or string) on a local traffic manager
func LTMDataGroupItemPatch(c *gin.Context) {
	var datagroupitemcreate ltm.CreateDataGroupItem
	direction := common.InternalDataGroup
	datagroupname := c.Params.ByName("datagroupname")

	f5url, err := ltm.Loadbalancer(c.Params.ByName("lbpair"), conf.Ltmdevicenames)
	if err != nil {
		respondWithStatus(err.Status, datagroupname, nil, err.Message, conf.Documentation["ltmdatagroupdocumentationuri"], c)
		return
	}

	if err := c.BindJSON(&datagroupitemcreate); err != nil {
		respondWithStatus(http.StatusBadRequest, "Invalid JSON data", "Create datagroup item",
			fmt.Sprintf("%s", err), conf.Documentation["ltmdatagroupdocumentationuri"], c)
		return
	}
	res, err := ltm.PatchLTMDataGroupItem(f5url, direction, datagroupname, &datagroupitemcreate)
	if err != nil {
		respondWithStatus(err.Status, datagroupname, nil, err.Message, conf.Documentation["ltmdatagroupdocumentationuri"], c)
		return
	}
	json.Unmarshal([]byte(res.Body), &returnerror)
	if res.Status == http.StatusOK {
		res.Status = http.StatusCreated
	}
	respondWithStatus(res.Status, "Datagroup item added in", datagroupname,
		returnerror.ErrorMessage(), conf.Documentation["ltmdatagroupdocumentationuri"], c)
}
开发者ID:zalando,项目名称:baboon-proxy,代码行数:29,代码来源:client.go


示例4: LTMPoolMemberPost

// LTMPoolMemberPost add new members to a specific pool on a local traffic manager
func LTMPoolMemberPost(c *gin.Context) {
	var poolmembercreate ltm.CreatePoolMember

	pool := c.Params.ByName("pool")
	f5url, err := ltm.Loadbalancer(c.Params.ByName("lbpair"), conf.Ltmdevicenames)
	if err != nil {
		respondWithStatus(err.Status, "", nil, err.Message, conf.Documentation["ltmpoolmemberdocumentationuri"], c)
		return
	}

	if err := c.BindJSON(&poolmembercreate); err != nil {
		respondWithStatus(http.StatusBadRequest, "Invalid JSON data", "Create pool member",
			fmt.Sprintf("%s", err), conf.Documentation["ltmpoolmemberdocumentationuri"], c)
		return
	}
	res, err := ltm.PostLTMPoolMember(f5url, pool, &poolmembercreate)
	if err != nil {
		respondWithStatus(err.Status, "", nil, err.Message, conf.Documentation["ltmpoolmemberdocumentationuri"], c)
		return
	}
	json.Unmarshal([]byte(res.Body), &returnerror)

	if res.Status == http.StatusOK {
		res.Status = http.StatusCreated
	}
	respondWithStatus(res.Status, "Poolmember added", poolmembercreate.Name,
		returnerror.ErrorMessage(), conf.Documentation["ltmpoolmemberdocumentationuri"], c)
}
开发者ID:zalando,项目名称:baboon-proxy,代码行数:29,代码来源:client.go


示例5: LTMDeviceList

// LTMDeviceList show local traffic manager devices
func LTMDeviceList(c *gin.Context) {
	f5url, err := ltm.Loadbalancer(c.Params.ByName("lbpair"), conf.Ltmdevicenames)
	if err != nil {
		respondWithStatus(err.Status, "", nil, err.Message, conf.Documentation["ltmdevicedocumentationuri"], c)
		return
	}
	res, devicelist, err := ltm.ShowLTMDevice(f5url)
	if err != nil {
		respondWithStatus(err.Status, "", nil, err.Message, conf.Documentation["ltmdevicedocumentationuri"], c)
		return
	}
	json.Unmarshal([]byte(res.Body), &returnerror)
	respondWithStatus(res.Status, "", devicelist, returnerror.ErrorMessage(), conf.Documentation["ltmdevicedocumentationuri"], c)
}
开发者ID:zalando,项目名称:baboon-proxy,代码行数:15,代码来源:client.go


示例6: LTMDataGroupList

// LTMDataGroupList show local traffic manager internal data groups
func LTMDataGroupList(c *gin.Context) {
	direction := common.InternalDataGroup
	f5url, err := ltm.Loadbalancer(c.Params.ByName("lbpair"), conf.Ltmdevicenames)
	if err != nil {
		respondWithStatus(err.Status, "", nil, err.Message, conf.Documentation["ltmdatagroupdocumentationuri"], c)
		return
	}
	res, datagrouplist, err := ltm.ShowLTMDataGroup(f5url, direction)
	if err != nil {
		respondWithStatus(err.Status, "", nil, err.Message, conf.Documentation["ltmdatagroupdocumentationuri"], c)
		return
	}
	json.Unmarshal([]byte(res.Body), &returnerror)
	respondWithStatus(res.Status, "", datagrouplist, returnerror.ErrorMessage(), conf.Documentation["ltmdatagroupdocumentationuri"], c)
}
开发者ID:zalando,项目名称:baboon-proxy,代码行数:16,代码来源:client.go


示例7: LTMFWRuleList

// LTMFWRuleList show local traffic manager iRules of a specific virtual server
func LTMFWRuleList(c *gin.Context) {
	vservername := c.Params.ByName("virtual")
	f5url, err := ltm.Loadbalancer(c.Params.ByName("lbpair"), conf.Ltmdevicenames)
	if err != nil {
		respondWithStatus(err.Status, vservername, nil, err.Message, conf.Documentation["ltmvirtualdocumentationuri"], c)
		return
	}
	res, rulelist, err := ltm.ShowLTMFWRules(f5url, vservername)
	if err != nil {
		respondWithStatus(err.Status, vservername, nil, err.Message, conf.Documentation["ltmvirtualdocumentationuri"], c)
		return
	}
	json.Unmarshal([]byte(res.Body), &returnerror)
	respondWithStatus(res.Status, "", rulelist, returnerror.ErrorMessage(), conf.Documentation["ltmvirtualdocumentationuri"], c)
}
开发者ID:zalando,项目名称:baboon-proxy,代码行数:16,代码来源:client.go


示例8: LTMWhiteAddressList

// LTMWhiteAddressList show local traffic whitelisted ip addresses
func LTMWhiteAddressList(c *gin.Context) {
	lbpair := c.Params.ByName("lbpair")
	f5url, err := ltm.Loadbalancer(lbpair, conf.Ltmdevicenames)
	if err != nil {
		respondWithStatus(err.Status, "", nil, err.Message, conf.Documentation["ltmaddresslistdocumentationuri"], c)
		return
	}
	f5url = util.ReplaceLTMUritoAddressListURI(f5url)
	res, addresslist, err := ltm.ShowLTMAddressList(f5url, common.WhiteList)
	if err != nil {
		respondWithStatus(err.Status, "", nil, err.Message, conf.Documentation["ltmaddresslistdocumentationuri"], c)
		return
	}
	json.Unmarshal([]byte(res.Body), &returnerror)
	respondWithStatus(res.Status, "", addresslist, returnerror.ErrorMessage(), conf.Documentation["ltmaddresslistdocumentationuri"], c)
}
开发者ID:zalando,项目名称:baboon-proxy,代码行数:17,代码来源:client.go


示例9: LTMPoolDelete

// LTMPoolDelete delete a pool on a local traffic manager
func LTMPoolDelete(c *gin.Context) {
	pool := c.Params.ByName("pool")
	f5url, err := ltm.Loadbalancer(c.Params.ByName("lbpair"), conf.Ltmdevicenames)
	if err != nil {
		respondWithStatus(err.Status, "", nil, err.Message, conf.Documentation["ltmpooldocumentationuri"], c)
		return
	}
	res, err := ltm.DeleteLTMPool(f5url, pool)
	if err != nil {
		respondWithStatus(err.Status, "", nil, err.Message, conf.Documentation["ltmpooldocumentationuri"], c)
		return
	}
	json.Unmarshal([]byte(res.Body), &returnerror)
	respondWithStatus(res.Status, "Pool deleted", pool,
		returnerror.ErrorMessage(), conf.Documentation["ltmpooldocumentationuri"], c)
}
开发者ID:zalando,项目名称:baboon-proxy,代码行数:17,代码来源:client.go


示例10: LTMPoolNameList

// LTMPoolNameList show specific local traffic manager pool
func LTMPoolNameList(c *gin.Context) {
	f5url, err := ltm.Loadbalancer(c.Params.ByName("lbpair"), conf.Ltmdevicenames)
	if err != nil {
		respondWithStatus(err.Status, "", nil, err.Message, conf.Documentation["ltmpooldocumentationuri"], c)
		return
	}
	pool := c.Params.ByName("pool")
	res, poollist, err := ltm.ShowLTMPool(f5url, pool)
	if err != nil {
		respondWithStatus(err.Status, "", nil, err.Message, conf.Documentation["ltmpooldocumentationuri"], c)
		return
	}
	json.Unmarshal([]byte(res.Body), &returnerror)
	u := new(url.URL)
	u.Scheme = common.Protocol
	u.Path = path.Join(c.Request.Host, c.Request.RequestURI, common.MembersURI)
	poollist.MembersReference = u.String()
	respondWithStatus(res.Status, "", poollist, returnerror.ErrorMessage(), conf.Documentation["ltmpooldocumentationuri"], c)
}
开发者ID:zalando,项目名称:baboon-proxy,代码行数:20,代码来源:client.go


示例11: LTMDataGroupDelete

// LTMDataGroupDelete delete a internal datagroup on a local traffic manager
func LTMDataGroupDelete(c *gin.Context) {
	var datagroupdelete ltm.RemoveDataGroup
	direction := common.InternalDataGroup
	f5url, err := ltm.Loadbalancer(c.Params.ByName("lbpair"), conf.Ltmdevicenames)
	if err != nil {
		respondWithStatus(err.Status, "", nil, err.Message, conf.Documentation["ltmdatagroupdocumentationuri"], c)
		return
	}
	if err := c.BindJSON(&datagroupdelete); err != nil {
		respondWithStatus(http.StatusBadRequest, "Invalid JSON data", "Delete datagroup item",
			fmt.Sprintf("%s", err), conf.Documentation["ltmdatagroupdocumentationuri"], c)
		return
	}
	res, err := ltm.DeleteLTMDataGroup(f5url, direction, datagroupdelete.Name)
	if err != nil {
		respondWithStatus(err.Status, "", nil, err.Message, conf.Documentation["ltmdatagroupdocumentationuri"], c)
		return
	}
	json.Unmarshal([]byte(res.Body), &returnerror)
	respondWithStatus(res.Status, "Datagroup deleted", datagroupdelete.Name,
		returnerror.ErrorMessage(), conf.Documentation["ltmdatagroupdocumentationuri"], c)
}
开发者ID:zalando,项目名称:baboon-proxy,代码行数:23,代码来源:client.go


示例12: LTMPoolMemberPut

// LTMPoolMemberPut modify pool members on a local traffic manager (enabled, disabled, force-offline)
func LTMPoolMemberPut(c *gin.Context) {
	var poolmembermodify ltm.ModifyPoolMember
	pool := c.Params.ByName("pool")
	f5url, err := ltm.Loadbalancer(c.Params.ByName("lbpair"), conf.Ltmdevicenames)
	if err != nil {
		respondWithStatus(err.Status, pool, nil, err.Message, conf.Documentation["ltmpoolmemberdocumentationuri"], c)
		return
	}
	if err := c.BindJSON(&poolmembermodify); err != nil {
		respondWithStatus(http.StatusBadRequest, "Invalid JSON data", "Modify pool member",
			fmt.Sprintf("%s", err), conf.Documentation["ltmpoolmemberdocumentationuri"], c)
		return
	}
	res, err := ltm.PutLTMPoolMember(f5url, pool, poolmembermodify.Name, poolmembermodify.Status)
	if err != nil {
		respondWithStatus(err.Status, pool, nil, err.Message, conf.Documentation["ltmpoolmemberdocumentationuri"], c)
		return
	}
	json.Unmarshal([]byte(res.Body), &returnerror)
	respondWithStatus(res.Status, "Poolmember modified", poolmembermodify.Name,
		returnerror.ErrorMessage(), conf.Documentation["ltmpoolmemberdocumentationuri"], c)
}
开发者ID:zalando,项目名称:baboon-proxy,代码行数:23,代码来源:client.go


示例13: LTMRemoveWhiteIPPatch

// LTMRemoveWhiteIPPatch remove ips which are currently whitelisted
func LTMRemoveWhiteIPPatch(c *gin.Context) {
	var removewhiteips ltm.DeleteAddresses

	f5url, err := ltm.Loadbalancer(c.Params.ByName("lbpair"), conf.Ltmdevicenames)
	if err != nil {
		respondWithStatus(err.Status, "", nil, err.Message, conf.Documentation["ltmaddresslistdocumentationuri"], c)
		return
	}
	f5url = util.ReplaceLTMUritoAddressListURI(f5url)
	if err := c.BindJSON(&removewhiteips); err != nil {
		respondWithStatus(http.StatusBadRequest, "Invalid JSON data", "Unblock IPs",
			fmt.Sprintf("%s", err), conf.Documentation["ltmaddresslistdocumentationuri"], c)
		return
	}
	res, err := ltm.DeleteLTMBlockAddresses(f5url, &removewhiteips, common.WhiteList)
	if err != nil {
		respondWithStatus(err.Status, "", nil, err.Message, conf.Documentation["ltmaddresslistdocumentationuri"], c)
		return
	}
	json.Unmarshal([]byte(res.Body), &returnerror)
	respondWithStatus(res.Status, "IP(s) removed successfully from whitelist", fmt.Sprintf("%+v", removewhiteips),
		returnerror.ErrorMessage(), conf.Documentation["ltmaddresslistdocumentationuri"], c)
}
开发者ID:zalando,项目名称:baboon-proxy,代码行数:24,代码来源:client.go



注:本文中的github.com/zalando-techmonkeys/baboon-proxy/ltm.Loadbalancer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang eskip.Route类代码示例发布时间:2022-05-28
下一篇:
Golang backend.Request函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap