@routr/ctl 2.0.8-alpha.23 → 2.0.8-alpha.25
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 +170 -51
- package/dist/base.d.ts +0 -1
- package/dist/base.js +0 -4
- package/dist/commands/acl/create.js +43 -43
- package/dist/commands/acl/describe.d.ts +10 -0
- package/dist/commands/acl/describe.js +62 -0
- package/dist/commands/acl/get.d.ts +1 -0
- package/dist/commands/acl/get.js +5 -20
- package/dist/commands/acl/update.js +43 -43
- package/dist/commands/agents/create.js +97 -97
- package/dist/commands/agents/describe.d.ts +10 -0
- package/dist/commands/agents/describe.js +72 -0
- package/dist/commands/agents/get.d.ts +1 -0
- package/dist/commands/agents/get.js +4 -26
- package/dist/commands/agents/update.js +88 -88
- package/dist/commands/credentials/describe.d.ts +10 -0
- package/dist/commands/credentials/describe.js +61 -0
- package/dist/commands/credentials/get.d.ts +1 -0
- package/dist/commands/credentials/get.js +5 -20
- package/dist/commands/credentials/update.js +39 -39
- package/dist/commands/domains/create.js +105 -105
- package/dist/commands/domains/describe.d.ts +10 -0
- package/dist/commands/domains/describe.js +78 -0
- package/dist/commands/domains/get.d.ts +1 -0
- package/dist/commands/domains/get.js +4 -24
- package/dist/commands/domains/update.js +99 -99
- package/dist/commands/numbers/create.js +88 -88
- package/dist/commands/numbers/describe.d.ts +10 -0
- package/dist/commands/numbers/describe.js +72 -0
- package/dist/commands/numbers/get.d.ts +1 -0
- package/dist/commands/numbers/get.js +4 -24
- package/dist/commands/numbers/update.js +69 -69
- package/dist/commands/peers/create.js +106 -97
- package/dist/commands/peers/describe.d.ts +10 -0
- package/dist/commands/peers/describe.js +80 -0
- package/dist/commands/peers/get.d.ts +1 -0
- package/dist/commands/peers/get.js +6 -43
- package/dist/commands/peers/update.js +103 -94
- package/dist/commands/trunks/create.js +143 -139
- package/dist/commands/trunks/describe.d.ts +10 -0
- package/dist/commands/trunks/describe.js +85 -0
- package/dist/commands/trunks/get.d.ts +1 -0
- package/dist/commands/trunks/get.js +6 -33
- package/dist/commands/trunks/update.js +146 -142
- package/dist/delete.js +8 -3
- package/oclif.manifest.json +267 -183
- package/package.json +8 -5
|
@@ -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
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
/*
|
|
7
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
8
|
+
* http://github.com/fonoster
|
|
9
|
+
*
|
|
10
|
+
* This file is part of Routr.
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the MIT License (the "License");
|
|
13
|
+
* you may not use this file except in compliance with
|
|
14
|
+
* the License. You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* https://opensource.org/licenses/MIT
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
/* eslint-disable require-jsdoc */
|
|
25
|
+
const base_1 = require("../../base");
|
|
26
|
+
const errors_1 = require("@oclif/core/lib/errors");
|
|
27
|
+
const prettyjson_1 = require("prettyjson");
|
|
28
|
+
const sdk_1 = __importDefault(require("@routr/sdk"));
|
|
29
|
+
const moment_1 = __importDefault(require("moment"));
|
|
30
|
+
class DescribeCommand extends base_1.BaseCommand {
|
|
31
|
+
async run() {
|
|
32
|
+
const { args, flags } = await this.parse(DescribeCommand);
|
|
33
|
+
const { endpoint, insecure } = flags;
|
|
34
|
+
const api = new sdk_1.default.Domains({ endpoint, insecure });
|
|
35
|
+
try {
|
|
36
|
+
const domain = await api.getDomain(args.ref);
|
|
37
|
+
const jsonObj = {
|
|
38
|
+
Ref: domain.ref,
|
|
39
|
+
APIVersion: domain.apiVersion,
|
|
40
|
+
Name: domain.name,
|
|
41
|
+
URI: domain.domainUri,
|
|
42
|
+
"Access Control List": domain.accessControlList
|
|
43
|
+
? {
|
|
44
|
+
Ref: domain.accessControlList.ref,
|
|
45
|
+
Name: domain.accessControlList.name,
|
|
46
|
+
Deny: domain.accessControlList.deny.join(","),
|
|
47
|
+
Allow: domain.accessControlList.allow.join(",")
|
|
48
|
+
}
|
|
49
|
+
: "None",
|
|
50
|
+
// TODO: Extend to show the Tel Url
|
|
51
|
+
"Egress Policies": domain.egressPolicies.length > 0
|
|
52
|
+
? domain.egressPolicies.map((p) => {
|
|
53
|
+
return {
|
|
54
|
+
Rule: p.rule,
|
|
55
|
+
"Number Ref": p.numberRef
|
|
56
|
+
};
|
|
57
|
+
})
|
|
58
|
+
: "None",
|
|
59
|
+
Extended: domain.extended,
|
|
60
|
+
Created: (0, moment_1.default)(new Date(domain.createdAt * 1000)).toISOString(),
|
|
61
|
+
Updated: (0, moment_1.default)(new Date(domain.updatedAt * 1000)).toISOString()
|
|
62
|
+
};
|
|
63
|
+
this.log((0, prettyjson_1.render)(jsonObj, { noColor: true }));
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
throw new errors_1.CLIError(e.message);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.default = DescribeCommand;
|
|
71
|
+
DescribeCommand.description = "show details of a Domain";
|
|
72
|
+
DescribeCommand.args = [
|
|
73
|
+
{
|
|
74
|
+
name: "ref",
|
|
75
|
+
required: false,
|
|
76
|
+
description: "reference to the Domain"
|
|
77
|
+
}
|
|
78
|
+
];
|
|
@@ -5,6 +5,7 @@ export default class GetDomainsCommand extends BaseCommand {
|
|
|
5
5
|
static examples: string[];
|
|
6
6
|
static flags: {
|
|
7
7
|
size: import("@oclif/core/lib/interfaces").OptionFlag<number>;
|
|
8
|
+
extended: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
9
|
};
|
|
9
10
|
static args: {
|
|
10
11
|
name: string;
|
|
@@ -64,36 +64,12 @@ class GetDomainsCommand extends base_1.BaseCommand {
|
|
|
64
64
|
domainUri: {
|
|
65
65
|
header: "URI"
|
|
66
66
|
},
|
|
67
|
-
accessControlListRef: {
|
|
68
|
-
header: "IP Access Control List",
|
|
69
|
-
get: (row) => { var _a; return ((_a = row.accessControlList) === null || _a === void 0 ? void 0 : _a.name) || "None"; },
|
|
70
|
-
extended: true
|
|
71
|
-
},
|
|
72
67
|
egressPolicies: {
|
|
73
68
|
header: "Egress Policies",
|
|
74
69
|
get: (row) => row.egressPolicies
|
|
75
70
|
.map((p) => `${p.rule}/${p.number.telUrl.split("tel:")[1]}`)
|
|
76
71
|
.join(", "),
|
|
77
72
|
extended: true
|
|
78
|
-
},
|
|
79
|
-
createdAt: {
|
|
80
|
-
header: "Created",
|
|
81
|
-
get: (row) => new Date(row.createdAt * 1000),
|
|
82
|
-
extended: true
|
|
83
|
-
},
|
|
84
|
-
updatedAt: {
|
|
85
|
-
header: "Updated",
|
|
86
|
-
get: (row) => new Date(row.updatedAt * 1000),
|
|
87
|
-
extended: true
|
|
88
|
-
},
|
|
89
|
-
extended: {
|
|
90
|
-
header: "Extended",
|
|
91
|
-
get: (row) => row.extended || {},
|
|
92
|
-
extended: true
|
|
93
|
-
},
|
|
94
|
-
apiVersion: {
|
|
95
|
-
header: "API",
|
|
96
|
-
extended: true
|
|
97
73
|
}
|
|
98
74
|
}, {
|
|
99
75
|
"no-header": !showHeader,
|
|
@@ -131,6 +107,10 @@ GetDomainsCommand.flags = {
|
|
|
131
107
|
char: "s",
|
|
132
108
|
description: "the number of items to return",
|
|
133
109
|
default: 50
|
|
110
|
+
}),
|
|
111
|
+
extended: core_1.Flags.boolean({
|
|
112
|
+
char: "x",
|
|
113
|
+
description: "extended output format"
|
|
134
114
|
})
|
|
135
115
|
};
|
|
136
116
|
GetDomainsCommand.args = [
|
|
@@ -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
|
}
|