Skip to content

Models

EntityFilterQuery = Sequence[EntityFilterItem] module-attribute

A key-value based filter expression for entities.

Each key of a record is a dot-separated path into the entity structure, e.g. metadata.name. The values are literal values to match against. As a value you can also pass in the symbol CATALOG_FILTER_EXISTS (exported from this package), which means that you assert on the existence of that key, no matter what its value is. All matching of keys and values is case insensitive. If multiple filter sets are given as an array, then there is effectively an OR between each filter set. Within one filter set, there is effectively an AND between the various keys. Within one key, if there are more than one value, then there is effectively an OR between them. Example: For an input of

[
  { kind: ['API', 'Component'] },
  { 'metadata.name': 'a', 'metadata.namespace': 'b' }
]

This effectively means

(kind = EITHER 'API' OR 'Component')
OR
(metadata.name = 'a' AND metadata.namespace = 'b' )

CatalogRequestOptions

Bases: TypedDict

Options you can pass into a catalog request for additional information.

Source code in backstage_catalog_client/models.py
class CatalogRequestOptions(TypedDict, total=False):
    """Options you can pass into a catalog request for additional information."""

    token: str
    """an Authentication token for authenticated requests"""

token: str instance-attribute

an Authentication token for authenticated requests

EntityRef dataclass

all parts of a compound entity reference.

Source code in backstage_catalog_client/models.py
@dataclass
class EntityRef:
    """all parts of a compound entity reference."""

    kind: str
    name: str
    namespace: str = "default"

    def __str__(self) -> str:
        return f"{self.kind}:{self.namespace}/{self.name}"

FullTextFilter

Bases: TypedDict

Source code in backstage_catalog_client/models.py
class FullTextFilter(TypedDict, total=False):
    search_term: str
    """search term"""
    search_fields: list[str]

search_term: str instance-attribute

search term

GetEntitiesRequest

Bases: CatalogRequestOptions, TypedDict

Source code in backstage_catalog_client/models.py
class GetEntitiesRequest(CatalogRequestOptions, TypedDict, total=False):
    entity_filter: EntityFilterQuery
    """If given, only entities matching this filter will be returned."""
    fields: Sequence[str]
    """If given, return only the parts of each entity that match the field declarations."""
    order: EntityOrderQuery | Sequence[EntityOrderQuery]
    """If given, order the result set by those directives."""
    offset: int
    """If given, skips over the first N items in the result set."""
    limit: int
    """If given, returns at most N items from the result set."""
    after: str
    """If given, skips over all items before that cursor as returned by a previous request."""

after: str instance-attribute

If given, skips over all items before that cursor as returned by a previous request.

entity_filter: EntityFilterQuery instance-attribute

If given, only entities matching this filter will be returned.

fields: Sequence[str] instance-attribute

If given, return only the parts of each entity that match the field declarations.

limit: int instance-attribute

If given, returns at most N items from the result set.

offset: int instance-attribute

If given, skips over the first N items in the result set.

order: EntityOrderQuery | Sequence[EntityOrderQuery] instance-attribute

If given, order the result set by those directives.

GetEntitiesResponse dataclass

the repsonse type for getEntities

Source code in backstage_catalog_client/models.py
@dataclass
class GetEntitiesResponse:
    """the repsonse type for getEntities"""

    items: list[Entity]

PageInfo dataclass

Source code in backstage_catalog_client/models.py
@dataclass
class PageInfo:
    nextCursor: str | None = None
    """The cursor for the next batch of entities"""
    prevCursor: str | None = None
    """The cursor for the previous batch of entities"""

nextCursor: str | None = None class-attribute instance-attribute

The cursor for the next batch of entities

prevCursor: str | None = None class-attribute instance-attribute

The cursor for the previous batch of entities

QueryEntitiesKwargs

Bases: FullTextFilter, CatalogRequestOptions, TypedDict

Source code in backstage_catalog_client/models.py
class QueryEntitiesKwargs(FullTextFilter, CatalogRequestOptions, TypedDict, total=False):
    cursor: str
    """cursor for the next batch of entities"""
    entity_filter: EntityFilterQuery
    """If given, only entities matching this filter will be returned."""
    fields: list[str]
    """If given, return only the parts of each entity that match the field declarations."""
    limit: int
    """controls the number of items per page;  default is 20"""
    order_fields: list[EntityOrderQuery] | EntityOrderQuery
    """If given, order the result set by those directives."""

cursor: str instance-attribute

cursor for the next batch of entities

entity_filter: EntityFilterQuery instance-attribute

If given, only entities matching this filter will be returned.

fields: list[str] instance-attribute

If given, return only the parts of each entity that match the field declarations.

limit: int instance-attribute

controls the number of items per page; default is 20

order_fields: list[EntityOrderQuery] | EntityOrderQuery instance-attribute

If given, order the result set by those directives.

QueryEntitiesResponse dataclass

Source code in backstage_catalog_client/models.py
@dataclass
class QueryEntitiesResponse:
    items: list[Entity]
    """The list of entities for the current request"""
    total_items: int
    """"The number of entities among all the requests"""
    page_info: PageInfo

items: list[Entity] instance-attribute

The list of entities for the current request

total_items: int instance-attribute

"The number of entities among all the requests