Bulk requests#

The order of the operations of a bulk request, and the bulkId: references between them.

class scim2_server.bulk.BulkPlan(operations: list[BulkOperation[Resource]], fail_on_errors: int | None)[source]#

The order of the operations of a bulk request, and the “bulkId:” references between them.

Per RFC 7644 §3.7.2, an operation can reference a resource that another POST of the same request creates. The operations run in the order of the request, except that a POST runs before the first operation that references it. The results keep the order of the request.

A plan does no input or output. The code running the request iterates over the steps, resolves the references of each one, applies it, and records its outcome.

plan_steps() → list[BulkStep][source]#

Order the operations so that a creation comes before the operations referencing it.

The order comes from a depth-first walk of the references, without recursion, so a long chain of references cannot exhaust the stack. A circular reference leaves the referencing operation before the creation it references, and resolve() then refuses it.

property stopped: bool#

Whether the request reached the number of errors the client accepts.

Per RFC 7644 §3.7.3, the request goes on despite failures, unless the client caps the errors it accepts with “failOnErrors”.

operation(step: BulkStep) → BulkOperation[Resource][source]#

Return the operation of a step, as the client sent it.

record(step: BulkStep, result: dict[str, Any], resource: Resource | None) → None[source]#

Record the outcome of a step, and the resource it created or updated.

outcomes() → list[dict[str, Any]][source]#

Return the outcome of the operations that ran, in the order of the request.

resolve(step: BulkStep) → BulkOperation[Resource][source]#

Replace the bulkId references of the operation of a step with the identifiers of the created resources.

Raises:
class scim2_server.bulk.BulkStep(index: int)[source]#

One step of a bulk plan.

A step produces the result of one operation of the request. A step is not an operation, so that a plan can later split an operation in several steps, for instance to resolve circular references.

index: int#

The position, in the request, of the operation whose result the step produces.