blob: cb7207246b4fe6c7326d5c7a3aa551055c57a655 [file] [log] [blame]
Jon Perritt816d2a02014-03-11 20:49:46 -05001package accounts
2
3import (
4 "strings"
5)
6
7type UpdateOpts struct {
8 Metadata map[string]string
9 Headers map[string]string
10}
11
12type GetOpts struct {
13 Headers map[string]string
14}
15
16// GetMetadata is a function that takes a GetResult (of type *perigee.Response)
17// and returns the custom metatdata associated with the account.
18func GetMetadata(gr GetResult) map[string]string {
19 metadata := make(map[string]string)
20 for k, v := range gr.HttpResponse.Header {
21 if strings.HasPrefix(k, "X-Account-Meta-") {
22 key := strings.TrimPrefix(k, "X-Account-Meta-")
23 metadata[key] = v[0]
24 }
25 }
26 return metadata
27}