cid-cmd 0.3.2__tar.gz → 0.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cid_cmd-0.3.2/cid_cmd.egg-info → cid_cmd-0.3.4}/PKG-INFO +1 -1
- cid_cmd-0.3.4/cid/_version.py +1 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/summary_view.sql +4 -1
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/summary_view_ri.sql +4 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/summary_view_sp.sql +4 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/summary_view_sp_ri.sql +4 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cudos/hourly_view.sql +5 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cudos/hourly_view_ri.sql +5 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cudos/hourly_view_sp.sql +5 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cudos/hourly_view_sp_ri.sql +5 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cudos/resource_view.sql +5 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cudos/resource_view_ri.sql +5 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cudos/resource_view_sp.sql +5 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cudos/resource_view_sp_ri.sql +5 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/cli.py +1 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/common.py +11 -7
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/cur.py +5 -4
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/iam.py +20 -3
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/quicksight/__init__.py +1 -1
- {cid_cmd-0.3.2 → cid_cmd-0.3.4/cid_cmd.egg-info}/PKG-INFO +1 -1
- cid_cmd-0.3.2/cid/_version.py +0 -1
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/LICENSE +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/MANIFEST.in +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/README.md +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/__init__.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/base.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/__init__.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/__init__.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/cid/compute.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/cid/ec2_running_cost.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/cid/s3_view.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/cid/summary_view.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/co/dataset.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/cudos/hourly_view.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/cudos/resource_view.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/kpi/kpi_ebs_snap.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/kpi/kpi_ebs_storage_all.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/kpi/kpi_instance_all.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/kpi/kpi_s3_storage_all.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/kpi/kpi_tracker.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/shared/customer_all.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/tao/dataset.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/trends/daily_anomaly_detection.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/trends/monthly_anomaly_detection.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/trends/monthly_bill_by_account.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/permissions/dashboard_permissions.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/permissions/dashboard_permissions_namespace.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/permissions/data_set_permissions.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/permissions/data_source_permissions.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/permissions/folder_permissions.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/compute_savings_plan_eligible_spend.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/ec2_running_cost.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/ec2_running_cost_ri.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/ec2_running_cost_sp.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/ec2_running_cost_sp_ri.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/ri_sp_mapping.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/ri_sp_mapping_ri.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/ri_sp_mapping_sp.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/ri_sp_mapping_sp_ri.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/s3.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/co/all_options.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/co/auto_scale.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/co/auto_scale_options.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/co/ebs_volume.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/co/ebs_volume_options.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/co/ec2_instance.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/co/ec2_instance_options.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/co/lambda.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/co/lambda_options.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/first_kpi_instance_mapping_view.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/kpi_ebs_snap_view.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/kpi_ebs_storage_view.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/kpi_instance_all_view.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/kpi_instance_all_view_noRI.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/kpi_instance_all_view_noRISP.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/kpi_instance_all_view_noSP.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/kpi_s3_storage_view.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/last_kpi_tracker_view.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/account_map.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/account_map_dummy.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/aws_accounts.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/aws_regions.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/aws_service_category_map.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/business_units_map.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/cur.yaml +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/payer_account_name_map.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/ta_descriptions.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/tao/glue_table.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/tao/ta_org_view.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/trends/daily_anomaly_detection.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/trends/monthly_anomaly_detection.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/trends/monthly_bill_by_account.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/trends/monthly_bill_by_account_ri.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/trends/monthly_bill_by_account_sp.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/trends/monthly_bill_by_account_sp_ri.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/resources.yaml +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/commands/__init__.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/commands/command_base.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/commands/init_qs.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/exceptions.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/export.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/__init__.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/account_map.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/athena.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/csv2view.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/diff.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/glue.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/organizations.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/quicksight/dashboard.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/quicksight/dataset.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/quicksight/datasource.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/quicksight/resource.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/quicksight/template.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/randtime.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/s3.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/timezone.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/logger.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/plugin.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/test/python/test_csv2view.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/test/python/test_isolated_parameters.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/test/python/test_merge.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/utils.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid_cmd.egg-info/SOURCES.txt +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid_cmd.egg-info/dependency_links.txt +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid_cmd.egg-info/entry_points.txt +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid_cmd.egg-info/requires.txt +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid_cmd.egg-info/top_level.txt +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/pyproject.toml +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.4}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '0.3.4'
|
|
@@ -83,5 +83,8 @@
|
|
|
83
83
|
WHEN ("line_item_line_item_type" <> 'SavingsPlanNegation') THEN "pricing_public_on_demand_cost" ELSE 0 END) "public_cost"
|
|
84
84
|
FROM
|
|
85
85
|
"${cur_table_name}"
|
|
86
|
-
WHERE
|
|
86
|
+
WHERE
|
|
87
|
+
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH))
|
|
88
|
+
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH))
|
|
89
|
+
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
|
|
87
90
|
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,33,34
|
|
@@ -73,6 +73,8 @@
|
|
|
73
73
|
WHEN ("line_item_line_item_type" <> 'SavingsPlanNegation') THEN "pricing_public_on_demand_cost" ELSE 0 END) "public_cost"
|
|
74
74
|
FROM
|
|
75
75
|
"${cur_table_name}"
|
|
76
|
-
WHERE
|
|
77
|
-
|
|
76
|
+
WHERE
|
|
77
|
+
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH))
|
|
78
|
+
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH))
|
|
79
|
+
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
|
|
78
80
|
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,33,34
|
|
@@ -77,6 +77,8 @@
|
|
|
77
77
|
WHEN ("line_item_line_item_type" <> 'SavingsPlanNegation') THEN "pricing_public_on_demand_cost" ELSE 0 END) "public_cost"
|
|
78
78
|
FROM
|
|
79
79
|
"${cur_table_name}"
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
WHERE
|
|
81
|
+
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH))
|
|
82
|
+
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH))
|
|
83
|
+
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
|
|
82
84
|
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,33,34
|
|
@@ -73,6 +73,8 @@
|
|
|
73
73
|
WHEN ("line_item_line_item_type" <> 'SavingsPlanNegation') THEN "pricing_public_on_demand_cost" ELSE 0 END) "public_cost"
|
|
74
74
|
FROM
|
|
75
75
|
"${cur_table_name}"
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
WHERE
|
|
77
|
+
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH))
|
|
78
|
+
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH))
|
|
79
|
+
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
|
|
78
80
|
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
|
|
@@ -21,5 +21,8 @@ CREATE OR REPLACE VIEW hourly_view AS
|
|
|
21
21
|
, "sum"("line_item_usage_amount") "usage_quantity"
|
|
22
22
|
FROM
|
|
23
23
|
"${cur_table_name}"
|
|
24
|
-
WHERE
|
|
25
|
-
|
|
24
|
+
WHERE
|
|
25
|
+
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
|
|
26
|
+
AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage'))
|
|
27
|
+
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
|
|
28
|
+
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
|
|
@@ -21,5 +21,8 @@ CREATE OR REPLACE VIEW hourly_view AS
|
|
|
21
21
|
, "sum"("line_item_usage_amount") "usage_quantity"
|
|
22
22
|
FROM
|
|
23
23
|
"${cur_table_name}"
|
|
24
|
-
WHERE
|
|
25
|
-
|
|
24
|
+
WHERE
|
|
25
|
+
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
|
|
26
|
+
AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage'))
|
|
27
|
+
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
|
|
28
|
+
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
|
|
@@ -21,5 +21,8 @@ CREATE OR REPLACE VIEW hourly_view AS
|
|
|
21
21
|
, "sum"("line_item_usage_amount") "usage_quantity"
|
|
22
22
|
FROM
|
|
23
23
|
"${cur_table_name}"
|
|
24
|
-
WHERE
|
|
25
|
-
|
|
24
|
+
WHERE
|
|
25
|
+
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
|
|
26
|
+
AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage'))
|
|
27
|
+
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
|
|
28
|
+
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
|
|
@@ -21,5 +21,8 @@ CREATE OR REPLACE VIEW hourly_view AS
|
|
|
21
21
|
, "sum"("line_item_usage_amount") "usage_quantity"
|
|
22
22
|
FROM
|
|
23
23
|
"${cur_table_name}"
|
|
24
|
-
WHERE
|
|
25
|
-
|
|
24
|
+
WHERE
|
|
25
|
+
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
|
|
26
|
+
AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage'))
|
|
27
|
+
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
|
|
28
|
+
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
|
|
@@ -35,5 +35,8 @@ CREATE OR REPLACE VIEW resource_view AS
|
|
|
35
35
|
, "sum"("line_item_unblended_cost") unblended_cost
|
|
36
36
|
FROM
|
|
37
37
|
"${cur_table_name}"
|
|
38
|
-
WHERE
|
|
39
|
-
|
|
38
|
+
WHERE
|
|
39
|
+
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
|
|
40
|
+
AND (line_item_resource_id <> '')
|
|
41
|
+
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
|
|
42
|
+
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
|
|
@@ -35,5 +35,8 @@ CREATE OR REPLACE VIEW resource_view AS
|
|
|
35
35
|
, "sum"("line_item_unblended_cost") unblended_cost
|
|
36
36
|
FROM
|
|
37
37
|
"${cur_table_name}"
|
|
38
|
-
WHERE
|
|
39
|
-
|
|
38
|
+
WHERE
|
|
39
|
+
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
|
|
40
|
+
AND (line_item_resource_id <> '')
|
|
41
|
+
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
|
|
42
|
+
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
|
|
@@ -35,5 +35,8 @@ CREATE OR REPLACE VIEW resource_view AS
|
|
|
35
35
|
, "sum"("line_item_unblended_cost") unblended_cost
|
|
36
36
|
FROM
|
|
37
37
|
"${cur_table_name}"
|
|
38
|
-
WHERE
|
|
39
|
-
|
|
38
|
+
WHERE
|
|
39
|
+
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
|
|
40
|
+
AND (line_item_resource_id <> '')
|
|
41
|
+
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
|
|
42
|
+
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
|
|
@@ -35,5 +35,8 @@ CREATE OR REPLACE VIEW resource_view AS
|
|
|
35
35
|
, "sum"("line_item_unblended_cost") unblended_cost
|
|
36
36
|
FROM
|
|
37
37
|
"${cur_table_name}"
|
|
38
|
-
WHERE
|
|
39
|
-
|
|
38
|
+
WHERE
|
|
39
|
+
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
|
|
40
|
+
AND (line_item_resource_id <> '')
|
|
41
|
+
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
|
|
42
|
+
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
|
|
@@ -125,6 +125,7 @@ def deploy(ctx, **kwargs):
|
|
|
125
125
|
--cur-table-name TEXT CUR table name
|
|
126
126
|
--quicksight-datasource-id TEXT QuickSight Datasource ARN (if not found one with provided Athena workgroup)
|
|
127
127
|
--quicksight-datasource-role-arn TEXT IAM Role used for DataSource Creation (if not provided, will use the default QS Role). Must have access to Athena and S3 buckets.
|
|
128
|
+
--allow-buckets Comma separated list of buckets names to add to the default Cid QuickSight role
|
|
128
129
|
--quicksight-user TEXT QuickSight user
|
|
129
130
|
--dataset-{dataset_name}-id TEXT QuickSight dataset id for a specific dataset
|
|
130
131
|
--view-{view_name}-{parameter} TEXT a custom parameter for a view creation, can use variable: {account_id}
|
|
@@ -1300,11 +1300,11 @@ class Cid():
|
|
|
1300
1300
|
if not role_arn:
|
|
1301
1301
|
role_name = get_parameters().get('quicksight-datasource-role')
|
|
1302
1302
|
if role_name:
|
|
1303
|
-
role_arn =
|
|
1303
|
+
role_arn = self.iam.get_role_arn(role_name)
|
|
1304
1304
|
|
|
1305
1305
|
if not role_arn:
|
|
1306
1306
|
quicksight_trusted_roles = list(self.iam.iterate_role_names(search="Roles[?AssumeRolePolicyDocument.Statement[?Principal.Service=='quicksight.amazonaws.com']].RoleName"))
|
|
1307
|
-
|
|
1307
|
+
quicksight_trusted_roles = [role for role in quicksight_trusted_roles if role not in ('aws-quicksight-secretsmanager-role-v0')] # filter out irrelevant roles
|
|
1308
1308
|
# TODO: filter only roles with Athena and S3 policies
|
|
1309
1309
|
cid_role_name = 'CidCmdQuickSightDataSourceRole'
|
|
1310
1310
|
choices = quicksight_trusted_roles
|
|
@@ -1321,12 +1321,16 @@ class Cid():
|
|
|
1321
1321
|
default=default,
|
|
1322
1322
|
)
|
|
1323
1323
|
if "<ADD NEW ROLE>" in choice or choice == cid_role_name: # Create or update role
|
|
1324
|
-
# TODO:
|
|
1324
|
+
# TODO: get buckets from dashboard parameters
|
|
1325
1325
|
buckets = [
|
|
1326
1326
|
f'cid-{self.base.account_id}-share',
|
|
1327
1327
|
f'cid-data-{self.base.account_id}',
|
|
1328
1328
|
f'costoptimizationdata{self.base.account_id}',
|
|
1329
1329
|
]
|
|
1330
|
+
additional_buckets = get_parameters().get('allow-buckets')
|
|
1331
|
+
if additional_buckets:
|
|
1332
|
+
buckets += additional_buckets.split(',')
|
|
1333
|
+
|
|
1330
1334
|
role_name = self.iam.ensure_data_source_role_exists(
|
|
1331
1335
|
role_name=cid_role_name,
|
|
1332
1336
|
database=self.athena.DatabaseName,
|
|
@@ -1335,11 +1339,11 @@ class Cid():
|
|
|
1335
1339
|
output_location_bucket = self.athena.workgroup_output_location().split('/')[2],
|
|
1336
1340
|
)
|
|
1337
1341
|
cid_print(f'Role {role_name} was updated. https://console.aws.amazon.com/iam/home?#/roles/details/{role_name}')
|
|
1338
|
-
role_arn =
|
|
1339
|
-
elif 'USE DEFAULT QuickSight ROLE' in choice:
|
|
1342
|
+
role_arn = self.iam.get_role_arn(role_name)
|
|
1343
|
+
elif 'USE DEFAULT QuickSight ROLE' in choice or choice == 'default':
|
|
1340
1344
|
role_arn = None
|
|
1341
1345
|
else:
|
|
1342
|
-
role_arn = choice
|
|
1346
|
+
role_arn = self.iam.get_role_arn(choice)
|
|
1343
1347
|
|
|
1344
1348
|
athena_datasource = self.qs.create_data_source(
|
|
1345
1349
|
athena_workgroup=self.athena.WorkGroup,
|
|
@@ -1710,7 +1714,7 @@ class Cid():
|
|
|
1710
1714
|
)
|
|
1711
1715
|
|
|
1712
1716
|
if not crawler_role.startswith('arn:'):
|
|
1713
|
-
crawler_role_arn = f"arn:
|
|
1717
|
+
crawler_role_arn = f"arn:{self.base.partition}:iam::{self.base.account_id}:role/{crawler_role}"
|
|
1714
1718
|
else:
|
|
1715
1719
|
crawler_role_arn = crawler_role
|
|
1716
1720
|
params = {
|
|
@@ -4,7 +4,7 @@ import json
|
|
|
4
4
|
import logging
|
|
5
5
|
|
|
6
6
|
from cid.base import CidBase
|
|
7
|
-
from cid.utils import get_parameter, get_parameters
|
|
7
|
+
from cid.utils import get_parameter, get_parameters, cid_print
|
|
8
8
|
from cid.exceptions import CidCritical
|
|
9
9
|
|
|
10
10
|
logger = logging.getLogger(__name__)
|
|
@@ -135,8 +135,9 @@ class CUR(CidBase):
|
|
|
135
135
|
self.athena.query(f'ALTER TABLE {self.table_name} ADD COLUMNS ({column} {column_type})')
|
|
136
136
|
except (self.athena.client.exceptions.ClientError, CidCritical) as exc:
|
|
137
137
|
raise CidCritical(f'Column {column} is not found in CUR and we were unable to add it. Please check FAQ.') from exc
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
# table takes time to update so just adding column to cached data
|
|
139
|
+
self._metadata.get('Columns', []).append({'Name': column, 'Type': column_type})
|
|
140
|
+
cid_print(f"Column '{column}' was added to CUR ({self.table_name}).")
|
|
140
141
|
return
|
|
141
142
|
|
|
142
143
|
# if table cannot be updated, check if it is ri/sp case - let's hope dashboard views can handle it:
|
|
@@ -145,7 +146,7 @@ class CUR(CidBase):
|
|
|
145
146
|
return
|
|
146
147
|
|
|
147
148
|
# if a required column is not there and not ri/sp -> stop
|
|
148
|
-
logger.critical(f"Column '{column}' is not in ({self.table_name}). Cannot continue")
|
|
149
|
+
logger.critical(f"Column '{column}' is not in ({self.table_name}). Cannot continue.")
|
|
149
150
|
|
|
150
151
|
|
|
151
152
|
def table_is_cur(self, table: dict=None, name: str=None, return_reason: bool=False) -> bool:
|
|
@@ -8,7 +8,7 @@ import logging
|
|
|
8
8
|
import boto3
|
|
9
9
|
from tqdm import tqdm
|
|
10
10
|
|
|
11
|
-
from cid.exceptions import CidCritical
|
|
11
|
+
from cid.exceptions import CidCritical, CidError
|
|
12
12
|
from cid.base import CidBase
|
|
13
13
|
from cid.utils import get_parameter
|
|
14
14
|
|
|
@@ -61,13 +61,13 @@ class IAM(CidBase):
|
|
|
61
61
|
"Sid": "AllowListBucket",
|
|
62
62
|
"Effect": "Allow",
|
|
63
63
|
"Action": ["s3:ListBucket"],
|
|
64
|
-
"Resource": [f"arn:
|
|
64
|
+
"Resource": [f"arn:{self.partition}:s3:::{s3bucket}"]
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
"Sid": "AllowReadFromBucket",
|
|
68
68
|
"Effect": "Allow",
|
|
69
69
|
"Action": [ "s3:GetObject"],
|
|
70
|
-
"Resource": [f"arn:
|
|
70
|
+
"Resource": [f"arn:{self.partition}:s3:::{s3bucket}/*"]
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
73
|
"Sid": "AllowGlueActions",
|
|
@@ -151,6 +151,7 @@ class IAM(CidBase):
|
|
|
151
151
|
"glue:GetPartition",
|
|
152
152
|
"glue:GetPartitions",
|
|
153
153
|
"glue:GetDatabases",
|
|
154
|
+
"glue:GetDatabase",
|
|
154
155
|
"glue:GetTable",
|
|
155
156
|
"glue:GetTables",
|
|
156
157
|
],
|
|
@@ -323,6 +324,22 @@ class IAM(CidBase):
|
|
|
323
324
|
except self.client.exceptions.ClientError as exc:
|
|
324
325
|
logger.warning('Failed to read available IEM roles: {exc}. Most likely not fatal.')
|
|
325
326
|
|
|
327
|
+
def get_role_arn(self, role_name:str) -> str:
|
|
328
|
+
""" Get role arn, and try the best guess if no permissions
|
|
329
|
+
"""
|
|
330
|
+
try:
|
|
331
|
+
return self.client.get_role(RoleName=role_name)['Role']['Arn']
|
|
332
|
+
except self.client.exceptions.NoSuchEntityException:
|
|
333
|
+
raise CidError(f"Role '{role_name}' does not exist.")
|
|
334
|
+
except self.client.exceptions.ClientError as exc:
|
|
335
|
+
if "AccessDenied" in str(exc):
|
|
336
|
+
logger.debug('Got access denied for describing role. Try the best guess')
|
|
337
|
+
if role_name.startswith('aws-quicksight-service-role'):
|
|
338
|
+
return f'arn:aws:iam::{self.account_id}:role/service-role/{role_name}'
|
|
339
|
+
else:
|
|
340
|
+
return f'arn:aws:iam::{self.account_id}:role/{role_name}'
|
|
341
|
+
raise CidError(f"An error occurred: {exc}")
|
|
342
|
+
|
|
326
343
|
def ensure_role_does_not_exist(self, role_name):
|
|
327
344
|
""" Remove a role and all policies if they are not used in other roles
|
|
328
345
|
"""
|
|
@@ -1338,7 +1338,7 @@ class QuickSight(CidBase):
|
|
|
1338
1338
|
theme = definition.get('theme')
|
|
1339
1339
|
if theme:
|
|
1340
1340
|
if not theme.startswith('arn:'):
|
|
1341
|
-
theme_arn = 'arn:
|
|
1341
|
+
theme_arn = f'arn:{self.partition}:quicksight::aws:theme/' + theme
|
|
1342
1342
|
else:
|
|
1343
1343
|
raise NotImplementedError('Only standard themes are supported now.')
|
|
1344
1344
|
create_parameters['ThemeArn'] = theme_arn
|
cid_cmd-0.3.2/cid/_version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '0.3.2'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/trends/daily_anomaly_detection.json
RENAMED
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/trends/monthly_anomaly_detection.json
RENAMED
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/trends/monthly_bill_by_account.json
RENAMED
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/permissions/dashboard_permissions.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/permissions/data_source_permissions.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/ec2_running_cost_sp_ri.sql
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/kpi_instance_all_view_noRI.sql
RENAMED
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/kpi_instance_all_view_noRISP.sql
RENAMED
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/kpi_instance_all_view_noSP.sql
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/aws_service_category_map.sql
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/payer_account_name_map.sql
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/trends/daily_anomaly_detection.sql
RENAMED
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/trends/monthly_anomaly_detection.sql
RENAMED
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/trends/monthly_bill_by_account.sql
RENAMED
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/trends/monthly_bill_by_account_ri.sql
RENAMED
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/trends/monthly_bill_by_account_sp.sql
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|