roles

package
v0.0.0-...-8db8df1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2017 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package roles provides information and interaction with the roles API resource for the OpenStack Identity service.

Example to List Role Assignments

listOpts := roles.ListAssignmentsOpts{
	UserID:         "97061de2ed0647b28a393c36ab584f39",
	ScopeProjectID: "9df1a02f5eb2416a9781e8b0c022d3ae",
}

allPages, err := roles.ListAssignments(identityClient, listOpts).AllPages()
if err != nil {
	panic(err)
}

allRoles, err := roles.ExtractRoleAssignments(allPages)
if err != nil {
	panic(err)
}

for _, role := range allRoles {
	fmt.Printf("%+v\n", role)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListAssignments

ListAssignments enumerates the roles assigned to a specified resource.

Types

type Domain

type Domain struct {
	ID string `json:"id,omitempty"`
}

Domain represents a domain in a role assignment scope.

type Group

type Group struct {
	ID string `json:"id,omitempty"`
}

Group represents a group in a role assignment scope.

type ListAssignmentsOpts

type ListAssignmentsOpts struct {
	// GroupID is the group ID to query.
	GroupID string `q:"group.id"`

	// RoleID is the specific role to query assignments to.
	RoleID string `q:"role.id"`

	// ScopeDomainID filters the results by the given domain ID.
	ScopeDomainID string `q:"scope.domain.id"`

	// ScopeProjectID filters the results by the given Project ID.
	ScopeProjectID string `q:"scope.project.id"`

	// UserID filterst he results by the given User ID.
	UserID string `q:"user.id"`

	// Effective lists effective assignments at the user, project, and domain
	// level, allowing for the effects of group membership.
	Effective *bool `q:"effective"`
}

ListAssignmentsOpts allows you to query the ListAssignments method. Specify one of or a combination of GroupId, RoleId, ScopeDomainId, ScopeProjectId, and/or UserId to search for roles assigned to corresponding entities.

func (ListAssignmentsOpts) ToRolesListAssignmentsQuery

func (opts ListAssignmentsOpts) ToRolesListAssignmentsQuery() (string, error)

ToRolesListAssignmentsQuery formats a ListAssignmentsOpts into a query string.

type ListAssignmentsOptsBuilder

type ListAssignmentsOptsBuilder interface {
	ToRolesListAssignmentsQuery() (string, error)
}

ListAssignmentsOptsBuilder allows extensions to add additional parameters to the ListAssignments request.

type Project

type Project struct {
	ID string `json:"id,omitempty"`
}

Project represents a project in a role assignment scope.

type Role

type Role struct {
	ID string `json:"id,omitempty"`
}

Role represents a Role in an assignment.

type RoleAssignment

type RoleAssignment struct {
	Role  Role  `json:"role,omitempty"`
	Scope Scope `json:"scope,omitempty"`
	User  User  `json:"user,omitempty"`
	Group Group `json:"group,omitempty"`
}

RoleAssignment is the result of a role assignments query.

func ExtractRoleAssignments

func ExtractRoleAssignments(r pagination.Page) ([]RoleAssignment, error)

ExtractRoleAssignments extracts a slice of RoleAssignments from a Collection acquired from List.

type RoleAssignmentPage

type RoleAssignmentPage struct {
	pagination.LinkedPageBase
}

RoleAssignmentPage is a single page of RoleAssignments results.

func (RoleAssignmentPage) IsEmpty

func (r RoleAssignmentPage) IsEmpty() (bool, error)

IsEmpty returns true if the RoleAssignmentPage contains no results.

func (RoleAssignmentPage) NextPageURL

func (r RoleAssignmentPage) NextPageURL() (string, error)

NextPageURL uses the response's embedded link reference to navigate to the next page of results.

type Scope

type Scope struct {
	Domain  Domain  `json:"domain,omitempty"`
	Project Project `json:"project,omitempty"`
}

Scope represents a scope in a Role assignment.

type User

type User struct {
	ID string `json:"id,omitempty"`
}

User represents a user in a role assignment scope.

Directories

Path Synopsis
roles unit tests
roles unit tests

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL