Skip to content

Commit 20dd1f6

Browse files
committed
Add command to update instance ports
1 parent 69de4fb commit 20dd1f6

5 files changed

Lines changed: 894 additions & 1 deletion

File tree

.agents/skills/brev-cli/SKILL.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ brev ports create my-node 53 --protocol udp --allow 203.0.113.10/32
181181
brev ports create my-instance 3000 --protocol http --public
182182
brev ports create my-instance 8888 --protocol http --authorize me@example.com
183183

184+
# Update one mapping interactively or by exact ID
185+
brev ports update my-instance --destination-port 8081
186+
brev ports update my-instance --id nport-abc123 --allow 203.0.113.10/32
187+
brev ports update my-instance --id nport-abc123 --public
188+
184189
# Close one port interactively, by exact ID, or close all ports
185190
brev ports close my-instance
186191
brev ports close my-instance --id nport-abc123 --approve

.agents/skills/brev-cli/reference/commands.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,43 @@ brev ports create my-instance 3000 --protocol http --public
546546
brev ports create my-instance 8888 --protocol http --authorize me@example.com
547547
```
548548

549+
#### Update a port
550+
551+
Update a mapping in place while preserving its `port_id` and public endpoint.
552+
Omit `--id` to select a mapping interactively. `edit` is an alias for `update`.
553+
554+
```bash
555+
brev ports update <instance-or-node> [flags]
556+
```
557+
558+
**Flags:**
559+
| Flag | Description |
560+
|------|-------------|
561+
| `--id` | Update the exact mapping with this `port_id`; omit to select interactively |
562+
| `--destination-port` | Change the destination port (1-65535) |
563+
| `--allow` | Replace source restrictions with this CIDR; repeat to add more than one |
564+
| `--allow-anywhere` | Clear all source restrictions |
565+
| `--protocol` | Change an HTTP mapping's origin protocol to `http` or `https` |
566+
| `--authorize` | Replace an HTTP mapping's authorized emails; repeat to add more than one |
567+
| `--public` | Allow unauthenticated public access to an HTTP mapping |
568+
| `--json` | Output the updated mapping as JSON |
569+
570+
`--allow` and `--allow-anywhere` cannot be combined. `--authorize` and
571+
`--public` cannot be combined. HTTP access and protocol flags are rejected for
572+
raw TCP, UDP, and SSH mappings. When one command updates multiple field groups,
573+
the API applies them in destination, source, protocol, then access order; those
574+
separate mutations are not transactional.
575+
576+
**Examples:**
577+
```bash
578+
brev ports update my-instance --destination-port 8081
579+
brev ports update my-instance --id nport-abc123 --allow 203.0.113.10/32
580+
brev ports edit my-node --id nport-abc123 --allow-anywhere
581+
brev ports update my-instance --id nport-abc123 --protocol https
582+
brev ports update my-instance --id nport-abc123 --authorize me@example.com
583+
brev ports update my-instance --id nport-abc123 --public --json
584+
```
585+
549586
#### Close ports
550587

551588
Select and close one port interactively, close an exact mapping by its

pkg/cmd/ports/ports.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ func NewCmdPorts(portStore Store) *cobra.Command {
5353
brev ports ls my-instance
5454
brev ports ls my-node --json`,
5555
}
56-
cmd.AddCommand(NewCmdPortsLs(portStore), NewCmdCreatePort(portStore), NewCmdClosePort(portStore))
56+
cmd.AddCommand(
57+
NewCmdPortsLs(portStore),
58+
NewCmdCreatePort(portStore),
59+
NewCmdUpdatePort(portStore),
60+
NewCmdClosePort(portStore),
61+
)
5762
return cmd
5863
}
5964

0 commit comments

Comments
 (0)