jrperritt | 0bc5578 | 2016-07-27 13:50:14 -0500 | [diff] [blame] | 1 | package trusts |
| 2 | |
| 3 | import "github.com/gophercloud/gophercloud/openstack/identity/v3/tokens" |
| 4 | |
| 5 | type AuthOptsExt struct { |
| 6 | tokens.AuthOptionsBuilder |
| 7 | TrustID string `json:"id"` |
| 8 | } |
| 9 | |
| 10 | func (opts AuthOptsExt) ToTokenV3CreateMap(scope map[string]interface{}) (map[string]interface{}, error) { |
| 11 | return opts.AuthOptionsBuilder.ToTokenV3CreateMap(scope) |
| 12 | } |
| 13 | |
| 14 | func (opts AuthOptsExt) ToTokenV3ScopeMap() (map[string]interface{}, error) { |
| 15 | b, err := opts.AuthOptionsBuilder.ToTokenV3ScopeMap() |
| 16 | if err != nil { |
| 17 | return nil, err |
| 18 | } |
| 19 | |
| 20 | if opts.TrustID != "" { |
| 21 | if b == nil { |
| 22 | b = make(map[string]interface{}) |
| 23 | } |
| 24 | b["OS-TRUST:trust"] = map[string]interface{}{ |
| 25 | "id": opts.TrustID, |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | return b, nil |
| 30 | } |
| 31 | |
| 32 | func (opts AuthOptsExt) CanReauth() bool { |
| 33 | return opts.AuthOptionsBuilder.CanReauth() |
| 34 | } |