Skip to main content
Version: Next

CatalogBuilder

Home > @backstage/plugin-catalog-backend > CatalogBuilder

Warning: This API is now obsolete.

Please migrate to the new backend system as this will be removed in the future.

A builder that helps wire up all of the component parts of the catalog.

The touch points where you can replace or extend behavior are as follows:

  • Entity policies can be added or replaced. These are automatically run after the processors' pre-processing steps. All policies are given the chance to inspect the entity, and all of them have to pass in order for the entity to be considered valid from an overall point of view. - Location analyzers can be added. These are responsible for analyzing repositories when onboarding them into the catalog, by finding catalog-info.yaml files and other artifacts that can help automatically register or create catalog data on the user's behalf. - Placeholder resolvers can be replaced or added. These run on the raw structured data between the parsing and pre-processing steps, to replace dollar-prefixed entries with their actual values (like $file). - Field format validators can be replaced. These check the format of individual core fields such as metadata.name, to ensure that they adhere to certain rules. - Processors can be added or replaced. These implement the functionality of reading, parsing, validating, and processing the entity data before it is persisted in the catalog.

Signature:

class CatalogBuilder 

Methods

Method

Modifiers

Description

addEntityPolicy(policies)

Adds policies that are used to validate entities between the pre- processing and post-processing stages. All such policies must pass for the entity to be considered valid.

If what you want to do is to replace the rules for what format is allowed in various core entity fields (such as metadata.name), you may want to use instead.

addEntityProvider(providers)

Adds or replaces entity providers. These are responsible for bootstrapping the list of entities out of original data sources. For example, there is one entity source for the config locations, and one for the database stored locations. If you ingest entities out of a third party system, you may want to implement that in terms of an entity provider as well.

addLocationAnalyzers(analyzers)

Adds Location Analyzers. These are responsible for analyzing repositories when onboarding them into the catalog, by finding catalog-info.yaml files and other artifacts that can help automatically register or create catalog data on the user's behalf.

addPermissionRules(permissionRules)

Adds additional permission rules. Permission rules are used to evaluate catalog resources against queries. See PermissionRule.

addPermissions(permissions)

Adds additional permissions. See .

addProcessor(processors)

Adds entity processors. These are responsible for reading, parsing, and processing entities before they are persisted in the catalog.

build()

Wires up and returns all of the component parts of the catalog

create(env)

static

Creates a catalog builder.

getDefaultProcessors()

Returns the default list of entity processors. These are responsible for reading, parsing, and processing entities before they are persisted in the catalog. Changing the order of processing can give more control to custom processors.

Consider using with

replaceEntityPolicies(policies)

Sets what policies to use for validation of entities between the pre- processing and post-processing stages. All such policies must pass for the entity to be considered valid.

If what you want to do is to replace the rules for what format is allowed in various core entity fields (such as metadata.name), you may want to use instead.

This function replaces the default set of policies; use with care.

replaceProcessors(processors)

Sets what entity processors to use. These are responsible for reading, parsing, and processing entities before they are persisted in the catalog.

This function replaces the default set of processors, consider using with ; use with care.

setAllowedLocationTypes(allowedLocationTypes)

Sets up the allowed location types from being registered via the location service.

setEntityDataParser(parser)

Sets up the catalog to use a custom parser for entity data.

This is the function that gets called immediately after some raw entity specification data has been read from a remote source, and needs to be parsed and emitted as structured data.

setEventBroker(broker)

Enables the publishing of events for conflicts in the DefaultProcessingDatabase

setFieldFormatValidators(validators)

Sets the validator function to use for one or more special fields of an entity. This is useful if the default rules for formatting of fields are not sufficient.

This function has no effect if used together with .

setLocationAnalyzer(locationAnalyzer)

Overwrites the default location analyzer.

setPlaceholderResolver(key, resolver)

Adds, or overwrites, a handler for placeholders (e.g. $file) in entity definition files.

setProcessingInterval(processingInterval)

Overwrites the default processing interval function used to spread entity updates in the catalog.

setProcessingIntervalSeconds(seconds)

Processing interval determines how often entities should be processed. Seconds provided will be multiplied by 1.5 The default processing interval is 100-150 seconds. setting this too low will potentially deplete request quotas to upstream services.

subscribe(options)

useLegacySingleProcessorValidation()

Enables the legacy behaviour of canceling validation early whenever only a single processor declares an entity kind to be valid.