schema

package
v0.0.0-...-3e6933e Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ATTR_DELIM = "."
View Source
const LDAP_Group_Entry = `` /* 465-byte string literal not displayed */
View Source
const LDAP_User_Entry = `` /* 1214-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type AttrType

type AttrType struct {
	Name            string      // name
	Type            string      // type
	Description     string      // description
	CaseExact       bool        // caseExact
	MultiValued     bool        // multiValued
	Mutability      string      // mutability
	Required        bool        // required
	Returned        string      // returned
	Uniqueness      string      // uniqueness
	SubAttributes   []*AttrType // subAttributes
	ReferenceTypes  []string    // referenceTypes
	CanonicalValues []string    // canonicalValues
	SubAttrMap      map[string]*AttrType
	SchemaId        string // schema's ID
	NormName        string // the lowercase name of the attribute
	// contains filtered or unexported fields
}

The definition of an attribute's type All the fields are named identical to those defined in the schema definition in rfc7643 so that schema JSON files can be parsed using Go's default unmarshaller

func (*AttrType) IsComplex

func (attr *AttrType) IsComplex() bool

TODO avoid the need for strings.ToLower() in all IsXXX methods by replacing with lowercase values or by storing the result in boolean fields

func (*AttrType) IsImmutable

func (attr *AttrType) IsImmutable() bool

func (*AttrType) IsReadOnly

func (attr *AttrType) IsReadOnly() bool

func (*AttrType) IsRef

func (attr *AttrType) IsRef() bool

func (*AttrType) IsSimple

func (attr *AttrType) IsSimple() bool

func (*AttrType) IsStringType

func (attr *AttrType) IsStringType() bool

func (*AttrType) IsUnique

func (attr *AttrType) IsUnique() bool

func (*AttrType) Parent

func (attr *AttrType) Parent() *AttrType

type LdapAttribute

type LdapAttribute struct {
	ScimAttrPath string    `json:"scimAttrPath"`
	Meta         bool      `json:"-"`
	AtType       *AttrType `json:"-"`
	LdapAttrName string    `json:"ldapAttrName"`
	Format       string    `json:"format"`
	FormatDelim  string    `json:"-"`
	SubAtNames   []string  `json:"-"`
}

type LdapEntryTemplate

type LdapEntryTemplate struct {
	Type            string                    `json:"type"`
	Endpoint        string                    `json:"-"`
	DnPrefix        string                    `json:"dnPrefix"`
	DnAtName        string                    `json:"-"`
	ObjectClasses   []string                  `json:"objectClasses"`
	Attributes      []*LdapAttribute          `json:"attributes"`
	AttrMap         map[string]*LdapAttribute `json:"-"`
	LdapToScimAtMap map[string]string         `json:"-"`
}

func NewLdapTemplate

func NewLdapTemplate(tmpl []byte, rsTypes map[string]*ResourceType) (entry *LdapEntryTemplate, err error)

type ResourceType

type ResourceType struct {
	Id               string
	Name             string
	Endpoint         string
	Description      string
	Schema           string
	SchemaExtensions []*SchemaExtension
	Meta             struct {
		Location     string
		ResourceType string
	}

	Text          string         // the JSON representation of this resource type
	UniqueAts     []string       // a collection of all unique attributes
	AtsNeverRtn   map[string]int // names of attributes that are never returned
	AtsAlwaysRtn  map[string]int // names of attributes that are always returned
	AtsRequestRtn map[string]int // names of attributes that are returned if requested
	AtsDefaultRtn map[string]int // names of attributes that are returned by default
	AtsReadOnly   map[string]int // names of attributes that are readonly
	// contains filtered or unexported fields
}

func LoadResourceType

func LoadResourceType(name string, sm map[string]*Schema) (*ResourceType, error)

func NewResourceType

func NewResourceType(data []byte, sm map[string]*Schema) (*ResourceType, error)

func (*ResourceType) GetAtType

func (rt *ResourceType) GetAtType(atPath string) *AttrType

func (*ResourceType) GetMainSchema

func (rt *ResourceType) GetMainSchema() *Schema

Returns the main schema of the given resourcetype

func (*ResourceType) GetSchema

func (rt *ResourceType) GetSchema(urnId string) *Schema

Returns the schema identified by the URN associated with the given resourcetype

type Schema

type Schema struct {
	Id          string // id
	Name        string // name
	Description string // description
	Attributes  []*AttrType
	AttrMap     map[string]*AttrType
	Text        string
	Meta        struct {
		Location     string // location
		ResourceType string // resourceType
	} // meta

	UniqueAts     []string
	RequiredAts   []string
	AtsNeverRtn   []string // names of attributes that are never returned
	AtsAlwaysRtn  []string // names of attributes that are always returned
	AtsRequestRtn []string // names of attributes that are returned if requested
	AtsDefaultRtn []string // names of attributes that are returned by default
	AtsReadOnly   []string // names of attributes that are readonly
}

Definition of the schema

func LoadSchema

func LoadSchema(name string) (*Schema, error)

Parses the given schema file and returns a schema instance after successfuly parsing

func NewSchema

func NewSchema(data []byte) (*Schema, error)

Parses the given schema data and returns a schema instance after successfuly parsing

func (*Schema) GetAtType

func (sc *Schema) GetAtType(name string) *AttrType

type SchemaExtension

type SchemaExtension struct {
	Schema   string
	Required bool
}

type ValidationErrors

type ValidationErrors struct {
	Count int
	Msgs  []string
}

func (*ValidationErrors) Error

func (ve *ValidationErrors) Error() string

Jump to

Keyboard shortcuts

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