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
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ release:
prerelease: auto

changelog:
use: github
sort: asc
filters:
exclude:
Expand Down
14 changes: 13 additions & 1 deletion CONTRIBUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,23 @@ func parseInput(cmd *cobra.Command, inputArgs []string) (*inputModel, error) {
return nil, &errors.ProjectIdError{}
}

return &inputModel{
model := inputModel{
GlobalFlagModel: globalFlags,
MyArg myArg,
MyFlag: flags.FlagToStringPointer(cmd, myFlag),
}, nil

// 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)
}
}

return &model, nil
}

// Build request to the API
Expand Down
2 changes: 1 addition & 1 deletion docs/stackit_dns_zone.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ stackit dns zone [flags]
* [stackit dns](./stackit_dns.md) - Provides functionality for DNS
* [stackit dns zone create](./stackit_dns_zone_create.md) - Creates a DNS zone
* [stackit dns zone delete](./stackit_dns_zone_delete.md) - Deletes a DNS zone
* [stackit dns zone describe](./stackit_dns_zone_describe.md) - Shows details of a DNS zone
* [stackit dns zone describe](./stackit_dns_zone_describe.md) - Shows details of a DNS zone
* [stackit dns zone list](./stackit_dns_zone_list.md) - List DNS zones
* [stackit dns zone update](./stackit_dns_zone_update.md) - Updates a DNS zone

4 changes: 2 additions & 2 deletions docs/stackit_dns_zone_describe.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## stackit dns zone describe

Shows details of a DNS zone
Shows details of a DNS zone

### Synopsis

Shows details of a DNS zone.
Shows details of a DNS zone.

