# polymorfa operation

> Commands under polymorfa operation.

## Commands

- [polymorfa operation cancel](https://docs.polymorfa.com/cli/operation/cancel): Request cancellation of a running campaign or production-enrollment operation. The operation moves to cancelling; follow it with operation wait.
- [polymorfa operation list](https://docs.polymorfa.com/cli/operation/list): List asynchronous operations, newest first. Team owners see team and project operations; project owners see one project.
- [polymorfa operation view](https://docs.polymorfa.com/cli/operation/view): View one asynchronous operation: status, sequence, progress, error, and whether it can be cancelled.
- [polymorfa operation wait](https://docs.polymorfa.com/cli/operation/wait): Wait until an operation succeeds, fails, or is cancelled. Exits 0 on success, 1 on failure or cancellation, and 8 when --timeout ends first.
- [polymorfa operation watch](https://docs.polymorfa.com/cli/operation/watch): Print each status change of an operation until it succeeds, fails, or is cancelled. With --json, prints one JSON document per change. Exits like operation wait.

## polymorfa operation cancel

Request cancellation of a running campaign or production-enrollment operation. The operation moves to cancelling; follow it with operation wait.

### Usage

```bash
polymorfa operation cancel OPERATION [flags]
```

### Arguments

- `OPERATION` (required). Operation ID.

### Flags

- `--idempotency-key <value>` (value). Use this key to identify retries; one is generated when omitted.
- `--yes` (boolean). Confirm the external effect without prompting.

Also accepts the [global flags](https://docs.polymorfa.com/cli#global-flags).

## polymorfa operation list

List asynchronous operations, newest first. Team owners see team and project operations; project owners see one project.

### Usage

```bash
polymorfa operation list [flags]
```

### Flags

- `--cursor <value>` (value). Continue from this opaque cursor.
- `--kind <value>` (value). Filter by operation kind, for example campaign.
- `--limit <value>` (value). Request this many resources per page. Default: `25`.
- `--max-items <value>` (value). Stop automatic pagination after this many resources.
- `--paginate` (boolean). Request consecutive pages until --max-items resources are collected or no pages remain. Requires --max-items.
- `--resource-id <value>` (value). Filter by resource ID. Requires --resource-type.
- `--resource-type <value>` (value). Filter by resource type. Requires --resource-id.
- `--since <value>` (value). Include operations created at or after this RFC 3339 time.
- `--status <value>` (value). Filter by status. Values: `pending`, `running`, `action_required`, `cancelling`, `succeeded`, `failed`, `cancelled`.
- `--until <value>` (value). Include operations created before this RFC 3339 time.

Also accepts the [global flags](https://docs.polymorfa.com/cli#global-flags).

### Examples

```bash
polymorfa operation list --status running
```

```bash
polymorfa operation list --resource-type campaign --resource-id <campaign-id> --json
```

## polymorfa operation view

View one asynchronous operation: status, sequence, progress, error, and whether it can be cancelled.

### Usage

```bash
polymorfa operation view OPERATION [flags]
```

### Arguments

- `OPERATION` (required). Operation ID.

### Flags

Also accepts the [global flags](https://docs.polymorfa.com/cli#global-flags).

## polymorfa operation wait

Wait until an operation succeeds, fails, or is cancelled. Exits 0 on success, 1 on failure or cancellation, and 8 when --timeout ends first.

### Usage

```bash
polymorfa operation wait OPERATION [flags]
```

### Arguments

- `OPERATION` (required). Operation ID.

### Flags

- `--timeout <value>` (value). Stop waiting after this many seconds. Default: `300`.

Also accepts the [global flags](https://docs.polymorfa.com/cli#global-flags).

### Examples

```bash
polymorfa operation wait <operation-id> --timeout 600
```

## polymorfa operation watch

Print each status change of an operation until it succeeds, fails, or is cancelled. With --json, prints one JSON document per change. Exits like operation wait.

### Usage

```bash
polymorfa operation watch OPERATION [flags]
```

### Arguments

- `OPERATION` (required). Operation ID.

### Flags

- `--timeout <value>` (value). Stop waiting after this many seconds. Default: `300`.

Also accepts the [global flags](https://docs.polymorfa.com/cli#global-flags).
