Skip to content

Commit d24108d

Browse files
committed
(fix): made orgLabel in model from pointer to string for not having to deal with nil values since it is required anyways
1 parent 884f8c7 commit d24108d

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

internal/cmd/network-area/list/list.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const (
3232
type inputModel struct {
3333
*globalflags.GlobalFlagModel
3434
Limit *int64
35-
OrganizationId *string
35+
OrganizationId string
3636
LabelSelector *string
3737
}
3838

@@ -85,17 +85,17 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
8585
var orgLabel string
8686
rmApiClient, err := rmClient.ConfigureClient(params.Printer, params.CliVersion)
8787
if err == nil {
88-
orgLabel, err = rmUtils.GetOrganizationName(ctx, rmApiClient, *model.OrganizationId)
88+
orgLabel, err = rmUtils.GetOrganizationName(ctx, rmApiClient, model.OrganizationId)
8989
if err != nil {
9090
params.Printer.Debug(print.ErrorLevel, "get organization name: %v", err)
91-
orgLabel = *model.OrganizationId
91+
orgLabel = model.OrganizationId
9292
}
9393
} else {
9494
params.Printer.Debug(print.ErrorLevel, "configure resource manager client: %v", err)
9595
}
9696

9797
if orgLabel == "" {
98-
orgLabel = *model.OrganizationId
98+
orgLabel = model.OrganizationId
9999
}
100100

101101
// Truncate output
@@ -132,7 +132,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, _ []string) (*inputModel,
132132
model := inputModel{
133133
GlobalFlagModel: globalFlags,
134134
Limit: limit,
135-
OrganizationId: flags.FlagToStringPointer(p, cmd, organizationIdFlag),
135+
OrganizationId: flags.FlagToStringValue(p, cmd, organizationIdFlag),
136136
LabelSelector: flags.FlagToStringPointer(p, cmd, labelSelectorFlag),
137137
}
138138

@@ -141,7 +141,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, _ []string) (*inputModel,
141141
}
142142

143143
func buildRequest(ctx context.Context, model *inputModel, apiClient *iaas.APIClient) iaas.ApiListNetworkAreasRequest {
144-
req := apiClient.ListNetworkAreas(ctx, *model.OrganizationId)
144+
req := apiClient.ListNetworkAreas(ctx, model.OrganizationId)
145145
if model.LabelSelector != nil {
146146
req = req.LabelSelector(*model.LabelSelector)
147147
}

internal/cmd/network-area/list/list_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
3939
GlobalFlagModel: &globalflags.GlobalFlagModel{
4040
Verbosity: globalflags.VerbosityDefault,
4141
},
42-
OrganizationId: &testOrganizationId,
42+
OrganizationId: testOrganizationId,
4343
Limit: utils.Ptr(int64(10)),
4444
LabelSelector: utils.Ptr(testLabelSelector),
4545
}

0 commit comments

Comments
 (0)