Documentation
¶
Index ¶
- Variables
- func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
- type ComplexityRoot
- type Config
- type DirectiveRoot
- type InviteInput
- type Mutation
- type MutationResolver
- type PageInfo
- type PageInput
- type Query
- type QueryResolver
- type RemoveRoleInput
- type ResolverRoot
- type Resource
- type ResourceContext
- type Role
- type RoleAssignmentResult
- type RoleRemovalResult
- type SortByInput
- type SortDirection
- type User
- type UserConnection
- type UserRoleChange
- type UserRoles
- type UserSortField
Constants ¶
This section is empty.
Variables ¶
View Source
var AllSortDirection = []SortDirection{ SortDirectionAsc, SortDirectionDesc, }
View Source
var AllUserSortField = []UserSortField{ UserSortFieldUserID, UserSortFieldEmail, UserSortFieldFirstName, UserSortFieldLastName, }
Functions ¶
func NewExecutableSchema ¶
func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.
Types ¶
type ComplexityRoot ¶
type ComplexityRoot struct {
Mutation struct {
AssignRolesToUsers func(childComplexity int, context ResourceContext, changes []*UserRoleChange, invites []*InviteInput) int
RemoveRole func(childComplexity int, context ResourceContext, input RemoveRoleInput) int
}
PageInfo struct {
Count func(childComplexity int) int
HasNextPage func(childComplexity int) int
HasPreviousPage func(childComplexity int) int
TotalCount func(childComplexity int) int
}
Query struct {
KnownUsers func(childComplexity int, sortBy *SortByInput, page *PageInput) int
Me func(childComplexity int) int
Roles func(childComplexity int, context ResourceContext) int
User func(childComplexity int, userID string) int
Users func(childComplexity int, context ResourceContext, roleFilters []string, sortBy *SortByInput, page *PageInput) int
}
Role struct {
Description func(childComplexity int) int
DisplayName func(childComplexity int) int
ID func(childComplexity int) int
}
RoleAssignmentResult struct {
AssignedCount func(childComplexity int) int
Errors func(childComplexity int) int
Success func(childComplexity int) int
}
RoleRemovalResult struct {
Error func(childComplexity int) int
Success func(childComplexity int) int
WasAssigned func(childComplexity int) int
}
User struct {
Email func(childComplexity int) int
FirstName func(childComplexity int) int
LastName func(childComplexity int) int
UserID func(childComplexity int) int
}
UserConnection struct {
PageInfo func(childComplexity int) int
Users func(childComplexity int) int
}
UserRoles struct {
Roles func(childComplexity int) int
User func(childComplexity int) int
}
}
type Config ¶
type Config struct {
Schema *ast.Schema
Resolvers ResolverRoot
Directives DirectiveRoot
Complexity ComplexityRoot
}
type DirectiveRoot ¶
type InviteInput ¶ added in v0.11.1
Input for inviting a new user and assigning roles
type MutationResolver ¶
type MutationResolver interface {
AssignRolesToUsers(ctx context.Context, context ResourceContext, changes []*UserRoleChange, invites []*InviteInput) (*RoleAssignmentResult, error)
RemoveRole(ctx context.Context, context ResourceContext, input RemoveRoleInput) (*RoleRemovalResult, error)
}
type PageInfo ¶
type PageInfo struct {
Count int `json:"count"`
TotalCount int `json:"totalCount"`
HasNextPage bool `json:"hasNextPage"`
HasPreviousPage bool `json:"hasPreviousPage"`
}
Holds additional information about the retrieved data
type QueryResolver ¶
type QueryResolver interface {
Roles(ctx context.Context, context ResourceContext) ([]*Role, error)
Users(ctx context.Context, context ResourceContext, roleFilters []string, sortBy *SortByInput, page *PageInput) (*UserConnection, error)
KnownUsers(ctx context.Context, sortBy *SortByInput, page *PageInput) (*UserConnection, error)
User(ctx context.Context, userID string) (*User, error)
Me(ctx context.Context) (*User, error)
}
type RemoveRoleInput ¶ added in v0.8.1
Input for removing a role from a user
type ResolverRoot ¶
type ResolverRoot interface {
Mutation() MutationResolver
Query() QueryResolver
}
type ResourceContext ¶ added in v0.8.1
type ResourceContext struct {
Group string `json:"group"`
Kind string `json:"kind"`
Resource *Resource `json:"resource"`
AccountPath string `json:"accountPath"`
}
Common resource context used across queries and mutations
type Role ¶
type Role struct {
// Is the unique identifier of the role
ID string `json:"id"`
// Is a human readable name of the role
DisplayName string `json:"displayName"`
// Is a description of what the role provides
Description string `json:"description"`
}
Represents a role that can be granted to a user or group of users
type RoleAssignmentResult ¶ added in v0.8.1
type RoleAssignmentResult struct {
Success bool `json:"success"`
Errors []string `json:"errors,omitempty"`
AssignedCount int `json:"assignedCount"`
}
Result of role assignment operation
type RoleRemovalResult ¶ added in v0.8.1
type RoleRemovalResult struct {
Success bool `json:"success"`
Error *string `json:"error,omitempty"`
WasAssigned bool `json:"wasAssigned"`
}
Result of role removal operation
type SortByInput ¶
type SortByInput struct {
Field UserSortField `json:"field"`
Direction SortDirection `json:"direction"`
}
type SortDirection ¶
type SortDirection string
const ( SortDirectionAsc SortDirection = "asc" SortDirectionDesc SortDirection = "desc" )
func (SortDirection) IsValid ¶
func (e SortDirection) IsValid() bool
func (SortDirection) MarshalGQL ¶
func (e SortDirection) MarshalGQL(w io.Writer)
func (SortDirection) MarshalJSON ¶
func (e SortDirection) MarshalJSON() ([]byte, error)
func (SortDirection) String ¶
func (e SortDirection) String() string
func (*SortDirection) UnmarshalGQL ¶
func (e *SortDirection) UnmarshalGQL(v any) error
func (*SortDirection) UnmarshalJSON ¶
func (e *SortDirection) UnmarshalJSON(b []byte) error
type User ¶
type User struct {
UserID string `json:"userId"`
Email string `json:"email"`
FirstName *string `json:"firstName,omitempty"`
LastName *string `json:"lastName,omitempty"`
}
Represents a user
type UserConnection ¶
type UserConnection struct {
Users []*UserRoles `json:"users"`
// number of granted users in the list
PageInfo *PageInfo `json:"pageInfo"`
}
Is a list of the users and their roles
type UserRoleChange ¶ added in v0.8.1
Holds information about a specific user and a list of roles that should be assigned to the user
type UserSortField ¶ added in v0.8.1
type UserSortField string
const ( UserSortFieldUserID UserSortField = "userId" UserSortFieldEmail UserSortField = "email" UserSortFieldFirstName UserSortField = "firstName" UserSortFieldLastName UserSortField = "lastName" )
func (UserSortField) IsValid ¶ added in v0.8.1
func (e UserSortField) IsValid() bool
func (UserSortField) MarshalGQL ¶ added in v0.8.1
func (e UserSortField) MarshalGQL(w io.Writer)
func (UserSortField) MarshalJSON ¶ added in v0.8.1
func (e UserSortField) MarshalJSON() ([]byte, error)
func (UserSortField) String ¶ added in v0.8.1
func (e UserSortField) String() string
func (*UserSortField) UnmarshalGQL ¶ added in v0.8.1
func (e *UserSortField) UnmarshalGQL(v any) error
func (*UserSortField) UnmarshalJSON ¶ added in v0.8.1
func (e *UserSortField) UnmarshalJSON(b []byte) error
Click to show internal directories.
Click to hide internal directories.