Skip to content

Commit a728c2b

Browse files
committed
resolved comments
1 parent 195b000 commit a728c2b

File tree

7 files changed

+32
-30
lines changed

7 files changed

+32
-30
lines changed

internal/cmd/logs/access_token/create/create.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ type inputModel struct {
4141
func NewCmd(params *types.CmdParams) *cobra.Command {
4242
cmd := &cobra.Command{
4343
Use: "create",
44-
Short: "Creates a logs access token",
45-
Long: "Creates a logs access token.",
44+
Short: "Creates a Logs access token",
45+
Long: "Creates a Logs access token.",
4646
Args: args.NoArgs,
4747
Example: examples.Build(
4848
examples.NewExample(
@@ -85,7 +85,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
8585
instanceLabel = model.InstanceId
8686
}
8787

88-
prompt := fmt.Sprintf("Are you sure you want to create a access token for the logs instance %q in the project %q?", instanceLabel, projectLabel)
88+
prompt := fmt.Sprintf("Are you sure you want to create a access token for the Logs instance %q in the project %q?", instanceLabel, projectLabel)
8989
err = params.Printer.PromptForConfirmation(prompt)
9090
if err != nil {
9191
return err
@@ -95,7 +95,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
9595
req := buildRequest(ctx, model, apiClient)
9696
resp, err := req.Execute()
9797
if err != nil {
98-
return fmt.Errorf("create logs access-token : %w", err)
98+
return fmt.Errorf("create Logs access-token : %w", err)
9999
}
100100

101101
return outputResult(params.Printer, model.OutputFormat, instanceLabel, resp)
@@ -106,7 +106,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
106106
}
107107

108108
func configureFlags(cmd *cobra.Command) {
109-
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "ID of the logs instance")
109+
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "ID of the Logs instance")
110110
cmd.Flags().String(displayNameFlag, "", "Display name for the access token")
111111
cmd.Flags().String(descriptionFlag, "", "Description of the access token")
112112
cmd.Flags().Int64(lifetimeFlag, 0, "Lifetime of the access token in days [1 - 180]")
@@ -151,7 +151,7 @@ func outputResult(p *print.Printer, outputFormat, instanceLabel string, accessTo
151151
return fmt.Errorf("access token cannot be nil")
152152
}
153153
return p.OutputResult(outputFormat, accessToken, func() error {
154-
p.Outputf("Created access token for logs instance %q.\n\nID: %s\nToken: %s\n", instanceLabel, utils.PtrValue(accessToken.Id), utils.PtrValue(accessToken.AccessToken))
154+
p.Outputf("Created access token for Logs instance %q.\n\nID: %s\nToken: %s\n", instanceLabel, utils.PtrValue(accessToken.Id), utils.PtrValue(accessToken.AccessToken))
155155
return nil
156156
})
157157
}

internal/cmd/logs/access_token/delete/delete.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ type inputModel struct {
3434
func NewCmd(params *types.CmdParams) *cobra.Command {
3535
cmd := &cobra.Command{
3636
Use: fmt.Sprintf("delete %s", accessTokenIdArg),
37-
Short: "Deletes a logs access token",
38-
Long: "Deletes a logs access token.",
37+
Short: "Deletes a Logs access token",
38+
Long: "Deletes a Logs access token.",
3939
Args: args.SingleArg(accessTokenIdArg, utils.ValidateUUID),
4040
Example: examples.Build(
4141
examples.NewExample(
@@ -87,7 +87,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
8787
}
8888

8989
func configureFlags(cmd *cobra.Command) {
90-
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "ID of the logs instance")
90+
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "ID of the Logs instance")
9191

9292
err := flags.MarkFlagsRequired(cmd, instanceIdFlag)
9393
cobra.CheckErr(err)

internal/cmd/logs/access_token/delete_all/delete_all.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ import (
77
"github.com/stackitcloud/stackit-cli/internal/pkg/args"
88
"github.com/stackitcloud/stackit-cli/internal/pkg/flags"
99
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
10+
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1011
"github.com/stackitcloud/stackit-sdk-go/services/logs"
1112

1213
"github.com/stackitcloud/stackit-cli/internal/pkg/errors"
1314
"github.com/stackitcloud/stackit-cli/internal/pkg/examples"
1415
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1516
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
1617
"github.com/stackitcloud/stackit-cli/internal/pkg/services/logs/client"
17-
"github.com/stackitcloud/stackit-cli/internal/pkg/services/logs/utils"
18+
logUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/logs/utils"
1819

1920
"github.com/spf13/cobra"
2021
)
@@ -31,8 +32,8 @@ type inputModel struct {
3132
func NewCmd(params *types.CmdParams) *cobra.Command {
3233
cmd := &cobra.Command{
3334
Use: "delete-all",
34-
Short: "Deletes all logs access token",
35-
Long: "Deletes all logs access token.",
35+
Short: "Deletes all Logs access token",
36+
Long: "Deletes all Logs access token.",
3637
Args: args.NoArgs,
3738
Example: examples.Build(
3839
examples.NewExample(
@@ -53,7 +54,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
5354
return err
5455
}
5556

56-
instanceLabel, err := utils.GetInstanceName(ctx, apiClient, model.ProjectId, model.Region, model.InstanceId)
57+
instanceLabel, err := logUtils.GetInstanceName(ctx, apiClient, model.ProjectId, model.Region, model.InstanceId)
5758
if err != nil {
5859
params.Printer.Debug(print.ErrorLevel, "get instance name: %v", err)
5960
instanceLabel = model.InstanceId
@@ -72,7 +73,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
7273
return fmt.Errorf("delete access token: %w", err)
7374
}
7475

75-
params.Printer.Outputf("Deleted %d access token(s)\n", len(*items.Tokens))
76+
params.Printer.Outputf("Deleted %d access token(s)\n", len(utils.PtrValue(items.Tokens)))
7677
return nil
7778
},
7879
}
@@ -81,7 +82,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
8182
}
8283

8384
func configureFlags(cmd *cobra.Command) {
84-
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "ID of the logs instance")
85+
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "ID of the Logs instance")
8586

8687
err := flags.MarkFlagsRequired(cmd, instanceIdFlag)
8788
cobra.CheckErr(err)

internal/cmd/logs/access_token/delete_all_expired/delete_all_expired.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ import (
77
"github.com/stackitcloud/stackit-cli/internal/pkg/args"
88
"github.com/stackitcloud/stackit-cli/internal/pkg/flags"
99
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
10+
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1011
"github.com/stackitcloud/stackit-sdk-go/services/logs"
1112

1213
"github.com/stackitcloud/stackit-cli/internal/pkg/errors"
1314
"github.com/stackitcloud/stackit-cli/internal/pkg/examples"
1415
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1516
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
1617
"github.com/stackitcloud/stackit-cli/internal/pkg/services/logs/client"
17-
"github.com/stackitcloud/stackit-cli/internal/pkg/services/logs/utils"
18+
logUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/logs/utils"
1819

1920
"github.com/spf13/cobra"
2021
)
@@ -31,8 +32,8 @@ type inputModel struct {
3132
func NewCmd(params *types.CmdParams) *cobra.Command {
3233
cmd := &cobra.Command{
3334
Use: "delete-all-expired",
34-
Short: "Deletes all expired logs access token",
35-
Long: "Deletes all expired logs access token.",
35+
Short: "Deletes all expired Logs access token",
36+
Long: "Deletes all expired Logs access token.",
3637
Args: args.NoArgs,
3738
Example: examples.Build(
3839
examples.NewExample(
@@ -53,7 +54,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
5354
return err
5455
}
5556

56-
instanceLabel, err := utils.GetInstanceName(ctx, apiClient, model.ProjectId, model.Region, model.InstanceId)
57+
instanceLabel, err := logUtils.GetInstanceName(ctx, apiClient, model.ProjectId, model.Region, model.InstanceId)
5758
if err != nil {
5859
params.Printer.Debug(print.ErrorLevel, "get instance name: %v", err)
5960
instanceLabel = model.InstanceId
@@ -72,7 +73,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
7273
return fmt.Errorf("delete access token: %w", err)
7374
}
7475

75-
params.Printer.Outputf("Deleted %d expired access token(s)\n", len(*items.Tokens))
76+
params.Printer.Outputf("Deleted %d expired access token(s)\n", len(utils.PtrValue(items.Tokens)))
7677
return nil
7778
},
7879
}
@@ -81,7 +82,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
8182
}
8283

8384
func configureFlags(cmd *cobra.Command) {
84-
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "ID of the logs instance")
85+
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "ID of the Logs instance")
8586

8687
err := flags.MarkFlagsRequired(cmd, instanceIdFlag)
8788
cobra.CheckErr(err)

internal/cmd/logs/access_token/describe/describe.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ type inputModel struct {
3434
func NewCmd(params *types.CmdParams) *cobra.Command {
3535
cmd := &cobra.Command{
3636
Use: fmt.Sprintf("describe %s", accessTokenIdArg),
37-
Short: "Shows details of a logs access token",
38-
Long: "Shows details of a logs access token.",
37+
Short: "Shows details of a Logs access token",
38+
Long: "Shows details of a Logs access token.",
3939
Args: args.SingleArg(accessTokenIdArg, utils.ValidateUUID),
4040
Example: examples.Build(
4141
examples.NewExample(
42-
`Show details of a logs access token with ID "xxx"`,
42+
`Show details of a Logs access token with ID "xxx"`,
4343
"$ stackit logs access-token describe xxx",
4444
),
4545
examples.NewExample(
46-
`Show details of a logs access token with ID "xxx" in JSON format`,
46+
`Show details of a Logs access token with ID "xxx" in JSON format`,
4747
"$ stackit logs access-token describe xxx --output-format json",
4848
),
4949
),
@@ -75,7 +75,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
7575
}
7676

7777
func configureFlags(cmd *cobra.Command) {
78-
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "ID of the logs instance")
78+
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "ID of the Logs instance")
7979

8080
err := flags.MarkFlagsRequired(cmd, instanceIdFlag)
8181
cobra.CheckErr(err)

internal/cmd/logs/access_token/list/list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
8181
}
8282

8383
// Truncate output
84-
items := *resp.Tokens
84+
items := utils.PtrValue(resp.Tokens)
8585
if model.Limit != nil && len(items) > int(*model.Limit) {
8686
items = items[:*model.Limit]
8787
}
@@ -95,7 +95,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
9595

9696
func configureFlags(cmd *cobra.Command) {
9797
cmd.Flags().Int64(limitFlag, 0, "Maximum number of entries to list")
98-
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "ID of the logs instance")
98+
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "ID of the Logs instance")
9999

100100
err := flags.MarkFlagsRequired(cmd, instanceIdFlag)
101101
cobra.CheckErr(err)

internal/cmd/logs/access_token/update/update.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
6767
// Get the display name for confirmation
6868
instanceLabel, err := logUtils.GetInstanceName(ctx, apiClient, model.ProjectId, model.Region, model.InstanceId)
6969
if err != nil {
70-
params.Printer.Debug(print.ErrorLevel, "get logs instance: %v", err)
70+
params.Printer.Debug(print.ErrorLevel, "get Logs instance: %v", err)
7171
}
7272
if instanceLabel == "" {
7373
instanceLabel = model.InstanceId
@@ -104,7 +104,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
104104
}
105105

106106
func configureFlags(cmd *cobra.Command) {
107-
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "ID of the logs instance")
107+
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "ID of the Logs instance")
108108
cmd.Flags().String(displayNameFlag, "", "Display name for the access token")
109109
cmd.Flags().String(descriptionFlag, "", "Description of the access token")
110110

0 commit comments

Comments
 (0)