本文整理汇总了Golang中github.com/rackspace/gophercloud.BuildHeaders函数的典型用法代码示例。如果您正苦于以下问题:Golang BuildHeaders函数的具体用法?Golang BuildHeaders怎么用?Golang BuildHeaders使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BuildHeaders函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ToCDNContainerEnableMap
// ToCDNContainerEnableMap formats an EnableOpts into a map of headers.
func (opts EnableOpts) ToCDNContainerEnableMap() (map[string]string, error) {
h, err := gophercloud.BuildHeaders(opts)
if err != nil {
return nil, err
}
return h, nil
}
开发者ID:Clarifai,项目名称:kubernetes,代码行数:8,代码来源:requests.go
示例2: ToContainerUpdateMap
// ToContainerUpdateMap formats a CreateOpts into a map of headers.
func (opts UpdateOpts) ToContainerUpdateMap() (map[string]string, error) {
h, err := gophercloud.BuildHeaders(opts)
if err != nil {
return nil, err
}
h["X-Cdn-Enabled"] = strconv.FormatBool(opts.CDNEnabled)
return h, nil
}
开发者ID:hortonworks,项目名称:kubernetes-yarn,代码行数:9,代码来源:delegate.go
示例3: ToContainerCreateMap
// ToContainerCreateMap formats a CreateOpts into a map of headers.
func (opts CreateOpts) ToContainerCreateMap() (map[string]string, error) {
h, err := gophercloud.BuildHeaders(opts)
if err != nil {
return nil, err
}
for k, v := range opts.Metadata {
h["X-Container-Meta-"+k] = v
}
return h, nil
}
开发者ID:MerlinDMC,项目名称:machine,代码行数:11,代码来源:requests.go
示例4: ToAccountUpdateMap
// ToAccountUpdateMap formats an UpdateOpts into a map[string]string of headers.
func (opts UpdateOpts) ToAccountUpdateMap() (map[string]string, error) {
headers, err := gophercloud.BuildHeaders(opts)
if err != nil {
return nil, err
}
for k, v := range opts.Metadata {
headers["X-Account-Meta-"+k] = v
}
return headers, err
}
开发者ID:Clarifai,项目名称:kubernetes,代码行数:11,代码来源:delegate.go
示例5: ToObjectUpdateMap
// ToObjectUpdateMap formats a UpdateOpts into a map of headers.
func (opts UpdateOpts) ToObjectUpdateMap() (map[string]string, error) {
h, err := gophercloud.BuildHeaders(opts)
if err != nil {
return nil, err
}
for k, v := range opts.Metadata {
h["X-Object-Meta-"+k] = v
}
return h, nil
}
开发者ID:CorainChicago,项目名称:gophercloud,代码行数:11,代码来源:requests.go
示例6: 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
示例7: ToObjectCopyMap
// ToObjectCopyMap formats a CopyOpts into a map of headers.
func (opts CopyOpts) ToObjectCopyMap() (map[string]string, error) {
if opts.Destination == "" {
return nil, fmt.Errorf("Required CopyOpts field 'Destination' not set.")
}
h, err := gophercloud.BuildHeaders(opts)
if err != nil {
return nil, err
}
for k, v := range opts.Metadata {
h["X-Object-Meta-"+k] = v
}
return h, nil
}
开发者ID:CorainChicago,项目名称:gophercloud,代码行数:14,代码来源:requests.go
示例8: 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
示例9: ToObjectCopyMap
// ToObjectCopyMap formats a CopyOpts into a map of headers.
func (opts CopyOpts) ToObjectCopyMap() (map[string]string, error) {
h, err := gophercloud.BuildHeaders(opts)
if err != nil {
return nil, err
}
for k, v := range opts.Metadata {
h["X-Object-Meta-"+k] = v
}
// `Content-Length` is required and a value of "0" is acceptable, but calling `gophercloud.BuildHeaders`
// will remove the `Content-Length` header if it's set to 0 (or equivalently not set). This will add
// the header if it's not already set.
if _, ok := h["Content-Length"]; !ok {
h["Content-Length"] = "0"
}
return h, nil
}
开发者ID:Clarifai,项目名称:kubernetes,代码行数:17,代码来源:delegate.go
示例10: ToContainerUpdateMap
// ToContainerUpdateMap formats a CreateOpts into a map of headers.
func (opts UpdateOpts) ToContainerUpdateMap() (map[string]string, error) {
h, err := gophercloud.BuildHeaders(opts)
if err != nil {
return nil, err
}
h["X-Cdn-Enabled"] = strconv.FormatBool(opts.CDNEnabled)
h["X-Log-Retention"] = strconv.FormatBool(opts.LogRetention)
if opts.XCDNEnabled != nil {
h["X-Cdn-Enabled"] = strconv.FormatBool(*opts.XCDNEnabled)
}
if opts.XLogRetention != nil {
h["X-Log-Retention"] = strconv.FormatBool(*opts.XLogRetention)
}
return h, nil
}
开发者ID:Clarifai,项目名称:kubernetes,代码行数:19,代码来源:requests.go
示例11: ToAccountGetMap
// ToAccountGetMap formats a GetOpts into a map[string]string of headers.
func (opts GetOpts) ToAccountGetMap() (map[string]string, error) {
return gophercloud.BuildHeaders(opts)
}
开发者ID:hortonworks,项目名称:kubernetes-yarn,代码行数:4,代码来源:requests.go
注:本文中的github.com/rackspace/gophercloud.BuildHeaders函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论