output

package
v2.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

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"`
}

func (Attribute) Validate

func (a Attribute) Validate() error

type AttributeEnum

type AttributeEnum struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	TypeName    string `json:"type_name"`
}

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 CatalogTypeModel struct {
	Name            string
	Description     string
	TypeName        string
	Ranked          bool
	Attributes      []client.CatalogTypeAttributePayloadV2
	SourceAttribute *Attribute // tracks the origin attribute, if an enum model
	SourceRepoUrl   string
}

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.

func (Output) Validate

func (o Output) Validate() error

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

Jump to

Keyboard shortcuts

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