digitalocean / digitalocean/doctl
doctl databases pool create (fails when --user arg not provided)
- Dominant language
- Go
- Stars
- 3.4k
- Forks
- 496
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 31
Description
**Describe the Issue:**
1. According to the DO Dashboard, connection pools can have the user field (also known as `User privileges override (Optional)`) set to an empty string (which appears as `N/A` in the table shown on the Connection Pools tab for a Postgres database). The empty string corresponds to "Use inbound user" in the DO Dashboard.
2. The [DO API Reference to "Add a New Connection Pool"](https://docs.digitalocean.com/reference/api/digitalocean/#tag/Databases/operation/databases_add_connectionPool) shows:
- `name`, `mode`, `size` and `db` are **required**, but
- `user` is **not required**.
3. When using `doctl databases pool create --size 25 --db --mode transaction`, I see an error message appear:
```
Error: (pool.create.user) command is missing required arguments
```
**See "Additional Details" below for a possible fix.**
**Environment:**
- doctl version: `1.142.0-release` (`Git commit hash: 4979b33d`)
- OS: Ubuntu 20.04.4 LTS
- Installation method: Installed binary from tarball (https://github.com/digitalocean/doctl/releases/download/v1.142.0/doctl-1.142.0-linux-amd64.tar.gz)
**Additional Details:**
Since the `--user` arg is not marked as a `requiredOpt()` in https://github.com/digitalocean/doctl/blob/c74c583764a12cc7ddb353acfe2733c5d20bc5d5/commands/databases.go#L1239-L1240
I believe the problem lies with
https://github.com/digitalocean/doctl/blob/c74c583764a12cc7ddb353acfe2733c5d20bc5d5/commands/databases.go#L1344-L1348
which probably needs to be modified so it doesn't throw an error if no `--user` arg is provided.
Contributor guide
Assessment
This issue has not been assessed yet.