Documentation
¶
Overview ¶
Package osinherit enables projects to inherit role assignments from either their owning domain or projects that are higher in the hierarchy.
Example to Assign a Inherited Role to a User to a Domain
domainID := "a99e9b4e620e4db09a2dfb6e42a01e66"
userID := "9df1a02f5eb2416a9781e8b0c022d3ae"
roleID := "9fe2ff9ee4384b1894a90878d3e92bab"
err := osinherit.Assign(context.TODO(), identityClient, roleID, osinherit.AssignOpts{
UserID: userID,
domainID: domainID,
}).ExtractErr()
if err != nil {
panic(err)
}
Example to Assign a Inherited Role to a User to a Project's subtree
projectID := "a99e9b4e620e4db09a2dfb6e42a01e66"
userID := "9df1a02f5eb2416a9781e8b0c022d3ae"
roleID := "9fe2ff9ee4384b1894a90878d3e92bab"
err := osinherit.Assign(context.TODO(), identityClient, roleID, osinherit.AssignOpts{
UserID: userID,
ProjectID: projectID,
}).ExtractErr()
if err != nil {
panic(err)
}
Example to validate a Inherited Role to a User to a Project's subtree
projectID := "a99e9b4e620e4db09a2dfb6e42a01e66"
userID := "9df1a02f5eb2416a9781e8b0c022d3ae"
roleID := "9fe2ff9ee4384b1894a90878d3e92bab"
err := osinherit.Validate(context.TODO(), identityClient, roleID, osinherit.validateOpts{
UserID: userID,
ProjectID: projectID,
}).ExtractErr()
if err != nil {
panic(err)
}
Example to unassign a Inherited Role to a User to a Project's subtree
projectID := "a99e9b4e620e4db09a2dfb6e42a01e66"
userID := "9df1a02f5eb2416a9781e8b0c022d3ae"
roleID := "9fe2ff9ee4384b1894a90878d3e92bab"
err := osinherit.Unassign(context.TODO(), identityClient, roleID, osinherit.UnassignOpts{
UserID: userID,
ProjectID: projectID,
}).ExtractErr()
if err != nil {
panic(err)
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssignOpts ¶
type AssignOpts struct {
// UserID is the ID of a user to assign an inherited role
// Note: exactly one of UserID or GroupID must be provided
UserID string `xor:"GroupID"`
// GroupID is the ID of a group to assign an inherited role
// Note: exactly one of UserID or GroupID must be provided
GroupID string `xor:"UserID"`
// ProjectID is the ID of a project to assign an inherited role on
// Note: exactly one of ProjectID or DomainID must be provided
ProjectID string `xor:"DomainID"`
// DomainID is the ID of a domain to assign an inherited role on
// Note: exactly one of ProjectID or DomainID must be provided
DomainID string `xor:"ProjectID"`
}
AssignOpts provides options to assign an inherited role
type AssignmentResult ¶
type AssignmentResult struct {
gophercloud.ErrResult
}
AssignmentResult represents the result of an assign operation. Call ExtractErr method to determine if the request succeeded or failed.
func Assign ¶
func Assign(ctx context.Context, client *gophercloud.ServiceClient, roleID string, opts AssignOpts) (r AssignmentResult)
Assign is the operation responsible for assigning an inherited role to a user/group on a project/domain.
type UnassignOpts ¶
type UnassignOpts struct {
// UserID is the ID of a user to unassign an inherited role
// Note: exactly one of UserID or GroupID must be provided
UserID string `xor:"GroupID"`
// GroupID is the ID of a group to unassign an inherited role
// Note: exactly one of UserID or GroupID must be provided
GroupID string `xor:"UserID"`
// ProjectID is the ID of a project to assign an inherited role on
// Note: exactly one of ProjectID or DomainID must be provided
ProjectID string `xor:"DomainID"`
// DomainID is the ID of a domain to assign an inherited role on
// Note: exactly one of ProjectID or DomainID must be provided
DomainID string `xor:"ProjectID"`
}
UnassignOpts provides options to unassign an inherited role
type UnassignmentResult ¶
type UnassignmentResult struct {
gophercloud.ErrResult
}
UnassignmentResult represents the result of an unassign operation. Call ExtractErr method to determine if the request succeeded or failed.
func Unassign ¶
func Unassign(ctx context.Context, client *gophercloud.ServiceClient, roleID string, opts UnassignOpts) (r UnassignmentResult)
Unassign is the operation responsible for unassigning an inherited role to a user/group on a project/domain.
type ValidateOpts ¶
type ValidateOpts struct {
// UserID is the ID of a user to validate an inherited role
// Note: exactly one of UserID or GroupID must be provided
UserID string `xor:"GroupID"`
// GroupID is the ID of a group to validate an inherited role
// Note: exactly one of UserID or GroupID must be provided
GroupID string `xor:"UserID"`
// ProjectID is the ID of a project to validate an inherited role on
// Note: exactly one of ProjectID or DomainID must be provided
ProjectID string `xor:"DomainID"`
// DomainID is the ID of a domain to validate an inherited role on
// Note: exactly one of ProjectID or DomainID must be provided
DomainID string `xor:"ProjectID"`
}
ValidateOpts provides options to which role to validate
type ValidateResult ¶
type ValidateResult struct {
gophercloud.ErrResult
}
ValidateResult represents the result of an validate operation. Call ExtractErr method to determine if the request succeeded or failed.
func Validate ¶
func Validate(ctx context.Context, client *gophercloud.ServiceClient, roleID string, opts ValidateOpts) (r ValidateResult)
Validate is the operation responsible for validating an inherited role of a user/group on a project/domain.