detectUsageBased returns (true, unit) when the dominant pricing unit is not time-based (i.e. not "Hrs"/"Hours"). It picks the unit from the first OnDemand entry, falling back to the first entry overall.
(entries []resources.PriceEntry)
| 624 | // time-based (i.e. not "Hrs"/"Hours"). It picks the unit from the first |
| 625 | // OnDemand entry, falling back to the first entry overall. |
| 626 | func detectUsageBased(entries []resources.PriceEntry) (bool, string) { |
| 627 | for _, e := range entries { |
| 628 | if e.IsCurrent { |
| 629 | return !isHourlyUnit(e.Unit), e.Unit |
| 630 | } |
| 631 | } |
| 632 | if len(entries) > 0 { |
| 633 | return !isHourlyUnit(entries[0].Unit), entries[0].Unit |
| 634 | } |
| 635 | return false, "" |
| 636 | } |
| 637 | |
| 638 | // resolveUsageQty returns the monthly quantity to use for a resource. |
| 639 | // Priority: usageMap (user-supplied) > rawType key > service/subLabel key > service key > global default. |
no test coverage detected