Documentation ¶
Index ¶
- func Collect(ctx context.Context, output *Output, entries []source.Entry, ...) ([]source.Entry, error)
- func MarshalType(output *Output) (base *CatalogTypeModel, enumTypes []*CatalogTypeModel)
- type Attribute
- type AttributeEnum
- type CatalogEntryModel
- type CatalogTypeModel
- type Output
- type SourceConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Collect ¶
func Collect(ctx context.Context, output *Output, entries []source.Entry, logger kitlog.Logger) ([]source.Entry, error)
Collect filters the list of entries against the source filter on the output, returning a list of all entries which pass the filter.
func MarshalType ¶
func MarshalType(output *Output) (base *CatalogTypeModel, enumTypes []*CatalogTypeModel)
MarshalType builds the base catalog type model for the output, and any associated enum types for its attributes.
Types ¶
type Attribute ¶
type Attribute struct { ID string `json:"id"` Name string `json:"name"` Type null.String `json:"type"` Array bool `json:"array"` Source null.String `json:"source"` Enum *AttributeEnum `json:"enum"` }
type AttributeEnum ¶
type CatalogEntryModel ¶
type CatalogEntryModel struct { ExternalID string Name string Aliases []string Rank int32 AttributeValues map[string]client.CatalogAttributeBindingPayloadV2 }
func MarshalEntries ¶
func MarshalEntries(ctx context.Context, output *Output, entries []source.Entry, logger kitlog.Logger) ([]*CatalogEntryModel, error)
MarshalEntries builds payloads to for the entries of the given output, assuming those entries have already been filtered.
The majority of the work comes from compiling and evaluating the JS expressions that marshal the catalog entries from source.
type CatalogTypeModel ¶
type Output ¶
type Output struct { Name string `json:"name"` Description string `json:"description"` TypeName string `json:"type_name"` Ranked bool `json:"ranked"` Source SourceConfig `json:"source"` Attributes []*Attribute `json:"attributes"` }
Output represents a catalog type that will be managed by this importer. It includes config for the resulting catalog type, along with catalog type attributes and how to build the values of said attributes from the sourced entries.
type SourceConfig ¶
type SourceConfig struct { Filter null.String `json:"filter"` Name string `json:"name"` ExternalID string `json:"external_id"` Rank null.String `json:"rank"` Aliases []string `json:"aliases"` }
SourceConfig controls how we filter the source for this output's entries, and sets the external ID – used to uniquely identify an entry in the catalog – and the aliases of that entry from the source.
func (SourceConfig) Validate ¶
func (s SourceConfig) Validate() error