(self, params, **kwargs)
| 889 | return msp_legacy_report_parser |
| 890 | |
| 891 | def execute(self, params, **kwargs): |
| 892 | from_date_str = kwargs.get('from_date') |
| 893 | to_date_str = kwargs.get('to_date') |
| 894 | if not from_date_str or not to_date_str: |
| 895 | # will use data range to query |
| 896 | rng = kwargs.get('range') |
| 897 | from_date, to_date = date_range_str_to_dates(rng) |
| 898 | else: |
| 899 | # will use start and end data |
| 900 | if loginv3.CommonHelperMethods.check_int(from_date_str): |
| 901 | from_date = datetime.datetime.fromtimestamp(int(from_date_str)) |
| 902 | else: |
| 903 | from_date = datetime.datetime.strptime(from_date_str + " 00:00:00", "%Y-%m-%d %H:%M:%S") |
| 904 | |
| 905 | if loginv3.CommonHelperMethods.check_int(to_date_str): |
| 906 | to_date = datetime.datetime.fromtimestamp(int(to_date_str)) |
| 907 | else: |
| 908 | to_date = datetime.datetime.strptime(to_date_str + " 11:59:59", "%Y-%m-%d %H:%M:%S") |
| 909 | |
| 910 | from_date_timestamp = int(from_date.timestamp() * 1000) |
| 911 | to_date_timestamp = int(to_date.timestamp() * 1000) |
| 912 | |
| 913 | rq = { |
| 914 | 'command': 'get_mc_license_adjustment_log', |
| 915 | 'from': from_date_timestamp, |
| 916 | 'to': to_date_timestamp |
| 917 | } |
| 918 | |
| 919 | rs = api.communicate(params, rq) |
| 920 | |
| 921 | title = None |
| 922 | headers = [] |
| 923 | table = [] |
| 924 | for log in rs['log']: |
| 925 | table.append([log['id'], log['date'], log['enterprise_id'], log['enterprise_name'], log['status'], |
| 926 | log['new_number_of_seats'], log['new_product_type'], log['note'], log['price']]) |
| 927 | |
| 928 | headers.extend(('id', 'time', 'company_id', 'company_name', 'status', 'number_of_allocations', 'plan', 'transaction_notes', 'price_estimate')) |
| 929 | |
| 930 | output_format = kwargs.get('format') |
| 931 | if output_format == 'table': |
| 932 | headers = [field_to_title(x) for x in headers] |
| 933 | return dump_report_data(table, headers, fmt=output_format, filename=kwargs.get('output'), title=title) |
| 934 | |
| 935 | |
| 936 | class MSPAddCommand(EnterpriseCommand): |
nothing calls this directly
no test coverage detected