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

Golang gophercloud.BuildQueryString函数代码示例

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

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



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

示例1: ToObjectGetQuery

// ToObjectGetQuery formats a GetOpts into a query string.
func (opts GetOpts) ToObjectGetQuery() (string, error) {
	q, err := gophercloud.BuildQueryString(opts)
	if err != nil {
		return "", err
	}
	return q.String(), nil
}
开发者ID:CorainChicago,项目名称:gophercloud,代码行数:8,代码来源:requests.go


示例2: ToResourceEventListQuery

// ToResourceEventListQuery formats a ListResourceEventsOpts into a query string.
func (opts ListResourceEventsOpts) ToResourceEventListQuery() (string, error) {
	q, err := gophercloud.BuildQueryString(opts)
	if err != nil {
		return "", err
	}
	return q.String(), nil
}
开发者ID:Clarifai,项目名称:kubernetes,代码行数:8,代码来源:requests.go


示例3: ToMeterStatisticsQuery

// ToMeterStatisticsQuery formats a StatisticsOpts into a query string.
func (opts MeterStatisticsOpts) ToMeterStatisticsQuery() (string, error) {
	q, err := gophercloud.BuildQueryString(opts)
	if err != nil {
		return "", err
	}
	return q.String(), nil
}
开发者ID:dudymas,项目名称:gophercloud,代码行数:8,代码来源:requests.go


示例4: ToPortListQuery

// ToPortListQuery formats a ListOpts into a query string.
func (opts ListOpts) ToPortListQuery() (string, error) {
	q, err := gophercloud.BuildQueryString(opts)
	if err != nil {
		return "", err
	}
	return q.String(), nil
}
开发者ID:feiskyer,项目名称:gophercloud,代码行数:8,代码来源:requests.go


示例5: ToContainerListParams

// ToContainerListParams formats a ListOpts into a query string and boolean
// representing whether to list complete information for each container.
func (opts ListOpts) ToContainerListParams() (bool, string, error) {
	q, err := gophercloud.BuildQueryString(opts)
	if err != nil {
		return false, "", err
	}
	return false, q.String(), nil
}
开发者ID:Clarifai,项目名称:kubernetes,代码行数:9,代码来源:delegate.go


示例6: ToRolesListAssignmentsQuery

// ToRolesListAssignmentsQuery formats a ListAssignmentsOpts into a query string.
func (opts ListAssignmentsOpts) ToRolesListAssignmentsQuery() (string, error) {
	q, err := gophercloud.BuildQueryString(opts)
	if err != nil {
		return "", err
	}
	return q.String(), nil
}
开发者ID:Clarifai,项目名称:kubernetes,代码行数:8,代码来源:requests.go


示例7: ToShowQuery

// ToMeterShowQuery formats a ShowOpts into a query string.
func (opts ShowOpts) ToShowQuery() (string, error) {
	q, err := gophercloud.BuildQueryString(opts)
	if err != nil {
		return "", err
	}
	return q.String(), nil
}
开发者ID:rackspace,项目名称:gophercloud,代码行数:8,代码来源:requests.go


示例8: ToObjectListParams

// ToObjectListParams formats a ListOpts into a query string and boolean
// representing whether to list complete information for each object.
func (opts ListOpts) ToObjectListParams() (bool, string, error) {
	q, err := gophercloud.BuildQueryString(opts)
	if err != nil {
		return false, "", err
	}
	return opts.Full, q.String(), nil
}
开发者ID:CorainChicago,项目名称:gophercloud,代码行数:9,代码来源:requests.go


示例9: ToCDNAssetDeleteParams

// ToCDNAssetDeleteParams formats a DeleteOpts into a query string.
func (opts DeleteOpts) ToCDNAssetDeleteParams() (string, error) {
	q, err := gophercloud.BuildQueryString(opts)
	if err != nil {
		return "", err
	}
	return q.String(), nil
}
开发者ID:Clarifai,项目名称:kubernetes,代码行数:8,代码来源:requests.go


示例10: GetDataByResolution

// GetDataByPoints retrieve metric data by resolution, for the specified tenant associated with RackspaceMetrics.
func GetDataByResolution(c *gophercloud.ServiceClient, metric string, opts QueryParams) GetResult {
	var res GetResult

	url := getURLForResolution(c, metric)
	query, _ := gophercloud.BuildQueryString(opts)
	url += query.String()
	_, res.Err = c.Get(url, &res.Body, nil)
	return res
}
开发者ID:goru97,项目名称:Metrics_GO,代码行数:10,代码来源:requests.go


示例11: List

// List returns a Pager which allows you to iterate over a collection of
// routers. It accepts a ListOpts struct, which allows you to filter and sort
// the returned collection for greater efficiency.
//
// Default policy settings return only those routers that are owned by the
// tenant who submits the request, unless an admin user submits the request.
func List(c *gophercloud.ServiceClient, opts ListOpts) pagination.Pager {
	q, err := gophercloud.BuildQueryString(&opts)
	if err != nil {
		return pagination.Pager{Err: err}
	}
	u := rootURL(c) + q.String()
	return pagination.NewPager(c, u, func(r pagination.PageResult) pagination.Page {
		return RouterPage{pagination.LinkedPageBase{PageResult: r}}
	})
}
开发者ID:hortonworks,项目名称:kubernetes-yarn,代码行数:16,代码来源:requests.go


