-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.ts
More file actions
71 lines (62 loc) · 2.73 KB
/
update.ts
File metadata and controls
71 lines (62 loc) · 2.73 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
60
61
62
63
64
65
66
67
68
69
70
71
/*---------------------------------------------------------------------------------------------
* 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 BaseCommand from "../../../extensions/base-command.js";
import { CustomFlags } from "../../../extensions/custom-flags.js";
export default class UpdateAccessControlGroup extends BaseCommand {
static description = 'Update the details of an existing group in an iTwin.';
static examples = [
{
command: `<%= config.bin %> <%= command.id %> --itwin-id ad0ba809-9241-48ad-9eb0-c8038c1a1d51 --group-id bf4d8b36-25d7-4b72-b38b-12c1f0325f42 --name "Updated Engineering Team" --description "Updated description"`,
description: 'Example 1: Update group name and description'
},
{
command: `<%= config.bin %> <%= command.id %> --itwin-id ad0ba809-9241-48ad-9eb0-c8038c1a1d51 --group-id bf4d8b36-25d7-4b72-b38b-12c1f0325f42 --member [email protected] --member [email protected] --ims-group "Sample IMS Group" --ims-group "Sample IMS Group"`,
description: 'Example 2: Update group members and IMS groups'
}
];
static flags = {
description: Flags.string({
char: 'd',
description: 'The updated description of the group.',
helpValue: '<string>',
}),
"group-id": Flags.string({
char: 'g',
description: 'The ID of the group to be updated.',
helpValue: '<string>',
required: true,
}),
"ims-group": Flags.string({
description: 'A list of IMS Groups to be linked to the group.',
helpValue: '<string>',
multiple: true,
}),
"itwin-id": CustomFlags.iTwinIDFlag({
description: 'The ID of the iTwin where the group exists.'
}),
member: Flags.string({
description: 'A list of members (emails) to be assigned to the group.',
helpValue: '<string>',
multiple: true,
}),
name: Flags.string({
char: 'n',
description: 'The updated name of the group.',
helpValue: '<string>',
}),
};
async run() {
const { flags } = await this.parse(UpdateAccessControlGroup);
const client = await this.getAccessControlApiClient();
const response = await client.updateGroup(flags["itwin-id"], flags["group-id"], {
description: flags.description,
imsGroups: flags["ims-group"],
members: flags.member,
name: flags.name,
});
return this.logAndReturnResult(response.group);
}
}