Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 1 addition & 9 deletions .github/docs/contribution-guide/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
}

// Write the input model to the debug logs
if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Please remember to run `make generate-docs` after your changes to keep the comma

Below is a typical structure of a CLI command:

https://github.com/stackitcloud/stackit-cli/blob/85ce44cd18d11169f2548d8657031b5fc6f94740/.github/docs/contribution-guide/cmd.go#L23-L156
https://github.com/stackitcloud/stackit-cli/blob/main/.github/docs/contribution-guide/cmd.go

Please remember to always add unit tests for `parseInput`, `buildRequest` (in `bar_test.go`), and any other util functions used.

Expand Down Expand Up @@ -87,7 +87,7 @@ If you want to add a command that uses a STACKIT service `foo` that was not yet
1. This is done in `internal/pkg/services/foo/client/client.go`
2. Below is an example of a typical `client.go` file structure:

https://github.com/stackitcloud/stackit-cli/blob/85ce44cd18d11169f2548d8657031b5fc6f94740/.github/docs/contribution-guide/client.go#L12-L35
https://github.com/stackitcloud/stackit-cli/blob/main/.github/docs/contribution-guide/client.go

### Local development

Expand Down
10 changes: 1 addition & 9 deletions internal/cmd/affinity-groups/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) {
Policy: flags.FlagToStringValue(p, cmd, policyFlag),
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}

Expand Down
10 changes: 1 addition & 9 deletions internal/cmd/affinity-groups/delete/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,6 @@ func parseInput(p *print.Printer, cmd *cobra.Command, cliArgs []string) (*inputM
AffinityGroupId: cliArgs[0],
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}
10 changes: 1 addition & 9 deletions internal/cmd/affinity-groups/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, cliArgs []string) (*inputM
AffinityGroupId: cliArgs[0],
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}

Expand Down
10 changes: 1 addition & 9 deletions internal/cmd/affinity-groups/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) {
Limit: limit,
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command) *inputModel {
OnlyPrintAccessToken: flags.FlagToBoolValue(p, cmd, onlyPrintAccessTokenFlag),
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model
}

Expand Down
10 changes: 1 addition & 9 deletions internal/cmd/auth/get-access-token/get_access_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,6 @@ func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) {
GlobalFlagModel: globalFlags,
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}
10 changes: 1 addition & 9 deletions internal/cmd/beta/alb/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) {
Configuration: flags.FlagToStringPointer(p, cmd, configurationFlag),
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}

Expand Down
10 changes: 1 addition & 9 deletions internal/cmd/beta/alb/delete/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
Name: loadbalancerName,
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}

Expand Down
10 changes: 1 addition & 9 deletions internal/cmd/beta/alb/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
Name: loadbalancerName,
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}

Expand Down
10 changes: 1 addition & 9 deletions internal/cmd/beta/alb/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) {
Limit: limit,
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}

Expand Down
10 changes: 1 addition & 9 deletions internal/cmd/beta/alb/observability-credentials/add/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) {
Password: flags.FlagToStringPointer(p, cmd, passwordFlag),
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string fo debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
CredentialsRef: credentialRef,
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
CredentialRef: credentialRef,
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}

Expand Down
10 changes: 1 addition & 9 deletions internal/cmd/beta/alb/observability-credentials/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) {
Limit: limit,
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.InfoLevel, modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) inputM
Password: flags.FlagToStringPointer(p, cmd, passwordFlag),
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return model
}

Expand Down
10 changes: 1 addition & 9 deletions internal/cmd/beta/alb/plans/plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) {
GlobalFlagModel: globalFlags,
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}

Expand Down
10 changes: 1 addition & 9 deletions internal/cmd/beta/alb/pool/update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) {
AlbName: flags.FlagToStringPointer(p, cmd, albNameFlag),
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}

Expand Down
10 changes: 1 addition & 9 deletions internal/cmd/beta/alb/quotas/quotas.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) {
GlobalFlagModel: globalFlags,
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}

Expand Down
10 changes: 1 addition & 9 deletions internal/cmd/beta/alb/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,6 @@ func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) {
Type: flags.FlagToStringPointer(p, cmd, typeFlag),
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}
10 changes: 1 addition & 9 deletions internal/cmd/beta/alb/update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) {
Configuration: flags.FlagToStringPointer(p, cmd, configurationFlag),
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}

Expand Down
10 changes: 1 addition & 9 deletions internal/cmd/beta/sqlserverflex/database/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
Owner: flags.FlagToStringValue(p, cmd, ownerFlag),
}

if p.IsVerbosityDebug() {
modelStr, err := print.BuildDebugStrFromInputModel(model)
if err != nil {
p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err)
} else {
p.Debug(print.DebugLevel, "parsed input values: %s", modelStr)
}
}

p.DebugInputModel(model)
return &model, nil
}

Expand Down
Loading
Loading