Skip to content

Loop Blocks

Accessed via client.loop_blocks.

pyawe.client.LoopBlocksClient

LoopBlocksClient(http: _HttpSession)

Methods for the /loop-blocks resource.

create

create(name: str, workflow_id: UUID | str, loop_type: str, loop_config: Any) -> CreateLoopBlockResponse

Create a loop block task inside a workflow.

Creates both the outer task (of type "loop_block") and an empty inner workflow that will be executed on each iteration.

Parameters:

Name Type Description Default
name str

Name shown on the loop block node and used as the inner workflow name.

required
workflow_id UUID | str

UUID of the outer workflow.

required
loop_type str

"count", "while", or "for_each".

required
loop_config Any

Type-dependent configuration dict:

  • "count": {"count": N}
  • "while": {"condition": "continue"}
  • "for_each": {"collection": [...]}
required

Returns:

Type Description
CreateLoopBlockResponse

class:~pyawe.models.CreateLoopBlockResponse containing the new

CreateLoopBlockResponse

outer task and loop block record.

Raises:

Type Description
AweAuthError

If not authenticated.

AweValidationError

On a 400 response.

get

get(loop_block_id: UUID | str) -> LoopBlock

Fetch a loop block.

Parameters:

Name Type Description Default
loop_block_id UUID | str

UUID of the loop block.

required

Returns:

Type Description
LoopBlock

class:~pyawe.models.LoopBlock.

Raises:

Type Description
AweNotFoundError

If the loop block does not exist.

AweAuthError

If not authenticated.

update

update(loop_block_id: UUID | str, *, name: str | None = None, loop_type: str | None = None, loop_config: Any | None = None) -> LoopBlock

Update a loop block; only supplied fields are changed.

Renaming the loop block also renames the inner workflow.

Parameters:

Name Type Description Default
loop_block_id UUID | str

UUID of the loop block.

required
name str | None

New name.

None
loop_type str | None

New loop type.

None
loop_config Any | None

New loop configuration.

None

Returns:

Type Description
LoopBlock

The updated :class:~pyawe.models.LoopBlock.

Raises:

Type Description
AweNotFoundError

If the loop block does not exist.

AweAuthError

If not authenticated.

delete

delete(loop_block_id: UUID | str) -> None

Delete a loop block.

Parameters:

Name Type Description Default
loop_block_id UUID | str

UUID of the loop block.

required

Raises:

Type Description
AweNotFoundError

If the loop block does not exist.

AweAuthError

If not authenticated.