Skip to content

Commit

Permalink
revert map to common go set pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
parametalol committed Sep 12, 2023
1 parent 0e18ba5 commit f476c1b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/dinosaur/pkg/services/quota/ams_quota_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ func newBaseQuotaReservedResourceResourceBuilder() amsv1.ReservedResourceBuilder
return rr
}

var supportedAMSBillingModels = map[string]bool{
string(amsv1.BillingModelMarketplace): true,
string(amsv1.BillingModelStandard): true,
string(amsv1.BillingModelMarketplaceAWS): true,
var supportedAMSBillingModels = map[string]struct{}{
string(amsv1.BillingModelMarketplace): struct{}{},
string(amsv1.BillingModelStandard): struct{}{},
string(amsv1.BillingModelMarketplaceAWS): struct{}{},
}

// CheckIfQuotaIsDefinedForInstanceType ...
Expand Down Expand Up @@ -71,7 +71,7 @@ func (q amsQuotaService) hasConfiguredQuotaCost(organizationID string, quotaType
for _, qc := range quotaCosts {
if qc.Allowed() > 0 {
for _, rr := range qc.RelatedResources() {
if supportedAMSBillingModels[rr.BillingModel()] {
if _, isCompatibleBillingModel := supportedAMSBillingModels[rr.BillingModel()]; isCompatibleBillingModel {
return true, nil
}
foundUnsupportedBillingModel = rr.BillingModel()
Expand Down Expand Up @@ -226,7 +226,7 @@ func mapAllowedQuotaCosts(quotaCosts []*amsv1.QuotaCost) (map[amsv1.BillingModel
}
for _, rr := range qc.RelatedResources() {
bm := amsv1.BillingModel(rr.BillingModel())
if supportedAMSBillingModels[rr.BillingModel()] {
if _, isCompatibleBillingModel := supportedAMSBillingModels[rr.BillingModel()]; isCompatibleBillingModel {
costsMap[bm] = append(costsMap[bm], qc)
} else {
foundUnsupportedBillingModel = rr.BillingModel()
Expand Down

0 comments on commit f476c1b

Please sign in to comment.