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.
Files changed (129) hide show
  1. {cid_cmd-0.3.2/cid_cmd.egg-info → cid_cmd-0.3.4}/PKG-INFO +1 -1
  2. cid_cmd-0.3.4/cid/_version.py +1 -0
  3. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/summary_view.sql +4 -1
  4. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/summary_view_ri.sql +4 -2
  5. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/summary_view_sp.sql +4 -2
  6. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/summary_view_sp_ri.sql +4 -2
  7. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cudos/hourly_view.sql +5 -2
  8. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cudos/hourly_view_ri.sql +5 -2
  9. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cudos/hourly_view_sp.sql +5 -2
  10. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cudos/hourly_view_sp_ri.sql +5 -2
  11. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cudos/resource_view.sql +5 -2
  12. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cudos/resource_view_ri.sql +5 -2
  13. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cudos/resource_view_sp.sql +5 -2
  14. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cudos/resource_view_sp_ri.sql +5 -2
  15. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/cli.py +1 -0
  16. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/common.py +11 -7
  17. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/cur.py +5 -4
  18. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/iam.py +20 -3
  19. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/quicksight/__init__.py +1 -1
  20. {cid_cmd-0.3.2 → cid_cmd-0.3.4/cid_cmd.egg-info}/PKG-INFO +1 -1
  21. cid_cmd-0.3.2/cid/_version.py +0 -1
  22. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/LICENSE +0 -0
  23. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/MANIFEST.in +0 -0
  24. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/README.md +0 -0
  25. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/__init__.py +0 -0
  26. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/base.py +0 -0
  27. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/__init__.py +0 -0
  28. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/__init__.py +0 -0
  29. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/cid/compute.json +0 -0
  30. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/cid/ec2_running_cost.json +0 -0
  31. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/cid/s3_view.json +0 -0
  32. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/cid/summary_view.json +0 -0
  33. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/co/dataset.json +0 -0
  34. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/cudos/hourly_view.json +0 -0
  35. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/cudos/resource_view.json +0 -0
  36. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/kpi/kpi_ebs_snap.json +0 -0
  37. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/kpi/kpi_ebs_storage_all.json +0 -0
  38. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/kpi/kpi_instance_all.json +0 -0
  39. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/kpi/kpi_s3_storage_all.json +0 -0
  40. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/kpi/kpi_tracker.json +0 -0
  41. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/shared/customer_all.json +0 -0
  42. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/tao/dataset.json +0 -0
  43. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/trends/daily_anomaly_detection.json +0 -0
  44. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/trends/monthly_anomaly_detection.json +0 -0
  45. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/datasets/trends/monthly_bill_by_account.json +0 -0
  46. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/permissions/dashboard_permissions.json +0 -0
  47. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/permissions/dashboard_permissions_namespace.json +0 -0
  48. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/permissions/data_set_permissions.json +0 -0
  49. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/permissions/data_source_permissions.json +0 -0
  50. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/permissions/folder_permissions.json +0 -0
  51. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/compute_savings_plan_eligible_spend.sql +0 -0
  52. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/ec2_running_cost.sql +0 -0
  53. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/ec2_running_cost_ri.sql +0 -0
  54. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/ec2_running_cost_sp.sql +0 -0
  55. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/ec2_running_cost_sp_ri.sql +0 -0
  56. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/ri_sp_mapping.sql +0 -0
  57. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/ri_sp_mapping_ri.sql +0 -0
  58. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/ri_sp_mapping_sp.sql +0 -0
  59. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/ri_sp_mapping_sp_ri.sql +0 -0
  60. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/cid/s3.sql +0 -0
  61. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/co/all_options.sql +0 -0
  62. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/co/auto_scale.json +0 -0
  63. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/co/auto_scale_options.sql +0 -0
  64. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/co/ebs_volume.json +0 -0
  65. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/co/ebs_volume_options.sql +0 -0
  66. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/co/ec2_instance.json +0 -0
  67. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/co/ec2_instance_options.sql +0 -0
  68. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/co/lambda.json +0 -0
  69. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/co/lambda_options.sql +0 -0
  70. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/first_kpi_instance_mapping_view.sql +0 -0
  71. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/kpi_ebs_snap_view.sql +0 -0
  72. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/kpi_ebs_storage_view.sql +0 -0
  73. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/kpi_instance_all_view.sql +0 -0
  74. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/kpi_instance_all_view_noRI.sql +0 -0
  75. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/kpi_instance_all_view_noRISP.sql +0 -0
  76. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/kpi_instance_all_view_noSP.sql +0 -0
  77. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/kpi_s3_storage_view.sql +0 -0
  78. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/kpi/last_kpi_tracker_view.sql +0 -0
  79. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/account_map.sql +0 -0
  80. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/account_map_dummy.sql +0 -0
  81. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/aws_accounts.sql +0 -0
  82. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/aws_regions.sql +0 -0
  83. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/aws_service_category_map.sql +0 -0
  84. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/business_units_map.sql +0 -0
  85. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/cur.yaml +0 -0
  86. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/payer_account_name_map.sql +0 -0
  87. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/shared/ta_descriptions.sql +0 -0
  88. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/tao/glue_table.json +0 -0
  89. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/tao/ta_org_view.sql +0 -0
  90. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/trends/daily_anomaly_detection.sql +0 -0
  91. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/trends/monthly_anomaly_detection.sql +0 -0
  92. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/trends/monthly_bill_by_account.sql +0 -0
  93. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/trends/monthly_bill_by_account_ri.sql +0 -0
  94. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/queries/trends/monthly_bill_by_account_sp.sql +0 -0
  95. {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
  96. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/builtin/core/data/resources.yaml +0 -0
  97. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/commands/__init__.py +0 -0
  98. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/commands/command_base.py +0 -0
  99. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/commands/init_qs.py +0 -0
  100. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/exceptions.py +0 -0
  101. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/export.py +0 -0
  102. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/__init__.py +0 -0
  103. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/account_map.py +0 -0
  104. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/athena.py +0 -0
  105. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/csv2view.py +0 -0
  106. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/diff.py +0 -0
  107. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/glue.py +0 -0
  108. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/organizations.py +0 -0
  109. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/quicksight/dashboard.py +0 -0
  110. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/quicksight/dataset.py +0 -0
  111. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/quicksight/datasource.py +0 -0
  112. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/quicksight/resource.py +0 -0
  113. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/quicksight/template.py +0 -0
  114. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/randtime.py +0 -0
  115. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/s3.py +0 -0
  116. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/helpers/timezone.py +0 -0
  117. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/logger.py +0 -0
  118. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/plugin.py +0 -0
  119. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/test/python/test_csv2view.py +0 -0
  120. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/test/python/test_isolated_parameters.py +0 -0
  121. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/test/python/test_merge.py +0 -0
  122. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid/utils.py +0 -0
  123. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid_cmd.egg-info/SOURCES.txt +0 -0
  124. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid_cmd.egg-info/dependency_links.txt +0 -0
  125. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid_cmd.egg-info/entry_points.txt +0 -0
  126. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid_cmd.egg-info/requires.txt +0 -0
  127. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/cid_cmd.egg-info/top_level.txt +0 -0
  128. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/pyproject.toml +0 -0
  129. {cid_cmd-0.3.2 → cid_cmd-0.3.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cid-cmd
3
- Version: 0.3.2
3
+ Version: 0.3.4
4
4
  Summary: Cloud Intelligence Dashboards deployment helper tool
5
5
  Home-page: https://github.com/aws-samples/aws-cudos-framework-deployment
6
6
  Author: AWS CUDOS Team
@@ -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 (("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH)) AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH)))
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 (("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH)) AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH)))
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
- WHERE (("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH)) AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH)))
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
- WHERE (("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH)) AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH)))
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 (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage')))
25
- GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
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 (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage')))
25
- GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
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 (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage')))
25
- GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
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 (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage')))
25
- GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
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 (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND (line_item_resource_id <> ''))
39
- 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
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 (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND (line_item_resource_id <> ''))
39
- 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
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 (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND (line_item_resource_id <> ''))
39
- 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
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 (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND (line_item_resource_id <> ''))
39
- 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
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 = f'arn:aws:iam::{self.base.account_id}:role/{role_name}'
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
- #quicksight_trusted_roles = [role for role in quicksight_trusted_roles if role not in ('aws-quicksight-secretsmanager-role-v0')] # filter out irrelevant roles
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: allow customer add buckets
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 = f'arn:aws:iam::{self.base.account_id}:role/{role_name}'
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:aws:iam::{self.base.account_id}:role/{crawler_role}"
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
- self._metadata = self.athena.get_table_metadata(self.table_name) # refresh table metadata
139
- logger.critical(f"Column '{column}' was added to CUR ({self.table_name}). Please make sure crawler do not override that columns. Crawler='{crawler_name}'")
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:aws:s3:::{s3bucket}"]
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:aws:s3:::{s3bucket}/*"]
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:aws:quicksight::aws:theme/' + theme
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cid-cmd
3
- Version: 0.3.2
3
+ Version: 0.3.4
4
4
  Summary: Cloud Intelligence Dashboards deployment helper tool
5
5
  Home-page: https://github.com/aws-samples/aws-cudos-framework-deployment
6
6
  Author: AWS CUDOS Team
@@ -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
File without changes