Skip to content

Commit df407a9

Browse files
authored
CLOUDP-352102: Make dedicated tags package (#2959)
Signed-off-by: jose.vazquez <[email protected]>
1 parent 4e1c83c commit df407a9

File tree

8 files changed

+54
-54
lines changed

8 files changed

+54
-54
lines changed

test/helper/cloud/aws/vpc.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"github.com/aws/aws-sdk-go-v2/service/ec2"
2424
"github.com/aws/aws-sdk-go-v2/service/ec2/types"
2525

26-
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"
26+
"github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper/tags"
2727
)
2828

2929
func CreateVPC(ctx context.Context, name, cidr, region string) (string, error) {
@@ -43,9 +43,9 @@ func CreateVPC(ctx context.Context, name, cidr, region string) (string, error) {
4343
ResourceType: types.ResourceTypeVpc,
4444
Tags: []types.Tag{
4545
{Key: aws.String("Name"), Value: aws.String(name)},
46-
{Key: aws.String(taghelper.OwnerEmailTag), Value: aws.String(taghelper.AKOEmail)},
47-
{Key: aws.String(taghelper.CostCenterTag), Value: aws.String(taghelper.AKOCostCenter)},
48-
{Key: aws.String(taghelper.EnvironmentTag), Value: aws.String(taghelper.AKOEnvTest)},
46+
{Key: aws.String(tags.OwnerEmailTag), Value: aws.String(tags.AKOEmail)},
47+
{Key: aws.String(tags.CostCenterTag), Value: aws.String(tags.AKOCostCenter)},
48+
{Key: aws.String(tags.EnvironmentTag), Value: aws.String(tags.AKOEnvTest)},
4949
},
5050
}},
5151
})

test/helper/cloud/azure/vpc.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2"
2323

2424
"github.com/mongodb/mongodb-atlas-kubernetes/v2/internal/pointer"
25-
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"
25+
"github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper/tags"
2626
)
2727

2828
func CreateVPC(ctx context.Context, vpcName, cidr, region string) (string, error) {
@@ -46,10 +46,10 @@ func CreateVPC(ctx context.Context, vpcName, cidr, region string) (string, error
4646
},
4747
},
4848
Tags: map[string]*string{
49-
"Name": pointer.MakePtr(vpcName),
50-
taghelper.OwnerEmailTag: pointer.MakePtr(taghelper.AKOEmail),
51-
taghelper.CostCenterTag: pointer.MakePtr(taghelper.AKOCostCenter),
52-
taghelper.EnvironmentTag: pointer.MakePtr(taghelper.AKOEnvTest),
49+
"Name": pointer.MakePtr(vpcName),
50+
tags.OwnerEmailTag: pointer.MakePtr(tags.AKOEmail),
51+
tags.CostCenterTag: pointer.MakePtr(tags.AKOCostCenter),
52+
tags.EnvironmentTag: pointer.MakePtr(tags.AKOEnvTest),
5353
},
5454
},
5555
nil,

test/helper/e2e/actions/cloud/aws.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import (
3535
. "github.com/onsi/gomega"
3636

3737
"github.com/mongodb/mongodb-atlas-kubernetes/v2/internal/pointer"
38-
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"
38+
"github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper/tags"
3939
)
4040

4141
type AwsAction struct {
@@ -91,10 +91,10 @@ func (a *AwsAction) CreateKMS(ctx context.Context, alias, region, atlasAccountAr
9191
Origin: kmstypes.OriginTypeAwsKms,
9292
Policy: aws.String(policyString),
9393
Tags: []kmstypes.Tag{
94-
{TagKey: aws.String(taghelper.OwnerTag), TagValue: aws.String(taghelper.AKOTeam)},
95-
{TagKey: aws.String(taghelper.OwnerEmailTag), TagValue: aws.String(taghelper.AKOEmail)},
96-
{TagKey: aws.String(taghelper.CostCenterTag), TagValue: aws.String(taghelper.AKOCostCenter)},
97-
{TagKey: aws.String(taghelper.EnvironmentTag), TagValue: aws.String(taghelper.AKOEnvTest)},
94+
{TagKey: aws.String(tags.OwnerTag), TagValue: aws.String(tags.AKOTeam)},
95+
{TagKey: aws.String(tags.OwnerEmailTag), TagValue: aws.String(tags.AKOEmail)},
96+
{TagKey: aws.String(tags.CostCenterTag), TagValue: aws.String(tags.AKOCostCenter)},
97+
{TagKey: aws.String(tags.EnvironmentTag), TagValue: aws.String(tags.AKOEnvTest)},
9898
},
9999
})
100100

