Skip to content

fix(sqlserverflex): require roles flag on user creation #657

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/stackit_beta_sqlserverflex_user_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ stackit beta sqlserverflex user create [flags]

```
Create a SQLServer Flex user for instance with ID "xxx" and specify the username, role and database
$ stackit beta sqlserverflex user create --instance-id xxx --username johndoe --roles "##STACKIT_DatabaseManager##" --database my-database
$ stackit beta sqlserverflex user create --instance-id xxx --username johndoe --roles "##STACKIT_DatabaseManager##"

Create a SQLServer Flex user for instance with ID "xxx", specifying multiple roles
$ stackit beta sqlserverflex user create --instance-id xxx --username johndoe --roles "##STACKIT_LoginManager##,##STACKIT_DatabaseManager##"
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/beta/sqlserverflex/user/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func NewCmd(p *print.Printer) *cobra.Command {
Example: examples.Build(
examples.NewExample(
`Create a SQLServer Flex user for instance with ID "xxx" and specify the username, role and database`,
`$ stackit beta sqlserverflex user create --instance-id xxx --username johndoe --roles "##STACKIT_DatabaseManager##" --database my-database`),
`$ stackit beta sqlserverflex user create --instance-id xxx --username johndoe --roles "##STACKIT_DatabaseManager##"`),
examples.NewExample(
`Create a SQLServer Flex user for instance with ID "xxx", specifying multiple roles`,
`$ stackit beta sqlserverflex user create --instance-id xxx --username johndoe --roles "##STACKIT_LoginManager##,##STACKIT_DatabaseManager##"`),
Expand Down Expand Up @@ -104,7 +104,7 @@ func configureFlags(cmd *cobra.Command) {
cmd.Flags().String(usernameFlag, "", "Username of the user")
cmd.Flags().StringSlice(rolesFlag, []string{}, "Roles of the user")

err := flags.MarkFlagsRequired(cmd, instanceIdFlag, usernameFlag)
err := flags.MarkFlagsRequired(cmd, instanceIdFlag, usernameFlag, rolesFlag)
cobra.CheckErr(err)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,7 @@ func TestParseInput(t *testing.T) {
flagValues: fixtureFlagValues(func(flagValues map[string]string) {
delete(flagValues, rolesFlag)
}),
isValid: true,
expectedModel: fixtureInputModel(func(model *inputModel) {
model.Roles = nil
}),
isValid: false,
},
{
description: "no values",
Expand Down