From 8d32f26f2aa68d2844d5749194417ce5b7f73b34 Mon Sep 17 00:00:00 2001 From: jdesouza Date: Thu, 28 Dec 2023 15:52:51 -0300 Subject: [PATCH] Added tag prefix support for aws/cloud costs (#863) * Removed gcloud auth * Added tag prefix for cloud costs * Added tag prefix for cloud costs * Fixes * Fixes --- plugins/aws-costs/CHANGELOG.md | 3 +++ plugins/aws-costs/aws-costs.sh | 4 +++- plugins/aws-costs/version.txt | 2 +- plugins/cloud-costs/CHANGELOG.md | 3 +++ plugins/cloud-costs/cloud-costs.sh | 6 +++++- plugins/cloud-costs/version.txt | 2 +- 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/plugins/aws-costs/CHANGELOG.md b/plugins/aws-costs/CHANGELOG.md index c1509a0ee..601803acc 100644 --- a/plugins/aws-costs/CHANGELOG.md +++ b/plugins/aws-costs/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 1.4.0 +* Added tag prefix + ## 1.3.0 * Added new fields line_item_usage_amount, line_item_operation, product_product_family diff --git a/plugins/aws-costs/aws-costs.sh b/plugins/aws-costs/aws-costs.sh index b4725fd5b..fe2efa252 100755 --- a/plugins/aws-costs/aws-costs.sh +++ b/plugins/aws-costs/aws-costs.sh @@ -12,6 +12,7 @@ cat << EOF usage: awscosts \ --database \ --table \ + --tagprefix \ --tagkey \ --tagvalue \ --catalog \ @@ -24,6 +25,7 @@ EOF } tagkey='' +tagprefix='' tagvalue='' database='' table='' @@ -90,7 +92,7 @@ queryResults=$(aws athena start-query-execution \ FROM \ "$database"."$table" \ WHERE \ - resource_tags_user_$tagkey='$tagvalue' \ + $tagprefix$tagkey='$tagvalue' \ AND line_item_usage_end_date > timestamp '$initial_date_time' \ AND line_item_usage_end_date <= timestamp '$final_date_time' \ GROUP BY 1,2,4,5,6,7,8,11,12 diff --git a/plugins/aws-costs/version.txt b/plugins/aws-costs/version.txt index f0bb29e76..88c5fb891 100644 --- a/plugins/aws-costs/version.txt +++ b/plugins/aws-costs/version.txt @@ -1 +1 @@ -1.3.0 +1.4.0 diff --git a/plugins/cloud-costs/CHANGELOG.md b/plugins/cloud-costs/CHANGELOG.md index 332d2b510..a0f341374 100644 --- a/plugins/cloud-costs/CHANGELOG.md +++ b/plugins/cloud-costs/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 0.1.8 +* Added tag prefix + ## 0.1.7 * Removing --quiet option diff --git a/plugins/cloud-costs/cloud-costs.sh b/plugins/cloud-costs/cloud-costs.sh index 8f40f88a0..8218bebdb 100755 --- a/plugins/cloud-costs/cloud-costs.sh +++ b/plugins/cloud-costs/cloud-costs.sh @@ -11,6 +11,7 @@ usage() cat << EOF usage: cloud-costs \ --provider + --tagprefix \ --tagkey \ --tagvalue \ --database \ @@ -49,6 +50,9 @@ while [ ! $# -eq 0 ]; do provider) provider=${2} ;; + tagprefix) + tagkey=${2} + ;; tagkey) tagkey=${2} ;; @@ -116,7 +120,7 @@ if [[ "$provider" = "aws" ]]; then FROM \ "$database"."$table" \ WHERE \ - resource_tags_user_$tagkey='$tagvalue' \ + $tagprefix$tagkey='$tagvalue' \ AND line_item_usage_end_date > timestamp '$initial_date_time' \ AND line_item_usage_end_date <= timestamp '$final_date_time' \ GROUP BY 1,2,4,5,6,7,8,11,12 diff --git a/plugins/cloud-costs/version.txt b/plugins/cloud-costs/version.txt index a1e1395ac..84aa3a7dd 100644 --- a/plugins/cloud-costs/version.txt +++ b/plugins/cloud-costs/version.txt @@ -1 +1 @@ -0.1.7 \ No newline at end of file +0.1.8 \ No newline at end of file