Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement postgresflex user #61

Merged
merged 20 commits into from
Feb 6, 2024
2 changes: 1 addition & 1 deletion docs/stackit_mongodbflex_instance_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ stackit mongodbflex instance create [flags]
--ram int Amount of RAM (in GB)
--storage-class string Storage class (default "premium-perf2-mongodb")
--storage-size int Storage size (in GB) (default 10)
--type string Instance type, one of ["Single" "Replica" "Sharded"] (default "Replica")
--type string Instance type, one of ["Replica" "Sharded" "Single"] (default "Replica")
--version string Version (default "6.0")
```

Expand Down
2 changes: 1 addition & 1 deletion docs/stackit_mongodbflex_user_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Creates a MongoDB Flex user
Creates a MongoDB Flex user.
The password is only visible upon creation and cannot be retrieved later.
Alternatively, you can reset the password and access the new one by running:
$ stackit mongodbflex user reset-password --instance-id <INSTANCE_ID> --user-id <USER_ID>
$ stackit mongodbflex user reset-password USER_ID --instance-id INSTANCE_ID

```
stackit mongodbflex user create [flags]
Expand Down
4 changes: 2 additions & 2 deletions docs/stackit_mongodbflex_user_describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Shows details of a MongoDB Flex user

Shows details of a MongoDB Flex user.
The user password is hidden inside the "host" field and replaced with asterisks, as it is only visible upon creation. You can reset it by running:
$ stackit mongodbflex user reset-password <USER_ID> --instance-id <INSTANCE_ID>
$ stackit mongodbflex user reset-password USER_ID --instance-id INSTANCE_ID

```
stackit mongodbflex user describe USER_ID [flags]
Expand All @@ -18,7 +18,7 @@ stackit mongodbflex user describe USER_ID [flags]
Get details of a MongoDB Flex user with ID "xxx" of instance with ID "yyy"
$ stackit mongodbflex user list xxx --instance-id yyy

Get details of a MongoDB Flex user with ID "xxx" of instance with ID "xxx" in table format
Get details of a MongoDB Flex user with ID "xxx" of instance with ID "yyy" in table format
$ stackit mongodbflex user list xxx --instance-id yyy --output-format pretty
```

Expand Down
1 change: 1 addition & 0 deletions docs/stackit_postgresflex.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ stackit postgresflex [flags]

* [stackit](./stackit.md) - Manage STACKIT resources using the command line
* [stackit postgresflex instance](./stackit_postgresflex_instance.md) - Provides functionality for PostgreSQL Flex instances
* [stackit postgresflex user](./stackit_postgresflex_user.md) - Provides functionality for PostgreSQL Flex users

37 changes: 37 additions & 0 deletions docs/stackit_postgresflex_user.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## stackit postgresflex user

Provides functionality for PostgreSQL Flex users

### Synopsis

Provides functionality for PostgreSQL Flex users.

```
stackit postgresflex user [flags]
```

### Options

```
-h, --help Help for "stackit postgresflex user"
```

### Options inherited from parent commands

```
-y, --assume-yes If set, skips all confirmation prompts
--async If set, runs the command asynchronously
-o, --output-format string Output format, one of ["json" "pretty"]
-p, --project-id string Project ID
```

### SEE ALSO

* [stackit postgresflex](./stackit_postgresflex.md) - Provides functionality for PostgreSQL Flex
* [stackit postgresflex user create](./stackit_postgresflex_user_create.md) - Creates a PostgreSQL Flex user
* [stackit postgresflex user delete](./stackit_postgresflex_user_delete.md) - Deletes a PostgreSQL Flex user
* [stackit postgresflex user describe](./stackit_postgresflex_user_describe.md) - Shows details of a PostgreSQL Flex user
* [stackit postgresflex user list](./stackit_postgresflex_user_list.md) - Lists all PostgreSQL Flex users of an instance
* [stackit postgresflex user reset-password](./stackit_postgresflex_user_reset-password.md) - Resets the password of a PostgreSQL Flex user
* [stackit postgresflex user update](./stackit_postgresflex_user_update.md) - Updates a PostgreSQL Flex user

47 changes: 47 additions & 0 deletions docs/stackit_postgresflex_user_create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
## stackit postgresflex user create

Creates a PostgreSQL Flex user

### Synopsis

Creates a PostgreSQL Flex user.
The password is only visible upon creation and cannot be retrieved later.
Alternatively, you can reset the password and access the new one by running:
$ stackit postgresflex user reset-password USER_ID --instance-id INSTANCE_ID

```
stackit postgresflex user create [flags]
```

### Examples

```
Create a PostgreSQL Flex user for instance with ID "xxx" and specify the username
$ stackit postgresflex user create --instance-id xxx --username johndoe --roles read

Create a PostgreSQL Flex user for instance with ID "xxx" with an automatically generated username
$ stackit postgresflex user create --instance-id xxx --roles read
```

