Skip to content

Commit

Permalink
Update SavingsplanNegation items
Browse files Browse the repository at this point in the history
  • Loading branch information
esebesto committed Aug 16, 2024
1 parent 1974bb0 commit bd7b67a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion nise/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "4.6.8"
__version__ = "4.6.9"


VERSION = __version__.split(".")
13 changes: 9 additions & 4 deletions nise/generators/aws/data_transfer_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,16 @@ def _update_data(self, row, start, end, **kwargs):
if negation:
row["lineItem/LineItemType"] = "SavingsPlanNegation"
row["lineItem/UnblendedCost"] = -abs(cost)
row["lineItem/LineItemDescription"] = f"SavingsPlanNegation used by AccountId : {self.payer_account}"
row["lineItem/ResourceId"] = None
row["lineItem/UnblendedRate"] = -abs(rate)
row["lineItem/BlendedCost"] = -abs(cost)

if not negation:
row["lineItem/BlendedRate"] = -abs(rate)
row[
"lineItem/LineItemDescription"
] = f"SavingsPlanNegation used by AccountId : {self.payer_account} and UsageSku : {self._product_sku}"
row["lineItem/ResourceId"] = None
row["savingsPlan/SavingsPlanEffectiveCost"] = None
row["savingsPlan/SavingsPlanRate"] = None
else:
self._add_tag_data(row)
self._add_category_data(row)
return row
Expand Down
15 changes: 12 additions & 3 deletions nise/generators/aws/ec2_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,20 +198,29 @@ def _update_data(self, row, start, end, **kwargs):
row["pricing/term"] = "OnDemand"
row["pricing/unit"] = "Hrs"
row["savingsPlan/SavingsPlanEffectiveCost"] = saving
row["savingsPlan/SavingsPlanRate"] = saving

# Overwrite lineItem/LineItemType for items with applied Savings plan
if saving is not None:
row["lineItem/LineItemType"] = "SavingsPlanCoveredUsage"

if negation:
row["lineItem/LineItemType"] = "SavingsPlanNegation"
row["lineItem/UnblendedCost"] = -abs(cost)
row["lineItem/LineItemDescription"] = f"SavingsPlanNegation used by AccountId : {self.payer_account}"
row["lineItem/ResourceId"] = None
row["lineItem/UnblendedRate"] = -abs(rate)
row["lineItem/BlendedCost"] = -abs(cost)
row["lineItem/BlendedRate"] = -abs(rate)
row[
"lineItem/LineItemDescription"
] = f"SavingsPlanNegation used by AccountId : {self.payer_account} and UsageSku : {self._product_sku}"
row["lineItem/ResourceId"] = None
row["savingsPlan/SavingsPlanEffectiveCost"] = None
row["savingsPlan/SavingsPlanRate"] = None

if not negation:
else:
self._add_tag_data(row)
self._add_category_data(row)

return row

def generate_data(self, report_type=None):
Expand Down

0 comments on commit bd7b67a

Please sign in to comment.