add purchase resource in model catalog

This commit is contained in:
mr 2025-02-11 09:16:18 +01:00 committed by pb
parent 4aebb48e73
commit c53e25e69a
5 changed files with 5 additions and 6 deletions

View File

@ -148,9 +148,9 @@ func (r *PricedComputeResource) GetPrice() (float64, error) {
} }
if r.SelectedPricing == nil { if r.SelectedPricing == nil {
if len(r.PricingProfiles) == 0 { if len(r.PricingProfiles) == 0 {
return 0, errors.New("pricing profile must be set") return 0, errors.New("pricing profile must be set on Priced Compute" + r.ResourceID)
} }
*r.SelectedPricing = r.PricingProfiles[0] r.SelectedPricing = &r.PricingProfiles[0]
} }
pricing := *r.SelectedPricing pricing := *r.SelectedPricing
price := float64(0) price := float64(0)

View File

@ -164,7 +164,7 @@ func (r *PricedDataResource) GetPrice() (float64, error) {
if len(r.PricingProfiles) == 0 { if len(r.PricingProfiles) == 0 {
return 0, errors.New("pricing profile must be set on Priced Data" + r.ResourceID) return 0, errors.New("pricing profile must be set on Priced Data" + r.ResourceID)
} }
*r.SelectedPricing = r.PricingProfiles[0] r.SelectedPricing = &r.PricingProfiles[0]
} }
pricing := *r.SelectedPricing pricing := *r.SelectedPricing
var err error var err error

View File

@ -86,7 +86,7 @@ func (r *PricedResource) GetPrice() (float64, error) {
if len(r.PricingProfiles) == 0 { if len(r.PricingProfiles) == 0 {
return 0, errors.New("pricing profile must be set on Priced Resource " + r.ResourceID) return 0, errors.New("pricing profile must be set on Priced Resource " + r.ResourceID)
} }
*r.SelectedPricing = r.PricingProfiles[0] r.SelectedPricing = &r.PricingProfiles[0]
} }
pricing := *r.SelectedPricing pricing := *r.SelectedPricing
return pricing.GetPrice(1, 0, *r.UsageStart, *r.UsageEnd) return pricing.GetPrice(1, 0, *r.UsageStart, *r.UsageEnd)

View File

@ -182,7 +182,6 @@ func (ri *ResourcePartnerShip[T]) GetPricingsProfiles(peerID string, groups []st
} }
for _, p := range ri.PeerGroups[peerID] { for _, p := range ri.PeerGroups[peerID] {
if slices.Contains(groups, p) { if slices.Contains(groups, p) {
for _, ri := range ri.PricingProfiles { for _, ri := range ri.PricingProfiles {
profiles = append(profiles, ri) profiles = append(profiles, ri)
} }

View File

@ -175,7 +175,7 @@ func (r *PricedStorageResource) GetPrice() (float64, error) {
if len(r.PricingProfiles) == 0 { if len(r.PricingProfiles) == 0 {
return 0, errors.New("pricing profile must be set on Priced Storage" + r.ResourceID) return 0, errors.New("pricing profile must be set on Priced Storage" + r.ResourceID)
} }
*r.SelectedPricing = r.PricingProfiles[0] r.SelectedPricing = &r.PricingProfiles[0]
} }
pricing := *r.SelectedPricing pricing := *r.SelectedPricing
var err error var err error