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

Golang perigee.Get函数代码示例

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

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



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

示例1: ListKeyPairs

// See the CloudImagesProvider interface for details.
func (gsp *genericServersProvider) ListKeyPairs() ([]KeyPair, error) {
	type KeyPairs struct {
		KeyPairs []struct {
			KeyPair KeyPair `json:"keypair"`
		} `json:"keypairs"`
	}

	var kp KeyPairs

	err := gsp.context.WithReauth(gsp.access, func() error {
		url := gsp.endpoint + "/os-keypairs"
		return perigee.Get(url, perigee.Options{
			CustomClient: gsp.context.httpClient,
			Results:      &kp,
			MoreHeaders: map[string]string{
				"X-Auth-Token": gsp.access.AuthToken(),
			},
		})
	})

	// Flatten out the list of keypairs
	var keypairs []KeyPair
	for _, k := range kp.KeyPairs {
		keypairs = append(keypairs, k.KeyPair)
	}
	return keypairs, err
}
开发者ID:WIZARD-CXY,项目名称:golang-devops-stuff,代码行数:28,代码来源:keypairs.go


示例2: ServerById

// See the CloudServersProvider interface for details.
func (gsp *genericServersProvider) ServerById(id string) (*Server, error) {
	var s *Server

	err := gsp.context.WithReauth(gsp.access, func() error {
		url := gsp.endpoint + "/servers/" + id
		return perigee.Get(url, perigee.Options{
			Results: &struct{ Server **Server }{&s},
			MoreHeaders: map[string]string{
				"X-Auth-Token": gsp.access.AuthToken(),
			},
			OkCodes: []int{200},
		})
	})

	// Compatibility with v0.0.x -- we "map" our public and private
	// addresses into a legacy structure field for the benefit of
	// earlier software.

	if err != nil {
		return s, err
	}

	err = mapstructure.Decode(s.RawAddresses, &s.Addresses)

	return s, err
}
开发者ID:ericcapricorn,项目名称:kubernetes,代码行数:27,代码来源:servers.go


示例3: ListServers

// See the CloudServersProvider interface for details.
func (gcp *genericServersProvider) ListServers() ([]Server, error) {
	var ss []Server

	err := gcp.context.WithReauth(gcp.access, func() error {
		url := gcp.endpoint + "/servers/detail"
		return perigee.Get(url, perigee.Options{
			CustomClient: gcp.context.httpClient,
			Results:      &struct{ Servers *[]Server }{&ss},
			MoreHeaders: map[string]string{
				"X-Auth-Token": gcp.access.AuthToken(),
			},
		})
	})

	// Compatibility with v0.0.x -- we "map" our public and private
	// addresses into a legacy structure field for the benefit of
	// earlier software.

	if err != nil {
		return ss, err
	}

	for _, s := range ss {
		err = mapstructure.Decode(s.RawAddresses, &s.Addresses)
		if err != nil {
			return ss, err
		}
	}

	return ss, err
}
开发者ID:ericcapricorn,项目名称:kubernetes,代码行数:32,代码来源:servers.go


示例4: Images

// Images method provides a complete list of images hosted at the region.
func (r *raxRegion) Images() ([]Image, error) {
	var is []Image
	url, _ := r.EndpointByName("images")
	err := perigee.Get(url, perigee.Options{
		CustomClient: r.httpClient,
		Results:      &struct{ Images *[]Image }{&is},
		MoreHeaders: map[string]string{
			"X-Auth-Token": r.token,
		},
	})
	return is, err
}
开发者ID:jyidiego,项目名称:gorax,代码行数:13,代码来源:region.go


示例5: Servers

// Servers method provides a complete list of servers hosted by the user
// at a given region.
func (r *raxRegion) Servers() ([]Server, error) {
	var ss []Server

	url, _ := r.EndpointByName("servers/detail")
	err := perigee.Get(url, perigee.Options{
		CustomClient: r.httpClient,
		Results:      &struct{ Servers *[]Server }{&ss},
		MoreHeaders: map[string]string{
			"X-Auth-Token": r.token,
		},
	})
	return ss, err
}
开发者ID:jyidiego,项目名称:gorax,代码行数:15,代码来源:region.go


示例6: ServerInfoById

// ServerInfoById provides the complete server information record
// given you know its unique ID.
func (r *raxRegion) ServerInfoById(id string) (*Server, error) {
	var s *Server

	baseUrl, err := r.EndpointByName("servers")
	serverUrl := fmt.Sprintf("%s/%s", baseUrl, id)
	err = perigee.Get(serverUrl, perigee.Options{
		Results: &struct{ Server **Server }{&s},
		MoreHeaders: map[string]string{
			"X-Auth-Token": r.token,
		},
	})
	return s, err
}
开发者ID:jyidiego,项目名称:gorax,代码行数:15,代码来源:region.go


