Documentation ¶
Index ¶
- Variables
- type Attribute
- func (attr *Attribute) CaseExact() bool
- func (attr *Attribute) CountAnnotations() int
- func (attr *Attribute) CountCanonicalValues() int
- func (attr *Attribute) CountReferenceTypes() int
- func (attr *Attribute) CountSubAttributes() int
- func (attr *Attribute) DFS(callback func(a *Attribute))
- func (attr *Attribute) Description() string
- func (attr *Attribute) Equals(other *Attribute) bool
- func (attr *Attribute) FindSubAttribute(criteria func(subAttr *Attribute) bool) *Attribute
- func (attr *Attribute) ForEachAnnotation(callback func(annotation string))
- func (attr *Attribute) ForEachCanonicalValue(callback func(canonicalValue string))
- func (attr *Attribute) ForEachReferenceType(callback func(referenceType string))
- func (attr *Attribute) ForEachSubAttribute(callback func(subAttribute *Attribute))
- func (attr *Attribute) GoesBy(name string) bool
- func (attr *Attribute) HasAnnotation(annotation string) bool
- func (attr *Attribute) HasCanonicalValue(criteria func(value string) bool) bool
- func (attr *Attribute) HasIdentitySubAttributes() bool
- func (attr *Attribute) HasPrimarySubAttribute() bool
- func (attr *Attribute) HasReferenceType(criteria func(value string) bool) bool
- func (attr *Attribute) ID() string
- func (attr *Attribute) Index() int
- func (attr *Attribute) IsElementAttributeOf(other *Attribute) bool
- func (attr *Attribute) IsIdentity() bool
- func (attr *Attribute) IsPrimary() bool
- func (attr *Attribute) Len() int
- func (attr *Attribute) Less(i, j int) bool
- func (attr *Attribute) MarshalJSON() ([]byte, error)
- func (attr *Attribute) MultiValued() bool
- func (attr *Attribute) MustValidate()
- func (attr *Attribute) Mutability() Mutability
- func (attr *Attribute) Name() string
- func (attr *Attribute) NewElementAttribute(annotations ...string) *Attribute
- func (attr *Attribute) Optional() bool
- func (attr *Attribute) Path() string
- func (attr *Attribute) Required() bool
- func (attr *Attribute) Returned() Returned
- func (attr *Attribute) SingleValued() bool
- func (attr *Attribute) Sort()
- func (attr *Attribute) String() string
- func (attr *Attribute) SubAttributeForName(name string) *Attribute
- func (attr *Attribute) Swap(i, j int)
- func (attr *Attribute) Type() Type
- func (attr *Attribute) Uniqueness() Uniqueness
- func (attr *Attribute) UnmarshalJSON(raw []byte) error
- type Mutability
- type ResourceType
- func (t *ResourceType) CountExtensions() int
- func (t *ResourceType) Description() string
- func (t *ResourceType) Endpoint() string
- func (t *ResourceType) ForEachExtension(callback func(extension *Schema, required bool))
- func (t *ResourceType) ID() string
- func (t *ResourceType) MarshalJSON() ([]byte, error)
- func (t *ResourceType) Name() string
- func (t *ResourceType) Schema() *Schema
- func (t *ResourceType) SuperAttribute(includeCore bool) *Attribute
- func (t *ResourceType) UnmarshalJSON(raw []byte) error
- type Returned
- type Schema
- type ServiceProviderConfig
- type Type
- type Uniqueness
Constants ¶
This section is empty.
Variables ¶
var SchemaHub = &schemaHub{schemaById: make(map[string]*Schema)}
Central repository for schemas
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
type Attribute struct {
// contains filtered or unexported fields
}
Enhanced SCIM attribute model. Attribute is the basic unit that describes data requirement in SCIM. It includes the data requirement defined in RFC7643. It also includes additional metadata that makes actual SCIM processing easier.
func (*Attribute) CaseExact ¶
Return true if the attribute's value is case sensitive. Note that case sensitivity only applies to string type attributes. The API does not provide a version in reverse form (i.e. CaseInExact) because they are too similar, and may potentially confuse developers, leading to bugs. Too check for case insensitivity, just use !attribute.CaseExact()
func (*Attribute) CountAnnotations ¶
Return the number of total annotations on this attribute.
func (*Attribute) CountCanonicalValues ¶
Return the total number of defined canonical values.
func (*Attribute) CountReferenceTypes ¶
Return the total number of reference types
func (*Attribute) CountSubAttributes ¶
Return the total number of sub attributes.
func (*Attribute) Description ¶
Return human-readable text to describe the attribute.
func (*Attribute) Equals ¶
Returns true if the two attributes are equal. This method checks pointer equality first. If does not match, goes on to check whether id matches.
func (*Attribute) FindSubAttribute ¶
Find the sub attribute that matches the criteria, or nil
func (*Attribute) ForEachAnnotation ¶
Iterate through all annotations on this attribute and invoke callback function on each.
func (*Attribute) ForEachCanonicalValue ¶
Iterate through all canonical values and invoke the callback function on each value.
func (*Attribute) ForEachReferenceType ¶
Iterate through all reference types and invoke the callback function on each value.
func (*Attribute) ForEachSubAttribute ¶
Iterate through all sub attributes and invoke the callback function on each value. This method is designed to preserve the SOLID principal. The callback SHALL NOT block the executing Goroutine.
func (*Attribute) GoesBy ¶
Return true if this attribute can be addressed by the given name. The method performs a case insensitive comparision of the provided name against the attribute's id, path, and name. If any matches, the attribute is considered addressable by that name.
func (*Attribute) HasAnnotation ¶
Returns true if this attribute is annotated with the given value
func (*Attribute) HasCanonicalValue ¶
Returns true if the a certain canonical value that meets the given criteria is defined among the canonical values of this attribute.
func (*Attribute) HasIdentitySubAttributes ¶
Return true if one or more of this attribute's sub attributes is marked as identity
func (*Attribute) HasPrimarySubAttribute ¶
Return true if one of this attribute's sub attribute is marked as primary.
func (*Attribute) HasReferenceType ¶
Returns true if the a certain reference type that meets the given criteria is defined among the reference types of this attribute.
func (*Attribute) ID ¶
Return ID of the attribute that uniquely identifies an attribute globally. ID shall be in the format of <schema_urn>:<full_path>. Core attributes has no need to prefix the schema URN. For instance, "schemas", "meta.version", "urn:ietf:params:scim:schemas:core:2.0:Group:displayName"
func (*Attribute) Index ¶
Return relative index of this attribute within its parent attribute, or on the top level. This index is used to sort the attribute, or the property carrying this attribute in ascending order within the scope of its container. The intention is to provide a stable iteration order, despite Golang's map does not range in a predictable order. The actual value of the index does not matter as long as they can be sorted in ascending order correctly.
func (*Attribute) IsElementAttributeOf ¶
Returns true if this attribute is the derived element attribute of the other attribute.
func (*Attribute) IsIdentity ¶
Return true if this attribute is considered an identity attribute. An identity attribute is annotated with annotations.Identity (@Identity). When one or more sub attributes for a complex attribute is annotated with @Identity, they will collectively be used to determine the identity of the complex attribute. Other attributes that were not annotated with @Identity no longer participates in operations like equality which involves identity.
func (*Attribute) IsPrimary ¶
Return true if this attribute is considered a primary attribute. A primary attribute is annotated with annotations.Primary (@Primary). It is only effective when it is annotated on a singular boolean attribute as a sub attribute of a multiValued complex attribute. The purpose is that among all the element boolean properties carrying this attribute, at most one can assume a true value.
func (*Attribute) MarshalJSON ¶
func (*Attribute) MultiValued ¶
Return true if the attribute is multiValued.
func (*Attribute) MustValidate ¶
func (attr *Attribute) MustValidate()
Validate the attribute. This method panics if encounters any error.
func (*Attribute) Mutability ¶
func (attr *Attribute) Mutability() Mutability
Return the mutability of the attribute.
func (*Attribute) NewElementAttribute ¶
Create the element attribute from this attribute. The element attribute is a derived attribute design for elements of a multiValued attribute. The ID of the attribute is suffixed with elemSuffix ("$elem"), and the multiValued attribute is set to false. All other attributes are carried over.
func (*Attribute) Optional ¶
Return true if the attribute is optional, which is the opposite of required.
func (*Attribute) Path ¶
Return the full path of this attribute. The full path will be the name of the attribute if this attribute is on the top level. If the attribute is a sub attribute, it will be attribute names delimited by period (".").
func (*Attribute) SingleValued ¶
Return true if the attribute is singular.
func (*Attribute) Sort ¶
func (attr *Attribute) Sort()
Sort the sub attributes recursively based on the index.
func (*Attribute) String ¶
Return a string representation of the attribute. This method is intended to assist debugger printing, and does not intend to display all data.
func (*Attribute) SubAttributeForName ¶
Return the sub attribute that goes by the name, or nil
func (*Attribute) Type ¶
Return the data type of the attribute. The data type cannot be used to definitively determine the nature of the attribute unless combined with the method MultiValued.
func (*Attribute) Uniqueness ¶
func (attr *Attribute) Uniqueness() Uniqueness
Return the uniqueness of the attribute.
func (*Attribute) UnmarshalJSON ¶
type Mutability ¶
type Mutability int
SCIM mutability definition
const ( // SCIM mutability attribute defined in RFC7643 MutabilityReadWrite Mutability = iota MutabilityReadOnly MutabilityWriteOnly MutabilityImmutable )
func MustParseMutability ¶
func MustParseMutability(value string) Mutability
Parse the given value to mutability type. Empty value is defaulted to readWrite. This function panics if the given value is invalid.
func (Mutability) MarshalJSON ¶
func (m Mutability) MarshalJSON() ([]byte, error)
func (Mutability) String ¶
func (m Mutability) String() string
Return the standard string representation of this mutability
type ResourceType ¶
type ResourceType struct {
// contains filtered or unexported fields
}
A SCIM resource type is a collection of schemas to describe a resource.
func (*ResourceType) CountExtensions ¶
func (t *ResourceType) CountExtensions() int
Return the number of schema extensions in this resource type
func (*ResourceType) Description ¶
func (t *ResourceType) Description() string
Return the description of the resource type
func (*ResourceType) Endpoint ¶
func (t *ResourceType) Endpoint() string
func (*ResourceType) ForEachExtension ¶
func (t *ResourceType) ForEachExtension(callback func(extension *Schema, required bool))
Iterate through all schema extensions and invoke the callback. The required parameter is the callback function indicates whether this schema extension is required. This method maintains SOLID principal. The callback SHALL NOT block.
func (*ResourceType) MarshalJSON ¶
func (t *ResourceType) MarshalJSON() ([]byte, error)
func (*ResourceType) Name ¶
func (t *ResourceType) Name() string
Return the name of the resource type
func (*ResourceType) Schema ¶
func (t *ResourceType) Schema() *Schema
Return the main schema of the resource type
func (*ResourceType) SuperAttribute ¶
func (t *ResourceType) SuperAttribute(includeCore bool) *Attribute
Return a complex attribute that contains all schema attributes as its sub attributes.
func (*ResourceType) UnmarshalJSON ¶
func (t *ResourceType) UnmarshalJSON(raw []byte) error
type Returned ¶
type Returned int
SCIM returned definition
func MustParseReturned ¶
Parse the given value to returned type. Empty value is defaulted to 'default'. This function panics if the given value is invalid.
func (Returned) MarshalJSON ¶
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
A SCIM schema is a collection of attributes, used to describe a whole or a part of a resource.
func (*Schema) CountAttributes ¶
Return the number of top level attributes in this schema.
func (*Schema) Description ¶
Return the description of the schema
func (*Schema) ForEachAttribute ¶
Iterate the top level attributes in this schema and invoke callback function. This method maintains SOLID principal. Callback function SHALL NOT block.
func (*Schema) MarshalJSON ¶
func (*Schema) UnmarshalJSON ¶
type ServiceProviderConfig ¶
type ServiceProviderConfig struct { Schemas []string `json:"schemas"` DocURI string `json:"documentationUri"` Patch struct { Supported bool `json:"supported"` } `json:"patch"` Bulk struct { Supported bool `json:"supported"` MaxOp int `json:"maxOperations"` MaxPayload int `json:"maxPayloadSize"` } `json:"bulk"` Filter struct { Supported bool `json:"supported"` MaxResults int `json:"maxResults"` } `json:"filter"` ChangePassword struct { Supported bool `json:"supported"` } `json:"changePassword"` Sort struct { Supported bool `json:"supported"` } `json:"sort"` ETag struct { Supported bool `json:"supported"` } `json:"etag"` AuthSchemes []struct { Type string `json:"type"` Name string `json:"name"` Description string `json:"description"` SpecURI string `json:"specUri"` DocURI string `json:"documentationUri"` } `json:"authenticationSchemes"` }
Structure for the service provider config
type Type ¶
type Type int
A SCIM data type
func MustParseType ¶
Parse the given value to type. Empty value is defaulted to 'string'. This function panics if the given value is invalid.
func (Type) MarshalJSON ¶
type Uniqueness ¶
type Uniqueness int
SCIM uniqueness definition
const ( // SCIM uniqueness attribute defined in RFC7643 UniquenessNone Uniqueness = iota UniquenessServer UniquenessGlobal )
func MustParseUniqueness ¶
func MustParseUniqueness(value string) Uniqueness
Parse the given value to uniqueness type. Empty value is defaulted to 'none'. This function panics if the given value is invalid.
func (Uniqueness) MarshalJSON ¶
func (u Uniqueness) MarshalJSON() ([]byte, error)
func (Uniqueness) String ¶
func (u Uniqueness) String() string
Return a standard definition of this uniqueness.