Skip to main content

A simple client for Backstage developer portal

Project description

Backstage Simple Client

A simple client for the Backstage developer portal.

Table of Contents

Installation

To install the Backstage Simple Client, you can use pip:

pip install backstage-simple-client

Usage

Here's an example of how to use the Backstage Simple Client:

from backstage_simple_client.client import BackstageClient
from backstage_simple_client.filters import Filter, FullSearchFilter

# Initialize the client
base_url = "https://example.com"
token = "your-token-here"

with BackstageClient(base_url, token=token) as client:
    # Search entities with a filter
    entities = client.search_entities(
        filter=Filter(metadata_namespace='development')
    )

# Print the results
for entity in entities.items:
    print(entity.metadata.name)

Examples

Multiple filters

entities = client.search_entities(
    filters = [
        Filter(kind='component', metadata_namespace='development'),
        Filter(kind='user')
    ]
)

Full-text search

entities = client.search_entities(
    full_text_filter = FullSearchFilter(term = "foobar", fields = ["metadata.name"])
)

Selecting fields, while applying limits and ordering

entities = client.search_entities(
    filter = Filter(kind='component', metadata_namespace='development'),
    fields = ['kind', 'metadata.name'],
    limit = 10,
    order_field = 'kind,asc'
)

Using pagination

pages = client.search_entities(
        filter   = Filter(kind='user')
        paginate = True
)
for page in pages:
    for entity in page.items:
        print(entity.metadata.name)

Getting entity by uid

entity = client.get_entities(uid="0442f73b-c3e9-4a94-a790-0981809b7267")

Getting entity (with its ancestry) by name

entity = client.get_entities(kind="User", name="jdoe")
entities = client.get_entities(kind="User", name="jdoe", ancestry=True)

Geting entities by refs

entities = client.get_entities(refs=["user:default/jdoe", "user:default/gijoe"], fields=["metadata.name", "metadata.namespace", "metadata.uid"])

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

backstage_simple_client-0.1.2.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

backstage_simple_client-0.1.2-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file backstage_simple_client-0.1.2.tar.gz.

File metadata

  • Download URL: backstage_simple_client-0.1.2.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.11.11 Linux/6.8.0-1020-azure

File hashes

Hashes for backstage_simple_client-0.1.2.tar.gz
Algorithm Hash digest
SHA256 10e97985bf2dc91d49e0e923a40fd17359568bfaa0630b6ae0b36ed5971ed1f1
MD5 5e7381cd0ee5b988529885ab55946690
BLAKE2b-256 88c4264630283ce41a3cf9cae40b9741acaa732b1332cce56eba3050f171dec2

See more details on using hashes here.

File details

Details for the file backstage_simple_client-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for backstage_simple_client-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 be718a1d3e3209459e99ade07d633d1ce21ce33b4348794779253a833d98f19c
MD5 7f3ec446c2bd0df98827b952d995ca12
BLAKE2b-256 8c5591cdbfa303311aa84f91bc49b10fcb629972c4375e1bcfbd003867d10bb5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page