@@ -406,10 +406,10 @@ func (a *AwsAction) createVPC(ctx context.Context, name, cidr, region string) (s
406406
ResourceType: ec2types.ResourceTypeVpc,
407407
Tags: []ec2types.Tag{
408408
{Key: aws.String("Name"), Value: aws.String(name)},
409-
{Key: aws.String(taghelper.OwnerTag), Value: aws.String(taghelper.AKOTeam)},
410-
{Key: aws.String(taghelper.OwnerEmailTag), Value: aws.String(taghelper.AKOEmail)},
411-
{Key: aws.String(taghelper.CostCenterTag), Value: aws.String(taghelper.AKOCostCenter)},
412-
{Key: aws.String(taghelper.EnvironmentTag), Value: aws.String(taghelper.AKOEnvTest)},
409+
{Key: aws.String(tags.OwnerTag), Value: aws.String(tags.AKOTeam)},
410+
{Key: aws.String(tags.OwnerEmailTag), Value: aws.String(tags.AKOEmail)},
411+
{Key: aws.String(tags.CostCenterTag), Value: aws.String(tags.AKOCostCenter)},
412+
{Key: aws.String(tags.EnvironmentTag), Value: aws.String(tags.AKOEnvTest)},
413413
},
414414
}},
415415
}
@@ -486,10 +486,10 @@ func (a *AwsAction) createSubnet(ctx context.Context, vpcID, name, cidr, region,
486486
ResourceType: ec2types.ResourceTypeSubnet,
487487
Tags: []ec2types.Tag{
488488
{Key: aws.String("Name"), Value: aws.String(name)},
489-
{Key: aws.String(taghelper.OwnerTag), Value: aws.String(taghelper.AKOTeam)},
490-
{Key: aws.String(taghelper.OwnerEmailTag), Value: aws.String(taghelper.AKOEmail)},
491-
{Key: aws.String(taghelper.CostCenterTag), Value: aws.String(taghelper.AKOCostCenter)},
492-
{Key: aws.String(taghelper.EnvironmentTag), Value: aws.String(taghelper.AKOEnvTest)},
489+
{Key: aws.String(tags.OwnerTag), Value: aws.String(tags.AKOTeam)},
490+
{Key: aws.String(tags.OwnerEmailTag), Value: aws.String(tags.AKOEmail)},
491+
{Key: aws.String(tags.CostCenterTag), Value: aws.String(tags.AKOCostCenter)},
492+
{Key: aws.String(tags.EnvironmentTag), Value: aws.String(tags.AKOEnvTest)},
493493
},
494494
}},
495495
VpcId: aws.String(vpcID),

test/helper/e2e/actions/cloud/azure.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"github.com/onsi/ginkgo/v2/dsl/core"
2727

2828
"github.com/mongodb/mongodb-atlas-kubernetes/v2/internal/pointer"
29-
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"
29+
"github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper/tags"
3030
)
3131

