Skip to content

Service Items

A service item is a running instance of a service — what a consumer has requested and what the service owner delivers. Service items are the central object in most automation workflows.

Accessed via client.service_items.

States

Runtime state

runtime_state Description
REQUESTED Requested by consumer, not yet in service
IN_SERVICE Active and being used
DECOMMISSIONED Decommissioned, no longer active

Change state

Reflects the aggregate state of all open change instances on the item:

change_state Description
CHANGES_PENDING At least one change instance is waiting for processing
CHANGES_APPROVED At least one is approved (none pending, errored, or rejected)
CHANGES_ERROR At least one change instance encountered an error
CHANGES_REJECTED At least one is rejected (none errored)
ALL_CHANGES_COMPLETED All change instances have finished

Model properties

Property Type Description
id int Service item ID
name str Service item name
runtime_state str Current runtime state
change_state str Aggregate change state
service_id int Associated service ID
service_name str Associated service name
application_id int Associated application ID
application_name str Associated application name
consumer_team_id int Consumer team ID
consumer_team_name str Consumer team name
service_owner_team_id int Service owner team ID
service_owner_team_name str Service owner team name
created datetime Creation timestamp
modified datetime Last modified timestamp

Methods

list(exclude_decommissioned=True, **filters)

Returns a lazy generator that iterates all service items one page at a time. By default, DECOMMISSIONED items are excluded — pass exclude_decommissioned=False to include them.

Filters:

Filter Type Description
name str Exact name match
runtime_state str Filter by runtime state (REQUESTED, IN_SERVICE, DECOMMISSIONED)
change_state str Filter by change state
service_id int Filter by service ID
service_name str Exact service name match
application_id int Filter by application ID
application_name str Exact application name match
application_name_contains str Partial application name match
consumer_team_id int Filter by consumer team
service_owner_id int Filter by service owner team
service_owner_team_id int Filter by service owner team ID
declaration str Exact match on the service item's declaration JSON
declaration_contains str Partial match on declaration
declaration_regex str Regex match on declaration
start_date str Filter by creation date (ISO format, inclusive lower bound)
end_date str Filter by creation date (ISO format, inclusive upper bound)
ordering str Sort field — prefix with - for descending (e.g. name, -modified)
# All active items (decommissioned excluded by default)
for item in client.service_items.list():
    print(item.name, item.runtime_state)

# Include decommissioned items
for item in client.service_items.list(exclude_decommissioned=False):
    print(item.name, item.runtime_state)

# Only items waiting to be provisioned
for item in client.service_items.list(runtime_state="REQUESTED"):
    print(item.name, item.service_name)

filter(**filters)

Same as list() but returns all results as a list. Accepts the same filters. Use when you need the count or random access.

# All IN_SERVICE items for a specific service, sorted by name
items = client.service_items.filter(
    service_id=45,
    runtime_state="IN_SERVICE",
    ordering="name"
)
print(f"{len(items)} active items")

# Items whose application name contains "prod"
items = client.service_items.filter(application_name_contains="prod")

# Items with pending changes for a consumer team
items = client.service_items.filter(
    consumer_team_id=5,
    change_state="CHANGES_PENDING"
)

get(id)

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

Service items have convenience methods to check their state without string comparisons: - is_requested() → True if runtime_state == "REQUESTED" - is_in_service() → True if runtime_state == "IN_SERVICE" - is_decommissioned() → True if runtime_state == "DECOMMISSIONED"

item = client.service_items.get(123)

print(item.id)
print(item.name)
print(item.runtime_state)
print(item.change_state)
print(item.service_name)
print(item.application_name)
print(item.consumer_team_name)
print(item.service_owner_team_name)
print(item.created)
print(item.modified)

# State checks
if item.is_requested():
    print("Waiting to be provisioned")
elif item.is_in_service():
    print("Currently active")
elif item.is_decommissioned():
    print("No longer active")

# Raw API data
raw = item.to_dict()

Deployed item instance methods

A ServiceItem returned from get(), list(), or filter() carries a reference to the client, so it can create, update, and fetch its own deployed items without going through client.deployed_items directly.

Method Description
get_deployed_item() Returns the most recently created deployed item for this service item, or None if it has none
create_deployed_item(data) Creates a deployed item scoped to this service item; data is the provisioning payload
update_deployed_item(data) Merges data into this service item's latest deployed item (same flat payload shape as create_deployed_item(), not a {"data": {...}} wrapper); raises NetorcaNotFoundError if it has no deployed item yet
item = client.service_items.get(123)

# Record what was provisioned
deployed = item.create_deployed_item({
    "host": "db-prod-01.internal",
    "port": 5432
})
print(deployed.id)

# Read it back later
latest = item.get_deployed_item()
print(latest.data_field)

# Append/update a field after a failover
item.update_deployed_item({"host": "db-prod-02.internal"})

by_service(service_id, **filters)

Shortcut to get all service items belonging to a specific service. Equivalent to filter(service_id=service_id, **filters). Returns a list.

Accepts all the same filters as filter().

# All items for a service
items = client.service_items.by_service(service_id=45)

# Only IN_SERVICE items for a service, sorted by name
items = client.service_items.by_service(service_id=45, runtime_state="IN_SERVICE", ordering="name")

by_application(application_id, **filters)

Shortcut to get all service items belonging to a specific application. Equivalent to filter(application_id=application_id, **filters). Returns a list.

items = client.service_items.by_application(application_id=10)

# Only active items in this application
items = client.service_items.by_application(application_id=10, runtime_state="IN_SERVICE")

in_service(**filters)

Returns all items with runtime_state="IN_SERVICE" as a list. Additional filters can be passed to narrow the results.

# All active items across all services
items = client.service_items.in_service()

# Active items for a specific service
items = client.service_items.in_service(service_id=45)

# Active items for a specific consumer team
items = client.service_items.in_service(consumer_team_id=5)

requested(**filters)

Returns all items with runtime_state="REQUESTED" as a list. These are items that have been ordered but not yet fulfilled.

# Everything waiting to be provisioned
items = client.service_items.requested()

# Waiting items for a specific service
items = client.service_items.requested(service_id=45)

get_dependant(**filters)

Returns service items that have a declared dependency on other service items. Useful for understanding provisioning order when services depend on each other. Returns a list of raw dicts.

dependants = client.service_items.get_dependant()
for dep in dependants:
    print(dep)

NetOrca Pack actions

Pack pipeline actions are exposed through client.pack. They can target a service item or a service.

client.pack.trigger(object_id, action_type, object_type="service_item")

Starts the active Pack processor at config, verify, execution, optimiser, or change_instance_validator.

result = client.pack.trigger(object_id=389, action_type="config")
result = client.pack.trigger(object_id=45, object_type="service", action_type="optimiser")

client.pack.retrigger(object_id, object_type="service_item", serviceowner_comment=None)

Restarts the Pack pipeline from CONFIG. An optional serviceowner_comment is included as feedback in the self-healing prompt context.

result = client.pack.retrigger(
    object_id=389,
    serviceowner_comment="The deployment failed; use VLAN 210",
)

Both actions are asynchronous. A successful response confirms that the request was accepted; query the resulting pipeline to determine its final state. Pack mutations always use the serviceowner route and require the caller to be an ADMIN or CONFIGURATION member of the owning team. Consumers, GENERAL members, and READ_ONLY members cannot trigger or retrigger Pack.

The trigger request has no payload. The retrigger payload is empty unless serviceowner_comment is provided. Both endpoints return a bare JSON string: "AI Processor has been triggered" or "AI Processor has been retriggered".