|
| 1 | +# Design: CLI Resource ID Error Suggestions |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +When users provide an incorrect resource ID (farm, queue, fleet, job, worker, storage profile) and receive an access denied or not found error, the CLI automatically suggests available resources they have access to. This helps users quickly identify and fix typos in resource IDs. |
| 6 | + |
| 7 | +## Implemented Commands |
| 8 | + |
| 9 | +The following commands show resource suggestions on access/not-found errors: |
| 10 | + |
| 11 | +| Command | Suggestions Shown | |
| 12 | +|---------|-------------------| |
| 13 | +| `deadline bundle submit` | queues → farms (fallback) | |
| 14 | +| `deadline farm list` | farms | |
| 15 | +| `deadline farm get` | farms | |
| 16 | +| `deadline fleet list` | fleets → farms (fallback) | |
| 17 | +| `deadline fleet get` | fleets → farms (fallback) | |
| 18 | +| `deadline queue list` | queues → farms (fallback) | |
| 19 | +| `deadline queue get` | queues → farms (fallback) | |
| 20 | +| `deadline queue paramdefs` | queues → farms (fallback) | |
| 21 | +| `deadline job list` | jobs → queues → farms (fallback) | |
| 22 | +| `deadline job get` | jobs → queues → farms (fallback) | |
| 23 | +| `deadline job cancel` | jobs → queues → farms (fallback) | |
| 24 | +| `deadline worker list` | workers → fleets (fallback) | |
| 25 | +| `deadline worker get` | workers → fleets (fallback) | |
| 26 | + |
| 27 | +## Key Behaviors |
| 28 | + |
| 29 | +- **CLI-only feature**: Library users (`deadline.client.api`) receive original `ClientError` exceptions |
| 30 | +- **Operation detection**: Uses `exc.operation_name` attribute for reliable operation identification |
| 31 | +- **Fuzzy matching for workers**: When a worker_id is provided, uses `searchTermFilter` with fuzzy matching |
| 32 | +- **Fallback hierarchy**: When List APIs fail, falls back up the resource hierarchy |
| 33 | +- **Permission hint**: When all List APIs fail, shows hint about missing IAM List permissions |
| 34 | +- **Truncation**: Lists are truncated at 10 items with "... and N more" message |
| 35 | + |
| 36 | +## Resource Hierarchy |
| 37 | + |
| 38 | +When an error occurs, the CLI attempts to list resources, falling back up the hierarchy if needed: |
| 39 | + |
| 40 | +``` |
| 41 | +Farm |
| 42 | +├── Queue |
| 43 | +│ ├── Job |
| 44 | +│ └── Storage Profile |
| 45 | +└── Fleet |
| 46 | + └── Worker |
| 47 | +``` |
| 48 | + |
| 49 | +## Output Examples |
| 50 | + |
| 51 | +**Queue ID error with available queues:** |
| 52 | +``` |
| 53 | +Failed to submit the job bundle to AWS Deadline Cloud: |
| 54 | +An error occurred (AccessDeniedException) when calling the GetQueue operation: ... |
| 55 | +
|
| 56 | +Available queues in farm farm-0123456789abcdef0123456789abcdef: |
| 57 | + queue-abcd1234567890abcdef1234567890ab Production Render Queue |
| 58 | + queue-efgh5678901234cdef5678901234cdef Test Queue |
| 59 | +``` |
| 60 | + |
| 61 | +**Farm ID error (cascading fallback):** |
| 62 | +``` |
| 63 | +Failed to get Jobs from Deadline: |
| 64 | +An error occurred (ResourceNotFoundException) when calling the SearchJobs operation: ... |
| 65 | +
|
| 66 | +Farm farm-wrongid12345678901234567890 may be incorrect. Available farms: |
| 67 | + farm-0123456789abcdef0123456789abcdef Studio Farm |
| 68 | + farm-abcdef01234567890abcdef012345678 Development Farm |
| 69 | +``` |
| 70 | + |
| 71 | +**Truncation for long lists:** |
| 72 | +``` |
| 73 | +Available queues in farm farm-0123456789abcdef0123456789abcdef: |
| 74 | + queue-abcd1234567890abcdef1234567890ab Production Render Queue |
| 75 | + queue-efgh5678901234cdef5678901234cdef Test Queue |
| 76 | + ... and 8 more |
| 77 | +``` |
| 78 | + |
| 79 | +**Permission hint when all List APIs fail:** |
| 80 | +``` |
| 81 | +Could not list available resources to suggest alternatives. |
| 82 | +This may indicate your IAM policy is missing List permissions. |
| 83 | +``` |
| 84 | + |
| 85 | +## Handled Error Codes |
| 86 | + |
| 87 | +- `AccessDeniedException` - User lacks permission (likely wrong ID) |
| 88 | +- `ResourceNotFoundException` - Resource doesn't exist |
| 89 | +- `ValidationException` - Invalid ID format |
| 90 | + |
| 91 | +## Use Cases |
| 92 | + |
| 93 | +### UC1: Mistyped Queue ID |
| 94 | +User provides wrong queue ID. CLI suggests available queues in the specified farm. |
| 95 | + |
| 96 | +### UC2: Mistyped Farm ID |
| 97 | +User provides wrong farm ID. CLI suggests available farms. |
| 98 | + |
| 99 | +### UC3: Mistyped Farm ID (cascading) |
| 100 | +User provides wrong farm ID when specifying a queue. Both GetQueue and ListQueues fail. CLI suggests available farms. |
| 101 | + |
| 102 | +### UC4: Mistyped Fleet ID |
| 103 | +User provides wrong fleet ID. CLI suggests available fleets in the farm. |
| 104 | + |
| 105 | +### UC5: Mistyped Job ID |
| 106 | +User provides wrong job ID. CLI suggests recent jobs in the queue. |
| 107 | + |
| 108 | +### UC6: Mistyped Worker ID |
| 109 | +User provides wrong worker ID. CLI suggests available workers in the fleet. |
| 110 | + |
| 111 | +### UC7: Mistyped Storage Profile ID |
| 112 | +User provides wrong storage profile ID. CLI suggests available storage profiles for the queue. |
0 commit comments