-
Notifications
You must be signed in to change notification settings - Fork 1
/
update.ts
42 lines (35 loc) · 1.21 KB
/
update.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
39
40
41
42
import { ElasticSipTrunking } from '@sinch/sdk-core';
import {
getAccessControlListIdFromConfig,
getPrintFormat,
initElasticSipTrunkingService,
printFullResponse,
} from '../../config';
(async () => {
console.log('***************************');
console.log('* updateAccessControlList *');
console.log('***************************');
const aclId = getAccessControlListIdFromConfig();
const requestData: ElasticSipTrunking.UpdateAccessControlListRequestData = {
id: aclId,
updateAccessControlListRequestBody: {
name: 'ACL updated with the Node.js SDK',
enabled: false,
ipRanges: [
{
description: 'Location 1 - updated',
ipAddress: '15.15.15.16',
range: 20,
},
],
},
};
const elasticSipTrunkingService = initElasticSipTrunkingService();
const response = await elasticSipTrunkingService.accessControlList.update(requestData);
const printFormat = getPrintFormat(process.argv);
if (printFormat === 'pretty') {
console.log(`The Access Control List with the id '${response.id}' has been updated at '${response.updateTime?.toISOString()}'. Its new name is '${response.name}'`);
} else {
printFullResponse(response);
}
})();