@rockset/cli
Version:
Official Rockset CLI
61 lines (59 loc) • 2.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@oclif/core");
const core_2 = require("@rockset/core");
const auth_1 = require("@rockset/core/dist/filesystem/auth");
const base_command_1 = require("../../base-command");
const chalk = require("chalk");
let AddProfile = /** @class */ (() => {
class AddProfile extends base_command_1.RockCommand {
async run() {
const { args, flags } = await this.parse(AddProfile);
// Will throw for invalid qualified name
await core_2.auth.createAuthProfile(args.name, auth_1.parseAuthProfile({
api_key: args.apikey,
api_server: args.apiserver,
}));
if (flags.activate) {
await core_2.auth.activateAuthProfile(args.name);
this.info(`Successfully added profile ${args.name}`);
}
}
}
AddProfile.flags = {
help: core_1.Flags.help({ char: 'h' }),
activate: core_1.Flags.boolean({
char: 'a',
default: true,
description: 'whether to activate the profile after creating it',
allowNo: true,
}),
};
AddProfile.args = [
{
name: 'name',
required: true,
hidden: false,
description: 'the name of the profile you wish to create',
},
{
name: 'apikey',
required: true,
hidden: false,
description: 'the apikey for your account',
},
{
name: 'apiserver',
required: false,
hidden: false,
description: 'the url for the Rockset API server to use',
default: 'https://api.rs2.usw2.rockset.com',
},
];
AddProfile.description = chalk `create a new profile with the specified name and apikey.
You can find an API Key for your account in the Rockset Console. {underline https://console.rockset.com/apikeys}
You can find a list of Rockset API servers and supported regions in the Rockset Docs. {underline https://rockset.com/docs/rest-api}
`;
return AddProfile;
})();
exports.default = AddProfile;