Documentation ¶
Index ¶
- Constants
- func ApplyPatch(patch Patch, subj *Resource, sch *Schema, ctx context.Context) (err error)
- func CompositeSearchFunc(repositories ...Repository) func(payload SearchRequest) (*ListResponse, error)
- func CorrectCase(subj *Resource, sch *Schema, ctx context.Context) (err error)
- func MarshalJSON(v interface{}, sch *Schema, attributes []string, excludedAttributes []string) ([]byte, error)
- func NewQueue(cap int) *queue
- func NewQueueWithoutLimit() *queue
- func NewStack(cap int) *stack
- func NewStackWithoutLimit() *stack
- func ValidateMutability(subj *Resource, ref *Resource, sch *Schema, ctx context.Context) (err error)
- func ValidateRequired(subj *Resource, sch *Schema, ctx context.Context) (err error)
- func ValidateType(subj *Resource, sch *Schema, ctx context.Context) (err error)
- func ValidateUniqueness(subj *Resource, sch *Schema, repo Repository, ctx context.Context) (err error)
- type Assist
- type Attribute
- func (a *Attribute) Assigned(v reflect.Value) bool
- func (a *Attribute) Clone() *Attribute
- func (a *Attribute) EqualsToPath(p Path) bool
- func (a *Attribute) ExpectsBinary() bool
- func (a *Attribute) ExpectsBool() bool
- func (a *Attribute) ExpectsComplex() bool
- func (a *Attribute) ExpectsComplexArray() bool
- func (a *Attribute) ExpectsFloat() bool
- func (a *Attribute) ExpectsInteger() bool
- func (a *Attribute) ExpectsString() bool
- func (a *Attribute) ExpectsStringArray() bool
- func (a *Attribute) GetAttribute(p Path, recursive bool) *Attribute
- func (a *Attribute) MarshalJSON() ([]byte, error)
- func (a *Attribute) TypeExpectation() string
- type AttributeSource
- type BulkReq
- type BulkReqOp
- type BulkResp
- type BulkRespOp
- type Complex
- type DataProvider
- type DuplicateError
- type ErrorFactory
- type FilterNode
- type FilterNodeType
- type InvalidFilterError
- type InvalidParamError
- type InvalidPathError
- type InvalidTypeError
- type ListResponse
- type Logger
- type MissingRequiredPropertyError
- type Modification
- type MultiValued
- func (c MultiValued) Add(value ...interface{}) MultiValued
- func (c MultiValued) Filter(root FilterNode, guide AttributeSource) chan interface{}
- func (c MultiValued) Get(index int) interface{}
- func (c MultiValued) Len() int
- func (c MultiValued) Remove(index int) MultiValued
- func (c MultiValued) Set(index int, value interface{})
- type MutabilityViolationError
- type NoAttributeError
- type Number
- type Patch
- type Path
- type PropertySource
- type Queue
- type ReadOnlyAssignment
- type Repository
- type RequestId
- type RequestTimestamp
- type RequestType
- type Resource
- type ResourceId
- type ResourceNotFoundError
- type Schema
- type SearchRequest
- type Stack
- type WebRequest
- type WebResponse
Constants ¶
const ( PathOperand = FilterNodeType(iota + 1) ConstantOperand LogicalOperator RelationalOperator Parenthesis )
const ( And = "and" Or = "or" Not = "not" Eq = "eq" Ne = "ne" Sw = "sw" Ew = "ew" Co = "co" Pr = "pr" Gt = "gt" Ge = "ge" Lt = "lt" Le = "le" )
const ( Add = "add" Remove = "remove" Replace = "replace" )
const ( UserUrn = "urn:ietf:params:scim:schemas:core:2.0:User" GroupUrn = "urn:ietf:params:scim:schemas:core:2.0:Group" ResourceTypeUrn = "urn:ietf:params:scim:schemas:core:2.0:resourceType" SPConfigUrn = "urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig" SchemaUrn = "urn:ietf:params:scim:schemas:core:2.0:Schema" ErrorUrn = "urn:ietf:params:scim:api:messages:2.0:Error" ListResponseUrn = "urn:ietf:params:scim:api:messages:2.0:ListResponse" PatchOpUrn = "urn:ietf:params:scim:api:messages:2.0:PatchOp" SearchUrn = "urn:ietf:params:scim:api:messages:2.0:SearchRequest" BulkRequestUrn = "urn:ietf:params:scim:api:messages:2.0:BulkRequest" BulkResponseUrn = "urn:ietf:params:scim:api:messages:2.0:BulkResponse" UserEnterpriseUrn = "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User" TypeString = "string" TypeBoolean = "boolean" TypeBinary = "binary" TypeDecimal = "decimal" TypeInteger = "integer" TypeDateTime = "datetime" TypeReference = "reference" TypeComplex = "complex" ReadOnly = "readOnly" ReadWrite = "readWrite" Immutable = "immutable" WriteOnly = "writeOnly" Always = "always" Never = "never" Default = "default" Request = "request" None = "none" Server = "server" Global = "global" External = "external" Uri = "uri" UserResourceType = "User" GroupResourceType = "Group" SchemaResourceType = "Schema" ResourceTypeResourceType = "ResourceType" ServiceProviderConfigResourceType = "ServiceProviderConfig" )
const ( GetUserById CreateUser ReplaceUser PatchUser QueryUser DeleteUser GetGroupById CreateGroup ReplaceGroup PatchGroup QueryGroup DeleteGroup RootQuery BulkOp GetSchemaById GetAllSchema GetSPConfig GetAllResourceType )
Variables ¶
This section is empty.
Functions ¶
func ApplyPatch ¶
func CompositeSearchFunc ¶
func CompositeSearchFunc( repositories ...Repository, ) func(payload SearchRequest) (*ListResponse, error)
simple factory method to return a repository query method to easily put together a query only repository by composing several repositories, useful when implementing root query functions
func MarshalJSON ¶
func NewQueueWithoutLimit ¶
func NewQueueWithoutLimit() *queue
func NewStackWithoutLimit ¶
func NewStackWithoutLimit() *stack
func ValidateMutability ¶
func ValidateRequired ¶
func ValidateUniqueness ¶
Types ¶
type Assist ¶
type Assist struct { JSONName string `json:"_jsonName"` // JSON field name used to render this field Path string `json:"_path"` // period delimited field names, useful to retrieve nested fields FullPath string `json:"_full_path"` // Path prefixed with the URN of this resource ArrayIndexKey []string `json:"_arrayIndexKey"` // the field names of the multiValued complex fields that can be used as a search index }
type Attribute ¶
type Attribute struct { Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` SubAttributes []*Attribute `json:"subAttributes,omitempty"` MultiValued bool `json:"multiValued"` Description string `json:"description,omitempty"` Required bool `json:"required"` CanonicalValues []string `json:"canonicalValues,omitempty"` CaseExact bool `json:"caseExact,omitempty"` Mutability string `json:"mutability,omitempty"` Returned string `json:"returned,omitempty"` Uniqueness string `json:"uniqueness,omitempty"` ReferenceTypes []string `json:"referenceTypes,omitempty"` Assist *Assist `json:"_assist"` }
func (*Attribute) EqualsToPath ¶
func (*Attribute) ExpectsBinary ¶
func (*Attribute) ExpectsBool ¶
func (*Attribute) ExpectsComplex ¶
func (*Attribute) ExpectsComplexArray ¶
func (*Attribute) ExpectsFloat ¶
func (*Attribute) ExpectsInteger ¶
func (*Attribute) ExpectsString ¶
func (*Attribute) ExpectsStringArray ¶
func (*Attribute) GetAttribute ¶
func (*Attribute) MarshalJSON ¶
func (*Attribute) TypeExpectation ¶
type AttributeSource ¶
type BulkReq ¶
type BulkReq struct { Schemas []string `json:"schemas"` FailOnErrors int `json:"failOnErrors"` Operations []BulkReqOp `json:"Operations"` }
func (BulkReq) Validate ¶
func (br BulkReq) Validate(ps PropertySource) error
type BulkReqOp ¶
type BulkReqOp struct { Path string `json:"path"` Data json.RawMessage `json:"data"` // contains filtered or unexported fields }
type BulkResp ¶
type BulkResp struct { Schemas []string `json:"schemas"` Operations []*BulkRespOp `json:"Operations"` }
type BulkRespOp ¶
type BulkRespOp struct { Location string `json:"location"` Response json.RawMessage `json:"response,omitempty"` Status int `json:"status"` // contains filtered or unexported fields }
func (BulkRespOp) Populate ¶
func (bro BulkRespOp) Populate(origReq BulkReqOp, resp WebResponse)
type Complex ¶
type Complex map[string]interface{}
SCIM complex data structure, Not thread-safe
func (Complex) Evaluate ¶
func (c Complex) Evaluate(filter FilterNode, guide AttributeSource) bool
Evaluate given predicate
func (Complex) Get ¶
func (c Complex) Get(p Path, guide AttributeSource) chan interface{}
type DataProvider ¶
type DuplicateError ¶
type DuplicateError struct { Path string Value interface{} }
Duplicate Error
func (DuplicateError) Error ¶
func (e DuplicateError) Error() string
type ErrorFactory ¶
type ErrorFactory interface { InvalidPath(path, detail string) error InvalidFilter(filter, detail string) error InvalidType(path, expect, got string) error NoAttribute(path string) error MissingRequiredProperty(path string) error MutabilityViolation(path string) error InvalidParam(name, expect, got string) error ResourceNotFound(id, version string) error Duplicate(path string, value interface{}) error Text(template string, args ...interface{}) error }
var (
Error ErrorFactory
)
type FilterNode ¶
type FilterNode interface { Data() interface{} Type() FilterNodeType Left() FilterNode Right() FilterNode CorrectCase(guide AttributeSource) }
interface to represent a node in the filter tree
type InvalidFilterError ¶
Invalid Filter
func (InvalidFilterError) Error ¶
func (e InvalidFilterError) Error() string
type InvalidParamError ¶
func (*InvalidParamError) Error ¶
func (e *InvalidParamError) Error() string
type InvalidPathError ¶
Invalid Path
func (InvalidPathError) Error ¶
func (e InvalidPathError) Error() string
type InvalidTypeError ¶
Invalid Type
func (*InvalidTypeError) Error ¶
func (e *InvalidTypeError) Error() string
type ListResponse ¶
type ListResponse struct { Schemas []string TotalResults int ItemsPerPage int StartIndex int Resources []DataProvider }
---------------------------------- List Response ----------------------------------
type Logger ¶
type Logger interface { Info(template string, args ...interface{}) Debug(template string, args ...interface{}) Error(template string, args ...interface{}) }
Common abstraction for logging providers
type MissingRequiredPropertyError ¶
type MissingRequiredPropertyError struct {
Path string
}
func (*MissingRequiredPropertyError) Error ¶
func (e *MissingRequiredPropertyError) Error() string
type Modification ¶
---------------------------------- Patch ----------------------------------
func (Modification) Validate ¶
func (m Modification) Validate() error
type MultiValued ¶
type MultiValued []interface{}
SCIM multivalued data structure, Not thread-safe
func (MultiValued) Add ¶
func (c MultiValued) Add(value ...interface{}) MultiValued
func (MultiValued) Filter ¶
func (c MultiValued) Filter(root FilterNode, guide AttributeSource) chan interface{}
func (MultiValued) Get ¶
func (c MultiValued) Get(index int) interface{}
func (MultiValued) Len ¶
func (c MultiValued) Len() int
func (MultiValued) Remove ¶
func (c MultiValued) Remove(index int) MultiValued
func (MultiValued) Set ¶
func (c MultiValued) Set(index int, value interface{})
type MutabilityViolationError ¶
type MutabilityViolationError struct {
Path string
}
func (*MutabilityViolationError) Error ¶
func (e *MutabilityViolationError) Error() string
type NoAttributeError ¶
type NoAttributeError struct {
Path string
}
No Attribute
func (*NoAttributeError) Error ¶
func (e *NoAttributeError) Error() string
type Path ¶
type Path interface { Next() Path // next Path, nil means this is the last one Value() string // text value, unprocessed Base() string // base Path value, i.e. 'groups' in 'groups[type Eq "direct"]' FilterRoot() FilterNode // root of the filter tree, i.e. 'Eq' in 'type Eq "direct"' SeparateAtLast() (Path, Path) // break up the path chain at the last node CollectValue() string // all path value downstream, separated by period. CorrectCase(AttributeSource, bool) // correct the case to defined values, and whether process downstream as well }
interface to represent a single segment in a Path i.e. 'emails' in 'emails.value' i.e. 'groups[type Eq "direct"]' in 'groups[type Eq "direct"].value'
type PropertySource ¶
type PropertySource interface { Get(key string) interface{} GetString(key string) string GetInt(key string) int GetBool(key string) bool }
Common abstraction for property providers
type ReadOnlyAssignment ¶
func NewGroupAssignment ¶
func NewGroupAssignment(groupRepository Repository) ReadOnlyAssignment
func NewIdAssignment ¶
func NewIdAssignment() ReadOnlyAssignment
func NewMetaAssignment ¶
func NewMetaAssignment(properties PropertySource, resourceType string) ReadOnlyAssignment
type Repository ¶
type Repository interface { Create(provider DataProvider) error Get(id, version string) (DataProvider, error) GetAll() ([]Complex, error) Count(query string) (int, error) Update(id, version string, provider DataProvider) error Delete(id, version string) error Search(payload SearchRequest) (*ListResponse, error) }
func NewMapRepository ¶
func NewMapRepository(initialData map[string]DataProvider) Repository
type RequestTimestamp ¶
type RequestTimestamp struct{}
type RequestType ¶
type RequestType struct{}
type ResourceId ¶
type ResourceId struct{}
type ResourceNotFoundError ¶
func (ResourceNotFoundError) Error ¶
func (e ResourceNotFoundError) Error() string
type Schema ¶
type Schema struct { Schemas []string `json:"schemas,omitempty"` Id string `json:"id,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Attributes []*Attribute `json:"attributes,omitempty"` }
func (*Schema) ToAttribute ¶
type SearchRequest ¶
type SearchRequest struct { Schemas []string `json:"schemas"` Attributes []string `json:"attributes"` ExcludedAttributes []string `json:"excludedAttributes"` Filter string `json:"filter"` SortBy string `json:"sortBy"` SortOrder string `json:"sortOrder"` StartIndex int `json:"startIndex"` Count int `json:"count"` }
---------------------------------- Search Request ----------------------------------
func (SearchRequest) Ascending ¶
func (sr SearchRequest) Ascending() bool
func (SearchRequest) Validate ¶
func (sr SearchRequest) Validate(guide AttributeSource) error