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(
    filter = [
        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.4.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.4-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: backstage_simple_client-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 c3ed2276309b89447c994d177402da610c2487ebca6b78d1b0d2af3d571337af
MD5 0a8c924920c8332745007b8147cf1e85
BLAKE2b-256 2350f1ca3469b681db9b0c3ab3a863231b789e25c2edc7aa78911ef2b2fef727

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for backstage_simple_client-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 44c160b0cf418bde8249aa67537727a61741d1c33317d940e326bb868ca33d86
MD5 9740a47759f4a3b729c96c1c01c86410
BLAKE2b-256 d9ed4e04faa08ee3d372dd21b51ce054961ed693076852d094c683786f38ccca

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