Documentation
¶
Index ¶
- Variables
- func GetDefaultValue[T SchemaTypes](s SchemaField) (*T, error)
- func IsFieldAmongDefaultList(f SchemaField) bool
- func Validate(c Configuration, v Configurable) error
- func ValidateBoolRules(r *v1_conf.BoolRules, v bool, name string) error
- func ValidateField[T SchemaTypes](s *SchemaField, value T) (bool, error)
- func ValidateIntRules(r *v1_conf.Int64Rules, vInt int, name string) error
- func ValidateRepeatedStringRules(r *v1_conf.RepeatedStringRules, v []string, name string) error
- func ValidateStringRules(r *v1_conf.StringRules, v string, name string) error
- func WithBool(f boolRuleMaker) fieldOption
- func WithDefaultValue(value any) fieldOption
- func WithDescription(description string) fieldOption
- func WithDisplayName(displayName string) fieldOption
- func WithExportTarget(target ExportTarget) fieldOption
- func WithHidden(hidden bool) fieldOption
- func WithInt(f intRuleMaker) fieldOption
- func WithIsSecret(value bool) fieldOption
- func WithPersistent(value bool) fieldOption
- func WithPlaceholder(value string) fieldOption
- func WithRequired(required bool) fieldOption
- func WithRequiredInGUI(value bool) fieldOption
- func WithShortHand(sh string) fieldOption
- func WithString(f stringRuleMaker) fieldOption
- func WithStringSlice(f stringSliceRuleMaker) fieldOption
- func WithStructFieldName(name string) fieldOption
- type BoolRuler
- type Configurable
- type Configuration
- type ErrConfigurationMissingFields
- type ExportTarget
- type FieldRule
- type IntRuler
- func (b *IntRuler) Eq(value int64) *IntRuler
- func (b *IntRuler) Gt(value int64) *IntRuler
- func (b *IntRuler) Gte(value int64) *IntRuler
- func (b *IntRuler) In(values []int64) *IntRuler
- func (b *IntRuler) Lt(value int64) *IntRuler
- func (b *IntRuler) Lte(value int64) *IntRuler
- func (b *IntRuler) NotIn(values []int64) *IntRuler
- func (b *IntRuler) ValidateEmpty(value bool) *IntRuler
- type Relationship
- type SchemaField
- func BoolField(name string, optional ...fieldOption) SchemaField
- func EnsureDefaultFieldsExists(originalFields []SchemaField) []SchemaField
- func IntField(name string, optional ...fieldOption) SchemaField
- func LambdaServerFields() []SchemaField
- func SelectField(name string, options []string, optional ...fieldOption) SchemaField
- func StringField(name string, optional ...fieldOption) SchemaField
- func StringSliceField(name string, optional ...fieldOption) SchemaField
- type SchemaFieldRelationship
- func EnsureDefaultRelationships(original []SchemaFieldRelationship) []SchemaFieldRelationship
- func FieldsAtLeastOneUsed(fields ...SchemaField) SchemaFieldRelationship
- func FieldsDependentOn(fields []SchemaField, required []SchemaField) SchemaFieldRelationship
- func FieldsMutuallyExclusive(fields ...SchemaField) SchemaFieldRelationship
- func FieldsRequiredTogether(fields ...SchemaField) SchemaFieldRelationship
- type SchemaTypes
- type StringRuler
- func (b *StringRuler) Contains(value string) *StringRuler
- func (b *StringRuler) Eq(value string) *StringRuler
- func (b *StringRuler) In(values []string) *StringRuler
- func (b *StringRuler) IsAddress() *StringRuler
- func (b *StringRuler) IsEmail() *StringRuler
- func (b *StringRuler) IsHostname() *StringRuler
- func (b *StringRuler) IsIP() *StringRuler
- func (b *StringRuler) IsIpv4() *StringRuler
- func (b *StringRuler) IsIpv6() *StringRuler
- func (b *StringRuler) IsURI() *StringRuler
- func (b *StringRuler) IsUUID() *StringRuler
- func (b *StringRuler) Len(value uint64) *StringRuler
- func (b *StringRuler) MaxLen(value uint64) *StringRuler
- func (b *StringRuler) MinLen(value uint64) *StringRuler
- func (b *StringRuler) NotContains(value string) *StringRuler
- func (b *StringRuler) NotIn(values []string) *StringRuler
- func (b *StringRuler) Pattern(value string) *StringRuler
- func (b *StringRuler) Prefix(value string) *StringRuler
- func (b *StringRuler) Suffix(value string) *StringRuler
- type StringSliceRuler
- func (b *StringSliceRuler) ItemRules(f func(stringer *StringRuler)) *StringSliceRuler
- func (b *StringSliceRuler) MaxItems(value uint64) *StringSliceRuler
- func (b *StringSliceRuler) MinItems(value uint64) *StringSliceRuler
- func (b *StringSliceRuler) Unique(unique bool) *StringSliceRuler
- func (b *StringSliceRuler) ValidateEmpty(value bool) *StringSliceRuler
- type Variant
- type WebFieldType
- type WellKnownStrings
Constants ¶
This section is empty.
Variables ¶
var ( ListTicketSchemasField = BoolField("list-ticket-schemas", WithHidden(true), WithDescription("List ticket schemas"), WithPersistent(true), WithExportTarget(ExportTargetNone)) TicketingField = BoolField("ticketing", WithDescription("This must be set to enable ticketing support"), WithPersistent(true), WithExportTarget(ExportTargetNone)) LambdaServerClientIDField = StringField("lambda-client-id", WithRequired(true), WithDescription("The oauth client id to use with the configuration endpoint"), WithExportTarget(ExportTargetNone)) LambdaServerClientSecretField = StringField("lambda-client-secret", WithRequired(true), WithDescription("The oauth client secret to use with the configuration endpoint"), WithExportTarget(ExportTargetNone)) )
var DefaultFields = []SchemaField{ createTicketField, bulkCreateTicketField, bulkTicketTemplatePathField, getTicketField, ListTicketSchemasField, provisioningField, TicketingField, c1zTmpDirField, clientIDField, clientSecretField, createAccountEmailField, createAccountLoginField, createAccountProfileField, deleteResourceField, deleteResourceTypeField, eventFeedField, fileField, grantEntitlementField, grantPrincipalField, grantPrincipalTypeField, logFormatField, revokeGrantField, rotateCredentialsField, rotateCredentialsTypeField, ticketIDField, ticketTemplatePathField, logLevelField, skipFullSync, otelCollectorEndpoint, }
DefaultFields list the default fields expected in every single connector.
var DefaultRelationships = []SchemaFieldRelationship{ FieldsRequiredTogether(grantEntitlementField, grantPrincipalField), FieldsRequiredTogether(clientIDField, clientSecretField), FieldsRequiredTogether(createTicketField, ticketTemplatePathField), FieldsRequiredTogether(bulkCreateTicketField, bulkTicketTemplatePathField), FieldsRequiredTogether(getTicketField, ticketIDField), FieldsMutuallyExclusive( grantEntitlementField, revokeGrantField, createAccountLoginField, deleteResourceField, rotateCredentialsField, eventFeedField, createTicketField, getTicketField, ListTicketSchemasField, bulkCreateTicketField, ), FieldsMutuallyExclusive( grantEntitlementField, revokeGrantField, createAccountEmailField, deleteResourceTypeField, rotateCredentialsTypeField, eventFeedField, ListTicketSchemasField, ), }
var LambdaServerRelationships = make([]SchemaFieldRelationship, 0)
var RelationshipToConstraintKind = map[Relationship]v1_conf.ConstraintKind{ RequiredTogether: v1_conf.ConstraintKind_CONSTRAINT_KIND_REQUIRED_TOGETHER, MutuallyExclusive: v1_conf.ConstraintKind_CONSTRAINT_KIND_MUTUALLY_EXCLUSIVE, AtLeastOne: v1_conf.ConstraintKind_CONSTRAINT_KIND_AT_LEAST_ONE, Dependents: v1_conf.ConstraintKind_CONSTRAINT_KIND_DEPENDENT_ON, }
var WrongValueTypeErr = errors.New("unable to cast any to concrete type")
Functions ¶
func GetDefaultValue ¶ added in v0.2.68
func GetDefaultValue[T SchemaTypes](s SchemaField) (*T, error)
SchemaField can't be generic over SchemaTypes without breaking backwards compatibility :-/.
func IsFieldAmongDefaultList ¶
func IsFieldAmongDefaultList(f SchemaField) bool
func Validate ¶ added in v0.2.3
func Validate(c Configuration, v Configurable) error
Validate perform validation of field requirement and constraints relationships after the configuration is read. We don't check the following:
- if sets of fields are mutually exclusive and required together at the same time
func ValidateBoolRules ¶ added in v0.2.68
func ValidateField ¶ added in v0.2.68
func ValidateField[T SchemaTypes](s *SchemaField, value T) (bool, error)
Go doesn't allow generic methods on a non-generic struct.
func ValidateIntRules ¶ added in v0.2.68
func ValidateIntRules(r *v1_conf.Int64Rules, vInt int, name string) error
func ValidateRepeatedStringRules ¶ added in v0.2.68
func ValidateRepeatedStringRules(r *v1_conf.RepeatedStringRules, v []string, name string) error
func ValidateStringRules ¶ added in v0.2.68
func ValidateStringRules(r *v1_conf.StringRules, v string, name string) error
func WithDefaultValue ¶
func WithDefaultValue(value any) fieldOption
func WithDescription ¶
func WithDescription(description string) fieldOption
func WithDisplayName ¶ added in v0.2.68
func WithDisplayName(displayName string) fieldOption
func WithExportTarget ¶ added in v0.2.68
func WithExportTarget(target ExportTarget) fieldOption
func WithHidden ¶
func WithHidden(hidden bool) fieldOption
func WithIsSecret ¶ added in v0.2.68
func WithIsSecret(value bool) fieldOption
func WithPersistent ¶ added in v0.2.32
func WithPersistent(value bool) fieldOption
func WithPlaceholder ¶ added in v0.2.68
func WithPlaceholder(value string) fieldOption
func WithRequired ¶
func WithRequired(required bool) fieldOption
func WithRequiredInGUI ¶ added in v0.2.68
func WithRequiredInGUI(value bool) fieldOption
func WithShortHand ¶
func WithShortHand(sh string) fieldOption
func WithString ¶ added in v0.2.68
func WithString(f stringRuleMaker) fieldOption
func WithStringSlice ¶ added in v0.2.68
func WithStringSlice(f stringSliceRuleMaker) fieldOption
func WithStructFieldName ¶ added in v0.2.71
func WithStructFieldName(name string) fieldOption
Types ¶
type BoolRuler ¶ added in v0.2.68
type BoolRuler struct {
// contains filtered or unexported fields
}
func NewBoolBuilder ¶ added in v0.2.68
type Configurable ¶ added in v0.2.71
type Configuration ¶ added in v0.2.3
type Configuration struct { Fields []SchemaField Constraints []SchemaFieldRelationship }
func NewConfiguration ¶ added in v0.2.3
func NewConfiguration(fields []SchemaField, constraints ...SchemaFieldRelationship) Configuration
func (*Configuration) Marshal ¶ added in v0.2.68
func (c *Configuration) Marshal() ([]byte, error)
func (*Configuration) MarshalJSON ¶ added in v0.2.68
func (c *Configuration) MarshalJSON() ([]byte, error)
type ErrConfigurationMissingFields ¶ added in v0.2.3
type ErrConfigurationMissingFields struct {
// contains filtered or unexported fields
}
func (*ErrConfigurationMissingFields) Error ¶ added in v0.2.3
func (e *ErrConfigurationMissingFields) Error() string
func (*ErrConfigurationMissingFields) Push ¶ added in v0.2.3
func (e *ErrConfigurationMissingFields) Push(err error)
type ExportTarget ¶ added in v0.2.68
type ExportTarget string
ExportTarget specifies who sets the flag.
CLI: dev ops invoking the connector, as for service mode, eg flag that specifies a file path on disk GUI: C1 tenant admin on the Web. Inclusive of CLI. eg service user name Ops: C1 support dashbaord. Inclusive of CLI. eg log level None: Only currently usable for the default fields. Those flags are consumed by the Syncer, not the Connector. ExportTarget is used by both dynamic conf generation and the conf schema exporting logic
const ( ExportTargetNone ExportTarget = "none" ExportTargetGUI ExportTarget = "gui" ExportTargetOps ExportTarget = "ops" ExportTargetCLIOnly ExportTarget = "cli" )
type FieldRule ¶ added in v0.2.68
type FieldRule struct {
// contains filtered or unexported fields
}
type IntRuler ¶ added in v0.2.68
type IntRuler struct {
// contains filtered or unexported fields
}
func NewIntBuilder ¶ added in v0.2.68
func NewIntBuilder(rules *v1_conf.Int64Rules) *IntRuler
func (*IntRuler) ValidateEmpty ¶ added in v0.2.68
type Relationship ¶
type Relationship int
const ( Invalid Relationship = iota RequiredTogether MutuallyExclusive AtLeastOne Dependents )
type SchemaField ¶
type SchemaField struct { FieldName string Required bool DefaultValue any Description string ExportTarget ExportTarget HelpURL string Variant Variant Rules FieldRule Secret bool StructFieldName string // Default fields - syncer side SyncerConfig syncerConfig // Config acutally ingested on the connector side - auth, regions, etc ConnectorConfig connectorConfig }
func BoolField ¶
func BoolField(name string, optional ...fieldOption) SchemaField
func EnsureDefaultFieldsExists ¶
func EnsureDefaultFieldsExists(originalFields []SchemaField) []SchemaField
func IntField ¶
func IntField(name string, optional ...fieldOption) SchemaField
func LambdaServerFields ¶ added in v0.2.71
func LambdaServerFields() []SchemaField
func SelectField ¶ added in v0.2.68
func SelectField(name string, options []string, optional ...fieldOption) SchemaField
func StringField ¶
func StringField(name string, optional ...fieldOption) SchemaField
func StringSliceField ¶ added in v0.2.13
func StringSliceField(name string, optional ...fieldOption) SchemaField
func (SchemaField) GetCLIShortHand ¶ added in v0.2.68
func (s SchemaField) GetCLIShortHand() string
func (SchemaField) GetDescription ¶
func (s SchemaField) GetDescription() string
func (SchemaField) GetName ¶
func (s SchemaField) GetName() string
func (SchemaField) IsHidden ¶ added in v0.2.68
func (s SchemaField) IsHidden() bool
func (SchemaField) IsPersistent ¶ added in v0.2.68
func (s SchemaField) IsPersistent() bool
type SchemaFieldRelationship ¶
type SchemaFieldRelationship struct { Kind Relationship Fields []SchemaField ExpectedFields []SchemaField // Not really expected, just another field bag. }
func EnsureDefaultRelationships ¶
func EnsureDefaultRelationships(original []SchemaFieldRelationship) []SchemaFieldRelationship
func FieldsAtLeastOneUsed ¶ added in v0.2.4
func FieldsAtLeastOneUsed(fields ...SchemaField) SchemaFieldRelationship
FieldsAtLeastOneUsed - the provided fields are valid if and only if at least one field is present.
func FieldsDependentOn ¶ added in v0.2.10
func FieldsDependentOn(fields []SchemaField, required []SchemaField) SchemaFieldRelationship
FieldsDependentOn - the provided fields are valid if and only if every field in `required` are also present.
func FieldsMutuallyExclusive ¶
func FieldsMutuallyExclusive(fields ...SchemaField) SchemaFieldRelationship
FieldsMutuallyExclusive - the provided fields are valid if and only if at most one field is present.
func FieldsRequiredTogether ¶
func FieldsRequiredTogether(fields ...SchemaField) SchemaFieldRelationship
FieldsRequiredTogether - the provided fields are valid if and only if every provided field is present.
type SchemaTypes ¶ added in v0.2.68
type StringRuler ¶ added in v0.2.68
type StringRuler struct {
// contains filtered or unexported fields
}
func NewStringBuilder ¶ added in v0.2.68
func NewStringBuilder(rules *v1_conf.StringRules) *StringRuler
func (*StringRuler) Contains ¶ added in v0.2.68
func (b *StringRuler) Contains(value string) *StringRuler
func (*StringRuler) Eq ¶ added in v0.2.68
func (b *StringRuler) Eq(value string) *StringRuler
func (*StringRuler) In ¶ added in v0.2.68
func (b *StringRuler) In(values []string) *StringRuler
func (*StringRuler) IsAddress ¶ added in v0.2.68
func (b *StringRuler) IsAddress() *StringRuler
func (*StringRuler) IsEmail ¶ added in v0.2.68
func (b *StringRuler) IsEmail() *StringRuler
func (*StringRuler) IsHostname ¶ added in v0.2.68
func (b *StringRuler) IsHostname() *StringRuler
func (*StringRuler) IsIP ¶ added in v0.2.68
func (b *StringRuler) IsIP() *StringRuler
func (*StringRuler) IsIpv4 ¶ added in v0.2.68
func (b *StringRuler) IsIpv4() *StringRuler
func (*StringRuler) IsIpv6 ¶ added in v0.2.68
func (b *StringRuler) IsIpv6() *StringRuler
func (*StringRuler) IsURI ¶ added in v0.2.68
func (b *StringRuler) IsURI() *StringRuler
func (*StringRuler) IsUUID ¶ added in v0.2.68
func (b *StringRuler) IsUUID() *StringRuler
func (*StringRuler) Len ¶ added in v0.2.68
func (b *StringRuler) Len(value uint64) *StringRuler
func (*StringRuler) MaxLen ¶ added in v0.2.68
func (b *StringRuler) MaxLen(value uint64) *StringRuler
func (*StringRuler) MinLen ¶ added in v0.2.68
func (b *StringRuler) MinLen(value uint64) *StringRuler
func (*StringRuler) NotContains ¶ added in v0.2.68
func (b *StringRuler) NotContains(value string) *StringRuler
func (*StringRuler) NotIn ¶ added in v0.2.68
func (b *StringRuler) NotIn(values []string) *StringRuler
func (*StringRuler) Pattern ¶ added in v0.2.68
func (b *StringRuler) Pattern(value string) *StringRuler
func (*StringRuler) Prefix ¶ added in v0.2.68
func (b *StringRuler) Prefix(value string) *StringRuler
func (*StringRuler) Suffix ¶ added in v0.2.68
func (b *StringRuler) Suffix(value string) *StringRuler
type StringSliceRuler ¶ added in v0.2.68
type StringSliceRuler struct {
// contains filtered or unexported fields
}
func NewRepeatedStringBuilder ¶ added in v0.2.68
func NewRepeatedStringBuilder(rules *v1_conf.RepeatedStringRules) *StringSliceRuler
func (*StringSliceRuler) ItemRules ¶ added in v0.2.68
func (b *StringSliceRuler) ItemRules(f func(stringer *StringRuler)) *StringSliceRuler
func (*StringSliceRuler) MaxItems ¶ added in v0.2.68
func (b *StringSliceRuler) MaxItems(value uint64) *StringSliceRuler
func (*StringSliceRuler) MinItems ¶ added in v0.2.68
func (b *StringSliceRuler) MinItems(value uint64) *StringSliceRuler
func (*StringSliceRuler) Unique ¶ added in v0.2.68
func (b *StringSliceRuler) Unique(unique bool) *StringSliceRuler
func (*StringSliceRuler) ValidateEmpty ¶ added in v0.2.68
func (b *StringSliceRuler) ValidateEmpty(value bool) *StringSliceRuler
type WebFieldType ¶ added in v0.2.68
type WebFieldType string
const ( Text WebFieldType = "TEXT" Randomize WebFieldType = "RANDOMIZE" OAuth2 WebFieldType = "OAUTH2" ConnectorDerivedOptions WebFieldType = "CONNECTOR_DERIVED_OPTIONS" FileUpload WebFieldType = "FILE_UPLOAD" )
type WellKnownStrings ¶ added in v0.2.68
type WellKnownStrings string
const ( WellKnownEmailString WellKnownStrings = "EMAIL" WellKnownHostnameString WellKnownStrings = "HOSTNAME" WellKnownIPString WellKnownStrings = "IP" WellKnownIpv4String WellKnownStrings = "IPv4" WellKnownIpv6String WellKnownStrings = "IPv6" WellKnownURIString WellKnownStrings = "URI" WellKnownUUIDString WellKnownStrings = "UUID" )