```
stackit dns zone describe ZONE_ID [flags]
Expand Down
2 changes: 1 addition & 1 deletion docs/stackit_postgresflex_instance_clone.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ stackit postgresflex instance clone INSTANCE_ID [flags]

```
-h, --help Help for "stackit postgresflex instance clone"
--recovery-timestamp string Recovery timestamp for the instance, in a date-time with the RFC3339 layout format, e.g. 2024-01-01T00:00:00Z
--recovery-timestamp string Recovery timestamp for the instance, in a date-time with the layout format YYYY-MM-DDTHH:mm:ss±HH:mm, e.g. 2006-01-02T15:04:05-07:00
--storage-class string Storage class. If not specified, storage class from the existing instance will be used.
--storage-size int Storage size (in GB). If not specified, storage size from the existing instance will be used.
```
Expand Down
17 changes: 14 additions & 3 deletions internal/cmd/argus/grafana/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ func NewCmd(p *print.Printer) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()
model, err := parseInput(p, cmd, args)

if err != nil {
return err
}

// Configure API client
apiClient, err := client.ConfigureClient(p)
if err != nil {
Expand Down Expand Up @@ -95,11 +95,22 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
return nil, &errors.ProjectIdError{}
}

return &inputModel{
model := inputModel{
GlobalFlagModel: globalFlags,
InstanceId: instanceId,
HidePassword: flags.FlagToBoolValue(p, cmd, hidePasswordFlag),
}, nil
}

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)
}
}

return &model, nil
}

func buildGetGrafanaConfigRequest(ctx context.Context, model *inputModel, apiClient *argus.APIClient) argus.ApiGetGrafanaConfigsRequest {
Expand Down
6 changes: 4 additions & 2 deletions internal/cmd/argus/grafana/describe/describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"testing"

"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
"github.com/stackitcloud/stackit-cli/internal/pkg/print"

"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
Expand Down Expand Up @@ -167,7 +168,8 @@ func TestParseInput(t *testing.T) {

for _, tt := range tests {
t.Run(tt.description, func(t *testing.T) {
cmd := NewCmd(nil)
p := print.NewPrinter()
cmd := NewCmd(p)
err := globalflags.Configure(cmd.Flags())
if err != nil {
t.Fatalf("configure global flags: %v", err)
Expand Down Expand Up @@ -199,7 +201,7 @@ func TestParseInput(t *testing.T) {
t.Fatalf("error validating flags: %v", err)
}

model, err := parseInput(nil, cmd, tt.argValues)
model, err := parseInput(p, cmd, tt.argValues)

if err != nil {
if !tt.isValid {
Expand Down
15 changes: 13 additions & 2 deletions internal/cmd/argus/grafana/public-read-access/disable/disable.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,21 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
return nil, &errors.ProjectIdError{}
}

return &inputModel{
model := inputModel{
GlobalFlagModel: globalFlags,
InstanceId: instanceId,
}, nil
}

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)
}
}

return &model, nil
}

func buildRequest(ctx context.Context, model *inputModel, apiClient argusUtils.ArgusClient) (argus.ApiUpdateGrafanaConfigsRequest, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"testing"

"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
argusUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/argus/utils"
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"

Expand Down Expand Up @@ -184,7 +185,8 @@ func TestParseInput(t *testing.T) {

for _, tt := range tests {
t.Run(tt.description, func(t *testing.T) {
cmd := NewCmd(nil)
p := print.NewPrinter()
cmd := NewCmd(p)
err := globalflags.Configure(cmd.Flags())
if err != nil {
t.Fatalf("configure global flags: %v", err)
Expand Down Expand Up @@ -216,7 +218,7 @@ func TestParseInput(t *testing.T) {
t.Fatalf("error validating flags: %v", err)
}

model, err := parseInput(nil, cmd, tt.argValues)
model, err := parseInput(p, cmd, tt.argValues)
if err != nil {
if !tt.isValid {
return
Expand Down
15 changes: 13 additions & 2 deletions internal/cmd/argus/grafana/public-read-access/enable/enable.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,21 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
return nil, &errors.ProjectIdError{}
}

return &inputModel{
model := inputModel{
GlobalFlagModel: globalFlags,
InstanceId: instanceId,
}, nil
}

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)
}
}

return &model, nil
}

func buildRequest(ctx context.Context, model *inputModel, apiClient argusUtils.ArgusClient) (argus.ApiUpdateGrafanaConfigsRequest, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"testing"

"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
argusUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/argus/utils"
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"

Expand Down Expand Up @@ -184,7 +185,8 @@ func TestParseInput(t *testing.T) {

for _, tt := range tests {
t.Run(tt.description, func(t *testing.T) {
cmd := NewCmd(nil)
p := print.NewPrinter()
cmd := NewCmd(p)
err := globalflags.Configure(cmd.Flags())
if err != nil {
t.Fatalf("configure global flags: %v", err)
Expand Down Expand Up @@ -216,7 +218,7 @@ func TestParseInput(t *testing.T) {
t.Fatalf("error validating flags: %v", err)
}

model, err := parseInput(nil, cmd, tt.argValues)
model, err := parseInput(p, cmd, tt.argValues)
if err != nil {
if !tt.isValid {
return
Expand Down
15 changes: 13 additions & 2 deletions internal/cmd/argus/grafana/single-sign-on/disable/disable.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,21 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
return nil, &errors.ProjectIdError{}
}

return &inputModel{
model := inputModel{
GlobalFlagModel: globalFlags,
InstanceId: instanceId,
}, nil
}

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)
}
}

return &model, nil
}

func buildRequest(ctx context.Context, model *inputModel, apiClient argusUtils.ArgusClient) (argus.ApiUpdateGrafanaConfigsRequest, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"testing"

"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
argusUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/argus/utils"
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"

Expand Down Expand Up @@ -184,7 +185,8 @@ func TestParseInput(t *testing.T) {

for _, tt := range tests {
t.Run(tt.description, func(t *testing.T) {
cmd := NewCmd(nil)
p := print.NewPrinter()
cmd := NewCmd(p)
err := globalflags.Configure(cmd.Flags())
if err != nil {
t.Fatalf("configure global flags: %v", err)
Expand Down Expand Up @@ -216,7 +218,7 @@ func TestParseInput(t *testing.T) {
t.Fatalf("error validating flags: %v", err)
}

model, err := parseInput(nil, cmd, tt.argValues)
model, err := parseInput(p, cmd, tt.argValues)
if err != nil {
if !tt.isValid {
return
Expand Down
15 changes: 13 additions & 2 deletions internal/cmd/argus/grafana/single-sign-on/enable/enable.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,21 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
return nil, &errors.ProjectIdError{}
}

return &inputModel{
model := inputModel{
GlobalFlagModel: globalFlags,
InstanceId: instanceId,
}, nil
}

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)
}
}

return &model, nil
}

func buildRequest(ctx context.Context, model *inputModel, apiClient argusUtils.ArgusClient) (argus.ApiUpdateGrafanaConfigsRequest, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"testing"

"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
argusUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/argus/utils"
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"

Expand Down Expand Up @@ -184,7 +185,8 @@ func TestParseInput(t *testing.T) {

for _, tt := range tests {
t.Run(tt.description, func(t *testing.T) {
cmd := NewCmd(nil)
p := print.NewPrinter()
cmd := NewCmd(p)
err := globalflags.Configure(cmd.Flags())
if err != nil {
t.Fatalf("configure global flags: %v", err)
Expand Down Expand Up @@ -216,7 +218,7 @@ func TestParseInput(t *testing.T) {
t.Fatalf("error validating flags: %v", err)
}

model, err := parseInput(nil, cmd, tt.argValues)
model, err := parseInput(p, cmd, tt.argValues)
if err != nil {
if !tt.isValid {
return
Expand Down
15 changes: 13 additions & 2 deletions internal/cmd/argus/instance/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,23 @@ func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) {
}
}

return &inputModel{
model := inputModel{
GlobalFlagModel: globalFlags,
InstanceName: flags.FlagToStringPointer(p, cmd, instanceNameFlag),
PlanId: planId,
PlanName: planName,
}, nil
}

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)
}
}

return &model, nil
}

type argusClient interface {
Expand Down
6 changes: 4 additions & 2 deletions internal/cmd/argus/instance/create/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"testing"

"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"

"github.com/google/go-cmp/cmp"
Expand Down Expand Up @@ -173,7 +174,8 @@ func TestParseInput(t *testing.T) {

for _, tt := range tests {
t.Run(tt.description, func(t *testing.T) {
cmd := NewCmd(nil)
p := print.NewPrinter()
cmd := NewCmd(p)
err := globalflags.Configure(cmd.Flags())
if err != nil {
t.Fatalf("configure global flags: %v", err)
Expand All @@ -197,7 +199,7 @@ func TestParseInput(t *testing.T) {
t.Fatalf("error validating flags: %v", err)
}

model, err := parseInput(nil, cmd)
model, err := parseInput(p, cmd)
if err != nil {
if !tt.isValid {
return
Expand Down
Loading