PricedItem evolved
This commit is contained in:
@@ -36,11 +36,11 @@ func (abs *ComputeResource) ConvertToPricedResource(t tools.DataType, selectedIn
|
||||
if t != tools.COMPUTE_RESOURCE {
|
||||
return nil, errors.New("not the proper type expected : cannot convert to priced resource : have " + t.String() + " wait Compute")
|
||||
}
|
||||
p, err := abs.AbstractInstanciatedResource.ConvertToPricedResource(t, selectedInstance, selectedPartnership, selectedBuyingStrategy, selectedStrategy, selectedBookingModeIndex, request)
|
||||
p, err := ConvertToPricedResource[*ComputeResourcePricingProfile](t, selectedInstance, selectedPartnership, selectedBuyingStrategy, selectedStrategy, selectedBookingModeIndex, abs, request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
priced := p.(*PricedResource)
|
||||
priced := p.(*PricedResource[*ComputeResourcePricingProfile])
|
||||
return &PricedComputeResource{
|
||||
PricedResource: *priced,
|
||||
}, nil
|
||||
@@ -122,7 +122,10 @@ func (p *ComputeResourcePricingProfile) GetPriceHT(amountOfData float64, explici
|
||||
return 0, errors.New("params must be set")
|
||||
}
|
||||
pp := float64(0)
|
||||
model := params[1]
|
||||
model := ""
|
||||
if len(params) > 1 {
|
||||
model = params[1]
|
||||
}
|
||||
if strings.Contains(params[0], "cpus") && len(params) > 1 {
|
||||
if _, ok := p.CPUsPrices[model]; ok {
|
||||
p.Pricing.Price = p.CPUsPrices[model]
|
||||
@@ -158,7 +161,7 @@ func (p *ComputeResourcePricingProfile) GetPriceHT(amountOfData float64, explici
|
||||
}
|
||||
|
||||
type PricedComputeResource struct {
|
||||
PricedResource
|
||||
PricedResource[*ComputeResourcePricingProfile]
|
||||
|
||||
CPUsLocated map[string]float64 `json:"cpus_in_use" bson:"cpus_in_use"` // CPUsInUse is the list of CPUs in use
|
||||
GPUsLocated map[string]float64 `json:"gpus_in_use" bson:"gpus_in_use"` // GPUsInUse is the list of GPUs in use
|
||||
|
||||
Reference in New Issue
Block a user