Skip to content

Commit d306968

Browse files
committed
docs: migrate common features content and refine structure
- Add comprehensive profiles/authentication docs - Add output formats documentation - Add JMESPath queries documentation - Add async operations documentation - Streamline quickstart to 60-second Docker experience - Move shell completions to Reference - Reorder sections for better flow
1 parent a645e9c commit d306968

File tree

14 files changed

+452
-836
lines changed

14 files changed

+452
-836
lines changed

docs/src/SUMMARY.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
# Summary
22

3-
[Introduction](./introduction.md)
4-
5-
# Getting Started
3+
# Introduction
64

5+
- [Overview](./introduction.md)
6+
- [Quick Start](./getting-started/quickstart.md)
77
- [Installation](./getting-started/installation.md)
8-
- [Profiles & Authentication](./getting-started/profiles.md)
9-
- [Common Features](./getting-started/common-features.md)
10-
- [Output Formats](./getting-started/output-formats.md)
11-
- [JMESPath Queries](./getting-started/jmespath-queries.md)
12-
- [Async Operations](./getting-started/async-operations.md)
13-
- [Shell Completions](./getting-started/shell-completions.md)
148

15-
# Walkthrough
9+
# Common Features
1610

17-
- [Overview & Concepts](./walkthrough/overview.md)
18-
- [Cloud Quick Examples](./walkthrough/cloud-examples.md)
19-
- [Enterprise Quick Examples](./walkthrough/enterprise-examples.md)
11+
- [Profiles & Authentication](./common-features/profiles.md)
12+
- [Output Formats](./common-features/output-formats.md)
13+
- [JMESPath Queries](./common-features/jmespath-queries.md)
14+
- [Async Operations](./common-features/async-operations.md)
2015

2116
# Redis Cloud
2217

@@ -49,6 +44,12 @@
4944
- [Diagnostics](./enterprise/operations/diagnostics.md)
5045
- [Migrations](./enterprise/operations/migration.md)
5146

47+
# Walkthrough
48+
49+
- [Overview & Concepts](./walkthrough/overview.md)
50+
- [Cloud Quick Examples](./walkthrough/cloud-examples.md)
51+
- [Enterprise Quick Examples](./walkthrough/enterprise-examples.md)
52+
5253
# Cookbook
5354

5455
- [Overview](./cookbook/README.md)
@@ -71,6 +72,7 @@
7172

7273
- [Environment Variables](./reference/environment-variables.md)
7374
- [Configuration File](./reference/config-file.md)
75+
- [Shell Completions](./reference/shell-completions.md)
7476
- [Security](./reference/security.md)
7577
- [Troubleshooting](./reference/troubleshooting.md)
7678
- [rladmin Comparison](./reference/rladmin.md)
Lines changed: 94 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,153 +1,138 @@
11
# Async Operations
22

3-
The `redisctl` CLI provides comprehensive support for asynchronous operations across both Redis Cloud and Redis Enterprise APIs. All create, update, and delete operations support the `--wait` flag family for tracking long-running operations.
3+
Many Redis Cloud and Enterprise operations are asynchronous - they return immediately with a task ID while the work happens in the background. redisctl handles this automatically.
44

5-
## Overview
5+
## The --wait Flag
66

7-
Many Redis Cloud API operations are asynchronous, returning immediately with a task ID while the operation continues in the background. The `--wait` flags allow you to:
8-
9-
- Wait for operations to complete before returning
10-
- Track progress with visual indicators
11-
- Set custom timeouts for long operations
12-
- Configure polling intervals
13-
14-
## Wait Flag Options
15-
16-
| Flag | Description | Default |
17-
|------|-------------|---------|
18-
| `--wait` | Wait for operation to complete | Timeout: 600s |
19-
| `--wait-timeout <seconds>` | Custom timeout duration | 600 |
20-
| `--wait-interval <seconds>` | Polling interval | 10 |
21-
22-
## Basic Usage
7+
Use `--wait` to block until the operation completes:
238

249
```bash
25-
# Create database and wait for completion
26-
redisctl cloud database create --subscription-id 12345 \
27-
--data @database.json --wait
28-
29-
# With custom timeout for large operations
30-
redisctl cloud database create --subscription-id 12345 \
31-
--data @large-db.json --wait --wait-timeout 1800
32-
33-
# With faster polling for quick operations
34-
redisctl cloud database update --subscription-id 12345 \
35-
--database-id 67890 --data @updates.json \
36-
--wait --wait-interval 2
37-
```
38-
39-
## Progress Tracking
40-
41-
When using the `--wait` flag, redisctl provides real-time progress tracking:
10+
# Returns immediately with task ID
11+
redisctl cloud database create --subscription-id 123 --data '{...}'
4212

13+
# Waits for completion, returns final result
14+
redisctl cloud database create --subscription-id 123 --data '{...}' --wait
4315
```
44-
Creating database...
45-
⠋ Waiting for task 12345 to complete... (10s)
46-
⠙ Status: processing (20s)
47-
⠹ Status: processing (30s)
48-
✓ Database creation completed successfully
49-
```
50-
51-
## Supported Operations
5216

53-
Async operations are supported across all major command categories:
17+
## Polling Options
5418

55-
- [Database Operations](./database-operations.md) - Create, update, delete, import, backup, migrate
56-
- [Subscription Management](./subscription-management.md) - Regular and fixed subscriptions
57-
- [Network Connectivity](./network-connectivity.md) - VPC Peering, PSC, Transit Gateway
58-
- [ACL Management](./acl-management.md) - Rules, roles, and users
59-
- [User & Account Management](./user-management.md) - Users and provider accounts
19+
Control how redisctl polls for completion:
6020

