qontract-reconcile 0.10.2.dev48__py3-none-any.whl → 0.10.2.dev49__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qontract-reconcile
3
- Version: 0.10.2.dev48
3
+ Version: 0.10.2.dev49
4
4
  Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
5
5
  Project-URL: homepage, https://github.com/app-sre/qontract-reconcile
6
6
  Project-URL: repository, https://github.com/app-sre/qontract-reconcile
@@ -751,7 +751,7 @@ tools/app_sre_tekton_access_reporter.py,sha256=o9prLUgQpwO3msRWc2as1xT1y9OB3znkp
751
751
  tools/app_sre_tekton_access_revalidation.py,sha256=66nHEaY-bIqxIhpcmwN8AvQZu6ZXenfkg4Fut0pVZRM,2726
752
752
  tools/glitchtip_access_reporter.py,sha256=o01A6b88t3Wie6tj_tJWWVo2J01LxQ_a9giGm4UzEaU,2901
753
753
  tools/glitchtip_access_revalidation.py,sha256=8kbBJk04mkq28kWoRDDkfCGIF3GRg3pJrFAh1sW0dbk,2821
754
- tools/qontract_cli.py,sha256=6nb6kl6-1ZQpvBeUXEkeahUfIrTDUdEynkVTNLklj6o,147182
754
+ tools/qontract_cli.py,sha256=157wUZMwEpCkLj68zCJX96AnhEDqoIiMEFK9BKFw5OU,148485
755
755
  tools/sd_app_sre_alert_report.py,sha256=jQpJdXVID68bSNtJNOGDh0-ei1CfEUS4Itr4MAaBNFA,5062
756
756
  tools/template_validation.py,sha256=qpKYaTgk0GOPGa2Ct5_5sKdwIHtCAKIBGzsMPuJU5fw,3371
757
757
  tools/cli_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -778,7 +778,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
778
778
  tools/saas_promotion_state/saas_promotion_state.py,sha256=UfwwRLS5Ya4_Nh1w5n1dvoYtchQvYE9yj1VANt2IKqI,3925
779
779
  tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
780
780
  tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y,894
781
- qontract_reconcile-0.10.2.dev48.dist-info/METADATA,sha256=v2cRkK9cInmcsq0dcaSRCoH1sne86X3HH4xgLjipM_E,24665
782
- qontract_reconcile-0.10.2.dev48.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
783
- qontract_reconcile-0.10.2.dev48.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
784
- qontract_reconcile-0.10.2.dev48.dist-info/RECORD,,
781
+ qontract_reconcile-0.10.2.dev49.dist-info/METADATA,sha256=wWmWGxP1x0eJkaoCP0dPkmUYEYYHnG3FFPvJxlE4gAs,24665
782
+ qontract_reconcile-0.10.2.dev49.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
783
+ qontract_reconcile-0.10.2.dev49.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
784
+ qontract_reconcile-0.10.2.dev49.dist-info/RECORD,,
tools/qontract_cli.py CHANGED
@@ -4510,5 +4510,39 @@ def tekton_roles_and_users(ctx, app_name):
4510
4510
  print_output(ctx.obj["options"], results, columns)
4511
4511
 
4512
4512
 
4513
+ @get.command(
4514
+ help="Get log group storage information from CloudWatch. This is an API-intensive operation so use wisely"
4515
+ )
4516
+ @click.argument("aws-account")
4517
+ @click.pass_context
4518
+ def log_group_usage(ctx, aws_account):
4519
+ accounts = queries.get_aws_accounts(name=aws_account)
4520
+ if not accounts:
4521
+ print("no aws account found with that name")
4522
+ sys.exit(1)
4523
+ account = accounts[0]
4524
+
4525
+ settings = queries.get_app_interface_settings()
4526
+ secret_reader = SecretReader(settings=settings)
4527
+ columns = ["log_group", "stored_bytes", "retention_days"]
4528
+ results = []
4529
+
4530
+ with AWSApi(1, [account], settings, secret_reader) as aws:
4531
+ session = aws.get_session(account["name"])
4532
+ cloudwatch_client = aws.get_session_client(session, "logs")
4533
+ paginator = cloudwatch_client.get_paginator("describe_log_groups")
4534
+ for page in paginator.paginate(PaginationConfig={}):
4535
+ results.extend(
4536
+ {
4537
+ "log_group": group["logGroupName"],
4538
+ "stored_bytes": group["storedBytes"],
4539
+ "retention_days": group["retentionInDays"],
4540
+ }
4541
+ for group in page["logGroups"]
4542
+ if group["storedBytes"] != 0
4543
+ )
4544
+ print_output(ctx.obj["options"], results, columns)
4545
+
4546
+
4513
4547
  if __name__ == "__main__":
4514
4548
  root() # pylint: disable=no-value-for-parameter