Documentation ¶
Overview ¶
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) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthOptsExt ¶
type AuthOptsExt struct { tokens.AuthOptionsBuilder // TrustID is the ID of the trust. TrustID string `json:"id"` }
AuthOptsExt extends the base Identity v3 tokens AuthOpts with a TrustID.
func (AuthOptsExt) CanReauth ¶
func (opts AuthOptsExt) CanReauth() bool
func (AuthOptsExt) ToTokenV3CreateMap ¶
func (opts AuthOptsExt) ToTokenV3CreateMap(scope map[string]interface{}) (map[string]interface{}, error)
ToTokenV3CreateMap builds a create request body from the AuthOpts.
func (AuthOptsExt) ToTokenV3ScopeMap ¶
func (opts AuthOptsExt) ToTokenV3ScopeMap() (map[string]interface{}, error)
ToTokenV3ScopeMap builds a scope from AuthOpts.
type CreateOpts ¶
type CreateOpts struct { // Impersonation allows the trustee to impersonate the trustor. Impersonation bool `json:"impersonation"` // TrusteeUserID is a user who is capable of consuming the trust. TrusteeUserID string `json:"trustee_user_id" required:"true"` // TrustorUserID is a user who created the trust. TrustorUserID string `json:"trustor_user_id" required:"true"` // AllowRedelegation enables redelegation of a trust. AllowRedelegation bool `json:"allow_redelegation,omitempty"` // ExpiresAt sets expiration time on trust. ExpiresAt *time.Time `json:"-"` // ProjectID identifies the project. ProjectID string `json:"project_id,omitempty"` // RedelegationCount specifies a depth of the redelegation chain. RedelegationCount int `json:"redelegation_count,omitempty"` // RemainingUses specifies how many times a trust can be used to get a token. RemainingUses int `json:"remaining_uses,omitempty"` // Roles specifies roles that need to be granted to trustee. Roles []Role `json:"roles,omitempty"` }
CreateOpts provides options used to create a new trust.
func (CreateOpts) ToTrustCreateMap ¶
func (opts CreateOpts) ToTrustCreateMap() (map[string]interface{}, error)
ToTrustCreateMap formats a CreateOpts into a create request.
type CreateOptsBuilder ¶
CreateOptsBuilder allows extensions to add additional parameters to the Create request.
type CreateResult ¶
type CreateResult struct {
// contains filtered or unexported fields
}
CreateResult is the response from a Create operation. Call its Extract method to interpret it as a Trust.
func Create ¶
func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create creates a new Trust.
type DeleteResult ¶
type DeleteResult struct {
gophercloud.ErrResult
}
DeleteResult is the response from a Delete operation. Call its ExtractErr to determine if the request succeeded or failed.
func Delete ¶
func Delete(client *gophercloud.ServiceClient, trustID string) (r DeleteResult)
Delete deletes a trust.
type TokenExt ¶
type TokenExt struct {
Trust Trust `json:"OS-TRUST:trust"`
}
TokenExt represents an extension of the base token result.
type Trust ¶
type Trust struct { ID string `json:"id"` Impersonation bool `json:"impersonation"` TrusteeUser TrusteeUser `json:"trustee_user"` TrustorUser TrustorUser `json:"trustor_user"` RedelegatedTrustID string `json:"redelegated_trust_id"` RedelegationCount int `json:"redelegation_count"` }
Trust represents a delegated authorization request between two identities.
type TrusteeUser ¶
type TrusteeUser struct {
ID string `json:"id"`
}
TrusteeUser represents the trusted user ID of a trust.
type TrustorUser ¶
type TrustorUser struct {
ID string `json:"id"`
}
TrustorUser represents the trusting user ID of a trust.