-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaddACL.ts
38 lines (31 loc) · 1.15 KB
/
addACL.ts
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
import { ElasticSipTrunking } from '@sinch/sdk-core';
import {
getAccessControlListIdFromConfig,
getPrintFormat,
getSipTrunkIdFromConfig,
initElasticSipTrunkingService,
printFullResponse,
} from '../../config';
(async () => {
console.log('*******************************');
console.log('* addAccessControlListToTrunk *');
console.log('*******************************');
const sipTrunkId = getSipTrunkIdFromConfig();
const aclId = getAccessControlListIdFromConfig();
const requestData: ElasticSipTrunking.AddAccessControlListToTrunkRequestData = {
trunkId: sipTrunkId,
addAccessControlListToTrunkRequestBody: {
accessControlListIds: [
aclId,
],
},
};
const elasticSipTrunkingService = initElasticSipTrunkingService();
const response = await elasticSipTrunkingService.sipTrunks.addAccessControlList(requestData);
const printFormat = getPrintFormat(process.argv);
if (printFormat === 'pretty') {
console.log(`The SIP trunk with the id '${requestData.trunkId}' contains the following ACL IDs:\n - ${response.accessControlListIds?.join('\n - ')}`);
} else {
printFullResponse(response);
}
})();