示例7: GetSGRule

// See the CloudServersProvider interface for details.
func (gsp *genericServersProvider) GetSGRule(id string) (*SGRule, error) {
	var sgr *SGRule
	err := gsp.context.WithReauth(gsp.access, func() error {
		ep := fmt.Sprintf("%s/os-security-group-default-rules/%s", gsp.endpoint, id)
		return perigee.Get(ep, perigee.Options{
			MoreHeaders: map[string]string{
				"X-Auth-Token": gsp.access.AuthToken(),
			},
			Results: &struct{ Security_group_default_rule **SGRule }{&sgr},
		})
	})
	return sgr, err
}
开发者ID:ericcapricorn,项目名称:kubernetes,代码行数:14,代码来源:servers.go


示例8: Flavors

// Flavors method provides a complete list of machine configurations (called flavors) available at the region.
func (r *raxRegion) Flavors() ([]Flavor, error) {
	var fs []Flavor

	url, _ := r.EndpointByName("flavors")
	err := perigee.Get(url, perigee.Options{
		CustomClient: r.httpClient,
		Results:      &struct{ Flavors *[]Flavor }{&fs},
		MoreHeaders: map[string]string{
			"X-Auth-Token": r.token,
		},
	})
	return fs, err
}
开发者ID:jyidiego,项目名称:gorax,代码行数:14,代码来源:region.go


示例9: ServerById

// See the CloudServersProvider interface for details.
func (gsp *genericServersProvider) ServerById(id string) (*Server, error) {
	var s *Server

	err := gsp.context.WithReauth(gsp.access, func() error {
		url := gsp.endpoint + "/servers/" + id
		return perigee.Get(url, perigee.Options{
			Results: &struct{ Server **Server }{&s},
			MoreHeaders: map[string]string{
				"X-Auth-Token": gsp.access.AuthToken(),
			},
		})
	})
	return s, err
}
开发者ID:rafbgarcia,项目名称:gophercloud,代码行数:15,代码来源:servers.go


示例10: GetFirewall

func (gnp *genericNetworksProvider) GetFirewall(firewallId string) (*Firewall, error) {
	var firewall *Firewall

	ep := gnp.endpoint + "/v2.0/fw/firewalls/" + firewallId
	err := perigee.Get(ep, perigee.Options{
		Results: &struct{ Firewall **Firewall }{&firewall},
		MoreHeaders: map[string]string{
			"X-Auth-Token": gnp.access.AuthToken(),
		},
		OkCodes: []int{200},
	})

	return firewall, err
}
开发者ID:haklop,项目名称:gophercloud-extensions,代码行数:14,代码来源:network.go


示例11: GetVip

func (gnp *genericNetworksProvider) GetVip(vipId string) (*Vip, error) {
	var vip *Vip

	ep := gnp.endpoint + "/v2.0/lb/vips/" + vipId
	err := perigee.Get(ep, perigee.Options{
		Results: &struct{ Vip **Vip }{&vip},
		MoreHeaders: map[string]string{
			"X-Auth-Token": gnp.access.AuthToken(),
		},
		OkCodes: []int{200},
	})

	return vip, err
}
开发者ID:haklop,项目名称:gophercloud-extensions,代码行数:14,代码来源:network.go


示例12: GetNetwork

func (gnp *genericNetworksProvider) GetNetwork(id string) (*Network, error) {
	var n *Network

	ep := gnp.endpoint + "/v2.0/networks/" + id
	err := perigee.Get(ep, perigee.Options{
		Results: &struct{ Network **Network }{&n},
		MoreHeaders: map[string]string{
			"X-Auth-Token": gnp.access.AuthToken(),
		},
		OkCodes: []int{200},
	})

	return n, err
}
开发者ID:haklop,项目名称:gophercloud-extensions,代码行数:14,代码来源:network.go


示例13: GetMember

func (gnp *genericNetworksProvider) GetMember(memberId string) (*Member, error) {
	var member *Member

	ep := gnp.endpoint + "/v2.0/lb/members/" + memberId
	err := perigee.Get(ep, perigee.Options{
		Results: &struct{ Member **Member }{&member},
		MoreHeaders: map[string]string{
			"X-Auth-Token": gnp.access.AuthToken(),
		},
		OkCodes: []int{200},
	})

	return member, err
}
开发者ID:haklop,项目名称:gophercloud-extensions,代码行数:14,代码来源:network.go


示例14: GetPool

