import { Command } from "@commander-js/extra-typings"; import { commandUploadIdentities } from "./commandUploadIdentities"; import { commandUploadEmails } from "./commandUploadEmails"; import { commandUploadApps } from "./commandUploadApps"; export const upload = new Command("upload").description( "Uploads files to Zygon.", ); upload .command("identities") .description( "Uploads a CSV file containing identities (accounts). Typically MDM/UEM/EMM generates those files.", ) .argument("", "Path to csv file, with a header") .option( "--app_column ", "the column header containing the app's name", "appName", ) .option( "--default_app_name ", "the default app name when the app name isnt specified", ) .option( "--status_column ", "the column header containing the status of the account", ) .option( "--role_column ", "the column header containing the status of the account", ) .option( "--fuzzy_apps", 'activates fuzzy match for matching app instances. Fuzzy removes version numbers, keywords such as "beta" etc. Default is exact match (case sensitive).', false, ) .option( "--create_unknown_apps", "If an app name in the uploaded file doesn't match anything on Zygon, it will create a new app instance. Default will not create unknown apps", false, ) .option( "--email_column ", "the column header containing the user's email", "userEmail", ) .option("--delimiter ", "the delimiter in the csv.", ",") .action(async (csvPath, options) => { await commandUploadIdentities(csvPath, options); }) .addHelpText( "after", ` Your CSV file must contain a header. By default, the mapping is done on appName and userEmail columns. `, ); upload .command("apps") .description( "Uploads a CSV file containing apps. Your CSV file must contain a header.", ) .argument("csv_path", "Path to the csv file containing the apps") .option( "--name_column
", "The header of the column containing the app's name.", "name", ) .option( "--labels_column
", "The header of the column containing the labels for the app. You can specify multiple labels by separating them with a comma (,).", ) .option("--delimiter ", "The delimiter in the csv.", ",") .option( "--dry_run", "Set to true to check which app already exists, and which one will be created", ) .action(commandUploadApps); upload .command("emails") .description("Uploads a CSV file containing emails' metadata.") .argument( "", "Path to either a CSV file with extracted email metadata, or a folder containing CSV files with extracted email metadata.", ) .action(commandUploadEmails) .addHelpText( "after", ` Your CSV file must contain these columns: sender, to, subject, timestamp. The expected timestamp format is "yyyy-MM-dd'T'HH:mm:ss.SSSz". You can generate the file using the email command (use zygon email --help for more information). `, );