Skip to content

Commit f287833

Browse files
committed
rename validateProject function
1 parent ec7a3dd commit f287833

File tree

9 files changed

+11
-11
lines changed

9 files changed

+11
-11
lines changed

internal/cmd/ske/cluster/create/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
7171
}
7272

7373
// Validate project ID (exists and user has access)
74-
projectLabel, err := validation.ValidateProject(ctx, params.Printer, params.CliVersion, cmd, model.ProjectId)
74+
projectLabel, err := validation.ValidateAndGetProjectLabel(ctx, params.Printer, params.CliVersion, cmd, model.ProjectId)
7575
if err != nil {
7676
return err
7777
}

internal/cmd/ske/cluster/delete/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
4646
}
4747

4848
// Validate project ID (exists and user has access)
49-
_, err = validation.ValidateProject(ctx, params.Printer, params.CliVersion, cmd, model.ProjectId)
49+
_, err = validation.ValidateAndGetProjectLabel(ctx, params.Printer, params.CliVersion, cmd, model.ProjectId)
5050
if err != nil {
5151
return err
5252
}

internal/cmd/ske/cluster/describe/describe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
5151
}
5252

5353
// Validate project ID (exists and user has access)
54-
_, err = validation.ValidateProject(ctx, params.Printer, params.CliVersion, cmd, model.ProjectId)
54+
_, err = validation.ValidateAndGetProjectLabel(ctx, params.Printer, params.CliVersion, cmd, model.ProjectId)
5555
if err != nil {
5656
return err
5757
}

internal/cmd/ske/cluster/list/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
5858
}
5959

6060
// Validate project ID (exists and user has access)
61-
projectLabel, err := validation.ValidateProject(ctx, params.Printer, params.CliVersion, cmd, model.ProjectId)
61+
projectLabel, err := validation.ValidateAndGetProjectLabel(ctx, params.Printer, params.CliVersion, cmd, model.ProjectId)
6262
if err != nil {
6363
return err
6464
}

internal/cmd/ske/describe/describe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
4343
}
4444

4545
// Validate project ID (exists and user has access)
46-
_, err = validation.ValidateProject(ctx, params.Printer, params.CliVersion, cmd, model.ProjectId)
46+
_, err = validation.ValidateAndGetProjectLabel(ctx, params.Printer, params.CliVersion, cmd, model.ProjectId)
4747
if err != nil {
4848
return err
4949
}

internal/cmd/ske/disable/disable.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
4242
}
4343

4444
// Validate project ID (exists and user has access)
45-
projectLabel, err := validation.ValidateProject(ctx, params.Printer, params.CliVersion, cmd, model.ProjectId)
45+
projectLabel, err := validation.ValidateAndGetProjectLabel(ctx, params.Printer, params.CliVersion, cmd, model.ProjectId)
4646
if err != nil {
4747
return err
4848
}

internal/cmd/ske/enable/enable.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
4242
}
4343

4444
// Validate project ID (exists and user has access)
45-
projectLabel, err := validation.ValidateProject(ctx, params.Printer, params.CliVersion, cmd, model.ProjectId)
45+
projectLabel, err := validation.ValidateAndGetProjectLabel(ctx, params.Printer, params.CliVersion, cmd, model.ProjectId)
4646
if err != nil {
4747
return err
4848
}

internal/cmd/ske/kubeconfig/create/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
8585
}
8686

8787
// Validate project ID (exists and user has access)
88-
_, err = validation.ValidateProject(ctx, params.Printer, params.CliVersion, cmd, model.ProjectId)
88+
_, err = validation.ValidateAndGetProjectLabel(ctx, params.Printer, params.CliVersion, cmd, model.ProjectId)
8989
if err != nil {
9090
return err
9191
}

internal/pkg/validation/project.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import (
1414
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
1515
)
1616

17-
// ValidateProject validates that the project ID is not empty, exists, and the user has access to it.
18-
// It returns the project name for display purposes.
19-
func ValidateProject(ctx context.Context, p *print.Printer, cliVersion string, cmd *cobra.Command, projectId string) (string, error) {
17+
// ValidateAndGetProjectLabel validates that the project ID is not empty, exists, and the user has access to it.
18+
// It returns the project label (name or ID) for display purposes.
19+
func ValidateAndGetProjectLabel(ctx context.Context, p *print.Printer, cliVersion string, cmd *cobra.Command, projectId string) (string, error) {
2020
// Check if project ID is empty
2121
if projectId == "" {
2222
return "", &errors.ProjectIdError{}

0 commit comments

Comments
 (0)