Skip to content

Commit 1d12b45

Browse files
committed
adjust quota commands
1 parent 5ab0f19 commit 1d12b45

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

internal/cmd/quota/list/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, _ []string) (*inputModel,
9393
}
9494

9595
func buildRequest(ctx context.Context, model *inputModel, apiClient *iaas.APIClient) iaas.ApiListQuotasRequest {
96-
request := apiClient.ListQuotas(ctx, model.ProjectId)
96+
request := apiClient.ListQuotas(ctx, model.ProjectId, model.Region)
9797

9898
return request
9999
}

internal/cmd/quota/list/list_test.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ import (
1515
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
1616
)
1717

18-
var projectIdFlag = globalflags.ProjectIdFlag
18+
const (
19+
projectIdFlag = globalflags.ProjectIdFlag
20+
regionFlag = globalflags.RegionFlag
21+
22+
testRegion = "eu01"
23+
)
1924

2025
type testCtxKey struct{}
2126

@@ -28,6 +33,7 @@ var (
2833
func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]string {
2934
flagValues := map[string]string{
3035
projectIdFlag: testProjectId,
36+
regionFlag: testRegion,
3137
}
3238
for _, mod := range mods {
3339
mod(flagValues)
@@ -37,7 +43,11 @@ func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]st
3743

3844
func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
3945
model := &inputModel{
40-
GlobalFlagModel: &globalflags.GlobalFlagModel{ProjectId: testProjectId, Verbosity: globalflags.VerbosityDefault},
46+
GlobalFlagModel: &globalflags.GlobalFlagModel{
47+
ProjectId: testProjectId,
48+
Region: testRegion,
49+
Verbosity: globalflags.VerbosityDefault,
50+
},
4151
}
4252
for _, mod := range mods {
4353
mod(model)
@@ -46,7 +56,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
4656
}
4757

4858
func fixtureRequest(mods ...func(request *iaas.ApiListQuotasRequest)) iaas.ApiListQuotasRequest {
49-
request := testClient.ListQuotas(testCtx, testProjectId)
59+
request := testClient.ListQuotas(testCtx, testProjectId, testRegion)
5060
for _, mod := range mods {
5161
mod(&request)
5262
}

0 commit comments

Comments
 (0)