示例12: ToObjectDownloadParams

// ToObjectDownloadParams formats a DownloadOpts into a query string and map of
// headers.
func (opts DownloadOpts) ToObjectDownloadParams() (map[string]string, string, error) {
	q, err := gophercloud.BuildQueryString(opts)
	if err != nil {
		return nil, "", err
	}
	h, err := gophercloud.BuildHeaders(opts)
	if err != nil {
		return nil, q.String(), err
	}
	return h, q.String(), nil
}
开发者ID:CorainChicago,项目名称:gophercloud,代码行数:13,代码来源:requests.go


示例13: List

// List enumerates the services available to a specific user.
func List(client *gophercloud.ServiceClient, opts ListOpts) pagination.Pager {
	u := listURL(client)
	q, err := gophercloud.BuildQueryString(opts)
	if err != nil {
		return pagination.Pager{Err: err}
	}
	u += q.String()
	createPage := func(r pagination.PageResult) pagination.Page {
		return ServicePage{pagination.LinkedPageBase{PageResult: r}}
	}

	return pagination.NewPager(client, u, createPage)
}
开发者ID:rtgoodwin,项目名称:cs-reboot-info,代码行数:14,代码来源:requests.go


示例14: SearchMetric

// SearchMetric retrieves a list of available metrics for the specified tenant associated with RackspaceMetrics.
func SearchMetric(c *gophercloud.ServiceClient, opts QueryParams) ([]Metric, error) {
	var res GetResult

	url := getSearchURL(c)
	query, _ := gophercloud.BuildQueryString(opts)
	url += query.String()

	_, res.Err = c.Get(url, &res.Body, nil)
	b := res.Body.(interface{})
	var metrics []Metric
	err := mapstructure.Decode(b, &metrics)
	return metrics, err
}
开发者ID:goru97,项目名称:Metrics_GO,代码行数:14,代码来源:requests.go


示例15: GetEvents

//GetEvents retrieves a list of events for the specified tenant associated with RackspaceMetrics.
func GetEvents(c *gophercloud.ServiceClient, opts QueryParams) ([]Event, error) {
	var res GetResult

	url := getEventURL(c)
	query, _ := gophercloud.BuildQueryString(opts)
	url += query.String()

	_, res.Err = c.Get(url, &res.Body, nil)
	b := res.Body.(interface{})
	var events []Event
	err := mapstructure.Decode(b, &events)
	return events, err
}
开发者ID:goru97,项目名称:Metrics_GO,代码行数:14,代码来源:requests.go


示例16: ToObjectCreateParams

// ToObjectCreateParams formats a CreateOpts into a query string and map of
// headers.
func (opts CreateOpts) ToObjectCreateParams() (map[string]string, string, error) {
	q, err := gophercloud.BuildQueryString(opts)
	if err != nil {
		return nil, "", err
	}
	h, err := gophercloud.BuildHeaders(opts)
	if err != nil {
		return nil, q.String(), err
	}

	for k, v := range opts.Metadata {
		h["X-Object-Meta-"+k] = v
	}

	return h, q.String(), nil
}
开发者ID:CorainChicago,项目名称:gophercloud,代码行数:18,代码来源:requests.go


示例17: List

// List enumerates the Tenants to which the current token has access.
func List(client *gophercloud.ServiceClient, opts *ListOpts) pagination.Pager {
	createPage := func(r pagination.PageResult) pagination.Page {
		return TenantPage{pagination.LinkedPageBase{PageResult: r}}
	}

	url := listURL(client)
	if opts != nil {
		q, err := gophercloud.BuildQueryString(opts)
		if err != nil {
			return pagination.Pager{Err: err}
		}
		url += q.String()
	}

	return pagination.NewPager(client, url, createPage)
}
开发者ID:COLDTURNIP,项目名称:kubernetes,代码行数:17,代码来源:requests.go


示例18: GetDataForListByResolution

// GetDataForListByResolution retrieve data against a list of metrics and specified resolution, for the specified tenant associated with RackspaceMetrics.
func GetDataForListByResolution(c *gophercloud.ServiceClient, opts QueryParams, metrics ...string) (MetricListData, error) {
	var res GetResult

	reqBody := make([]interface{}, len(metrics))
	for i, v := range metrics {
		reqBody[i] = v
	}
	url := getURLForListAndResolution(c)
	query, _ := gophercloud.BuildQueryString(opts)
	url += query.String()
	_, res.Err = c.Post(url, reqBody, &res.Body, &gophercloud.RequestOpts{
		OkCodes: []int{200},
	})
	b := res.Body.(interface{})
	var metricList MetricListData
	err := mapstructure.Decode(b, &metricList)
	return metricList, err
}
开发者ID:goru97,项目名称:Metrics_GO,代码行数:19,代码来源:requests.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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