@contrail/cli 2.1.4 → 2.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -1
- package/dist/api/webhooks.d.ts +4 -0
- package/dist/api/webhooks.js +16 -0
- package/dist/commands/groups/export.js +3 -2
- package/dist/commands/types/getAll.js +8 -8
- package/dist/commands/users/export.js +2 -1
- package/dist/commands/webhooks/create.d.ts +9 -0
- package/dist/commands/webhooks/create.js +26 -0
- package/dist/commands/webhooks/delete.d.ts +12 -0
- package/dist/commands/webhooks/delete.js +51 -0
- package/dist/commands/webhooks/getWebhookTrigger.d.ts +9 -0
- package/dist/commands/webhooks/getWebhookTrigger.js +38 -0
- package/dist/commands/webhooks/list.d.ts +10 -0
- package/dist/commands/webhooks/list.js +32 -0
- package/dist/interfaces.d.ts +7 -0
- package/dist/templates/typescript/tsconfig.json +1 -1
- package/oclif.manifest.json +94 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ $ npm install -g @contrail/cli
|
|
|
15
15
|
$ contrail COMMAND
|
|
16
16
|
running command...
|
|
17
17
|
$ contrail (--version)
|
|
18
|
-
@contrail/cli/2.1.
|
|
18
|
+
@contrail/cli/2.1.6 darwin-arm64 node-v18.13.0
|
|
19
19
|
$ contrail --help [COMMAND]
|
|
20
20
|
USAGE
|
|
21
21
|
$ contrail COMMAND
|
|
@@ -80,6 +80,10 @@ To get instructions on how to set up autocomplete for your shell, run `contrail
|
|
|
80
80
|
* [`contrail types uploadUsageInfo`](#contrail-types-uploadusageinfo)
|
|
81
81
|
* [`contrail users export`](#contrail-users-export)
|
|
82
82
|
* [`contrail users upload USERSFILE`](#contrail-users-upload-usersfile)
|
|
83
|
+
* [`contrail webhooks create`](#contrail-webhooks-create)
|
|
84
|
+
* [`contrail webhooks delete [WEBHOOKID]`](#contrail-webhooks-delete-webhookid)
|
|
85
|
+
* [`contrail webhooks getWebhookTrigger [WEBHOOKID]`](#contrail-webhooks-getwebhooktrigger-webhookid)
|
|
86
|
+
* [`contrail webhooks list`](#contrail-webhooks-list)
|
|
83
87
|
* [`contrail workflow-template-definitions install`](#contrail-workflow-template-definitions-install)
|
|
84
88
|
* [`contrail workflow-template-definitions list`](#contrail-workflow-template-definitions-list)
|
|
85
89
|
* [`contrail workflow-templates delete`](#contrail-workflow-templates-delete)
|
|
@@ -1143,6 +1147,85 @@ EXAMPLES
|
|
|
1143
1147
|
$ contrail users import <USERS_FILE>
|
|
1144
1148
|
```
|
|
1145
1149
|
|
|
1150
|
+
## `contrail webhooks create`
|
|
1151
|
+
|
|
1152
|
+
Create a new webhook
|
|
1153
|
+
|
|
1154
|
+
```
|
|
1155
|
+
USAGE
|
|
1156
|
+
$ contrail webhooks create [-j]
|
|
1157
|
+
|
|
1158
|
+
FLAGS
|
|
1159
|
+
-j, --json output in json format
|
|
1160
|
+
|
|
1161
|
+
DESCRIPTION
|
|
1162
|
+
Create a new webhook
|
|
1163
|
+
|
|
1164
|
+
EXAMPLES
|
|
1165
|
+
$ contrail webhooks create
|
|
1166
|
+
```
|
|
1167
|
+
|
|
1168
|
+
## `contrail webhooks delete [WEBHOOKID]`
|
|
1169
|
+
|
|
1170
|
+
Delete an existing webhook. To delete a single webhook, pass its ID. To delete multiple webhooks, do not pass a value for the ID, and select multiple using the interactive selector
|
|
1171
|
+
|
|
1172
|
+
```
|
|
1173
|
+
USAGE
|
|
1174
|
+
$ contrail webhooks delete [WEBHOOKID] [-j]
|
|
1175
|
+
|
|
1176
|
+
ARGUMENTS
|
|
1177
|
+
WEBHOOKID The id of the webhook to delete
|
|
1178
|
+
|
|
1179
|
+
FLAGS
|
|
1180
|
+
-j, --json output in json format
|
|
1181
|
+
|
|
1182
|
+
DESCRIPTION
|
|
1183
|
+
Delete an existing webhook. To delete a single webhook, pass its ID. To delete multiple webhooks, do not pass a value
|
|
1184
|
+
for the ID, and select multiple using the interactive selector
|
|
1185
|
+
|
|
1186
|
+
EXAMPLES
|
|
1187
|
+
$ contrail webhooks delete
|
|
1188
|
+
|
|
1189
|
+
$ contrail webhooks delete 12345abcd-1234-abcd-1234-12345abcde
|
|
1190
|
+
```
|
|
1191
|
+
|
|
1192
|
+
## `contrail webhooks getWebhookTrigger [WEBHOOKID]`
|
|
1193
|
+
|
|
1194
|
+
Crafts a webhook trigger that can be used for event workflows. This command does not alter the state of any webhook or event workflow. It is only a utility for generating a webhook trigger.
|
|
1195
|
+
|
|
1196
|
+
```
|
|
1197
|
+
USAGE
|
|
1198
|
+
$ contrail webhooks getWebhookTrigger [WEBHOOKID]
|
|
1199
|
+
|
|
1200
|
+
ARGUMENTS
|
|
1201
|
+
WEBHOOKID The id of the webhook to delete
|
|
1202
|
+
|
|
1203
|
+
DESCRIPTION
|
|
1204
|
+
Crafts a webhook trigger that can be used for event workflows. This command does not alter the state of any webhook or
|
|
1205
|
+
event workflow. It is only a utility for generating a webhook trigger.
|
|
1206
|
+
|
|
1207
|
+
EXAMPLES
|
|
1208
|
+
$ contrail webhooks getWebhookTrigger 1234-abcd-1234-abcd-1234abcd
|
|
1209
|
+
```
|
|
1210
|
+
|
|
1211
|
+
## `contrail webhooks list`
|
|
1212
|
+
|
|
1213
|
+
List current webhooks
|
|
1214
|
+
|
|
1215
|
+
```
|
|
1216
|
+
USAGE
|
|
1217
|
+
$ contrail webhooks list [-j]
|
|
1218
|
+
|
|
1219
|
+
FLAGS
|
|
1220
|
+
-j, --json output in json format
|
|
1221
|
+
|
|
1222
|
+
DESCRIPTION
|
|
1223
|
+
List current webhooks
|
|
1224
|
+
|
|
1225
|
+
EXAMPLES
|
|
1226
|
+
$ contrail webhooks list
|
|
1227
|
+
```
|
|
1228
|
+
|
|
1146
1229
|
## `contrail workflow-template-definitions install`
|
|
1147
1230
|
|
|
1148
1231
|
Install the template definitions of an app to your org
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteWebhook = exports.createWebhook = exports.getWebhooks = void 0;
|
|
4
|
+
const sdk_1 = require("@contrail/sdk");
|
|
5
|
+
async function getWebhooks() {
|
|
6
|
+
return await new sdk_1.Entities().get({ entityName: 'webhook' });
|
|
7
|
+
}
|
|
8
|
+
exports.getWebhooks = getWebhooks;
|
|
9
|
+
async function createWebhook(webhook) {
|
|
10
|
+
return await new sdk_1.Entities().create({ entityName: 'webhook', object: webhook });
|
|
11
|
+
}
|
|
12
|
+
exports.createWebhook = createWebhook;
|
|
13
|
+
async function deleteWebhook(webhookId) {
|
|
14
|
+
return await new sdk_1.Entities().delete({ entityName: 'webhook', id: webhookId });
|
|
15
|
+
}
|
|
16
|
+
exports.deleteWebhook = deleteWebhook;
|
|
@@ -41,7 +41,7 @@ ExportGroups.flags = {
|
|
|
41
41
|
async function exportGroups(fileLocation, overwrite) {
|
|
42
42
|
const allGroups = await (0, users_1.getGroups)({ relations: ['groupPrincipals'] });
|
|
43
43
|
const allUsersInOrg = await (0, users_1.getUserOrgs)();
|
|
44
|
-
|
|
44
|
+
let groups = [];
|
|
45
45
|
for (const group of allGroups) {
|
|
46
46
|
const groupPrincipals = getGroupPrincipals(group, allGroups, allUsersInOrg);
|
|
47
47
|
groups.push({
|
|
@@ -49,6 +49,7 @@ async function exportGroups(fileLocation, overwrite) {
|
|
|
49
49
|
groupPrincipals,
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
+
groups = groups.sort((one, two) => (one.name < two.name ? -1 : 1));
|
|
52
53
|
await saveData(groups, fileLocation, overwrite);
|
|
53
54
|
}
|
|
54
55
|
exports.exportGroups = exportGroups;
|
|
@@ -88,5 +89,5 @@ function getGroupPrincipals(group, allGroups, orgUsers) {
|
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
|
-
return principals;
|
|
92
|
+
return principals.sort((one, two) => { var _a, _b; return (((_b = (_a = one.email) !== null && _a !== void 0 ? _a : one.name < two.email) !== null && _b !== void 0 ? _b : two.name) ? -1 : 1); });
|
|
92
93
|
}
|
|
@@ -99,7 +99,7 @@ async function reduceTypePropertyPolicies(data) {
|
|
|
99
99
|
statements: x.policy.statements.map(x => reducePrincipal(x)),
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
|
-
});
|
|
102
|
+
}).sort((one, two) => (one.label < two.label ? -1 : 1));
|
|
103
103
|
}
|
|
104
104
|
function reduceTypePropertyPolicyLinks(data) {
|
|
105
105
|
var _a, _b;
|
|
@@ -168,7 +168,7 @@ async function reduceTypePolicies(data) {
|
|
|
168
168
|
statements: x.policy.statements.map(x => reducePrincipal(x)),
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
|
-
});
|
|
171
|
+
}).sort((one, two) => (one.label < two.label ? -1 : 1));
|
|
172
172
|
}
|
|
173
173
|
function reduceTypePolicyLinks(data) {
|
|
174
174
|
var _a;
|
|
@@ -197,7 +197,7 @@ function reduceUsageInfo(data) {
|
|
|
197
197
|
typeSlug: (_a = data.types.find(y => y.id === x.typeId)) === null || _a === void 0 ? void 0 : _a.slug,
|
|
198
198
|
typePropertySlug: (_b = typeProperties.find(y => y.id === x.typePropertyId)) === null || _b === void 0 ? void 0 : _b.slug,
|
|
199
199
|
};
|
|
200
|
-
});
|
|
200
|
+
}).sort((one, two) => (one.label < two.label ? -1 : 1));
|
|
201
201
|
}
|
|
202
202
|
function reduceRuleSetLinks(data) {
|
|
203
203
|
var _a, _b;
|
|
@@ -225,7 +225,7 @@ function reduceRuleSets(data) {
|
|
|
225
225
|
ruleSet: x.ruleSet,
|
|
226
226
|
name: x.name,
|
|
227
227
|
};
|
|
228
|
-
});
|
|
228
|
+
}).sort((one, two) => (one.name < two.name ? -1 : 1));
|
|
229
229
|
}
|
|
230
230
|
function reduceOptionSets(data) {
|
|
231
231
|
var _a;
|
|
@@ -235,7 +235,7 @@ function reduceOptionSets(data) {
|
|
|
235
235
|
isArchived: optionSet.isArchived,
|
|
236
236
|
optionSet: optionSet.optionSet,
|
|
237
237
|
};
|
|
238
|
-
});
|
|
238
|
+
}).sort((one, two) => (one.name < two.name ? -1 : 1));
|
|
239
239
|
}
|
|
240
240
|
function reduceOptionSetHierarchies(data) {
|
|
241
241
|
var _a;
|
|
@@ -246,7 +246,7 @@ function reduceOptionSetHierarchies(data) {
|
|
|
246
246
|
options: x.options,
|
|
247
247
|
name: x.name
|
|
248
248
|
};
|
|
249
|
-
});
|
|
249
|
+
}).sort((one, two) => (one.name < two.name ? -1 : 1));
|
|
250
250
|
}
|
|
251
251
|
function reduceOptionSetHierarchyLinks(data) {
|
|
252
252
|
var _a;
|
|
@@ -276,7 +276,7 @@ function reduceOptionSetHierarchyLinks(data) {
|
|
|
276
276
|
typeSlug: type.slug,
|
|
277
277
|
typePropertySlugs,
|
|
278
278
|
};
|
|
279
|
-
}).filter(x => !!x);
|
|
279
|
+
}).filter(x => !!x).sort((one, two) => (one.typeSlug < two.typeSlug ? -1 : 1));
|
|
280
280
|
}
|
|
281
281
|
function reduceTypes(dataHolder) {
|
|
282
282
|
console.log('Found types: ', dataHolder.types.length);
|
|
@@ -320,7 +320,7 @@ function reduceTypes(dataHolder) {
|
|
|
320
320
|
return {
|
|
321
321
|
...x
|
|
322
322
|
};
|
|
323
|
-
}),
|
|
323
|
+
}).sort((one, two) => (one.slug < two.slug ? -1 : 1)),
|
|
324
324
|
};
|
|
325
325
|
reducedTypes.push(reducedType);
|
|
326
326
|
}
|
|
@@ -40,7 +40,7 @@ ExportUsers.flags = {
|
|
|
40
40
|
};
|
|
41
41
|
async function exportUsers(fileLocation, overwrite) {
|
|
42
42
|
const allUsersInOrg = await (0, users_1.getUserOrgs)();
|
|
43
|
-
|
|
43
|
+
let users = [];
|
|
44
44
|
for (const userInOrg of allUsersInOrg) {
|
|
45
45
|
delete userInOrg.user.id;
|
|
46
46
|
delete userInOrg.user.updatedBy;
|
|
@@ -53,6 +53,7 @@ async function exportUsers(fileLocation, overwrite) {
|
|
|
53
53
|
...userInOrg.user
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
+
users = users.sort((one, two) => (one.email < two.email ? -1 : 1));
|
|
56
57
|
await saveData(users, fileLocation, overwrite);
|
|
57
58
|
}
|
|
58
59
|
exports.exportUsers = exportUsers;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class CreateWebhooks extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const login_1 = require("../../auth/login");
|
|
5
|
+
const webhooks_1 = require("../../api/webhooks");
|
|
6
|
+
class CreateWebhooks extends core_1.Command {
|
|
7
|
+
async run() {
|
|
8
|
+
const { flags } = await this.parse(CreateWebhooks);
|
|
9
|
+
await (0, login_1.authUser)();
|
|
10
|
+
const webhook = await (0, webhooks_1.createWebhook)({});
|
|
11
|
+
if (flags.json) {
|
|
12
|
+
console.log(JSON.stringify(webhook, null, 2));
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
console.log(webhook.id);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.default = CreateWebhooks;
|
|
20
|
+
CreateWebhooks.description = 'Create a new webhook';
|
|
21
|
+
CreateWebhooks.examples = [
|
|
22
|
+
'contrail webhooks create',
|
|
23
|
+
];
|
|
24
|
+
CreateWebhooks.flags = {
|
|
25
|
+
json: core_1.Flags.boolean({ char: 'j', description: 'output in json format', default: false }),
|
|
26
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class DeleteWebhooks extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
};
|
|
8
|
+
static args: {
|
|
9
|
+
webhookId: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const login_1 = require("../../auth/login");
|
|
6
|
+
const webhooks_1 = require("../../api/webhooks");
|
|
7
|
+
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
8
|
+
class DeleteWebhooks extends core_1.Command {
|
|
9
|
+
async run() {
|
|
10
|
+
const { flags, args } = await this.parse(DeleteWebhooks);
|
|
11
|
+
await (0, login_1.authUser)();
|
|
12
|
+
const webhooks = await (0, webhooks_1.getWebhooks)();
|
|
13
|
+
const deletedWebhooks = [];
|
|
14
|
+
if (args.webhookId) {
|
|
15
|
+
const toDelete = webhooks.find(x => x.id === args.webhookId);
|
|
16
|
+
if (!toDelete) {
|
|
17
|
+
throw new Error(`No webhook found with id ${args.webhookId}`);
|
|
18
|
+
}
|
|
19
|
+
deletedWebhooks.push(await (0, webhooks_1.deleteWebhook)(toDelete.id));
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
const answer = await inquirer_1.default.prompt({
|
|
23
|
+
type: 'checkbox',
|
|
24
|
+
name: 'webhookIds',
|
|
25
|
+
message: 'which webhook(s) would you like to delete?',
|
|
26
|
+
choices: webhooks.map(x => ({ name: x.id, value: x.id })),
|
|
27
|
+
});
|
|
28
|
+
for (const id of answer.webhookIds) {
|
|
29
|
+
deletedWebhooks.push(await (0, webhooks_1.deleteWebhook)(id));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (flags.json) {
|
|
33
|
+
console.log(JSON.stringify(deletedWebhooks, null, 2));
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
console.log(deletedWebhooks.map(x => x.id).join('\n'));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.default = DeleteWebhooks;
|
|
41
|
+
DeleteWebhooks.description = 'Delete an existing webhook. To delete a single webhook, pass its ID. To delete multiple webhooks, do not pass a value for the ID, and select multiple using the interactive selector';
|
|
42
|
+
DeleteWebhooks.examples = [
|
|
43
|
+
'contrail webhooks delete',
|
|
44
|
+
'contrail webhooks delete 12345abcd-1234-abcd-1234-12345abcde',
|
|
45
|
+
];
|
|
46
|
+
DeleteWebhooks.flags = {
|
|
47
|
+
json: core_1.Flags.boolean({ char: 'j', description: 'output in json format', default: false }),
|
|
48
|
+
};
|
|
49
|
+
DeleteWebhooks.args = {
|
|
50
|
+
webhookId: core_1.Args.string({ description: 'The id of the webhook to delete', required: false }),
|
|
51
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class GetWebhookTrigger extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
webhookId: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const login_1 = require("../../auth/login");
|
|
6
|
+
const webhooks_1 = require("../../api/webhooks");
|
|
7
|
+
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
8
|
+
class GetWebhookTrigger extends core_1.Command {
|
|
9
|
+
async run() {
|
|
10
|
+
const { args } = await this.parse(GetWebhookTrigger);
|
|
11
|
+
await (0, login_1.authUser)();
|
|
12
|
+
const webhooks = await (0, webhooks_1.getWebhooks)();
|
|
13
|
+
if (args.webhookId) {
|
|
14
|
+
const foundWebhook = webhooks.find(x => x.id === args.webhookId);
|
|
15
|
+
if (!foundWebhook) {
|
|
16
|
+
throw new Error(`No webhook found with id ${args.webhookId}`);
|
|
17
|
+
}
|
|
18
|
+
console.log(`webhookId:${foundWebhook.id}`);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
const answer = await inquirer_1.default.prompt({
|
|
22
|
+
type: 'list',
|
|
23
|
+
name: 'webhookId',
|
|
24
|
+
message: 'For which webhook would you like ot generate an event tirgger?',
|
|
25
|
+
choices: webhooks.map(x => ({ name: x.id, value: x.id })),
|
|
26
|
+
});
|
|
27
|
+
console.log(`webhookId:${answer.webhookId}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.default = GetWebhookTrigger;
|
|
32
|
+
GetWebhookTrigger.description = 'Crafts a webhook trigger that can be used for event workflows. This command does not alter the state of any webhook or event workflow. It is only a utility for generating a webhook trigger.';
|
|
33
|
+
GetWebhookTrigger.examples = [
|
|
34
|
+
'contrail webhooks getWebhookTrigger 1234-abcd-1234-abcd-1234abcd',
|
|
35
|
+
];
|
|
36
|
+
GetWebhookTrigger.args = {
|
|
37
|
+
webhookId: core_1.Args.string({ description: 'The id of the webhook to delete', required: false }),
|
|
38
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class ListWebhooks extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
};
|
|
8
|
+
static args: {};
|
|
9
|
+
run(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const login_1 = require("../../auth/login");
|
|
5
|
+
const webhooks_1 = require("../../api/webhooks");
|
|
6
|
+
class ListWebhooks extends core_1.Command {
|
|
7
|
+
async run() {
|
|
8
|
+
const { flags } = await this.parse(ListWebhooks);
|
|
9
|
+
await (0, login_1.authUser)();
|
|
10
|
+
const webhooks = await (0, webhooks_1.getWebhooks)();
|
|
11
|
+
if (flags.json) {
|
|
12
|
+
console.log(JSON.stringify(webhooks, null, 2));
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
console.log(webhooks.map(x => x.id).join('\n'));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.default = ListWebhooks;
|
|
20
|
+
ListWebhooks.description = 'List current webhooks';
|
|
21
|
+
ListWebhooks.examples = [
|
|
22
|
+
'contrail webhooks list',
|
|
23
|
+
];
|
|
24
|
+
ListWebhooks.flags = {
|
|
25
|
+
// // flag with a value (-n, --name=VALUE)
|
|
26
|
+
// name: Flags.string({char: 'n', description: 'name to print'}),
|
|
27
|
+
// flag with no value (-f, --force)
|
|
28
|
+
json: core_1.Flags.boolean({ char: 'j', description: 'output in json format', default: false }),
|
|
29
|
+
};
|
|
30
|
+
ListWebhooks.args = {
|
|
31
|
+
// file: Args.string({description: 'file to read'}),
|
|
32
|
+
};
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -127,6 +127,13 @@ export interface AppOrg {
|
|
|
127
127
|
apiKey?: AppApiKey;
|
|
128
128
|
appConfig?: any;
|
|
129
129
|
}
|
|
130
|
+
export interface Webhook {
|
|
131
|
+
id?: string;
|
|
132
|
+
createdOn?: Date;
|
|
133
|
+
createdById?: string;
|
|
134
|
+
createdBy?: any;
|
|
135
|
+
orgId?: string;
|
|
136
|
+
}
|
|
130
137
|
export interface AppCodePackage {
|
|
131
138
|
id: string;
|
|
132
139
|
appId: string;
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.1.
|
|
2
|
+
"version": "2.1.6",
|
|
3
3
|
"commands": {
|
|
4
4
|
"app:create": {
|
|
5
5
|
"id": "app:create",
|
|
@@ -1014,6 +1014,99 @@
|
|
|
1014
1014
|
}
|
|
1015
1015
|
}
|
|
1016
1016
|
},
|
|
1017
|
+
"webhooks:create": {
|
|
1018
|
+
"id": "webhooks:create",
|
|
1019
|
+
"description": "Create a new webhook",
|
|
1020
|
+
"strict": true,
|
|
1021
|
+
"pluginName": "@contrail/cli",
|
|
1022
|
+
"pluginAlias": "@contrail/cli",
|
|
1023
|
+
"pluginType": "core",
|
|
1024
|
+
"aliases": [],
|
|
1025
|
+
"examples": [
|
|
1026
|
+
"contrail webhooks create"
|
|
1027
|
+
],
|
|
1028
|
+
"flags": {
|
|
1029
|
+
"json": {
|
|
1030
|
+
"name": "json",
|
|
1031
|
+
"type": "boolean",
|
|
1032
|
+
"char": "j",
|
|
1033
|
+
"description": "output in json format",
|
|
1034
|
+
"allowNo": false
|
|
1035
|
+
}
|
|
1036
|
+
},
|
|
1037
|
+
"args": {}
|
|
1038
|
+
},
|
|
1039
|
+
"webhooks:delete": {
|
|
1040
|
+
"id": "webhooks:delete",
|
|
1041
|
+
"description": "Delete an existing webhook. To delete a single webhook, pass its ID. To delete multiple webhooks, do not pass a value for the ID, and select multiple using the interactive selector",
|
|
1042
|
+
"strict": true,
|
|
1043
|
+
"pluginName": "@contrail/cli",
|
|
1044
|
+
"pluginAlias": "@contrail/cli",
|
|
1045
|
+
"pluginType": "core",
|
|
1046
|
+
"aliases": [],
|
|
1047
|
+
"examples": [
|
|
1048
|
+
"contrail webhooks delete",
|
|
1049
|
+
"contrail webhooks delete 12345abcd-1234-abcd-1234-12345abcde"
|
|
1050
|
+
],
|
|
1051
|
+
"flags": {
|
|
1052
|
+
"json": {
|
|
1053
|
+
"name": "json",
|
|
1054
|
+
"type": "boolean",
|
|
1055
|
+
"char": "j",
|
|
1056
|
+
"description": "output in json format",
|
|
1057
|
+
"allowNo": false
|
|
1058
|
+
}
|
|
1059
|
+
},
|
|
1060
|
+
"args": {
|
|
1061
|
+
"webhookId": {
|
|
1062
|
+
"name": "webhookId",
|
|
1063
|
+
"description": "The id of the webhook to delete",
|
|
1064
|
+
"required": false
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
},
|
|
1068
|
+
"webhooks:getWebhookTrigger": {
|
|
1069
|
+
"id": "webhooks:getWebhookTrigger",
|
|
1070
|
+
"description": "Crafts a webhook trigger that can be used for event workflows. This command does not alter the state of any webhook or event workflow. It is only a utility for generating a webhook trigger.",
|
|
1071
|
+
"strict": true,
|
|
1072
|
+
"pluginName": "@contrail/cli",
|
|
1073
|
+
"pluginAlias": "@contrail/cli",
|
|
1074
|
+
"pluginType": "core",
|
|
1075
|
+
"aliases": [],
|
|
1076
|
+
"examples": [
|
|
1077
|
+
"contrail webhooks getWebhookTrigger 1234-abcd-1234-abcd-1234abcd"
|
|
1078
|
+
],
|
|
1079
|
+
"flags": {},
|
|
1080
|
+
"args": {
|
|
1081
|
+
"webhookId": {
|
|
1082
|
+
"name": "webhookId",
|
|
1083
|
+
"description": "The id of the webhook to delete",
|
|
1084
|
+
"required": false
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
},
|
|
1088
|
+
"webhooks:list": {
|
|
1089
|
+
"id": "webhooks:list",
|
|
1090
|
+
"description": "List current webhooks",
|
|
1091
|
+
"strict": true,
|
|
1092
|
+
"pluginName": "@contrail/cli",
|
|
1093
|
+
"pluginAlias": "@contrail/cli",
|
|
1094
|
+
"pluginType": "core",
|
|
1095
|
+
"aliases": [],
|
|
1096
|
+
"examples": [
|
|
1097
|
+
"contrail webhooks list"
|
|
1098
|
+
],
|
|
1099
|
+
"flags": {
|
|
1100
|
+
"json": {
|
|
1101
|
+
"name": "json",
|
|
1102
|
+
"type": "boolean",
|
|
1103
|
+
"char": "j",
|
|
1104
|
+
"description": "output in json format",
|
|
1105
|
+
"allowNo": false
|
|
1106
|
+
}
|
|
1107
|
+
},
|
|
1108
|
+
"args": {}
|
|
1109
|
+
},
|
|
1017
1110
|
"workflow-template-definitions:install": {
|
|
1018
1111
|
"id": "workflow-template-definitions:install",
|
|
1019
1112
|
"description": "Install the template definitions of an app to your org",
|