@@ -16,7 +16,12 @@ import (
1616 "github.com/stackitcloud/stackit-sdk-go/services/iaas"
1717)
1818
19- var projectIdFlag = globalflags .ProjectIdFlag
19+ const (
20+ projectIdFlag = globalflags .ProjectIdFlag
21+ regionFlag = globalflags .RegionFlag
22+
23+ testRegion = "eu01"
24+ )
2025
2126type testCtxKey struct {}
2227
@@ -29,7 +34,9 @@ var testRemoteSecurityGroupId = uuid.NewString()
2934
3035func fixtureFlagValues (mods ... func (flagValues map [string ]string )) map [string ]string {
3136 flagValues := map [string ]string {
32- projectIdFlag : testProjectId ,
37+ projectIdFlag : testProjectId ,
38+ regionFlag : testRegion ,
39+
3340 securityGroupIdFlag : testSecurityGroupId ,
3441 directionFlag : "ingress" ,
3542 descriptionFlag : "example-description" ,
@@ -53,6 +60,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
5360 model := & inputModel {
5461 GlobalFlagModel : & globalflags.GlobalFlagModel {
5562 ProjectId : testProjectId ,
63+ Region : testRegion ,
5664 Verbosity : globalflags .VerbosityDefault ,
5765 },
5866 SecurityGroupId : testSecurityGroupId ,
@@ -75,7 +83,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
7583}
7684
7785func fixtureRequest (mods ... func (request * iaas.ApiCreateSecurityGroupRuleRequest )) iaas.ApiCreateSecurityGroupRuleRequest {
78- request := testClient .CreateSecurityGroupRule (testCtx , testProjectId , testSecurityGroupId )
86+ request := testClient .CreateSecurityGroupRule (testCtx , testProjectId , testRegion , testSecurityGroupId )
7987 request = request .CreateSecurityGroupRulePayload (fixturePayload ())
8088 for _ , mod := range mods {
8189 mod (& request )
@@ -84,7 +92,7 @@ func fixtureRequest(mods ...func(request *iaas.ApiCreateSecurityGroupRuleRequest
8492}
8593
8694func fixtureRequiredRequest (mods ... func (request * iaas.ApiCreateSecurityGroupRuleRequest )) iaas.ApiCreateSecurityGroupRuleRequest {
87- request := testClient .CreateSecurityGroupRule (testCtx , testProjectId , testSecurityGroupId )
95+ request := testClient .CreateSecurityGroupRule (testCtx , testProjectId , testRegion , testSecurityGroupId )
8896 request = request .CreateSecurityGroupRulePayload (iaas.CreateSecurityGroupRulePayload {
8997 Direction : utils .Ptr ("ingress" ),
9098 })
@@ -267,6 +275,7 @@ func TestBuildRequest(t *testing.T) {
267275 model : & inputModel {
268276 GlobalFlagModel : & globalflags.GlobalFlagModel {
269277 ProjectId : testProjectId ,
278+ Region : testRegion ,
270279 Verbosity : globalflags .VerbosityDefault ,
271280 },
272281 Direction : utils .Ptr ("ingress" ),
0 commit comments