Skip to main content

f5xc-py-substrate

imge-substrate

Python SDK for F5 Distributed Cloud (XC) APIs that can be regenerated when the XC Open API Spec is updated.

This SDK aims to be a "safe" layer to build upon to prevent having to rework downstream dependencies post release/API changes.

Features

  • Full API coverage: 250+ resources generated from F5 XC OpenAPI specs
  • All operations: Both standard CRUD and CustomAPI operations are supported
  • Typed models: Pydantic v2 models with IDE autocomplete support
  • Lazy loading: Resources load on first access for fast startup

Installation

pip install f5xc-py-substrate

Or install from source:

git clone https://github.com/your-org/f5xc-py-substrate.git
cd f5xc-py-substrate
pip install -e .

Quick Start

from f5xc_py_substrate import Client

# Initialize with explicit credentials
client = Client(
    tenant_url="https://your-tenant.console.ves.volterra.io",
    token="your-api-token"
)

# Or use environment variables (F5XC_TENANT_URL, F5XC_API_TOKEN)
client = Client()

# List resources
lbs = client.http_loadbalancer.list(namespace="default")
for lb in lbs:
    print(lb.metadata.name)

API Design Pattern

F5 XC uses a metadata/spec pattern similar to Kubernetes:

Field Purpose
metadata Identity and organization: name, namespace, labels, annotations, description
spec Configuration: the actual resource settings
status Runtime state (read-only, returned by API)
# Creating a resource - you provide metadata + spec
client.http_loadbalancer.create(
    namespace="default",       # metadata.namespace
    name="my-lb",              # metadata.name
    labels={"env": "prod"},    # metadata.labels
    spec=...,                  # The configuration
)

# Reading a resource - you get metadata + spec + status
lb = client.http_loadbalancer.get(namespace="default", name="my-lb")
lb.metadata.name        # "my-lb"
lb.metadata.namespace   # "default"
lb.metadata.labels      # {"env": "prod"}
lb.spec                 # The configuration you provided
lb.status               # Runtime state from the system

If you've used kubectl, this will feel familiar. The SDK's create() and replace() methods accept metadata fields as top-level parameters for convenience.

Usage Examples

Get a Resource

lb = client.http_loadbalancer.get(namespace="default", name="my-lb")

# Access metadata and spec
print(lb.metadata.name)       # "my-lb"
print(lb.metadata.namespace)  # "default"
print(lb.metadata.labels)     # {"env": "prod"}
print(lb.spec)

Create a Resource

# Access spec models directly from the resource (no import needed)
client.http_loadbalancer.create(
    namespace="default",
    name="my-lb",
    spec=client.http_loadbalancer.CreateSpecType(
        domains=["example.com"],
    ),
    labels={"env": "prod"},
    description="Production load balancer",
)

# Or using raw body for full control
client.http_loadbalancer.create(
    namespace="default",
    name="my-lb",
    body={
        "metadata": {
            "name": "my-lb",
            "namespace": "default",
            "labels": {"env": "prod"},
        },
        "spec": {
            "domains": ["example.com"],
        },
    },
)

List with Filters

# Filter by labels
lbs = client.http_loadbalancer.list(
    namespace="default",
    label_filter="env in (staging, production)"
)

Replace a Resource

# Replace requires the complete spec, not just the changed fields
client.http_loadbalancer.replace(
    namespace="default",
    name="my-lb",
    spec=client.http_loadbalancer.ReplaceSpecType(
        domains=["example.com", "www.example.com"],
    ),
    description="Updated load balancer",
)

Delete a Resource

client.http_loadbalancer.delete(namespace="default", name="my-lb")

Serialization

All models include helper methods for serialization:

lb = client.http_loadbalancer.get(namespace="default", name="my-lb")

# To dictionary (excludes None values by default)
data = lb.to_dict()

# To JSON string (compact by default)
json_str = lb.to_json()
json_str = lb.to_json(indent=2)  # Pretty print

# To YAML (requires: pip install f5xc-py-substrate[yaml])
yaml_str = lb.to_yaml()

get() Response Filtering

By default, get() excludes verbose fields (forms, references, system_metadata) for cleaner output. Use include_all=True when you need the complete response:

# Default: clean response without verbose fields
lb = client.http_loadbalancer.get(namespace="default", name="my-lb")

# Full response with all fields
lb = client.http_loadbalancer.get(
    namespace="default",
    name="my-lb",
    include_all=True
)

See Advanced Usage for more details.

Available Resources

The SDK includes 250+ resources. Access any resource as an attribute on the client:

client.http_loadbalancer
client.origin_pool
client.healthcheck
client.namespace
client.virtual_host
# ... and many more

Documentation

Requirements

  • Python 3.9+
  • httpx
  • pydantic v2

License

This is free and unencumbered software released into the public domain. See LICENSE for details.

Metadata

Release files for f5xc-py-substrate 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for f5xc-py-substrate 0.1.0
File Size Uploaded
f5xc_py_substrate-0.1.0.tar.gz 837.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for f5xc-py-substrate 0.1.0
File Interpreter ABI Platform
f5xc_py_substrate-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 2.3 MB

Release files / f5xc_py_substrate-0.1.0.tar.gz

Download URL f5xc_py_substrate-0.1.0.tar.gz
Size 837.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c64a971e1eecfcf604a5dd26c4056ce6dc942955dc1c1abbbba22917e4751250
BLAKE2b-256 checksum
How to use checksums
16b1a35c823387fea9c0159fd4b1f84c7b6ab92110e9ae5743fd1ce88bf5cf3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 21, 2025.

Transparency log

Release files / f5xc_py_substrate-0.1.0-py3-none-any.whl

Download URL f5xc_py_substrate-0.1.0-py3-none-any.whl
Size 1.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
7810c0b0232f4ec0e06453336201634b7c1ccc7f621c3a3ef8cd2576e21e8829
BLAKE2b-256 checksum
How to use checksums
ff23a2157f60ee05db48d02791883155a43afb4db671c5400739881e0c860163
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 21, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page