Documentation ¶
Index ¶
- Variables
- func IsFieldAmongDefaultList(f SchemaField) bool
- func Validate(c Configuration, v *viper.Viper) error
- func WithDefaultValue(value any) fieldOption
- func WithDescription(description string) fieldOption
- func WithHidden(hidden bool) fieldOption
- func WithRequired(required bool) fieldOption
- func WithShortHand(sh string) fieldOption
- type Configuration
- type ErrConfigurationMissingFields
- type Relationship
- type SchemaField
- func BoolField(name string, optional ...fieldOption) SchemaField
- func EnsureDefaultFieldsExists(originalFields []SchemaField) []SchemaField
- func IntField(name string, optional ...fieldOption) SchemaField
- func StringArrayField(name string, optional ...fieldOption) SchemaField
- func StringField(name string, optional ...fieldOption) SchemaField
- func (s SchemaField) Bool() (bool, error)
- func (s SchemaField) GetDescription() string
- func (s SchemaField) GetName() string
- func (s SchemaField) GetType() reflect.Kind
- func (s SchemaField) Int() (int, error)
- func (s SchemaField) String() (string, error)
- func (s SchemaField) StringArray() ([]string, error)
- type SchemaFieldRelationship
- func EnsureDefaultRelationships(original []SchemaFieldRelationship) []SchemaFieldRelationship
- func FieldsAtLeastOneUsed(fields ...SchemaField) SchemaFieldRelationship
- func FieldsDependentOn(dependent []SchemaField, expected []SchemaField) SchemaFieldRelationship
- func FieldsMutuallyExclusive(fields ...SchemaField) SchemaFieldRelationship
- func FieldsRequiredTogether(fields ...SchemaField) SchemaFieldRelationship
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ListTicketSchemasField = BoolField("list-ticket-schemas", WithHidden(true), WithDescription("List ticket schemas")) TicketingField = BoolField("ticketing", WithDescription("This must be set to enable ticketing support")) )
View Source
var DefaultFields = []SchemaField{ createTicketField, getTicketField, ListTicketSchemasField, provisioningField, TicketingField, c1zTmpDirField, clientIDField, clientSecretField, createAccountEmailField, createAccountLoginField, deleteResourceField, deleteResourceTypeField, eventFeedField, fileField, grantEntitlementField, grantPrincipalField, grantPrincipalTypeField, logFormatField, revokeGrantField, rotateCredentialsField, rotateCredentialsTypeField, ticketIDField, ticketTemplatePathField, logLevelField, }
DefaultFields list the default fields expected in every single connector.
View Source
var (
WrongValueTypeErr = errors.New("unable to cast any to concrete type")
)
Functions ¶
func IsFieldAmongDefaultList ¶
func IsFieldAmongDefaultList(f SchemaField) bool
func Validate ¶ added in v0.2.3
func Validate(c Configuration, v *viper.Viper) error
Validate perform validation of field requirement and constraints relationships after the configuration is read. We don't check the following:
- if required fields are mutually exclusive
- repeated fields (by name) are defined
- if sets of fields are mutually exclusive and required together at the same time
- if fields depedent on themselves
func WithDefaultValue ¶
func WithDefaultValue(value any) fieldOption
func WithDescription ¶
func WithDescription(description string) fieldOption
func WithHidden ¶
func WithHidden(hidden bool) fieldOption
func WithRequired ¶
func WithRequired(required bool) fieldOption
func WithShortHand ¶
func WithShortHand(sh string) fieldOption
Types ¶
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
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 Relationship ¶
type Relationship int
const ( RequiredTogether Relationship = iota + 1 MutuallyExclusive AtLeastOne Dependents )
type SchemaField ¶
type SchemaField struct { FieldName string FieldType reflect.Kind CLIShortHand string Required bool Hidden bool Description string DefaultValue any }
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 StringArrayField ¶ added in v0.2.3
func StringArrayField(name string, optional ...fieldOption) SchemaField
func StringField ¶
func StringField(name string, optional ...fieldOption) SchemaField
func (SchemaField) Bool ¶
func (s SchemaField) Bool() (bool, error)
Bool returns the default value as a boolean.
func (SchemaField) GetDescription ¶
func (s SchemaField) GetDescription() string
func (SchemaField) GetName ¶
func (s SchemaField) GetName() string
func (SchemaField) GetType ¶
func (s SchemaField) GetType() reflect.Kind
func (SchemaField) Int ¶
func (s SchemaField) Int() (int, error)
Int returns the default value as a integer.
func (SchemaField) String ¶
func (s SchemaField) String() (string, error)
String returns the default value as a string.
func (SchemaField) StringArray ¶ added in v0.2.3
func (s SchemaField) StringArray() ([]string, error)
StringArray retuns the default value as a string array.
type SchemaFieldRelationship ¶
type SchemaFieldRelationship struct { Kind Relationship Fields []SchemaField ExpectedFields []SchemaField }
func EnsureDefaultRelationships ¶
func EnsureDefaultRelationships(original []SchemaFieldRelationship) []SchemaFieldRelationship
func FieldsAtLeastOneUsed ¶ added in v0.2.4
func FieldsAtLeastOneUsed(fields ...SchemaField) SchemaFieldRelationship
func FieldsDependentOn ¶ added in v0.2.10
func FieldsDependentOn(dependent []SchemaField, expected []SchemaField) SchemaFieldRelationship
func FieldsMutuallyExclusive ¶
func FieldsMutuallyExclusive(fields ...SchemaField) SchemaFieldRelationship
func FieldsRequiredTogether ¶
func FieldsRequiredTogether(fields ...SchemaField) SchemaFieldRelationship
Click to show internal directories.
Click to hide internal directories.