cid-cmd 0.3.2__tar.gz → 0.3.8__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.8}/PKG-INFO +1 -1
- cid_cmd-0.3.8/cid/_version.py +1 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cid/summary_view.sql +4 -1
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cid/summary_view_ri.sql +4 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cid/summary_view_sp.sql +4 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cid/summary_view_sp_ri.sql +4 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cudos/hourly_view.sql +5 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cudos/hourly_view_ri.sql +5 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cudos/hourly_view_sp.sql +5 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cudos/hourly_view_sp_ri.sql +5 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cudos/resource_view.sql +5 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cudos/resource_view_ri.sql +5 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cudos/resource_view_sp.sql +5 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cudos/resource_view_sp_ri.sql +5 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/cli.py +8 -4
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/common.py +28 -14
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/helpers/athena.py +18 -19
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/helpers/cur.py +7 -4
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/helpers/iam.py +25 -8
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/helpers/quicksight/__init__.py +2 -2
- {cid_cmd-0.3.2 → cid_cmd-0.3.8/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.8}/LICENSE +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/MANIFEST.in +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/README.md +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/__init__.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/base.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/__init__.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/__init__.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/datasets/cid/compute.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/datasets/cid/ec2_running_cost.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/datasets/cid/s3_view.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/datasets/cid/summary_view.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/datasets/co/dataset.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/datasets/cudos/hourly_view.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/datasets/cudos/resource_view.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/datasets/kpi/kpi_ebs_snap.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/datasets/kpi/kpi_ebs_storage_all.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/datasets/kpi/kpi_instance_all.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/datasets/kpi/kpi_s3_storage_all.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/datasets/kpi/kpi_tracker.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/datasets/shared/customer_all.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/datasets/tao/dataset.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/datasets/trends/daily_anomaly_detection.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/datasets/trends/monthly_anomaly_detection.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/datasets/trends/monthly_bill_by_account.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/permissions/dashboard_permissions.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/permissions/dashboard_permissions_namespace.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/permissions/data_set_permissions.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/permissions/data_source_permissions.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/permissions/folder_permissions.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cid/compute_savings_plan_eligible_spend.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cid/ec2_running_cost.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cid/ec2_running_cost_ri.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cid/ec2_running_cost_sp.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cid/ec2_running_cost_sp_ri.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cid/ri_sp_mapping.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cid/ri_sp_mapping_ri.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cid/ri_sp_mapping_sp.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cid/ri_sp_mapping_sp_ri.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/cid/s3.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/co/all_options.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/co/auto_scale.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/co/auto_scale_options.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/co/ebs_volume.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/co/ebs_volume_options.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/co/ec2_instance.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/co/ec2_instance_options.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/co/lambda.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/co/lambda_options.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/kpi/first_kpi_instance_mapping_view.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/kpi/kpi_ebs_snap_view.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/kpi/kpi_ebs_storage_view.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/kpi/kpi_instance_all_view.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/kpi/kpi_instance_all_view_noRI.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/kpi/kpi_instance_all_view_noRISP.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/kpi/kpi_instance_all_view_noSP.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/kpi/kpi_s3_storage_view.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/kpi/last_kpi_tracker_view.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/shared/account_map.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/shared/account_map_dummy.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/shared/aws_accounts.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/shared/aws_regions.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/shared/aws_service_category_map.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/shared/business_units_map.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/shared/cur.yaml +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/shared/payer_account_name_map.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/shared/ta_descriptions.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/tao/glue_table.json +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/tao/ta_org_view.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/trends/daily_anomaly_detection.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/trends/monthly_anomaly_detection.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/trends/monthly_bill_by_account.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/trends/monthly_bill_by_account_ri.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/trends/monthly_bill_by_account_sp.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/trends/monthly_bill_by_account_sp_ri.sql +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/resources.yaml +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/commands/__init__.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/commands/command_base.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/commands/init_qs.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/exceptions.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/export.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/helpers/__init__.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/helpers/account_map.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/helpers/csv2view.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/helpers/diff.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/helpers/glue.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/helpers/organizations.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/helpers/quicksight/dashboard.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/helpers/quicksight/dataset.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/helpers/quicksight/datasource.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/helpers/quicksight/resource.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/helpers/quicksight/template.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/helpers/randtime.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/helpers/s3.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/helpers/timezone.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/logger.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/plugin.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/test/python/test_csv2view.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/test/python/test_isolated_parameters.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/test/python/test_merge.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/utils.py +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid_cmd.egg-info/SOURCES.txt +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid_cmd.egg-info/dependency_links.txt +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid_cmd.egg-info/entry_points.txt +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid_cmd.egg-info/requires.txt +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid_cmd.egg-info/top_level.txt +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/pyproject.toml +0 -0
- {cid_cmd-0.3.2 → cid_cmd-0.3.8}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '0.3.8'
|
|
@@ -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
|
|
@@ -26,10 +26,12 @@ def cid_command(func):
|
|
|
26
26
|
if len(ctx.args) % 2 != 0:
|
|
27
27
|
print(f"Unknown extra argument, or an option without value {ctx.args}")
|
|
28
28
|
exit(-1)
|
|
29
|
+
params = {}
|
|
29
30
|
for i in range(0, len(ctx.args), 2):
|
|
30
|
-
|
|
31
|
+
key = ctx.args[i][2:].replace('-', '_')
|
|
32
|
+
params[key] = ctx.args[i+1]
|
|
33
|
+
set_parameters(params, all_yes=ctx.obj.all_yes)
|
|
31
34
|
|
|
32
|
-
set_parameters(kwargs, all_yes=ctx.obj.all_yes)
|
|
33
35
|
res = None
|
|
34
36
|
try:
|
|
35
37
|
res = func(ctx, **kwargs)
|
|
@@ -59,7 +61,7 @@ def cid_command(func):
|
|
|
59
61
|
|
|
60
62
|
@click.group()
|
|
61
63
|
@click.option('--profile_name', '--profile', help='AWS Profile name to use', default=None)
|
|
62
|
-
@click.option('--region_name', help="AWS Region
|
|
64
|
+
@click.option('--region_name', help="AWS Region", default=None)
|
|
63
65
|
@click.option('--aws_access_key_id', help='', default=None)
|
|
64
66
|
@click.option('--aws_secret_access_key', help='', default=None)
|
|
65
67
|
@click.option('--aws_session_token', help='', default=None)
|
|
@@ -75,7 +77,6 @@ def main(ctx, **kwargs):
|
|
|
75
77
|
|
|
76
78
|
ctx.obj = Cid(**kwargs)
|
|
77
79
|
|
|
78
|
-
|
|
79
80
|
@click.option('-v', '--verbose', count=True)
|
|
80
81
|
@click.option('-y', '--yes', help='confirm all', is_flag=True, default=False)
|
|
81
82
|
@cid_command
|
|
@@ -125,6 +126,7 @@ def deploy(ctx, **kwargs):
|
|
|
125
126
|
--cur-table-name TEXT CUR table name
|
|
126
127
|
--quicksight-datasource-id TEXT QuickSight Datasource ARN (if not found one with provided Athena workgroup)
|
|
127
128
|
--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.
|
|
129
|
+
--allow-buckets Comma separated list of buckets names to add to the default Cid QuickSight role
|
|
128
130
|
--quicksight-user TEXT QuickSight user
|
|
129
131
|
--dataset-{dataset_name}-id TEXT QuickSight dataset id for a specific dataset
|
|
130
132
|
--view-{view_name}-{parameter} TEXT a custom parameter for a view creation, can use variable: {account_id}
|
|
@@ -135,6 +137,7 @@ def deploy(ctx, **kwargs):
|
|
|
135
137
|
--resources TEXT CID resources yaml file or url
|
|
136
138
|
--category TEXT Comma separated list of categories of dashboards (ex: foundational,advanced )
|
|
137
139
|
--catalog TEXT Comma separated list of catalog files or urls (ex: foundational,advanced )
|
|
140
|
+
--theme TEXT A QuickSight Theme (CLASSIC|MIDNIGHT|SEASIDE|RAINIER)
|
|
138
141
|
"""
|
|
139
142
|
ctx.obj.deploy(**kwargs)
|
|
140
143
|
|
|
@@ -200,6 +203,7 @@ def update(ctx, dashboard_id, force, recursive, **kwargs):
|
|
|
200
203
|
\b
|
|
201
204
|
|
|
202
205
|
--on-drift (show|override) Action if a drift of view and dataset is discovered. 'override' = override drift(will destroy customization) or 'show' (default) = show a diff. In Unattended mode (without terminal on-drift will have allways override behaviour)
|
|
206
|
+
--theme TEXT A QuickSight Theme (CLASSIC|MIDNIGHT|SEASIDE|RAINIER)
|
|
203
207
|
|
|
204
208
|
"""
|
|
205
209
|
ctx.obj.update(dashboard_id, force=force, recursive=recursive, **kwargs)
|
|
@@ -45,7 +45,8 @@ class Cid():
|
|
|
45
45
|
self.qs_url = 'https://{region}.quicksight.{domain}/sn/dashboards/{dashboard_id}'
|
|
46
46
|
self.all_yes = kwargs.get('yes')
|
|
47
47
|
self.verbose = kwargs.get('verbose')
|
|
48
|
-
|
|
48
|
+
# save main parameters to global parameters but do not override parameters that were set from outside
|
|
49
|
+
set_parameters({key: val for key, val in kwargs.items() if key.replace('_', '-') not in get_parameters()}, self.all_yes)
|
|
49
50
|
self._logger = None
|
|
50
51
|
self.catalog_urls = [
|
|
51
52
|
'https://raw.githubusercontent.com/aws-samples/aws-cudos-framework-deployment/main/dashboards/catalog.yaml',
|
|
@@ -60,9 +61,11 @@ class Cid():
|
|
|
60
61
|
'aws_session_token': None
|
|
61
62
|
}
|
|
62
63
|
for key in params.keys():
|
|
63
|
-
value = get_parameters().get(key.replace('_', '-'))
|
|
64
|
-
if value !=
|
|
64
|
+
value = get_parameters().get(key.replace('_', '-'), '<NO VALUE>')
|
|
65
|
+
if value != '<NO VALUE>':
|
|
65
66
|
params[key] = value
|
|
67
|
+
if get_parameters().get('region'):
|
|
68
|
+
params['region_name'] = get_parameters().get('region') # use region as a synonym of region_name
|
|
66
69
|
|
|
67
70
|
print('Checking AWS environment...')
|
|
68
71
|
try:
|
|
@@ -1300,11 +1303,11 @@ class Cid():
|
|
|
1300
1303
|
if not role_arn:
|
|
1301
1304
|
role_name = get_parameters().get('quicksight-datasource-role')
|
|
1302
1305
|
if role_name:
|
|
1303
|
-
role_arn =
|
|
1306
|
+
role_arn = self.iam.get_role_arn(role_name)
|
|
1304
1307
|
|
|
1305
1308
|
if not role_arn:
|
|
1306
1309
|
quicksight_trusted_roles = list(self.iam.iterate_role_names(search="Roles[?AssumeRolePolicyDocument.Statement[?Principal.Service=='quicksight.amazonaws.com']].RoleName"))
|
|
1307
|
-
|
|
1310
|
+
quicksight_trusted_roles = [role for role in quicksight_trusted_roles if role not in ('aws-quicksight-secretsmanager-role-v0')] # filter out irrelevant roles
|
|
1308
1311
|
# TODO: filter only roles with Athena and S3 policies
|
|
1309
1312
|
cid_role_name = 'CidCmdQuickSightDataSourceRole'
|
|
1310
1313
|
choices = quicksight_trusted_roles
|
|
@@ -1321,25 +1324,36 @@ class Cid():
|
|
|
1321
1324
|
default=default,
|
|
1322
1325
|
)
|
|
1323
1326
|
if "<ADD NEW ROLE>" in choice or choice == cid_role_name: # Create or update role
|
|
1324
|
-
# TODO:
|
|
1327
|
+
# TODO: get buckets from dashboard parameters
|
|
1325
1328
|
buckets = [
|
|
1326
|
-
f'cid-{self.base.account_id}-
|
|
1329
|
+
f'cid-{self.base.account_id}-shared',
|
|
1330
|
+
f'cid-{self.base.account_id}-data-exports',
|
|
1327
1331
|
f'cid-data-{self.base.account_id}',
|
|
1328
1332
|
f'costoptimizationdata{self.base.account_id}',
|
|
1329
1333
|
]
|
|
1334
|
+
additional_buckets = get_parameters().get('allow-buckets')
|
|
1335
|
+
if additional_buckets:
|
|
1336
|
+
buckets += [bucket.strip().replace('{account_id}', self.base.account_id) for bucket in additional_buckets.split(',')]
|
|
1337
|
+
|
|
1338
|
+
databases = set([
|
|
1339
|
+
"optimization_data",
|
|
1340
|
+
"cid_data_collection",
|
|
1341
|
+
"cid_data_export", # prefix for data-exports hardcoded here
|
|
1342
|
+
self.athena.DatabaseName,
|
|
1343
|
+
])
|
|
1330
1344
|
role_name = self.iam.ensure_data_source_role_exists(
|
|
1331
1345
|
role_name=cid_role_name,
|
|
1332
|
-
|
|
1346
|
+
databases=databases,
|
|
1333
1347
|
workgroup=self.athena.WorkGroup,
|
|
1334
1348
|
buckets=buckets,
|
|
1335
1349
|
output_location_bucket = self.athena.workgroup_output_location().split('/')[2],
|
|
1336
1350
|
)
|
|
1337
1351
|
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:
|
|
1352
|
+
role_arn = self.iam.get_role_arn(role_name)
|
|
1353
|
+
elif 'USE DEFAULT QuickSight ROLE' in choice or choice == 'default':
|
|
1340
1354
|
role_arn = None
|
|
1341
1355
|
else:
|
|
1342
|
-
role_arn = choice
|
|
1356
|
+
role_arn = self.iam.get_role_arn(choice)
|
|
1343
1357
|
|
|
1344
1358
|
athena_datasource = self.qs.create_data_source(
|
|
1345
1359
|
athena_workgroup=self.athena.WorkGroup,
|
|
@@ -1677,8 +1691,8 @@ class Cid():
|
|
|
1677
1691
|
pass
|
|
1678
1692
|
else:
|
|
1679
1693
|
self.athena.execute_query(view_query)
|
|
1680
|
-
|
|
1681
|
-
|
|
1694
|
+
assert self.athena.wait_for_view(view_name), f"Failed to create a view {view_name}"
|
|
1695
|
+
logger.info(f'View "{view_name}" created')
|
|
1682
1696
|
|
|
1683
1697
|
if 'crawler' in view_definition:
|
|
1684
1698
|
if not ('CREATE EXTERNAL TABLE' in view_query.upper() or view_definition.get('type') == 'Glue_Table'):
|
|
@@ -1710,7 +1724,7 @@ class Cid():
|
|
|
1710
1724
|
)
|
|
1711
1725
|
|
|
1712
1726
|
if not crawler_role.startswith('arn:'):
|
|
1713
|
-
crawler_role_arn = f"arn:
|
|
1727
|
+
crawler_role_arn = f"arn:{self.base.partition}:iam::{self.base.account_id}:role/{crawler_role}"
|
|
1714
1728
|
else:
|
|
1715
1729
|
crawler_role_arn = crawler_role
|
|
1716
1730
|
params = {
|
|
@@ -73,29 +73,28 @@ class Athena(CidBase):
|
|
|
73
73
|
except Exception as exc:
|
|
74
74
|
if 'AccessDeniedException' in str(exc):
|
|
75
75
|
logger.warning(f'{type(exc)} - Missing athena:GetDatabase permission. Cannot verify existence of {self._DatabaseName} in {self.CatalogName}. Hope you have it there.')
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
else:
|
|
77
|
+
raise
|
|
78
|
+
return self._DatabaseName
|
|
78
79
|
# Get AWS Athena databases
|
|
79
80
|
athena_databases = self.list_databases()
|
|
80
81
|
|
|
81
|
-
#
|
|
82
|
+
# check if we have a default database
|
|
82
83
|
default_databases = [database for database in athena_databases if database['Name'] == self.defaults.get('DatabaseName')]
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
)
|
|
96
|
-
|
|
97
|
-
self._DatabaseName = self.defaults.get('DatabaseName')
|
|
98
|
-
self.query(f'CREATE DATABASE {self._DatabaseName}')
|
|
84
|
+
|
|
85
|
+
# Ask user
|
|
86
|
+
choices = [d['Name'] for d in athena_databases]
|
|
87
|
+
if self.defaults.get('DatabaseName') not in choices:
|
|
88
|
+
choices.append(self.defaults.get('DatabaseName') + ' (CREATE NEW)')
|
|
89
|
+
self._DatabaseName = get_parameter(
|
|
90
|
+
param_name='athena-database',
|
|
91
|
+
message="Select AWS Athena database to use",
|
|
92
|
+
choices=choices,
|
|
93
|
+
default=default_databases[0]['Name'] if default_databases else None,
|
|
94
|
+
)
|
|
95
|
+
if self._DatabaseName.endswith( ' (CREATE NEW)'):
|
|
96
|
+
self._DatabaseName = self.defaults.get('DatabaseName')
|
|
97
|
+
self.query(f'CREATE DATABASE {self._DatabaseName}')
|
|
99
98
|
logger.info(f'Using Athena database: {self._DatabaseName}')
|
|
100
99
|
return self._DatabaseName
|
|
101
100
|
|
|
@@ -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:
|
|
@@ -176,6 +177,8 @@ class CUR(CidBase):
|
|
|
176
177
|
self._metadata = self.athena.get_table_metadata(table_name)
|
|
177
178
|
except self.athena.client.exceptions.ResourceNotFoundException as exc:
|
|
178
179
|
raise CidCritical(f'Provided cur-table-name "{table_name}" is not found. Please make sure the table exists.') from exc
|
|
180
|
+
except self.athena. athena.exceptions.MetadataException as exc:
|
|
181
|
+
raise CidCritical(f'Provided cur-table-name "{table_name}" is not found in database "{self.athena.DatabaseName}". Please make sure the table exists. Also if you use LakeFormation, make sure that the user is granted with read rights.') from exc
|
|
179
182
|
res, message = self.table_is_cur(table=self._metadata, return_reason=True)
|
|
180
183
|
if not res:
|
|
181
184
|
raise CidCritical(f'Table {table_name} does not look like CUR. {message}')
|
|
@@ -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",
|
|
@@ -113,7 +113,7 @@ class IAM(CidBase):
|
|
|
113
113
|
policy_merge_mode='MERGE_RESOURCES',
|
|
114
114
|
managed_policies=[]
|
|
115
115
|
)
|
|
116
|
-
def ensure_data_source_role_exists(self, role_name,
|
|
116
|
+
def ensure_data_source_role_exists(self, role_name, databases, workgroup, kms_key_arns='', buckets=[], output_location_bucket=None):
|
|
117
117
|
''' Create or update a role specifically for a QS Datasource
|
|
118
118
|
'''
|
|
119
119
|
return self.ensure_role_with_policy(
|
|
@@ -151,14 +151,16 @@ 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
|
],
|
|
157
158
|
"Resource": [
|
|
158
159
|
f"arn:{self.partition}:glue:{self.region}:{self.account_id}:catalog",
|
|
159
|
-
|
|
160
|
-
f"arn:{self.partition}:glue:{self.region}:{self.account_id}:
|
|
161
|
-
|
|
160
|
+
] + sum([
|
|
161
|
+
[f"arn:{self.partition}:glue:{self.region}:{self.account_id}:database/{database}",
|
|
162
|
+
f"arn:{self.partition}:glue:{self.region}:{self.account_id}:table/{database}/*" ]
|
|
163
|
+
for database in databases ], []),
|
|
162
164
|
},
|
|
163
165
|
{
|
|
164
166
|
"Sid": "AllowAthena",
|
|
@@ -175,7 +177,6 @@ class IAM(CidBase):
|
|
|
175
177
|
],
|
|
176
178
|
"Resource": [
|
|
177
179
|
f"arn:{self.partition}:athena:{self.region}:{self.account_id}:datacatalog/AwsDataCatalog", # TODO: check if this can be variable?
|
|
178
|
-
f"arn:{self.partition}:athena:{self.region}:{self.account_id}:database/{database}",
|
|
179
180
|
f"arn:{self.partition}:athena:{self.region}:{self.account_id}:workgroup/{workgroup}",
|
|
180
181
|
]
|
|
181
182
|
},
|
|
@@ -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
|
"""
|
|
@@ -1335,10 +1335,10 @@ class QuickSight(CidBase):
|
|
|
1335
1335
|
'Name': definition.get('name'),
|
|
1336
1336
|
'ValidationStrategy': {'Mode': 'LENIENT'},
|
|
1337
1337
|
}
|
|
1338
|
-
theme = definition.get('theme')
|
|
1338
|
+
theme = get_parameters().get('theme') or 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.8}/cid/builtin/core/data/datasets/trends/daily_anomaly_detection.json
RENAMED
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/datasets/trends/monthly_anomaly_detection.json
RENAMED
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/datasets/trends/monthly_bill_by_account.json
RENAMED
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.8}/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.8}/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.8}/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.8}/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.8}/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.8}/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.8}/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.8}/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.8}/cid/builtin/core/data/queries/trends/daily_anomaly_detection.sql
RENAMED
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/trends/monthly_anomaly_detection.sql
RENAMED
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.8}/cid/builtin/core/data/queries/trends/monthly_bill_by_account.sql
RENAMED
|
File without changes
|
{cid_cmd-0.3.2 → cid_cmd-0.3.8}/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.8}/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
|