Skip to content

Commit

Permalink
minor renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-degtiarenko committed Dec 6, 2022
1 parent 9028ff3 commit 1ee67b0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions internal/dinosaur/pkg/services/quota/ams_quota_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,29 +98,29 @@ func (q amsQuotaService) selectBillingModelFromDinosaurInstanceType(orgID, cloud
return "", errors.InsufficientQuotaError("%v: error getting quotas for product %s", err, instanceType.GetQuotaType().GetProduct())
}

hasGenericMarketplace := false
hasMarketplaceAWS := false
hasStandardMarketplace := false
hasBillingModelMarketplace := false
hasBillingModelMarketplaceAWS := false
hasBillingModelStandard := false
for _, qc := range quotaCosts {
for _, rr := range qc.RelatedResources() {
if qc.Consumed() < qc.Allowed() || rr.Cost() == 0 {
hasGenericMarketplace = hasGenericMarketplace || rr.BillingModel() == string(amsv1.BillingModelMarketplace)
hasMarketplaceAWS = hasMarketplaceAWS || rr.BillingModel() == string(amsv1.BillingModelMarketplaceAWS)
hasStandardMarketplace = hasStandardMarketplace || rr.BillingModel() == string(amsv1.BillingModelStandard)
hasBillingModelMarketplace = hasBillingModelMarketplace || rr.BillingModel() == string(amsv1.BillingModelMarketplace)
hasBillingModelMarketplaceAWS = hasBillingModelMarketplaceAWS || rr.BillingModel() == string(amsv1.BillingModelMarketplaceAWS)
hasBillingModelStandard = hasBillingModelStandard || rr.BillingModel() == string(amsv1.BillingModelStandard)
}
}
}

if cloudAccountID != "" && cloudProviderID == awsCloudProvider {
if hasMarketplaceAWS || hasGenericMarketplace {
if hasBillingModelMarketplaceAWS || hasBillingModelMarketplace {
return string(amsv1.BillingModelMarketplaceAWS), nil
}
return "", errors.InvalidCloudAccountID("No subscription available for cloud account %s", cloudAccountID)
}
if hasGenericMarketplace {
if hasBillingModelMarketplace {
return string(amsv1.BillingModelMarketplace), nil
}
if hasStandardMarketplace {
if hasBillingModelStandard {
return string(amsv1.BillingModelStandard), nil
}
return "", errors.InsufficientQuotaError("No available billing model found")
Expand Down

0 comments on commit 1ee67b0

Please sign in to comment.