-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate.ts
More file actions
59 lines (49 loc) · 1.98 KB
/
create.ts
File metadata and controls
59 lines (49 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import { Flags } from "@oclif/core";
import { apiReference } from "../../../extensions/api-reference.js";
import BaseCommand from "../../../extensions/base-command.js";
export default class CreateAccessControlGroup extends BaseCommand {
static apiReference : apiReference = {
link: "https://developer.bentley.com/apis/access-control-v2/operations/create-itwin-group/",
name: "Create iTwin Group",
}
static description = 'Create a new group for an iTwin.';
static examples = [
{
command: `<%= config.bin %> <%= command.id %> --itwin-id ad0ba809-9241-48ad-9eb0-c8038c1a1d51 --name "Engineering Team" --description "Group handling engineering tasks"`,
description: 'Example 1:'
}
];
static flags = {
description: Flags.string({
char: 'd',
description: 'A description of the group.',
helpValue: '<string>',
required: true,
}),
"itwin-id": Flags.string({
char: 'i',
description: 'The ID of the iTwin where the group is being created.',
helpValue: '<string>',
required: true,
}),
name: Flags.string({
char: 'n',
description: 'The name of the group to be created.',
helpValue: '<string>',
required: true,
}),
};
async run() {
const { flags } = await this.parse(CreateAccessControlGroup);
const client = await this.getAccessControlApiClient();
const response = await client.createGroup(flags["itwin-id"], {
description: flags.description,
name: flags.name,
});
return this.logAndReturnResult(response.group);
}
}