### Options

```
-h, --help Help for "stackit postgresflex user create"
--instance-id string ID of the instance
--roles strings Roles of the user, possible values are ["read" "readWrite"] (default [read])
--username string Username of the user. If not specified, a random username will be assigned
```

### Options inherited from parent commands

```
-y, --assume-yes If set, skips all confirmation prompts
--async If set, runs the command asynchronously
-o, --output-format string Output format, one of ["json" "pretty"]
-p, --project-id string Project ID
```

### SEE ALSO

* [stackit postgresflex user](./stackit_postgresflex_user.md) - Provides functionality for PostgreSQL Flex users

41 changes: 41 additions & 0 deletions docs/stackit_postgresflex_user_delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## stackit postgresflex user delete

Deletes a PostgreSQL Flex user

### Synopsis

Deletes a PostgreSQL Flex user by ID.
You can get the IDs of users for an instance by running:
$ stackit postgresflex user list --instance-id <INSTANCE_ID>

```
stackit postgresflex user delete USER_ID [flags]
```

### Examples

```
Delete a PostgreSQL Flex user with ID "xxx" for instance with ID "yyy"
$ stackit postgresflex user delete xxx --instance-id yyy
```

### Options

```
-h, --help Help for "stackit postgresflex user delete"
--instance-id string Instance ID
```

### Options inherited from parent commands

```
-y, --assume-yes If set, skips all confirmation prompts
--async If set, runs the command asynchronously
-o, --output-format string Output format, one of ["json" "pretty"]
-p, --project-id string Project ID
```

### SEE ALSO

* [stackit postgresflex user](./stackit_postgresflex_user.md) - Provides functionality for PostgreSQL Flex users

44 changes: 44 additions & 0 deletions docs/stackit_postgresflex_user_describe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
## stackit postgresflex user describe

Shows details of a PostgreSQL Flex user

### Synopsis

Shows details of a PostgreSQL Flex user.
The user password is hidden inside the "host" field and replaced with asterisks, as it is only visible upon creation. You can reset it by running:
$ stackit postgresflex user reset-password USER_ID --instance-id INSTANCE_ID

```
stackit postgresflex user describe USER_ID [flags]
```

### Examples

```
Get details of a PostgreSQL Flex user with ID "xxx" of instance with ID "yyy"
$ stackit postgresflex user list xxx --instance-id yyy

Get details of a PostgreSQL Flex user with ID "xxx" of instance with ID "yyy" in table format
$ stackit postgresflex user list xxx --instance-id yyy --output-format pretty
```

### Options

```
-h, --help Help for "stackit postgresflex user describe"
--instance-id string ID of the instance
```

### Options inherited from parent commands

```
-y, --assume-yes If set, skips all confirmation prompts
--async If set, runs the command asynchronously
-o, --output-format string Output format, one of ["json" "pretty"]
-p, --project-id string Project ID
```

### SEE ALSO

* [stackit postgresflex user](./stackit_postgresflex_user.md) - Provides functionality for PostgreSQL Flex users

46 changes: 46 additions & 0 deletions docs/stackit_postgresflex_user_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## stackit postgresflex user list

Lists all PostgreSQL Flex users of an instance

### Synopsis

Lists all PostgreSQL Flex users of an instance.

```
stackit postgresflex user list [flags]
```

### Examples

```
List all PostgreSQL Flex users of instance with ID "xxx"
$ stackit postgresflex user list --instance-id xxx

List all PostgreSQL Flex users of instance with ID "xxx" in JSON format
$ stackit postgresflex user list --instance-id xxx --output-format json

List up to 10 PostgreSQL Flex users of instance with ID "xxx"
$ stackit postgresflex user list --instance-id xxx --limit 10
```

### Options

```
-h, --help Help for "stackit postgresflex user list"
--instance-id string Instance ID
--limit int Maximum number of entries to list
```

### Options inherited from parent commands

```
-y, --assume-yes If set, skips all confirmation prompts
--async If set, runs the command asynchronously
-o, --output-format string Output format, one of ["json" "pretty"]
-p, --project-id string Project ID
```

### SEE ALSO

* [stackit postgresflex user](./stackit_postgresflex_user.md) - Provides functionality for PostgreSQL Flex users

39 changes: 39 additions & 0 deletions docs/stackit_postgresflex_user_reset-password.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## stackit postgresflex user reset-password

Resets the password of a PostgreSQL Flex user

### Synopsis

Resets the password of a PostgreSQL Flex user. The new password is returned in the response.

```
stackit postgresflex user reset-password USER_ID [flags]
```

### Examples

```
Reset the password of a PostgreSQL Flex user with ID "xxx" of instance with ID "yyy"
$ stackit postgresflex user reset-password xxx --instance-id yyy
```

### Options

```
-h, --help Help for "stackit postgresflex user reset-password"
--instance-id string ID of the instance
```

