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.3.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.3-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: backstage_simple_client-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 8733e2cdf40d9c4f52b80481fc090b4909d8dc4a06fc2520f0abb73c9ca06263
MD5 733f6ad8b84f16342de64c8ecc068dc6
BLAKE2b-256 6c1e5e86e43e767bd6f672bddcf220b1511d143a6316afc9d274f2f3e3bd8501

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for backstage_simple_client-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c79305bd33073d290300506ee29e3a931db27545533d1a3be6603ca378d627f3
MD5 480317809d3fa006f4ff46c81450e098
BLAKE2b-256 2ec075e7403c75167e2498c7949037849a2712e0d38426d2e1a2770031f90307

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