add sets up
This commit is contained in:
@@ -30,12 +30,11 @@ func (r *ComputeResource) GetType() string {
|
||||
return tools.COMPUTE_RESOURCE.String()
|
||||
}
|
||||
|
||||
func (abs *ComputeResource) ConvertToPricedResource(
|
||||
t tools.DataType, request *tools.APIRequest, buyingStrategy int, pricingStrategy int) pricing.PricedItemITF {
|
||||
func (abs *ComputeResource) ConvertToPricedResource(t tools.DataType, request *tools.APIRequest) pricing.PricedItemITF {
|
||||
if t != tools.COMPUTE_RESOURCE {
|
||||
return nil
|
||||
}
|
||||
p := abs.AbstractInstanciatedResource.ConvertToPricedResource(t, request, buyingStrategy, pricingStrategy)
|
||||
p := abs.AbstractInstanciatedResource.ConvertToPricedResource(t, request)
|
||||
priced := p.(*PricedResource)
|
||||
return &PricedComputeResource{
|
||||
PricedResource: *priced,
|
||||
@@ -84,6 +83,10 @@ func (p *ComputeResourcePricingProfile) IsPurchasable() bool {
|
||||
return p.Pricing.BuyingStrategy != pricing.UNDEFINED_SUBSCRIPTION
|
||||
}
|
||||
|
||||
func (p *ComputeResourcePricingProfile) GetPurchase() pricing.BuyingStrategy {
|
||||
return p.Pricing.BuyingStrategy
|
||||
}
|
||||
|
||||
func (p *ComputeResourcePricingProfile) IsBooked() bool {
|
||||
if p.Pricing.BuyingStrategy == pricing.PERMANENT {
|
||||
p.Pricing.BuyingStrategy = pricing.SUBSCRIPTION
|
||||
@@ -159,10 +162,7 @@ func (r *PricedComputeResource) GetPrice() (float64, error) {
|
||||
r.UsageEnd = &add
|
||||
}
|
||||
if r.SelectedPricing == nil {
|
||||
if len(r.PricingProfiles) == 0 {
|
||||
return 0, errors.New("pricing profile must be set on Priced Compute" + r.ResourceID)
|
||||
}
|
||||
r.SelectedPricing = r.PricingProfiles[0]
|
||||
return 0, errors.New("pricing profile must be set on Priced Compute" + r.ResourceID)
|
||||
}
|
||||
pricing := r.SelectedPricing
|
||||
price := float64(0)
|
||||
|
||||
Reference in New Issue
Block a user