func (gnp *genericNetworksProvider) GetPool(poolId string) (*Pool, error) {
	var pool *Pool

	ep := gnp.endpoint + "/v2.0/lb/pools/" + poolId
	err := perigee.Get(ep, perigee.Options{
		Results: &struct{ Pool **Pool }{&pool},
		MoreHeaders: map[string]string{
			"X-Auth-Token": gnp.access.AuthToken(),
		},
		OkCodes: []int{200},
	})

	return pool, err
}
开发者ID:haklop,项目名称:gophercloud-extensions,代码行数:14,代码来源:network.go


示例15: GetSecurityGroup

func (gnp *genericNetworksProvider) GetSecurityGroup(id string) (*SecurityGroup, error) {
	var s *SecurityGroup

	ep := gnp.endpoint + "/v2.0/security-groups/" + id
	err := perigee.Get(ep, perigee.Options{
		Results: &struct{ SecurityGroup **SecurityGroup }{&s},
		MoreHeaders: map[string]string{
			"X-Auth-Token": gnp.access.AuthToken(),
		},
		OkCodes: []int{200},
	})

	return s, err
}
开发者ID:haklop,项目名称:gophercloud-extensions,代码行数:14,代码来源:network.go


示例16: GetRouter

func (gnp *genericNetworksProvider) GetRouter(routerId string) (*Router, error) {
	var r *Router

	ep := gnp.endpoint + "/v2.0/routers/" + routerId
	err := perigee.Get(ep, perigee.Options{
		Results: &struct{ Router **Router }{&r},
		MoreHeaders: map[string]string{
			"X-Auth-Token": gnp.access.AuthToken(),
		},
		OkCodes: []int{200},
	})

	return r, err
}
开发者ID:haklop,项目名称:gophercloud-extensions,代码行数:14,代码来源:network.go


示例17: ListFlavors

// See CloudServersProvider interface for details.
func (gsp *genericServersProvider) ListFlavors() ([]Flavor, error) {
	var fs []Flavor

	err := gsp.context.WithReauth(gsp.access, func() error {
		url := gsp.endpoint + "/flavors/detail"
		return perigee.Get(url, perigee.Options{
			CustomClient: gsp.context.httpClient,
			Results:      &struct{ Flavors *[]Flavor }{&fs},
			MoreHeaders: map[string]string{
				"X-Auth-Token": gsp.access.AuthToken(),
			},
		})
	})
	return fs, err
}
开发者ID:WIZARD-CXY,项目名称:golang-devops-stuff,代码行数:16,代码来源:flavors.go


示例18: ListServersLinksOnly

// See the CloudServersProvider interface for details.
func (gcp *genericServersProvider) ListServersLinksOnly() ([]Server, error) {
	var ss []Server

	err := gcp.context.WithReauth(gcp.access, func() error {
		url := gcp.endpoint + "/servers"
		return perigee.Get(url, perigee.Options{
			CustomClient: gcp.context.httpClient,
			Results:      &struct{ Servers *[]Server }{&ss},
			MoreHeaders: map[string]string{
				"X-Auth-Token": gcp.access.AuthToken(),
			},
		})
	})
	return ss, err
}
开发者ID:ericcapricorn,项目名称:kubernetes,代码行数:16,代码来源:servers.go


示例19: ListImages

// See the CloudImagesProvider interface for details.
func (gsp *genericServersProvider) ListImages() ([]Image, error) {
	var is []Image

	err := gsp.context.WithReauth(gsp.access, func() error {
		url := gsp.endpoint + "/images/detail"
		return perigee.Get(url, perigee.Options{
			CustomClient: gsp.context.httpClient,
			Results:      &struct{ Images *[]Image }{&is},
			MoreHeaders: map[string]string{
				"X-Auth-Token": gsp.access.AuthToken(),
			},
		})
	})
	return is, err
}
开发者ID:philips,项目名称:gophercloud,代码行数:16,代码来源:images.go


示例20: ShowKeyPair

func (gsp *genericServersProvider) ShowKeyPair(name string) (KeyPair, error) {
	var kp KeyPair

	err := gsp.context.WithReauth(gsp.access, func() error {
		url := gsp.endpoint + "/os-keypairs/" + name
		return perigee.Get(url, perigee.Options{
			CustomClient: gsp.context.httpClient,
			Results:      &struct{ KeyPair *KeyPair }{&kp},
			MoreHeaders: map[string]string{
				"X-Auth-Token": gsp.access.AuthToken(),
			},
		})
	})
	return kp, err
}
开发者ID:WIZARD-CXY,项目名称:golang-devops-stuff,代码行数:15,代码来源:keypairs.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang perigee.Post函数代码示例发布时间:2022-05-28
下一篇:
Golang perigee.Delete函数代码示例发布时间: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