@c8y/toolkit
Version:
Toolkit for Cumulocity applications, allows to e.g. deploy an application to an instance of Cumulocity.
36 lines • 2.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerCreateTenantCommand = registerCreateTenantCommand;
const constants_1 = require("../constants");
const helpers_1 = require("../utils/helpers");
const create_tenant_1 = require("../utils/create-tenant");
function registerCreateTenantCommand(program) {
program
.command('create-tenant')
.description('Creates a new subtenant.')
.requiredOption('-u, --url <URL>', constants_1.OPTIONS_CONSTANTS['TXT.URL'], (0, helpers_1.getFromEnvVar)('C8Y_URL'))
.requiredOption('-U, --user <user>', constants_1.OPTIONS_CONSTANTS['TXT.USERNAME'], (0, helpers_1.getFromEnvVar)('C8Y_USER'))
.requiredOption('-P, --password <password>', constants_1.OPTIONS_CONSTANTS['TXT.PASSWORD'], (0, helpers_1.getFromEnvVar)('C8Y_PASSWORD'))
.option('-t, --tenant <tenant>', constants_1.OPTIONS_CONSTANTS['TXT.TENANT'], (0, helpers_1.getFromEnvVar)('C8Y_TENANT'))
.option('--tenantsNumber <n>', 'The number of tenants to be created, default to 1.', parseInt)
.option('--tenantUser [value]', 'Username of the created tenant(s).')
.option('--tenantPassword [value]', 'Password of the created tenant(s).')
.option('--domainNamePrefix [value]', 'The tenant name value')
.option('--allowCreateTenants [value]', 'If the created tenant(s) should be allowed to create subtenants', true)
.option('--companyName [value]', 'A scope is added as the company name', 'e2eTesting tenant')
.option('--noTenantSuffix [value]', 'If set to true, there will be no number attached to the tenant name', false)
.option('--contactName [value]', 'The tenants contact name.', 'Mr. Smith')
.option('--contactPhone [value]', 'The tenants contact phone.', '+48123456789')
.option('--applicationsToBeSubscribed [value]', 'A comma separated list of applications names to be subscribed', '')
.action(async (options) => {
try {
await (0, create_tenant_1.createTenant)(options);
}
catch (e) {
console.error('Failed to create tenant');
console.error(e);
throw e;
}
});
}
//# sourceMappingURL=create-tenant.js.map