Skip to content

Commit d5ddc17

Browse files
committed
Working sub command and better outputs
1 parent 6dfd120 commit d5ddc17

17 files changed

+849
-691
lines changed

AGENTS.md

Lines changed: 105 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,23 @@ This document provides a comprehensive reference for AI agents using the CloudAM
55
## Configuration
66

77
### API Key Setup
8-
The CLI uses API keys in this priority order:
9-
1. `CLOUDAMQP_APIKEY` environment variable (for main API)
10-
2. `~/.cloudamqprc` JSON config file
8+
The CLI uses a single API key for all operations in this priority order:
9+
1. `CLOUDAMQP_APIKEY` environment variable
10+
2. `~/.cloudamqprc` plain text config file
1111
3. Interactive prompt
1212

13-
For instance-specific operations, use:
14-
- `CLOUDAMQP_INSTANCE_{ID}_APIKEY` environment variable
15-
- Stored in `~/.cloudamqprc` under `instance_keys`
16-
1713
### Base URL
18-
Default: `https://customer.cloudamqp.com/api` (can be changed for development)
14+
Default: `https://customer.cloudamqp.com/api` (unified API endpoint)
1915

2016
## Command Structure
2117

2218
```
23-
cloudamqp <category> <action> [arguments] [flags]
19+
cloudamqp <category> <action> [--id <instance_id>] [other flags]
2420
```
2521

26-
## Main API Commands (using main API key)
22+
All instance-specific operations use the `--id` flag to specify the instance.
23+
24+
## Main API Commands
2725

2826
### Instance Management
2927

@@ -35,9 +33,8 @@ cloudamqp instance list
3533

3634
#### Get Instance Details
3735
```bash
38-
cloudamqp instance get <id>
36+
cloudamqp instance get --id <id>
3937
```
40-
- Automatically saves instance API key for later use
4138
- Returns: Full instance details including API key, URLs, hostnames
4239

