@rockset/cli
Version:
Official Rockset CLI
70 lines (66 loc) • 2.89 kB
JavaScript
;
/* eslint-disable unicorn/filename-case */
// Generated file, please do not edit directly
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@oclif/core");
const core_2 = require("@rockset/core");
const util_1 = require("../../../helper/util");
const base_command_1 = require("../../../base-command");
const chalk = require("chalk");
const cli_ux_1 = require("cli-ux");
const bodySchema = `name: aliasName
description: version alias
collections:
- commons.foo
- prod.demo
`;
let CreateAlias = /** @class */ (() => {
class CreateAlias extends base_command_1.RockCommand {
async run() {
const { args, flags } = await this.parse(CreateAlias);
// Rockset client object
const client = await core_2.main.createClient();
const namedArgs = CreateAlias.args;
// apicall
const apicall = client.aliases.createAlias.bind(client.aliases);
// endpoint
const endpoint = '/v1/orgs/self/ws/{workspace}/aliases';
const method = 'POST';
await util_1.runApiCall.bind(this)({ args, flags, namedArgs, apicall, method, endpoint, bodySchema });
}
}
CreateAlias.flags = Object.assign({ help: core_1.Flags.help({ char: 'h' }), body: core_1.Flags.string({
required: true,
description: 'Path to a file whose contents will be passed as the POST body of this request. Format must be [json|yaml]. An example schema is shown below.',
}), raw: core_1.Flags.boolean({
description: 'Show the raw output from the server, instead of grabbing the results. Usually used in conjunction with --output=json',
}) }, cli_ux_1.cli.table.flags({ only: ['columns', 'output'] }));
CreateAlias.args = [
{
name: 'workspace',
description: 'name of the workspace',
required: true,
hidden: false,
},
];
CreateAlias.description = `create new alias in a workspace
Arguments to this command will be passed as URL parameters to ${chalk.bold(`POST: /v1/orgs/self/ws/{workspace}/aliases`)}
${chalk.bold(`This endpoint REQUIRES a POST body. To specify a POST body, please pass a JSON or YAML file to the --body flag.
`)}
Example Body (YAML):
name: aliasName
description: version alias
collections:
- commons.foo
- prod.demo
Endpoint Reference
POST: /v1/orgs/self/ws/{workspace}/aliases
Create Alias
Create new alias in a workspace.
More documentation at ${chalk.underline(`https://docs.rockset.com/rest-api#createalias`)}`;
CreateAlias.examples = [
'$ rockset api:aliases:createAlias WORKSPACE --body body.yaml\n$ cat body.yaml\nname: aliasName\ndescription: version alias\ncollections:\n - commons.foo\n - prod.demo\n\n',
];
return CreateAlias;
})();
exports.default = CreateAlias;