field

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: Apache-2.0 Imports: 5 Imported by: 50

Documentation

Index

Constants

This section is empty.

Variables

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 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 Relationship

type Relationship int
const (
	RequiredTogether Relationship = iota + 1
	MutuallyExclusive
)

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 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.

type SchemaFieldRelationship

type SchemaFieldRelationship struct {
	Kind   Relationship
	Fields []SchemaField
}

func EnsureDefaultRelationships

func EnsureDefaultRelationships(original []SchemaFieldRelationship) []SchemaFieldRelationship

func FieldsMutuallyExclusive

func FieldsMutuallyExclusive(fields ...SchemaField) SchemaFieldRelationship

func FieldsRequiredTogether

func FieldsRequiredTogether(fields ...SchemaField) SchemaFieldRelationship

Jump to

Keyboard shortcuts

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