3232
const (
@@ -143,9 +143,9 @@ func (a *AzureAction) CreatePrivateEndpoint(vpcName, subnetName, endpointName, s
143143
},
144144
},
145145
Tags: map[string]*string{
146-
taghelper.OwnerEmailTag: pointer.MakePtr(taghelper.AKOEmail),
147-
taghelper.CostCenterTag: pointer.MakePtr(taghelper.AKOCostCenter),
148-
taghelper.EnvironmentTag: pointer.MakePtr(taghelper.AKOEnvTest),
146+
tags.OwnerEmailTag: pointer.MakePtr(tags.AKOEmail),
147+
tags.CostCenterTag: pointer.MakePtr(tags.AKOCostCenter),
148+
tags.EnvironmentTag: pointer.MakePtr(tags.AKOEnvTest),
149149
},
150150
},
151151
nil,
@@ -252,10 +252,10 @@ func (a *AzureAction) createVpcWithSubnets(ctx context.Context, vpcName, cidr, r
252252
Subnets: subnetsSpec,
253253
},
254254
Tags: map[string]*string{
255-
"Name": pointer.MakePtr(vpcName),
256-
taghelper.OwnerEmailTag: pointer.MakePtr(taghelper.AKOEmail),
257-
taghelper.CostCenterTag: pointer.MakePtr(taghelper.AKOCostCenter),
258-
taghelper.EnvironmentTag: pointer.MakePtr(taghelper.AKOEnvTest),
255+
"Name": pointer.MakePtr(vpcName),
256+
tags.OwnerEmailTag: pointer.MakePtr(tags.AKOEmail),
257+
tags.CostCenterTag: pointer.MakePtr(tags.AKOCostCenter),
258+
tags.EnvironmentTag: pointer.MakePtr(tags.AKOEnvTest),
259259
},
260260
},
261261
nil,
@@ -431,9 +431,9 @@ func (a *AzureAction) CreateKeyVault(keyName string) (string, error) {
431431
Kty: pointer.MakePtr(armkeyvault.JSONWebKeyTypeRSA),
432432
},
433433
Tags: map[string]*string{
434-
taghelper.OwnerEmailTag: pointer.MakePtr(taghelper.AKOEmail),
435-
taghelper.CostCenterTag: pointer.MakePtr(taghelper.AKOCostCenter),
436-
taghelper.EnvironmentTag: pointer.MakePtr(taghelper.AKOEnvTest),
434+
tags.OwnerEmailTag: pointer.MakePtr(tags.AKOEmail),
435+
tags.CostCenterTag: pointer.MakePtr(tags.AKOCostCenter),
436+
tags.EnvironmentTag: pointer.MakePtr(tags.AKOEnvTest),
437437
},
438438
}
439439

test/helper/e2e/actions/cloudaccess/aws_roles.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"github.com/aws/aws-sdk-go-v2/service/iam"
2626
"github.com/aws/aws-sdk-go-v2/service/iam/types"
2727

28-
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"
28+
"github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper/tags"
2929
)
3030

