| 731 | |
| 732 | @staticmethod |
| 733 | def execute_usage(params, **kwargs): |
| 734 | if kwargs.get('helpflag'): |
| 735 | ksm_usage_parser.print_help() |
| 736 | return |
| 737 | if not params.enterprise: |
| 738 | print(f'{bcolors.WARNING}secrets-manager usage requires an enterprise account.{bcolors.ENDC}') |
| 739 | return |
| 740 | |
| 741 | detail = kwargs.get('detail', False) |
| 742 | by_device = kwargs.get('by_device', False) |
| 743 | summary = kwargs.get('summary', False) |
| 744 | timeline = kwargs.get('timeline', False) |
| 745 | export_all = kwargs.get('export_all', False) |
| 746 | time_range = kwargs.get('range') |
| 747 | |
| 748 | # Validate mutually-exclusive families. |
| 749 | if timeline and (detail or by_device or summary): |
| 750 | print(f'{bcolors.WARNING}--timeline cannot be combined with --detail/--by-device/--summary.{bcolors.ENDC}') |
| 751 | return |
| 752 | if summary and (detail or by_device): |
| 753 | print(f'{bcolors.WARNING}--summary is its own report; do not combine with --detail/--by-device.{bcolors.ENDC}') |
| 754 | return |
| 755 | if not timeline and (export_all or time_range): |
| 756 | print(f'{bcolors.WARNING}--all and --range apply only to --timeline.{bcolors.ENDC}') |
| 757 | return |
| 758 | |
| 759 | if timeline: |
| 760 | return KSMCommand._usage_timeline(params, **kwargs) |
| 761 | return KSMCommand._usage_metrics(params, **kwargs) |
| 762 | |
| 763 | @staticmethod |
| 764 | def _usage_metrics(params, **kwargs): |