/
doc.go
58 lines (47 loc) · 1.35 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
Package trusts enables management of OpenStack Identity Trusts.
Example to Create a Token with Username, Password, and Trust ID
var trustToken struct {
tokens.Token
trusts.TokenExt
}
authOptions := tokens.AuthOptions{
UserID: "username",
Password: "password",
}
createOpts := trusts.AuthOptsExt{
AuthOptionsBuilder: authOptions,
TrustID: "de0945a",
}
err := tokens.Create(identityClient, createOpts).ExtractInto(&trustToken)
if err != nil {
panic(err)
}
Example to Create a Trust
expiresAt := time.Date(2019, 12, 1, 14, 0, 0, 999999999, time.UTC)
createOpts := trusts.CreateOpts{
ExpiresAt: &expiresAt,
Impersonation: true,
AllowRedelegation: true,
ProjectID: "9b71012f5a4a4aef9193f1995fe159b2",
Roles: []trusts.Role{
{
Name: "member",
},
},
TrusteeUserID: "ecb37e88cc86431c99d0332208cb6fbf",
TrustorUserID: "959ed913a32c4ec88c041c98e61cbbc3",
}
trust, err := trusts.Create(identityClient, createOpts).Extract()
if err != nil {
panic(err)
}
fmt.Printf("Trust: %+v\n", trust)
Example to Delete a Trust
trustID := "3422b7c113894f5d90665e1a79655e23"
err := trusts.Delete(identityClient, trustID).ExtractErr()
if err != nil {
panic(err)
}
*/
package trusts