@routr/ctl 2.0.8-alpha.23 → 2.0.8-alpha.24
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 +1 -1
- package/dist/commands/acl/create.js +43 -43
- package/dist/commands/acl/get.js +1 -1
- package/dist/commands/acl/update.js +43 -43
- package/dist/commands/agents/create.js +97 -97
- package/dist/commands/agents/update.js +88 -88
- package/dist/commands/credentials/update.js +39 -39
- package/dist/commands/domains/create.js +105 -105
- package/dist/commands/domains/update.js +99 -99
- package/dist/commands/numbers/create.js +88 -88
- package/dist/commands/numbers/update.js +69 -69
- package/dist/commands/peers/create.js +100 -97
- package/dist/commands/peers/update.js +97 -94
- package/dist/commands/trunks/create.js +148 -148
- package/dist/commands/trunks/update.js +151 -151
- package/dist/delete.js +8 -3
- package/oclif.manifest.json +1 -1
- package/package.json +4 -4
|
@@ -34,51 +34,51 @@ class UpdateCommand extends base_1.BaseCommand {
|
|
|
34
34
|
async run() {
|
|
35
35
|
const { args, flags } = await this.parse(UpdateCommand);
|
|
36
36
|
const { endpoint, insecure } = flags;
|
|
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
|
-
|
|
37
|
+
try {
|
|
38
|
+
const api = new sdk_1.default.Credentials({ endpoint, insecure });
|
|
39
|
+
const credentialsFromDB = await api.getCredentials(args.ref);
|
|
40
|
+
this.log("This utility will help you update an existing set of Credentials.");
|
|
41
|
+
this.log("Press ^C at any time to quit.");
|
|
42
|
+
const answers = await inquirer_1.default.prompt([
|
|
43
|
+
{
|
|
44
|
+
name: "name",
|
|
45
|
+
message: "Friendly Name",
|
|
46
|
+
type: "input",
|
|
47
|
+
default: credentialsFromDB.name,
|
|
48
|
+
validate: validators_1.nameValidator
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "username",
|
|
52
|
+
message: "Username",
|
|
53
|
+
type: "input",
|
|
54
|
+
default: credentialsFromDB.username,
|
|
55
|
+
validate: validators_1.usernameValidator
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "password",
|
|
59
|
+
message: "Password",
|
|
60
|
+
type: "password"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "confirm",
|
|
64
|
+
message: "Ready?",
|
|
65
|
+
type: "confirm"
|
|
66
|
+
}
|
|
67
|
+
]);
|
|
68
|
+
answers.ref = args.ref;
|
|
69
|
+
if (!answers.confirm) {
|
|
70
|
+
this.warn("Aborted");
|
|
65
71
|
}
|
|
66
|
-
|
|
67
|
-
answers.ref = args.ref;
|
|
68
|
-
if (!answers.confirm) {
|
|
69
|
-
this.warn("Aborted");
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
try {
|
|
72
|
+
else {
|
|
73
73
|
core_1.CliUx.ux.action.start(`Updating Credentials for ${answers.name}`);
|
|
74
74
|
const acl = await api.updateCredentials(answers);
|
|
75
75
|
await core_1.CliUx.ux.wait(1000);
|
|
76
76
|
core_1.CliUx.ux.action.stop(acl.ref);
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
core_1.CliUx.ux.action.stop();
|
|
81
|
+
throw new errors_1.CLIError(e.message);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -58,105 +58,105 @@ class CreateCommand extends base_1.BaseCommand {
|
|
|
58
58
|
async run() {
|
|
59
59
|
const { flags } = await this.parse(CreateCommand);
|
|
60
60
|
const { endpoint, insecure } = flags;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
61
|
+
try {
|
|
62
|
+
// TODO: Fix hardcoded pageSize
|
|
63
|
+
const acls = await new sdk_1.default.ACL({ endpoint, insecure }).listACLs({
|
|
64
|
+
pageSize: 25,
|
|
65
|
+
pageToken: ""
|
|
66
|
+
});
|
|
67
|
+
const aclChoices = acls.items.map((acl) => {
|
|
68
|
+
return {
|
|
69
|
+
name: acl.name,
|
|
70
|
+
value: acl.ref
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
// TODO: Fix hardcoded pageSize
|
|
74
|
+
const numbers = await new sdk_1.default.Numbers({ endpoint, insecure }).listNumbers({
|
|
75
|
+
pageSize: 25,
|
|
76
|
+
pageToken: ""
|
|
77
|
+
});
|
|
78
|
+
const numberChoices = numbers.items.map((number) => {
|
|
79
|
+
return {
|
|
80
|
+
name: number.name,
|
|
81
|
+
value: number.ref
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
this.log("This utility will help you create a new Domain.");
|
|
85
|
+
this.log("Press ^C at any time to quit.");
|
|
86
|
+
const group1 = await inquirer_1.default.prompt([
|
|
87
|
+
{
|
|
88
|
+
name: "name",
|
|
89
|
+
message: "Friendly Name",
|
|
90
|
+
type: "input",
|
|
91
|
+
validate: validators_1.nameValidator
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: "domainUri",
|
|
95
|
+
message: "SIP URI",
|
|
96
|
+
type: "input",
|
|
97
|
+
validate: validators_1.domainUriValidator
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "accessControlListRef",
|
|
101
|
+
message: "IP Access Control List",
|
|
102
|
+
type: "list",
|
|
103
|
+
choices: [{ name: "None", value: undefined }, ...aclChoices]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: "addEgressRule",
|
|
107
|
+
message: "Add an Egress Rule?",
|
|
108
|
+
type: "confirm",
|
|
109
|
+
default: false,
|
|
110
|
+
when: numberChoices.length > 0
|
|
111
|
+
}
|
|
112
|
+
]);
|
|
113
|
+
const group2Questions = [
|
|
114
|
+
{
|
|
115
|
+
name: "numberRef",
|
|
116
|
+
message: "Number",
|
|
117
|
+
type: "list",
|
|
118
|
+
choices: [{ name: "None", value: undefined }, ...numberChoices],
|
|
119
|
+
when: numberChoices.length > 0
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: "rule",
|
|
123
|
+
message: "Rule",
|
|
124
|
+
type: "input",
|
|
125
|
+
default: ".*",
|
|
126
|
+
when: (answers) => answers.numberRef
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: "addEgressRule",
|
|
130
|
+
message: "Add another Egress Rule?",
|
|
131
|
+
type: "confirm",
|
|
132
|
+
default: false,
|
|
133
|
+
when: (answers) => answers.numberRef
|
|
134
|
+
}
|
|
135
|
+
];
|
|
136
|
+
let addEgressRule = group1.addEgressRule;
|
|
137
|
+
const egressPolicies = [];
|
|
138
|
+
// eslint-disable-next-line no-loops/no-loops
|
|
139
|
+
while (addEgressRule) {
|
|
140
|
+
const group2 = await inquirer_1.default.prompt(group2Questions);
|
|
141
|
+
if (group2.numberRef) {
|
|
142
|
+
egressPolicies.push({
|
|
143
|
+
numberRef: group2.numberRef,
|
|
144
|
+
rule: group2.rule
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
addEgressRule = group2.addEgressRule;
|
|
145
148
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
const group3 = await inquirer_1.default.prompt([
|
|
150
|
+
{
|
|
151
|
+
name: "confirm",
|
|
152
|
+
message: "Ready?",
|
|
153
|
+
type: "confirm"
|
|
154
|
+
}
|
|
155
|
+
]);
|
|
156
|
+
if (!group3.confirm) {
|
|
157
|
+
this.warn("Aborted");
|
|
153
158
|
}
|
|
154
|
-
|
|
155
|
-
if (!group3.confirm) {
|
|
156
|
-
this.warn("Aborted");
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
try {
|
|
159
|
+
else {
|
|
160
160
|
core_1.CliUx.ux.action.start(`Creating Domain ${group1.name}`);
|
|
161
161
|
const api = new sdk_1.default.Domains({ endpoint, insecure });
|
|
162
162
|
const domains = await api.createDomain({
|
|
@@ -166,14 +166,14 @@ class CreateCommand extends base_1.BaseCommand {
|
|
|
166
166
|
await core_1.CliUx.ux.wait(1000);
|
|
167
167
|
core_1.CliUx.ux.action.stop(domains.ref);
|
|
168
168
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
169
|
+
}
|
|
170
|
+
catch (e) {
|
|
171
|
+
core_1.CliUx.ux.action.stop();
|
|
172
|
+
if (e.code === grpc.status.ALREADY_EXISTS) {
|
|
173
|
+
throw new errors_1.CLIError("This Domain already exist");
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
throw new errors_1.CLIError(e.message);
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
}
|
|
@@ -34,103 +34,103 @@ class UpdateCommand extends base_1.BaseCommand {
|
|
|
34
34
|
async run() {
|
|
35
35
|
const { args, flags } = await this.parse(UpdateCommand);
|
|
36
36
|
const { endpoint, insecure } = flags;
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
37
|
+
try {
|
|
38
|
+
const api = new sdk_1.default.Domains({ endpoint, insecure });
|
|
39
|
+
const domainFromDB = await api.getDomain(args.ref);
|
|
40
|
+
// TODO: Fix hardcoded pageSize
|
|
41
|
+
const acls = await new sdk_1.default.ACL({ endpoint, insecure }).listACLs({
|
|
42
|
+
pageSize: 25,
|
|
43
|
+
pageToken: ""
|
|
44
|
+
});
|
|
45
|
+
const aclChoices = acls.items.map((acl) => {
|
|
46
|
+
return {
|
|
47
|
+
name: acl.name,
|
|
48
|
+
value: acl.ref
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
// TODO: Fix hardcoded pageSize
|
|
52
|
+
const numbers = await new sdk_1.default.Numbers({ endpoint, insecure }).listNumbers({
|
|
53
|
+
pageSize: 25,
|
|
54
|
+
pageToken: ""
|
|
55
|
+
});
|
|
56
|
+
const numberChoices = numbers.items.map((number) => {
|
|
57
|
+
return {
|
|
58
|
+
name: number.name,
|
|
59
|
+
value: number.ref
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
this.log("This utility will help you update an existing Domain.");
|
|
63
|
+
this.log("Press ^C at any time to quit.");
|
|
64
|
+
this.warn("Adding Egress Policies will delete existing ones.");
|
|
65
|
+
const group1 = await inquirer_1.default.prompt([
|
|
66
|
+
{
|
|
67
|
+
name: "name",
|
|
68
|
+
message: "Friendly Name",
|
|
69
|
+
type: "input",
|
|
70
|
+
default: domainFromDB.name,
|
|
71
|
+
validate: validators_1.nameValidator
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "accessControlListRef",
|
|
75
|
+
message: "IP Access Control List",
|
|
76
|
+
type: "list",
|
|
77
|
+
choices: [{ name: "None", value: undefined }, ...aclChoices],
|
|
78
|
+
default: domainFromDB.accessControlListRef
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "addEgressRule",
|
|
82
|
+
message: "Add an Egress Rule?",
|
|
83
|
+
type: "confirm",
|
|
84
|
+
default: false,
|
|
85
|
+
when: aclChoices.length > 0
|
|
86
|
+
}
|
|
87
|
+
]);
|
|
88
|
+
const group2Questions = [
|
|
89
|
+
{
|
|
90
|
+
name: "numberRef",
|
|
91
|
+
message: "Number",
|
|
92
|
+
type: "list",
|
|
93
|
+
choices: [{ name: "None", value: undefined }, ...numberChoices]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "rule",
|
|
97
|
+
message: "Rule",
|
|
98
|
+
type: "input",
|
|
99
|
+
default: ".*",
|
|
100
|
+
when: (answers) => answers.numberRef
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "addEgressRule",
|
|
104
|
+
message: "Add another Egress Rule?",
|
|
105
|
+
type: "confirm",
|
|
106
|
+
default: false,
|
|
107
|
+
when: (answers) => answers.numberRef
|
|
108
|
+
}
|
|
109
|
+
];
|
|
110
|
+
let addEgressRule = group1.addEgressRule;
|
|
111
|
+
const egressPolicies = [];
|
|
112
|
+
// eslint-disable-next-line no-loops/no-loops
|
|
113
|
+
while (addEgressRule) {
|
|
114
|
+
const group2 = await inquirer_1.default.prompt(group2Questions);
|
|
115
|
+
if (group2.numberRef) {
|
|
116
|
+
egressPolicies.push({
|
|
117
|
+
numberRef: group2.numberRef,
|
|
118
|
+
rule: group2.rule
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
addEgressRule = group2.addEgressRule;
|
|
85
122
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
name: "rule",
|
|
96
|
-
message: "Rule",
|
|
97
|
-
type: "input",
|
|
98
|
-
default: ".*",
|
|
99
|
-
when: (answers) => answers.numberRef
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
name: "addEgressRule",
|
|
103
|
-
message: "Add another Egress Rule?",
|
|
104
|
-
type: "confirm",
|
|
105
|
-
default: false,
|
|
106
|
-
when: (answers) => answers.numberRef
|
|
123
|
+
const group3 = await inquirer_1.default.prompt([
|
|
124
|
+
{
|
|
125
|
+
name: "confirm",
|
|
126
|
+
message: "Ready?",
|
|
127
|
+
type: "confirm"
|
|
128
|
+
}
|
|
129
|
+
]);
|
|
130
|
+
if (!group3.confirm) {
|
|
131
|
+
this.warn("Aborted");
|
|
107
132
|
}
|
|
108
|
-
|
|
109
|
-
let addEgressRule = group1.addEgressRule;
|
|
110
|
-
const egressPolicies = [];
|
|
111
|
-
// eslint-disable-next-line no-loops/no-loops
|
|
112
|
-
while (addEgressRule) {
|
|
113
|
-
const group2 = await inquirer_1.default.prompt(group2Questions);
|
|
114
|
-
if (group2.numberRef) {
|
|
115
|
-
egressPolicies.push({
|
|
116
|
-
numberRef: group2.numberRef,
|
|
117
|
-
rule: group2.rule
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
addEgressRule = group2.addEgressRule;
|
|
121
|
-
}
|
|
122
|
-
const group3 = await inquirer_1.default.prompt([
|
|
123
|
-
{
|
|
124
|
-
name: "confirm",
|
|
125
|
-
message: "Ready?",
|
|
126
|
-
type: "confirm"
|
|
127
|
-
}
|
|
128
|
-
]);
|
|
129
|
-
if (!group3.confirm) {
|
|
130
|
-
this.warn("Aborted");
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
try {
|
|
133
|
+
else {
|
|
134
134
|
core_1.CliUx.ux.action.start(`Updating Domain ${group1.name}`);
|
|
135
135
|
const domain = await api.updateDomain({
|
|
136
136
|
ref: domainFromDB.ref,
|
|
@@ -140,10 +140,10 @@ class UpdateCommand extends base_1.BaseCommand {
|
|
|
140
140
|
await core_1.CliUx.ux.wait(1000);
|
|
141
141
|
core_1.CliUx.ux.action.stop(domain.ref);
|
|
142
142
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
}
|
|
144
|
+
catch (e) {
|
|
145
|
+
core_1.CliUx.ux.action.stop();
|
|
146
|
+
throw new errors_1.CLIError(e.message);
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
}
|