src/bosh-softlayer-cpi/softlayer/client/client.go
func FindPerformanceIOPSPrice(productPackage datatypes.Product_Package, size int, iops int) (datatypes.Product_Item_Price, error) {
	for _, item := range productPackage.Items {
		if int(*item.Capacity) != int(iops) {
			continue
		}
		for _, price := range item.Prices {
			// Only collect prices from valid location groups.
			if price.LocationGroupId != nil {
				continue
			}
			if !hasCategory(price.Categories, "performance_storage_iops") {
				continue
			}
			min, err := strconv.Atoi(*price.CapacityRestrictionMinimum)
			if err != nil {
				return datatypes.Product_Item_Price{}, bosherr.Errorf("Unable to find price for %d iops for the given volume", iops)
			}
			if size < int(min) {
				continue
			}
			max, err := strconv.Atoi(*price.CapacityRestrictionMaximum)
			if err != nil {
				return datatypes.Product_Item_Price{}, bosherr.Errorf("Unable to find price for %d iops for the given volume", iops)
			}
			if size > int(max) {
				continue
			}
			return price, nil
		}
	}
	return datatypes.Product_Item_Price{}, bosherr.Errorf("Unable to find price for %d iops for the given volume", iops)
}
func FindPerformanceIOPSPrice(productPackage datatypes.Product_Package, size int, iops int) (datatypes.Product_Item_Price, error) {
	for _, item := range productPackage.Items {
		if int(*item.Capacity) != int(iops) {
			continue
		}
		for _, price := range item.Prices {
			// Only collect prices from valid location groups.
			if price.LocationGroupId != nil {
				continue
			}
			if !hasCategory(price.Categories, "performance_storage_iops") {
				continue
			}
			min, err := strconv.Atoi(*price.CapacityRestrictionMinimum)
			if err != nil {
				return datatypes.Product_Item_Price{}, bosherr.Errorf("Unable to find price for %d iops for the given volume", iops)
			}
			if size < int(min) {
				continue
			}
			max, err := strconv.Atoi(*price.CapacityRestrictionMaximum)
			if err != nil {
				return datatypes.Product_Item_Price{}, bosherr.Errorf("Unable to find price for %d iops for the given volume", iops)
			}
			if size > int(max) {
				continue
			}
			return price, nil
		}
	}
	return datatypes.Product_Item_Price{}, bosherr.Errorf("Unable to find price for %d iops for the given volume", iops)
}
func FindPerformanceIOPSPrice ( productPackage datatypes . Product_Package , size int , iops int ) ( datatypes . Product_Item_Price , error ) { for _ , item := range productPackage . Items { if int ( * item . Capacity ) != int ( iops ) { continue } for _ , price := range item . Prices { // Only collect prices from valid location groups. if price . LocationGroupId != nil { continue } if ! hasCategory ( price . Categories , " " ) { continue } min , err := strconv . Atoi ( * price . CapacityRestrictionMinimum ) if err != nil { return datatypes . Product_Item_Price { } , bosherr . Errorf ( " " , iops ) } if size < int ( min ) { continue } max , err := strconv . Atoi ( * price . CapacityRestrictionMaximum ) if err != nil { return datatypes . Product_Item_Price { } , bosherr . Errorf ( " " , iops ) } if size > int ( max ) { continue } return price , nil } } return datatypes . Product_Item_Price { } , bosherr . Errorf ( " " , iops ) }
// Find the price in the given package with the specified size and iops
Find the price in the given package with the specified size and iops