### Options inherited from parent commands

```
-y, --assume-yes If set, skips all confirmation prompts
--async If set, runs the command asynchronously
-o, --output-format string Output format, one of ["json" "pretty"]
-p, --project-id string Project ID
```

### SEE ALSO

* [stackit postgresflex user](./stackit_postgresflex_user.md) - Provides functionality for PostgreSQL Flex users

40 changes: 40 additions & 0 deletions docs/stackit_postgresflex_user_update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## stackit postgresflex user update

Updates a PostgreSQL Flex user

### Synopsis

Updates a PostgreSQL Flex user.

```
stackit postgresflex user update USER_ID [flags]
```

### Examples

```
Update the roles of a PostgreSQL Flex user with ID "xxx" of instance with ID "yyy"
$ stackit postgresflex user update xxx --instance-id yyy --roles read
```

### Options

```
-h, --help Help for "stackit postgresflex user update"
--instance-id string ID of the instance
--roles strings Roles of the user, possible values are ["read" "readWrite"] (default [])
```

### Options inherited from parent commands

```
-y, --assume-yes If set, skips all confirmation prompts
--async If set, runs the command asynchronously
-o, --output-format string Output format, one of ["json" "pretty"]
-p, --project-id string Project ID
```

### SEE ALSO

* [stackit postgresflex user](./stackit_postgresflex_user.md) - Provides functionality for PostgreSQL Flex users

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/stackitcloud/stackit-sdk-go/services/membership v0.3.4
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.10.3
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.9.2
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.9.0
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.9.1
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.7.5
github.com/stackitcloud/stackit-sdk-go/services/serviceaccount v0.3.4
github.com/stackitcloud/stackit-sdk-go/services/ske v0.9.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.10.3 h1:M7ALIg1tE
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.10.3/go.mod h1:LWfUBjGQWF3SZivQdUdAC/WxJkx8ImJKy5GFMV3tXHY=
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.9.2 h1:dwZ1NDD+AxTaZqAeR/0PY7yt32dbABhQH1Vsnt8A+hg=
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.9.2/go.mod h1:M8mjTS5yR0XXoH9EpuULme9fEkLhUz4UOT7XSHUSRQ8=
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.9.0 h1:b4RFEDSMa+p8iUsMS/RzhkT6uLhD607lhQyQPfrO8nU=
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.9.0/go.mod h1:bVXMSjQH1eGUF5IoPAD8BjAzhRMunDlnrwLsaCPgRQ4=
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.9.1 h1:41M0IWsHFmt2KvoY/4vwWYNG94Tx3U3diSlYdz0thJE=
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.9.1/go.mod h1:bVXMSjQH1eGUF5IoPAD8BjAzhRMunDlnrwLsaCPgRQ4=
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.10.0 h1:Fle394socpyf662g3jMrtZpZaWVgBMBIEFnh4fnGock=
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.10.0/go.mod h1:JvqOSrTCiynS0x6Y9OsK54yvdB6AtIWLwXDEjoCkAIg=
github.com/stackitcloud/stackit-sdk-go/services/redis v0.10.0 h1:4u+OiVDAI6Hpej81e+YrbzN5FT4l7ZrTw+eSRcQnCYg=
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/mongodbflex/user/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func NewCmd() *cobra.Command {
"Creates a MongoDB Flex user.",
"The password is only visible upon creation and cannot be retrieved later.",
"Alternatively, you can reset the password and access the new one by running:",
" $ stackit mongodbflex user reset-password --instance-id <INSTANCE_ID> --user-id <USER_ID>",
" $ stackit mongodbflex user reset-password USER_ID --instance-id INSTANCE_ID",
),
Example: examples.Build(
examples.NewExample(
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/mongodbflex/user/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ func NewCmd() *cobra.Command {
Long: fmt.Sprintf("%s\n%s\n%s",
"Shows details of a MongoDB Flex user.",
`The user password is hidden inside the "host" field and replaced with asterisks, as it is only visible upon creation. You can reset it by running:`,
" $ stackit mongodbflex user reset-password <USER_ID> --instance-id <INSTANCE_ID>",
" $ stackit mongodbflex user reset-password USER_ID --instance-id INSTANCE_ID",
),
Example: examples.Build(
examples.NewExample(
`Get details of a MongoDB Flex user with ID "xxx" of instance with ID "yyy"`,
"$ stackit mongodbflex user list xxx --instance-id yyy"),
examples.NewExample(
`Get details of a MongoDB Flex user with ID "xxx" of instance with ID "xxx" in table format`,
`Get details of a MongoDB Flex user with ID "xxx" of instance with ID "yyy" in table format`,
"$ stackit mongodbflex user list xxx --instance-id yyy --output-format pretty"),
),
Args: args.SingleArg(userIdArg, utils.ValidateUUID),
Expand Down
Loading
Loading