61-
## Error Handling
21+
```bash
22+
redisctl cloud subscription create \
23+
--data '{...}' \
24+
--wait \
25+
--poll-interval 10 \ # Check every 10 seconds (default: 5)
26+
--max-wait 600 # Timeout after 10 minutes (default: 300)
27+
```
6228

63-
### Timeout Behavior
29+
## Task Management
6430

65-
If an operation exceeds the timeout:
66-
- The CLI exits with an error
67-
- The task continues running in the background
68-
- You can check status using the task ID
31+
### Check Task Status
6932

7033
```bash
71-
# Operation times out
72-
Error: Operation timed out after 600 seconds. Task 12345 is still running.
34+
# Cloud
35+
redisctl cloud task get <task-id>
7336

74-
# Check task status manually
75-
redisctl cloud task get 12345
37+
# Enterprise
38+
redisctl enterprise action get <action-id>
7639
```
7740

78-
### Recovery Options
41+
### List Recent Tasks
7942

8043
```bash
81-
# Retry with longer timeout
82-
redisctl cloud database create --data @database.json \
83-
--wait --wait-timeout 1800
44+
# Cloud - list all tasks
45+
redisctl cloud task list
8446

85-
# Check task status without waiting
86-
redisctl cloud task list --status pending
47+
# Enterprise - list actions
48+
redisctl enterprise action list
8749
```
8850

89-
## Best Practices
51+
## Common Async Operations
9052

91-
### Choosing Timeouts
53+
### Redis Cloud
9254

93-
- **Small operations**: Default 600s is usually sufficient
94-
- **Large databases**: Increase to 1800s (30 min) or more
95-
- **Bulk operations**: Consider 3600s (1 hour) for very large datasets
96-
- **Network operations**: May need longer timeouts in some regions
55+
- `subscription create/delete`
56+
- `database create/update/delete`
57+
- `vpc-peering create/delete`
58+
- `cloud-account create/delete`
9759

98-
### Polling Intervals
60+
### Redis Enterprise
9961

100-
- **Default (10s)**: Good balance for most operations
101-
- **Fast operations (2-5s)**: For operations you expect to complete quickly
102-
- **Long operations (30-60s)**: Reduce API calls for very long operations
62+
- `database create/update/delete`
63+
- `cluster join/remove-node`
64+
- `module upload`
10365

104-
### Automation
66+
## Error Handling
10567

106-
The `--wait` flags are designed for automation:
68+
When `--wait` is used and an operation fails:
10769

10870
```bash
109-
#!/bin/bash
110-
# CI/CD pipeline example
111-
set -e # Exit on error
112-
113-
# Create infrastructure
114-
redisctl cloud subscription create --data @prod-sub.json \
115-
--wait --wait-timeout 1800
71+
$ redisctl cloud database create --data '{...}' --wait
72+
Error: Task failed: Invalid memory configuration
73+
74+
# Check task details
75+
$ redisctl cloud task get abc-123
76+
{
77+
"taskId": "abc-123",
78+
"status": "failed",
79+
"error": "Invalid memory configuration"
80+
}
81+
```
11682

117-
SUB_ID=$(redisctl cloud subscription list -q "[0].id" -o json)
83+
## Scripting Patterns
11884

119-
redisctl cloud database create --subscription-id $SUB_ID \
120-
--data @prod-db.json --wait --wait-timeout 900
85+
### Wait and Extract Result
12186

122-
echo "Infrastructure ready!"
87+
```bash
88+
# Create and get the new database ID
89+
DB_ID=$(redisctl cloud database create \
90+
--subscription-id 123 \
91+
--data '{"name": "mydb"}' \
92+
--wait \
93+
-q 'databaseId')
94+
95+
echo "Created database: $DB_ID"
12396
```
12497

125-
## Parallel Operations
98+
### Fire and Forget
99+
100+
```bash
101+
# Start multiple operations in parallel
102+
redisctl cloud database delete 123 456 &
103+
redisctl cloud database delete 123 789 &
104+
wait
105+
```
126106

127-
You can run multiple async operations in parallel:
107+
### Custom Polling
128108

129109
```bash
130-
#!/bin/bash
131-
# Create multiple databases in parallel
132-
for i in {1..5}; do
133-
redisctl cloud database create --subscription-id 12345 \
134-
--data @db-$i.json --wait &
110+
# Start operation
111+
TASK_ID=$(redisctl cloud database create --data '{...}' -q 'taskId')
112+
113+
# Custom polling loop
114+
while true; do
115+
STATUS=$(redisctl cloud task get $TASK_ID -q 'status')
116+
echo "Status: $STATUS"
117+
118+
if [ "$STATUS" = "completed" ] || [ "$STATUS" = "failed" ]; then
119+
break
120+
fi
121+
122+
sleep 10
135123
done
136-
137-
# Wait for all background jobs
138-
wait
139-
echo "All databases created!"
140124
```
141125

142-
## Implementation Details
126+
## Timeouts
127+
128+
If an operation exceeds `--max-wait`:
143129

144-
All async operations use the centralized `handle_async_response` function which:
145-
- Extracts task IDs from API responses
146-
- Polls for task completion
147-
- Provides consistent progress indicators
148-
- Handles timeouts and errors uniformly
130+
```bash
131+
$ redisctl cloud subscription create --data '{...}' --wait --max-wait 60
132+
Error: Operation timed out after 60 seconds. Task ID: abc-123
133+
134+
# Check manually
135+
$ redisctl cloud task get abc-123
136+
```
149137

150-
The system automatically detects task IDs from various response formats:
151-
- `taskId` field in response
152-
- `links` array with task references
153-
- Nested task objects
138+
The operation continues in the background - only the CLI stops waiting.

0 commit comments

Comments
 (0)