blob: 999dd73deb563fcdae724140866d9c560454bfee [file] [log] [blame]
jrperritt0bc55782016-07-27 13:50:14 -05001package trusts
2
3import "github.com/gophercloud/gophercloud/openstack/identity/v3/tokens"
4
5type AuthOptsExt struct {
6 tokens.AuthOptionsBuilder
7 TrustID string `json:"id"`
8}
9
10func (opts AuthOptsExt) ToTokenV3CreateMap(scope map[string]interface{}) (map[string]interface{}, error) {
11 return opts.AuthOptionsBuilder.ToTokenV3CreateMap(scope)
12}
13
14func (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
32func (opts AuthOptsExt) CanReauth() bool {
33 return opts.AuthOptionsBuilder.CanReauth()
34}