3131
type AssumeRolePolicyDocument struct {
@@ -113,10 +113,10 @@ func CreateAWSIAMRole(ctx context.Context, roleName string) (string, error) {
113113
AssumeRolePolicyDocument: &policy,
114114
}
115115
roleInput.Tags = []types.Tag{
116-
{Key: aws.String(taghelper.OwnerTag), Value: aws.String(taghelper.AKOTeam)},
117-
{Key: aws.String(taghelper.OwnerEmailTag), Value: aws.String(taghelper.AKOEmail)},
118-
{Key: aws.String(taghelper.CostCenterTag), Value: aws.String(taghelper.AKOCostCenter)},
119-
{Key: aws.String(taghelper.EnvironmentTag), Value: aws.String(taghelper.AKOEnvTest)},
116+
{Key: aws.String(tags.OwnerTag), Value: aws.String(tags.AKOTeam)},
117+
{Key: aws.String(tags.OwnerEmailTag), Value: aws.String(tags.AKOEmail)},
118+
{Key: aws.String(tags.CostCenterTag), Value: aws.String(tags.AKOCostCenter)},
119+
{Key: aws.String(tags.EnvironmentTag), Value: aws.String(tags.AKOEnvTest)},
120120
}
121121
role, err := IAMClient.CreateRole(ctx, &roleInput)
122122
if err != nil {

test/helper/e2e/api/aws/aws_resources_generator.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
s3types "github.com/aws/aws-sdk-go-v2/service/s3/types"
2828
"github.com/onsi/ginkgo/v2"
2929

30-
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"
30+
"github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper/tags"
3131
)
3232

3333
type AwsResourcesGenerator struct {
@@ -110,10 +110,10 @@ func (g *AwsResourcesGenerator) CreatePolicy(ctx context.Context, name string, p
110110
PolicyDocument: policy(),
111111
PolicyName: aws.String(name),
112112
Tags: []iamtypes.Tag{
113-
{Key: aws.String(taghelper.OwnerTag), Value: aws.String(taghelper.AKOTeam)},
114-
{Key: aws.String(taghelper.OwnerEmailTag), Value: aws.String(taghelper.AKOEmail)},
115-
{Key: aws.String(taghelper.CostCenterTag), Value: aws.String(taghelper.AKOCostCenter)},
116-
{Key: aws.String(taghelper.EnvironmentTag), Value: aws.String(taghelper.AKOEnvTest)},
113+
{Key: aws.String(tags.OwnerTag), Value: aws.String(tags.AKOTeam)},
114+
{Key: aws.String(tags.OwnerEmailTag), Value: aws.String(tags.AKOEmail)},
115+
{Key: aws.String(tags.CostCenterTag), Value: aws.String(tags.AKOCostCenter)},
116+
{Key: aws.String(tags.EnvironmentTag), Value: aws.String(tags.AKOEnvTest)},
117117
},
118118
}
119119

@@ -196,10 +196,10 @@ func (g *AwsResourcesGenerator) CreateBucket(ctx context.Context, name string) e
196196

197197
tagSet := &s3types.Tagging{
198198
TagSet: []s3types.Tag{
199-
{Key: aws.String(taghelper.OwnerTag), Value: aws.String(taghelper.AKOTeam)},
200-
{Key: aws.String(taghelper.OwnerEmailTag), Value: aws.String(taghelper.AKOEmail)},
201-
{Key: aws.String(taghelper.CostCenterTag), Value: aws.String(taghelper.AKOCostCenter)},
202-
{Key: aws.String(taghelper.EnvironmentTag), Value: aws.String(taghelper.AKOEnvTest)},
199+
{Key: aws.String(tags.OwnerTag), Value: aws.String(tags.AKOTeam)},
200+
{Key: aws.String(tags.OwnerEmailTag), Value: aws.String(tags.AKOEmail)},
201+
{Key: aws.String(tags.CostCenterTag), Value: aws.String(tags.AKOCostCenter)},
202+
{Key: aws.String(tags.EnvironmentTag), Value: aws.String(tags.AKOEnvTest)},
203203
},
204204
}
205205

test/helper/e2e/api/azure/azure.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import (
2727
"github.com/Azure/go-autorest/autorest/to"
2828

2929
"github.com/mongodb/mongodb-atlas-kubernetes/v2/internal/pointer"
30-
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"
3130
"github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper/e2e/config"
31+
"github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper/tags"
3232
)
3333

3434
// AZURE_CLIENT_ID id of an Azure Active Directory application
@@ -65,11 +65,11 @@ func SessionAzure(subscriptionID string, tagNameValue string) (sessionAzure, err
6565
SubscriptionID: subscriptionID,
6666
Authorizer: authorizer,
6767
Tags: map[string]*string{
68-
"name": to.StringPtr(tagNameValue),
69-
config.TagForTestKey: to.StringPtr(config.TagForTestValue),
70-
taghelper.OwnerEmailTag: pointer.MakePtr(taghelper.AKOEmail),
71-
taghelper.CostCenterTag: pointer.MakePtr(taghelper.AKOCostCenter),
72-
taghelper.EnvironmentTag: pointer.MakePtr(taghelper.AKOEnvTest),
68+
"name": to.StringPtr(tagNameValue),
69+
config.TagForTestKey: to.StringPtr(config.TagForTestValue),
70+
tags.OwnerEmailTag: pointer.MakePtr(tags.AKOEmail),
71+
tags.CostCenterTag: pointer.MakePtr(tags.AKOCostCenter),
72+
tags.EnvironmentTag: pointer.MakePtr(tags.AKOEnvTest),
7373
},
7474
}, nil
7575
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package helper
15+
package tags
1616

1717
const (
1818
OwnerTag = "Owner"

0 commit comments

Comments
 (0)