cid-cmd 4.0.2__tar.gz → 4.0.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-4.0.2/cid_cmd.egg-info → cid_cmd-4.0.4}/PKG-INFO +1 -1
- cid_cmd-4.0.4/cid/_version.py +2 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/common.py +8 -9
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/cur_proxy.py +3 -3
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/quicksight/__init__.py +26 -25
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/quicksight/dashboard.py +17 -29
- {cid_cmd-4.0.2 → cid_cmd-4.0.4/cid_cmd.egg-info}/PKG-INFO +1 -1
- cid_cmd-4.0.2/cid/_version.py +0 -2
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/LICENSE +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/MANIFEST.in +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/README.md +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/__init__.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/base.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/__init__.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/__init__.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/cid/compute.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/cid/ec2_running_cost.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/cid/s3_view.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/cid/summary_view.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/co/dataset.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/cudos/hourly_view.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/cudos/resource_view.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/kpi/kpi_ebs_snap.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/kpi/kpi_ebs_storage_all.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/kpi/kpi_instance_all.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/kpi/kpi_s3_storage_all.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/kpi/kpi_tracker.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/shared/customer_all.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/tao/dataset.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/trends/daily_anomaly_detection.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/trends/monthly_anomaly_detection.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/trends/monthly_bill_by_account.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/permissions/dashboard_permissions.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/permissions/dashboard_permissions_namespace.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/permissions/data_set_permissions.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/permissions/data_source_permissions.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/permissions/folder_permissions.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/cid/compute_savings_plan_eligible_spend.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/cid/ec2_running_cost.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/cid/ri_sp_mapping.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/cid/s3.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/cid/summary_view.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/co/all_options.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/co/auto_scale.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/co/auto_scale_options.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/co/ebs_volume.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/co/ebs_volume_options.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/co/ec2_instance.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/co/ec2_instance_options.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/co/lambda.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/co/lambda_options.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/co/rds_database.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/co/rds_instance_options.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/co/rds_storage_options.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/cudos/hourly_view.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/cudos/resource_view.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/kpi/first_kpi_instance_mapping_view.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/kpi/kpi_ebs_snap_view.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/kpi/kpi_ebs_storage_view.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/kpi/kpi_instance_all_view.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/kpi/kpi_s3_storage_view.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/kpi/last_kpi_tracker_view.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/shared/account_map.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/shared/account_map_cur2.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/shared/account_map_dummy.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/shared/aws_accounts.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/shared/aws_regions.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/shared/aws_service_category_map.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/shared/business_units_map.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/shared/cur.yaml +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/shared/customer_all_unlimited.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/shared/payer_account_name_map.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/shared/ta_descriptions.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/tao/glue_table.json +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/tao/ta_org_view.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/trends/daily_anomaly_detection.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/trends/monthly_anomaly_detection.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/trends/monthly_bill_by_account.sql +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/resources.yaml +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/cli.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/commands/__init__.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/commands/command_base.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/commands/init_qs.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/exceptions.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/export.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/__init__.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/account_map.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/athena.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/cloudformation.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/csv2view.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/cur.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/diff.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/glue.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/iam.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/organizations.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/quicksight/dataset.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/quicksight/datasource.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/quicksight/definition.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/quicksight/resource.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/quicksight/template.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/quicksight/version.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/randtime.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/s3.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/helpers/timezone.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/logger.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/plugin.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/test/python/test_csv2view.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/test/python/test_isolated_parameters.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/test/python/test_merge.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/utils.py +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid_cmd.egg-info/SOURCES.txt +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid_cmd.egg-info/dependency_links.txt +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid_cmd.egg-info/entry_points.txt +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid_cmd.egg-info/requires.txt +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid_cmd.egg-info/top_level.txt +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/pyproject.toml +0 -0
- {cid_cmd-4.0.2 → cid_cmd-4.0.4}/setup.cfg +0 -0
|
@@ -300,7 +300,7 @@ class Cid():
|
|
|
300
300
|
logger.debug(f"Issue logging action {action} for dashboard {dashboard_id} , due to a urllib3 exception {str(e)} . This issue will be ignored")
|
|
301
301
|
|
|
302
302
|
def get_page(self, source):
|
|
303
|
-
resp = requests.get(source, timeout=10)
|
|
303
|
+
resp = requests.get(source, timeout=10, headers={'User-Agent': 'cid'})
|
|
304
304
|
resp.raise_for_status()
|
|
305
305
|
return resp
|
|
306
306
|
|
|
@@ -435,7 +435,7 @@ class Cid():
|
|
|
435
435
|
|
|
436
436
|
# In case if we cannot discover datasets, we need to discover dashboards
|
|
437
437
|
# TODO: check if datasets returns explicit permission denied and only then discover dashboards as a workaround
|
|
438
|
-
self.qs.
|
|
438
|
+
self.qs.dashboards
|
|
439
439
|
|
|
440
440
|
dashboard_id = dashboard_id or get_parameters().get('dashboard-id')
|
|
441
441
|
category_filter = [cat for cat in get_parameters().get('category', '').upper().split(',') if cat]
|
|
@@ -782,8 +782,7 @@ class Cid():
|
|
|
782
782
|
# Check if dataset is used in some other dashboard
|
|
783
783
|
for dashboard in (self.qs.dashboards or {}).values():
|
|
784
784
|
if dataset.id in dashboard.datasets.values():
|
|
785
|
-
|
|
786
|
-
print (f'Dataset {dataset.name} ({dataset.id}) is still used by dashboard "{dashboard.id}". Skipping.')
|
|
785
|
+
cid_print(f'Dataset {dataset.name} ({dataset.id}) is still used by dashboard "{dashboard.id}". Skipping.')
|
|
787
786
|
return False
|
|
788
787
|
else: #not used
|
|
789
788
|
|
|
@@ -1073,13 +1072,13 @@ class Cid():
|
|
|
1073
1072
|
|
|
1074
1073
|
if dashboard.latest:
|
|
1075
1074
|
cid_print("You are up to date!")
|
|
1076
|
-
cid_print(f" Version {
|
|
1075
|
+
cid_print(f" Version {dashboard.cid_version}")
|
|
1077
1076
|
else:
|
|
1078
1077
|
cid_print(f"An update is available:")
|
|
1079
|
-
cid_print(f" Version {
|
|
1078
|
+
cid_print(f" Version {dashboard.cid_version} -> {dashboard.latest_available_cid_version}")
|
|
1080
1079
|
|
|
1081
1080
|
try:
|
|
1082
|
-
return dashboard.cid_version.compatible_versions(dashboard.
|
|
1081
|
+
return dashboard.cid_version.compatible_versions(dashboard.latest_available_cid_version)
|
|
1083
1082
|
except ValueError as exc:
|
|
1084
1083
|
logger.info(exc)
|
|
1085
1084
|
return None
|
|
@@ -1094,10 +1093,10 @@ class Cid():
|
|
|
1094
1093
|
if isinstance(dashboard.deployedTemplate, CidQsTemplate):
|
|
1095
1094
|
print(f'Deployed template: {dashboard.deployedTemplate.arn}')
|
|
1096
1095
|
if isinstance(dashboard.sourceTemplate, CidQsTemplate):
|
|
1097
|
-
print(f"Latest template: {dashboard.sourceTemplate.arn}/version/{dashboard.
|
|
1096
|
+
print(f"Latest template: {dashboard.sourceTemplate.arn}/version/{dashboard.sourceTemplate.version}")
|
|
1098
1097
|
|
|
1099
1098
|
try:
|
|
1100
|
-
cid_print(f'\nUpdating {dashboard_id} from <BOLD>{dashboard.cid_version}<END> to <BOLD>{dashboard.
|
|
1099
|
+
cid_print(f'\nUpdating {dashboard_id} from <BOLD>{dashboard.cid_version}<END> to <BOLD>{dashboard.latest_available_cid_version}<END>')
|
|
1101
1100
|
except:
|
|
1102
1101
|
cid_print(f'\nUpdating {dashboard_id}')
|
|
1103
1102
|
logger.debug('Failed to define versions. Still continue.')
|
|
@@ -491,7 +491,7 @@ class ProxyView():
|
|
|
491
491
|
if not self.cur.column_exists(requirement):
|
|
492
492
|
missing_requirements.append(requirement)
|
|
493
493
|
|
|
494
|
-
if missing_requirements:
|
|
494
|
+
if missing_requirements and field_type.lower() in empty:
|
|
495
495
|
logger.trace(f'field {field} cannot be present as prereqs are missing in source cur: {missing_requirements}')
|
|
496
496
|
return empty[field_type.lower()]
|
|
497
497
|
|
|
@@ -508,10 +508,10 @@ class ProxyView():
|
|
|
508
508
|
keys_set = set(self.exposed_maps.get(field, set()))
|
|
509
509
|
keys_set.update(self.fields_to_expose_in_maps.get(map_field, set()))
|
|
510
510
|
for key in keys_set:
|
|
511
|
-
if f'{map_field}_{key}'
|
|
511
|
+
if self.cur.column_exists(f'{map_field}_{key}'):
|
|
512
512
|
map_mapping[key] = f'{map_field}_{key}'
|
|
513
513
|
else:
|
|
514
|
-
map_mapping[key] = '
|
|
514
|
+
map_mapping[key] = empty['string'] # all known maps have string vaules for now
|
|
515
515
|
if not map_mapping:
|
|
516
516
|
return 'cast(NULL AS MAP<VARCHAR, VARCHAR>)'
|
|
517
517
|
map_mapping = dict(sorted(map_mapping.items())) # ordered dict
|
|
@@ -166,11 +166,11 @@ class QuickSight(CidBase):
|
|
|
166
166
|
return self._datasources
|
|
167
167
|
|
|
168
168
|
def ensure_subscription(self) -> None:
|
|
169
|
-
"""Ensure that the QuickSight subscription is active"""
|
|
169
|
+
"""Ensure that the Amazon QuickSight subscription is active"""
|
|
170
170
|
if not self.edition(fresh=True):
|
|
171
|
-
raise CidCritical('QuickSight is not activated. Please run `cid-cmd initqs` command, or activate QuickSight Enterprise Edition from the console.')
|
|
171
|
+
raise CidCritical('Amazon QuickSight is not activated. Please run `cid-cmd initqs` command, or activate QuickSight Enterprise Edition from the console.')
|
|
172
172
|
if self.edition() == 'STANDARD':
|
|
173
|
-
raise CidCritical(f'QuickSight Enterprise edition is required, you have {self.edition}.')
|
|
173
|
+
raise CidCritical(f'Amazon QuickSight Enterprise edition is required, you have {self.edition}.')
|
|
174
174
|
logger.info(f'QuickSight subscription: {self._subscription_info}')
|
|
175
175
|
|
|
176
176
|
def describe_account_subscription(self) -> dict:
|
|
@@ -809,7 +809,7 @@ class QuickSight(CidBase):
|
|
|
809
809
|
|
|
810
810
|
|
|
811
811
|
def describe_dashboard(self, poll: bool=False, **kwargs) -> Union[None, Dashboard]:
|
|
812
|
-
""" Describes an
|
|
812
|
+
""" Describes an Amazon QuickSight dashboard
|
|
813
813
|
Keyword arguments:
|
|
814
814
|
DashboardId
|
|
815
815
|
poll_interval
|
|
@@ -842,14 +842,14 @@ class QuickSight(CidBase):
|
|
|
842
842
|
except self.client.exceptions.ResourceNotFoundException:
|
|
843
843
|
return None
|
|
844
844
|
except self.client.exceptions.UnsupportedUserEditionException as exc:
|
|
845
|
-
raise CidCritical('Error:
|
|
845
|
+
raise CidCritical('Error: Amazon QuickSight Enterprise Edition is required') from exc
|
|
846
846
|
except Exception as exc:
|
|
847
847
|
logger.error(f'Error in describe_dashboard: {exc}')
|
|
848
848
|
raise
|
|
849
849
|
|
|
850
850
|
# Create a method to retrieve the definition for a given dashboard
|
|
851
851
|
def describe_dashboard_definition(self, dashboard_id: str, refresh: bool = False) -> CidQsDefinition:
|
|
852
|
-
""" Describes an
|
|
852
|
+
""" Describes an Amazon QuickSight dashboard definition """
|
|
853
853
|
if refresh or not self._definitions.get(f'{self.account_id}:{self.identityRegion}:{dashboard_id}'):
|
|
854
854
|
try:
|
|
855
855
|
parameters = {
|
|
@@ -860,7 +860,7 @@ class QuickSight(CidBase):
|
|
|
860
860
|
self._definitions.update({f'{self.account_id}:{self.identityRegion}:{dashboard_id}': CidQsDefinition(result.get('Definition'))})
|
|
861
861
|
logger.debug(result)
|
|
862
862
|
except self.client.exceptions.UnsupportedUserEditionException as exc:
|
|
863
|
-
raise CidCritical('
|
|
863
|
+
raise CidCritical('Amazon QuickSight Enterprise Edition is required') from exc
|
|
864
864
|
except self.client.exceptions.ResourceNotFoundException as exc:
|
|
865
865
|
raise CidError(f'Error: Definition for dashboard with ID {dashboard_id} is not available in account {self.account_id} and region {self.identityRegion}') from exc
|
|
866
866
|
except Exception as exc:
|
|
@@ -869,7 +869,7 @@ class QuickSight(CidBase):
|
|
|
869
869
|
return self._definitions.get(f'{self.account_id}:{self.identityRegion}:{dashboard_id}')
|
|
870
870
|
|
|
871
871
|
def delete_dashboard(self, dashboard_id):
|
|
872
|
-
""" Deletes an
|
|
872
|
+
""" Deletes an Amazon QuickSight dashboard """
|
|
873
873
|
params = {
|
|
874
874
|
'AwsAccountId': self.account_id,
|
|
875
875
|
'DashboardId': dashboard_id
|
|
@@ -880,7 +880,7 @@ class QuickSight(CidBase):
|
|
|
880
880
|
return result
|
|
881
881
|
|
|
882
882
|
def delete_data_source(self, datasource_id):
|
|
883
|
-
""" Deletes an
|
|
883
|
+
""" Deletes an Amazon QuickSight dashboard """
|
|
884
884
|
params = {
|
|
885
885
|
'AwsAccountId': self.account_id,
|
|
886
886
|
'DataSourceId': datasource_id
|
|
@@ -896,7 +896,7 @@ class QuickSight(CidBase):
|
|
|
896
896
|
return result
|
|
897
897
|
|
|
898
898
|
def delete_dataset(self, id: str) -> bool:
|
|
899
|
-
""" Deletes an
|
|
899
|
+
""" Deletes an Amazon QuickSight dataset """
|
|
900
900
|
|
|
901
901
|
logger.info(f'Deleting dataset {id}')
|
|
902
902
|
try:
|
|
@@ -949,7 +949,7 @@ class QuickSight(CidBase):
|
|
|
949
949
|
|
|
950
950
|
|
|
951
951
|
def describe_dataset(self, id, timeout: int=1) -> Dataset:
|
|
952
|
-
""" Describes an
|
|
952
|
+
""" Describes an Amazon QuickSight dataset """
|
|
953
953
|
if self._datasets and id in self._datasets:
|
|
954
954
|
return self._datasets.get(id)
|
|
955
955
|
self._datasets = self._datasets or {}
|
|
@@ -1048,7 +1048,7 @@ class QuickSight(CidBase):
|
|
|
1048
1048
|
return mode, status
|
|
1049
1049
|
|
|
1050
1050
|
def describe_data_source(self, id: str, update: bool=False) -> Datasource:
|
|
1051
|
-
""" Describes an
|
|
1051
|
+
""" Describes an Amazon QuickSight DataSource """
|
|
1052
1052
|
if not update and self.datasources and id in self.datasources:
|
|
1053
1053
|
return self.datasources.get(id)
|
|
1054
1054
|
try:
|
|
@@ -1073,7 +1073,7 @@ class QuickSight(CidBase):
|
|
|
1073
1073
|
|
|
1074
1074
|
|
|
1075
1075
|
def describe_template(self, template_id: str, version_number: int=None, account_id: str=None, region: str='us-east-1') -> CidQsTemplate:
|
|
1076
|
-
""" Describes an
|
|
1076
|
+
""" Describes an Amazon QuickSight template """
|
|
1077
1077
|
if not account_id:
|
|
1078
1078
|
account_id=self.cidAccountId
|
|
1079
1079
|
if not self._templates.get(f'{account_id}:{region}:{template_id}:{version_number}'):
|
|
@@ -1089,7 +1089,7 @@ class QuickSight(CidBase):
|
|
|
1089
1089
|
self._templates.update({f'{account_id}:{region}:{template_id}:{version_number}': CidQsTemplate(result.get('Template'))})
|
|
1090
1090
|
logger.debug(result)
|
|
1091
1091
|
except self.client.exceptions.UnsupportedUserEditionException as exc:
|
|
1092
|
-
raise CidCritical('
|
|
1092
|
+
raise CidCritical('Amazon QuickSight Enterprise Edition is required') from exc
|
|
1093
1093
|
except self.client.exceptions.ResourceNotFoundException as exc:
|
|
1094
1094
|
raise CidError(f'Error: Template {template_id} is not available in account {account_id} and region {region}') from exc
|
|
1095
1095
|
except Exception as exc:
|
|
@@ -1098,7 +1098,7 @@ class QuickSight(CidBase):
|
|
|
1098
1098
|
return self._templates.get(f'{account_id}:{region}:{template_id}:{version_number}')
|
|
1099
1099
|
|
|
1100
1100
|
def describe_user(self, username: str) -> dict:
|
|
1101
|
-
""" Describes an
|
|
1101
|
+
""" Describes an Amazon QuickSight user """
|
|
1102
1102
|
parameters = {
|
|
1103
1103
|
'AwsAccountId': self.account_id,
|
|
1104
1104
|
'UserName': username,
|
|
@@ -1122,7 +1122,7 @@ class QuickSight(CidBase):
|
|
|
1122
1122
|
return None
|
|
1123
1123
|
|
|
1124
1124
|
def describe_group(self, groupname: str) -> dict:
|
|
1125
|
-
""" Describes an
|
|
1125
|
+
""" Describes an Amazon QuickSight Group """
|
|
1126
1126
|
try:
|
|
1127
1127
|
result = self.identityClient.describe_group(**{
|
|
1128
1128
|
'AwsAccountId': self.account_id,
|
|
@@ -1140,7 +1140,7 @@ class QuickSight(CidBase):
|
|
|
1140
1140
|
|
|
1141
1141
|
|
|
1142
1142
|
def create_dataset(self, definition: dict) -> str:
|
|
1143
|
-
""" Creates an
|
|
1143
|
+
""" Creates an Amazon QuickSight dataset """
|
|
1144
1144
|
poll_interval = 1
|
|
1145
1145
|
max_timeout = 60
|
|
1146
1146
|
columns_tpl = {
|
|
@@ -1167,7 +1167,8 @@ class QuickSight(CidBase):
|
|
|
1167
1167
|
dataset_id = definition.get("DataSetId")
|
|
1168
1168
|
logger.info(f'Dataset {definition.get("Name")} already exists with DataSetId={dataset_id}')
|
|
1169
1169
|
except self.client.exceptions.LimitExceededException as exc:
|
|
1170
|
-
|
|
1170
|
+
logger.error(exc)
|
|
1171
|
+
raise CidCritical(f'Not enough Amazon QuickSight SPICE capacity in {self.region}. Add SPICE here https://quicksight.aws.amazon.com/sn/admin#capacity .') from exc
|
|
1171
1172
|
|
|
1172
1173
|
logger.info(f'Waiting for {definition.get("Name")} to be created')
|
|
1173
1174
|
deadline = time.time() + max_timeout
|
|
@@ -1185,7 +1186,7 @@ class QuickSight(CidBase):
|
|
|
1185
1186
|
|
|
1186
1187
|
|
|
1187
1188
|
def update_dataset(self, definition: dict) -> Dataset:
|
|
1188
|
-
""" Update an
|
|
1189
|
+
""" Update an Amazon QuickSight dataset """
|
|
1189
1190
|
definition.update({'AwsAccountId': self.account_id})
|
|
1190
1191
|
logger.info(f'Updating dataset {definition.get("Name")}')
|
|
1191
1192
|
|
|
@@ -1338,7 +1339,7 @@ class QuickSight(CidBase):
|
|
|
1338
1339
|
pass
|
|
1339
1340
|
|
|
1340
1341
|
def create_dashboard(self, definition: dict) -> Dashboard:
|
|
1341
|
-
""" Creates an
|
|
1342
|
+
""" Creates an Amazon QuickSight dashboard """
|
|
1342
1343
|
|
|
1343
1344
|
create_parameters = self._build_params_for_create_update_dash(definition)
|
|
1344
1345
|
|
|
@@ -1430,7 +1431,7 @@ class QuickSight(CidBase):
|
|
|
1430
1431
|
return create_parameters
|
|
1431
1432
|
|
|
1432
1433
|
def update_dashboard(self, dashboard: Dashboard, definition):
|
|
1433
|
-
""" Updates an
|
|
1434
|
+
""" Updates an Amazon QuickSight dashboard """
|
|
1434
1435
|
update_parameters = self._build_params_for_create_update_dash(definition)
|
|
1435
1436
|
logger.info(f'Updating dashboard "{dashboard.name}"')
|
|
1436
1437
|
logger.debug(f"Update parameters: {update_parameters}")
|
|
@@ -1457,7 +1458,7 @@ class QuickSight(CidBase):
|
|
|
1457
1458
|
|
|
1458
1459
|
|
|
1459
1460
|
def update_dashboard_permissions(self, **update_parameters):
|
|
1460
|
-
""" Updates an
|
|
1461
|
+
""" Updates an Amazon QuickSight dashboard permissions """
|
|
1461
1462
|
logger.debug(f"Updating Dashboard permissions: {update_parameters}")
|
|
1462
1463
|
update_parameters.update({'AwsAccountId': self.account_id})
|
|
1463
1464
|
update_status = self.client.update_dashboard_permissions(**update_parameters)
|
|
@@ -1466,7 +1467,7 @@ class QuickSight(CidBase):
|
|
|
1466
1467
|
|
|
1467
1468
|
|
|
1468
1469
|
def update_data_set_permissions(self, **update_parameters):
|
|
1469
|
-
""" Updates an
|
|
1470
|
+
""" Updates an Amazon QuickSight dataset permissions """
|
|
1470
1471
|
logger.debug(f"Updating DataSet permissions: {update_parameters}")
|
|
1471
1472
|
update_parameters.update({'AwsAccountId': self.account_id})
|
|
1472
1473
|
update_status = self.client.update_data_set_permissions(**update_parameters)
|
|
@@ -1475,7 +1476,7 @@ class QuickSight(CidBase):
|
|
|
1475
1476
|
|
|
1476
1477
|
|
|
1477
1478
|
def update_data_source_permissions(self, **update_parameters):
|
|
1478
|
-
""" Updates an
|
|
1479
|
+
""" Updates an Amazon QuickSight data source permissions """
|
|
1479
1480
|
logger.debug(f"Updating DataSource permissions: {update_parameters}")
|
|
1480
1481
|
update_parameters.update({'AwsAccountId': self.account_id})
|
|
1481
1482
|
update_status = self.client.update_data_source_permissions(**update_parameters)
|
|
@@ -1484,7 +1485,7 @@ class QuickSight(CidBase):
|
|
|
1484
1485
|
|
|
1485
1486
|
|
|
1486
1487
|
def update_template_permissions(self, **update_parameters):
|
|
1487
|
-
""" Updates an
|
|
1488
|
+
""" Updates an Amazon QuickSight template permissions """
|
|
1488
1489
|
logger.debug(f"Updating Template permissions: {update_parameters}")
|
|
1489
1490
|
update_parameters.update({'AwsAccountId': self.account_id})
|
|
1490
1491
|
update_status = self.client.update_template_permissions(**update_parameters)
|
|
@@ -64,26 +64,17 @@ class Dashboard(CidQsResource):
|
|
|
64
64
|
return None
|
|
65
65
|
|
|
66
66
|
@property
|
|
67
|
-
def
|
|
67
|
+
def deployed_cid_version(self) -> int:
|
|
68
68
|
if isinstance(self.deployedTemplate, CidQsTemplate):
|
|
69
|
-
return self.deployedTemplate.
|
|
69
|
+
return self.deployedTemplate.cid_version
|
|
70
70
|
elif isinstance(self.deployedDefinition, CidQsDefinition):
|
|
71
71
|
return self.deployedDefinition.cid_version
|
|
72
72
|
else:
|
|
73
|
-
return
|
|
73
|
+
return None
|
|
74
74
|
|
|
75
75
|
@property
|
|
76
76
|
def latest(self) -> bool:
|
|
77
|
-
return self.
|
|
78
|
-
|
|
79
|
-
@property
|
|
80
|
-
def latest_version(self) -> int:
|
|
81
|
-
if isinstance(self.sourceTemplate, CidQsTemplate):
|
|
82
|
-
return self.sourceTemplate.version
|
|
83
|
-
elif isinstance(self.sourceDefinition, CidQsDefinition):
|
|
84
|
-
return self.sourceDefinition.cid_version
|
|
85
|
-
else:
|
|
86
|
-
return -1
|
|
77
|
+
return self.latest_available_cid_version == self.deployed_cid_version
|
|
87
78
|
|
|
88
79
|
@property
|
|
89
80
|
def health(self) -> bool:
|
|
@@ -98,6 +89,7 @@ class Dashboard(CidQsResource):
|
|
|
98
89
|
else:
|
|
99
90
|
return "UNKNOWN"
|
|
100
91
|
|
|
92
|
+
|
|
101
93
|
@property
|
|
102
94
|
def cid_version(self) -> int:
|
|
103
95
|
if self.origin_type == "TEMPLATE":
|
|
@@ -108,7 +100,7 @@ class Dashboard(CidQsResource):
|
|
|
108
100
|
return None
|
|
109
101
|
|
|
110
102
|
@property
|
|
111
|
-
def
|
|
103
|
+
def latest_available_cid_version(self) -> int:
|
|
112
104
|
if self.origin_type == "TEMPLATE":
|
|
113
105
|
return self.sourceTemplate.cid_version
|
|
114
106
|
elif self.origin_type == "DEFINITION":
|
|
@@ -136,11 +128,11 @@ class Dashboard(CidQsResource):
|
|
|
136
128
|
# Source Template has changed
|
|
137
129
|
elif self.deployedTemplate and self.sourceTemplate and self.deployedTemplate.arn and self.sourceTemplate.arn and not self.deployedTemplate.arn.startswith(self.sourceTemplate.arn):
|
|
138
130
|
self._status = 'legacy'
|
|
139
|
-
elif self.
|
|
131
|
+
elif not self.latest_available_cid_version or not self.deployed_cid_version:
|
|
140
132
|
self._status = 'undetermined'
|
|
141
133
|
else:
|
|
142
|
-
if self.
|
|
143
|
-
self._status = f'update available {self.
|
|
134
|
+
if self.latest_available_cid_version > self.deployed_cid_version:
|
|
135
|
+
self._status = f'update available {self.deployed_cid_version}->{self.latest_available_cid_version}'
|
|
144
136
|
elif self.latest:
|
|
145
137
|
self._status = 'up to date'
|
|
146
138
|
return self._status
|
|
@@ -157,22 +149,18 @@ class Dashboard(CidQsResource):
|
|
|
157
149
|
if self.status_detail:
|
|
158
150
|
cid_print(f" <BOLD>Status detail:<END> {self.status_detail}")
|
|
159
151
|
|
|
160
|
-
|
|
161
|
-
cid_version_latest = "N/A"
|
|
162
|
-
|
|
163
|
-
cid_version = self.cid_version
|
|
164
|
-
if cid_version is None:
|
|
152
|
+
if not self.cid_version:
|
|
165
153
|
logger.debug("The cid version of the deployed dashboard could not be retrieved")
|
|
166
154
|
|
|
167
|
-
|
|
168
|
-
if cid_version_latest is None:
|
|
155
|
+
if not self.latest_available_cid_version:
|
|
169
156
|
logger.debug("The latest version of the dashboard could not be retrieved")
|
|
170
|
-
|
|
171
|
-
if self.latest:
|
|
172
|
-
cid_print(f" <BOLD>Version:<END> <GREEN>{cid_version}<END> (latest)")
|
|
157
|
+
cid_print(f" <BOLD>Version:<END> <YELLOW>{self.cid_version or 'N/A'}<END> (unable to find latest)")
|
|
173
158
|
else:
|
|
174
|
-
|
|
175
|
-
|
|
159
|
+
if self.latest:
|
|
160
|
+
cid_print(f" <BOLD>Version:<END> <GREEN>{self.cid_version or 'N/A'}<END> (latest)")
|
|
161
|
+
else:
|
|
162
|
+
logger.debug("An update is available")
|
|
163
|
+
cid_print(f" <BOLD>Version:<END> <YELLOW>{self.cid_version or 'N/A'} --> {self.latest_available_cid_version or 'N/A'}<END>")
|
|
176
164
|
|
|
177
165
|
cid_print(' <BOLD>Owners:<END>')
|
|
178
166
|
try:
|
cid_cmd-4.0.2/cid/_version.py
DELETED
|
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-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/trends/daily_anomaly_detection.json
RENAMED
|
File without changes
|
{cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/trends/monthly_anomaly_detection.json
RENAMED
|
File without changes
|
{cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/datasets/trends/monthly_bill_by_account.json
RENAMED
|
File without changes
|
{cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/permissions/dashboard_permissions.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cid_cmd-4.0.2 → cid_cmd-4.0.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
|
|
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
|
{cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/shared/aws_service_category_map.sql
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/shared/customer_all_unlimited.sql
RENAMED
|
File without changes
|
{cid_cmd-4.0.2 → cid_cmd-4.0.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-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/trends/daily_anomaly_detection.sql
RENAMED
|
File without changes
|
{cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/trends/monthly_anomaly_detection.sql
RENAMED
|
File without changes
|
{cid_cmd-4.0.2 → cid_cmd-4.0.4}/cid/builtin/core/data/queries/trends/monthly_bill_by_account.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|