4340
#### Create Instance
@@ -50,20 +47,20 @@ cloudamqp instance create --name=<name> --plan=<plan> --region=<region> [--tags=
5047

5148
#### Update Instance
5249
```bash
53-
cloudamqp instance update <id> --name=<new_name> --plan=<new_plan>
50+
cloudamqp instance update --id <id> --name=<new_name> --plan=<new_plan>
5451
```
5552
- Updates instance name and/or plan
5653
- Use for upgrading/downgrading plans
5754

5855
#### Delete Instance
5956
```bash
60-
cloudamqp instance delete <id>
57+
cloudamqp instance delete --id <id>
6158
```
6259
- Permanently deletes the instance
6360

6461
#### Resize Instance Disk
6562
```bash
66-
cloudamqp instance resize <id> --disk-size=<gb> [--allow-downtime]
63+
cloudamqp instance resize --id <id> --disk-size=<gb> [--allow-downtime]
6764
```
6865
- Required: disk-size (in GB)
6966
- Optional: allow-downtime flag
@@ -77,7 +74,7 @@ cloudamqp vpc list
7774

7875
#### Get VPC Details
7976
```bash
80-
cloudamqp vpc get <id>
77+
cloudamqp vpc get --id <id>
8178
```
8279

8380
#### Create VPC
@@ -87,12 +84,12 @@ cloudamqp vpc create --name=<name> --region=<region> --subnet=<subnet> [--tags=<
8784

8885
#### Update VPC
8986
```bash
90-
cloudamqp vpc update <id> --name=<new_name>
87+
cloudamqp vpc update --id <id> --name=<new_name>
9188
```
9289

9390
#### Delete VPC
9491
```bash
95-
cloudamqp vpc delete <id>
92+
cloudamqp vpc delete --id <id>
9693
```
9794

9895
### Team Management
@@ -109,101 +106,122 @@ cloudamqp team invite --email=<email> [--role=<role>] [--tags=<tag>]
109106

110107
#### Update Team Member
111108
```bash
112-
cloudamqp team update <id> --role=<role>
109+
cloudamqp team update --user-id <id> --role=<role>
113110
```
114111

115112
#### Remove Team Member
116113
```bash
117-
cloudamqp team remove <id>
114+
cloudamqp team remove --email=<email>
118115
```
119116

120117
### Billing & Plans
121118

122119
#### List Available Plans
123120
```bash
124-
cloudamqp plans
121+
cloudamqp plans [--backend=<rabbitmq|lavinmq>]
125122
```
126123
- Returns: Array of plans with name, price, backend, shared status
127124

128125
#### List Available Regions
129126
```bash
130-
cloudamqp regions
127+
cloudamqp regions [--provider=<provider>]
131128
```
132129

133-
134130
### Audit & Security
135131

136-
#### List Audit Logs
132+
#### Export Audit Logs
137133
```bash
138-
cloudamqp audit
134+
cloudamqp audit [--timestamp=<timestamp>]
139135
```
140136

141137
#### Rotate API Key
142138
```bash
143139
cloudamqp rotate-key
144140
```
145141

146-
## Instance-Specific API Commands (using instance API key)
142+
## Instance-Specific Operations
147143

148-
These commands use the pattern: `cloudamqp instance manage <instance_id> <category> <action>`
144+
All instance-specific commands use the unified API and `--id` flag pattern.
149145

150146
### Node Management
151147

152148
#### List Nodes
153149
```bash
154-
cloudamqp instance manage <id> nodes
150+
cloudamqp instance nodes list --id <id>
151+
```
152+
153+
#### Get Available Versions
154+
```bash
155+
cloudamqp instance nodes versions --id <id>
155156
```
156157

157158
### Plugin Management
158159

159160
#### List Plugins
160161
```bash
161-
cloudamqp instance manage <id> plugins list
162+
cloudamqp instance plugins list --id <id>
162163
```
163164
- Returns: Array of plugins with name, version, description, enabled status
164165

166+
### RabbitMQ Configuration
167+
168+
#### List All Configuration Settings
169+
```bash
170+
cloudamqp instance config list --id <id>
171+
```
172+
173+
#### Get Specific Configuration Setting
174+
```bash
175+
cloudamqp instance config get --id <id> --key <config_key>
176+
```
177+
178+
#### Set Configuration Setting
179+
```bash
180+
cloudamqp instance config set --id <id> --key <config_key> --value <config_value>
181+
```
182+
165183
### Account Operations
166184

167185
#### Rotate Instance Password
168186
```bash
169-
cloudamqp instance manage <id> account rotate-password
187+
cloudamqp instance account rotate-password --id <id>
170188
```
171189

172190
#### Rotate Instance API Key
173191
```bash
174-
cloudamqp instance manage <id> account rotate-apikey
192+
cloudamqp instance account rotate-apikey --id <id>
175193
```
176194

177195
### Instance Actions
178196

179197
#### Restart Operations
180198
```bash
181-
cloudamqp instance manage <id> actions restart-rabbitmq [--nodes=node1,node2]
182-
cloudamqp instance manage <id> actions restart-cluster
183-
cloudamqp instance manage <id> actions restart-management [--nodes=node1,node2]
199+
cloudamqp instance actions restart-rabbitmq --id <id> [--nodes=node1,node2]
200+
cloudamqp instance actions restart-cluster --id <id>
201+
cloudamqp instance actions restart-management --id <id> [--nodes=node1,node2]
184202
```
185203

186204
#### Start/Stop Operations
187205
```bash
188-
cloudamqp instance manage <id> actions start [--nodes=node1,node2]
189-
cloudamqp instance manage <id> actions stop [--nodes=node1,node2]
190-
cloudamqp instance manage <id> actions reboot [--nodes=node1,node2]
191-
cloudamqp instance manage <id> actions start-cluster
192-
cloudamqp instance manage <id> actions stop-cluster
206+
cloudamqp instance actions start --id <id> [--nodes=node1,node2]
207+
cloudamqp instance actions stop --id <id> [--nodes=node1,node2]
208+
cloudamqp instance actions reboot --id <id> [--nodes=node1,node2]
209+
cloudamqp instance actions start-cluster --id <id>
210+
cloudamqp instance actions stop-cluster --id <id>
193211
```
194212

195213
#### Upgrade Operations
196214
```bash
197-
cloudamqp instance manage <id> actions upgrade-erlang
198-
cloudamqp instance manage <id> actions upgrade-rabbitmq --version=<version>
199-
cloudamqp instance manage <id> actions upgrade-all
200-
cloudamqp instance manage <id> actions upgrade-versions # Check available versions
215+
cloudamqp instance actions upgrade-erlang --id <id>
216+
cloudamqp instance actions upgrade-rabbitmq --id <id> --version=<version>
217+
cloudamqp instance actions upgrade-all --id <id>
218+
cloudamqp instance actions upgrade-versions --id <id> # Check available versions
201219
```
202220

203221
#### Feature Toggle Operations
204222
```bash
205-
cloudamqp instance manage <id> actions toggle-hipe --enable=true/false [--nodes=node1,node2]
206-
cloudamqp instance manage <id> actions toggle-firehose --enable=true/false --vhost=<vhost>
223+
cloudamqp instance actions toggle-hipe --id <id> --enable=true/false [--nodes=node1,node2]
224+
cloudamqp instance actions toggle-firehose --id <id> --enable=true/false --vhost=<vhost>
207225
```
208226

209227
## Common Usage Patterns
@@ -215,25 +233,40 @@ cloudamqp instance create --name="my-instance" --plan="bunny-1" --region="amazon
215233

216234
# Poll until ready
217235
while true; do
218-
cloudamqp instance get <id> | grep '"ready": true' && break
236+
cloudamqp instance get --id <id> | grep '"ready": true' && break
219237
sleep 30
220238
done
221239
```
222240

223241
### 2. Upgrade Instance Plan
224242
```bash
225-
cloudamqp instance update <id> --plan="rabbit-3"
243+
cloudamqp instance update --id <id> --plan="rabbit-3"
226244
```
227245

228-
### 3. Instance Management Workflow
246+
### 3. Complete Instance Management Workflow
229247
```bash
230-
# Get instance details (saves API key automatically)
231-
cloudamqp instance get <id>
248+
# Get instance details
249+
cloudamqp instance get --id <id>
232250

233-
# Now you can use instance-specific commands
234-
cloudamqp instance manage <id> nodes
235-
cloudamqp instance manage <id> plugins list
236-
cloudamqp instance manage <id> actions restart-rabbitmq
251+
# Check nodes and configuration
252+
cloudamqp instance nodes list --id <id>
253+
cloudamqp instance config list --id <id>
254+
255+
# Perform maintenance
256+
cloudamqp instance actions restart-rabbitmq --id <id>
257+
cloudamqp instance actions upgrade-all --id <id>
258+
```
259+
260+
### 4. Configuration Management
261+
```bash
262+
# List all configuration
263+
cloudamqp instance config list --id <id>
264+
265+
# Get specific setting
266+
cloudamqp instance config get --id <id> --key tcp_listen_options
267+
268+
# Update configuration
269+
cloudamqp instance config set --id <id> --key tcp_listen_options --value '[{"port": 5672}]'
237270
```
238271

239272
## Common Plans
@@ -270,10 +303,21 @@ cloudamqp instance manage <id> actions restart-rabbitmq
270303

271304
## Notes for AI Agents
272305

273-
1. Always use `cloudamqp instance get <id>` before instance-specific operations to ensure the instance API key is saved
274-
2. Instance creation is async - poll with `get` until `ready: true`
275-
3. Plan upgrades are immediate but may cause brief downtime
276-
4. Some actions (upgrades, restarts) are asynchronous - they return immediately but run in background
277-
5. The `--tags` flag can be used multiple times: `--tags=prod --tags=web`
278-
6. VPC operations require the instance to be in the same region as the VPC
279-
7. When asked for the openapi spec there are make targets `make openapi.yaml` and `make openapi-instance.yaml` to download the latest version.
306+
1. **Unified API**: All operations now use a single API key and the unified customer API endpoint
307+
2. **Flag-based Commands**: All instance-specific operations use `--id <instance_id>` instead of positional arguments
308+
3. **Instance Creation**: Instance creation is async - poll with `get --id <id>` until `ready: true`
309+
4. **Plan Upgrades**: Plan upgrades are immediate but may cause brief downtime
310+
5. **Async Operations**: Some actions (upgrades, restarts) are asynchronous - they return immediately but run in background
311+
6. **Multiple Tags**: The `--tags` flag can be used multiple times: `--tags=prod --tags=web`
312+
7. **VPC Requirements**: VPC operations require the instance to be in the same region as the VPC
313+
8. **Configuration Management**: Use the config commands to manage RabbitMQ settings directly
314+
9. **OpenAPI Specs**: When asked for OpenAPI specs, use make targets `make openapi.yaml` and `make openapi-instance.yaml` to download the latest versions
315+
316+
## Configuration File Format
317+
318+
The `~/.cloudamqprc` file contains only your API key in plain text:
319+
```
320+
your-api-key-here
321+
```
322+
323+
No JSON formatting or multiple keys are needed - the unified API handles all operations with a single key.

0 commit comments

Comments
 (0)