Skip to content

Service Configs

Service configs record the configuration state of a service at a specific version. When a service owner provisions or modifies a service item, they create a service config snapshot to capture exactly what was applied.

Accessed via client.service_configs.

Model properties

Property Type Description
id int Config snapshot ID
service_id int Associated service ID
version int Version number (read-only, auto-incremented)
config dict The configuration data at this version
created datetime When this snapshot was taken
modified datetime Last modified timestamp

Methods

list(**filters)

Returns a lazy generator of all service config snapshots.

Filters:

Filter Type Description
service_id int Filter snapshots for a specific service
ordering str Sort field — prefix with - for descending (e.g. -created)
# All config snapshots
for config in client.service_configs.list():
    print(config.id, config.version, config.created)

# All snapshots for a specific service, newest first
for config in client.service_configs.list(service_id=45, ordering="-created"):
    print(config.version, config.config)

filter(**filters)

Same as list() but returns all results as a list. Accepts the same filters.

configs = client.service_configs.filter(service_id=45)
print(f"Found {len(configs)} config snapshots")

# Most recent snapshot for a service
configs = client.service_configs.filter(service_id=45, ordering="-created")
latest = configs[0] if configs else None

get(id)

Retrieves a single service config by ID. Raises NetorcaNotFoundError if not found.

config = client.service_configs.get(55)

print(config.id)
print(config.service_id)
print(config.version)
print(config.created)
print(config.config)   # the full configuration snapshot as a dict

create(data)

Creates a new configuration snapshot. The service field links the config to a service, and config holds the configuration dict to record.

Field Type Required Description
service int yes The service this config belongs to
config dict yes The configuration state to snapshot
config = client.service_configs.create({
    "service": 45,
    "config": {
        "engine":  "postgres",
        "size":    "medium",
        "version": "15",
        "host":    "db-prod-01.internal"
    }
})
print(config.id, config.version)