@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
|
@@ -60,110 +60,119 @@ class CreateCommand extends base_1.BaseCommand {
|
|
|
60
60
|
var _a, _b;
|
|
61
61
|
const { flags } = await this.parse(CreateCommand);
|
|
62
62
|
const { endpoint, insecure } = flags;
|
|
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
|
-
|
|
145
|
-
|
|
63
|
+
try {
|
|
64
|
+
// TODO: Fix hardcoded pageSize
|
|
65
|
+
const acls = await new sdk_1.default.ACL({ endpoint, insecure }).listACLs({
|
|
66
|
+
pageSize: 25,
|
|
67
|
+
pageToken: ""
|
|
68
|
+
});
|
|
69
|
+
// TODO: Fix hardcoded pageSize
|
|
70
|
+
const credentials = await new sdk_1.default.Credentials({
|
|
71
|
+
endpoint,
|
|
72
|
+
insecure
|
|
73
|
+
}).listCredentials({
|
|
74
|
+
pageSize: 25,
|
|
75
|
+
pageToken: ""
|
|
76
|
+
});
|
|
77
|
+
const aclList = ((_a = acls.items) === null || _a === void 0 ? void 0 : _a.map((acl) => {
|
|
78
|
+
return { name: acl.name, value: acl.ref };
|
|
79
|
+
})) || [];
|
|
80
|
+
const credentialsList = ((_b = credentials.items) === null || _b === void 0 ? void 0 : _b.map((credential) => {
|
|
81
|
+
return { name: credential.name, value: credential.ref };
|
|
82
|
+
})) || [];
|
|
83
|
+
this.log("This utility will help you create a new Peer.");
|
|
84
|
+
this.log("Press ^C at any time to quit.");
|
|
85
|
+
const answers = await inquirer_1.default.prompt([
|
|
86
|
+
{
|
|
87
|
+
name: "name",
|
|
88
|
+
message: "Friendly Name",
|
|
89
|
+
type: "input",
|
|
90
|
+
validate: validators_1.nameValidator
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "username",
|
|
94
|
+
message: "Username",
|
|
95
|
+
type: "input",
|
|
96
|
+
validate: validators_1.usernameValidator
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: "aor",
|
|
100
|
+
message: "Adress of Record",
|
|
101
|
+
type: "input",
|
|
102
|
+
validate: validators_1.aorValidator
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "contactAddr",
|
|
106
|
+
message: "Contact Address",
|
|
107
|
+
type: "input",
|
|
108
|
+
validate: validators_1.contactAddrValidator
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "accessControlListRef",
|
|
112
|
+
message: "IP Access Control List",
|
|
113
|
+
choices: [{ name: "None", value: undefined }, ...aclList],
|
|
114
|
+
type: "list"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "credentialsRef",
|
|
118
|
+
message: "Credentials Name",
|
|
119
|
+
choices: [{ name: "None", value: undefined }, ...credentialsList],
|
|
120
|
+
type: "list"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "withSessionAffinity",
|
|
124
|
+
message: "Enable Session Affinity?",
|
|
125
|
+
type: "confirm",
|
|
126
|
+
default: false,
|
|
127
|
+
when: (answers) => answers.aor.startsWith("backend:")
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "balancingAlgorithm",
|
|
131
|
+
message: "Balancing Algorithm",
|
|
132
|
+
choices: [
|
|
133
|
+
{
|
|
134
|
+
name: "Round Robin",
|
|
135
|
+
value: common_1.CommonTypes.LoadBalancingAlgorithm.ROUND_ROBIN
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: "Least Sessions",
|
|
139
|
+
value: common_1.CommonTypes.LoadBalancingAlgorithm.LEAST_SESSIONS
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
type: "list",
|
|
143
|
+
default: common_1.CommonTypes.LoadBalancingAlgorithm.ROUND_ROBIN,
|
|
144
|
+
when: (answers) => answers.aor.startsWith("backend:")
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "enabled",
|
|
148
|
+
message: "Enabled?",
|
|
149
|
+
type: "confirm",
|
|
150
|
+
default: true
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: "confirm",
|
|
154
|
+
message: "Ready?",
|
|
155
|
+
type: "confirm"
|
|
156
|
+
}
|
|
157
|
+
]);
|
|
158
|
+
if (!answers.confirm) {
|
|
159
|
+
this.warn("Aborted");
|
|
146
160
|
}
|
|
147
|
-
|
|
148
|
-
if (!answers.confirm) {
|
|
149
|
-
this.warn("Aborted");
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
try {
|
|
161
|
+
else {
|
|
153
162
|
core_1.CliUx.ux.action.start(`Creating Peer ${answers.name}`);
|
|
154
163
|
const api = new sdk_1.default.Peers({ endpoint, insecure });
|
|
155
164
|
const peer = await api.createPeer(answers);
|
|
156
165
|
await core_1.CliUx.ux.wait(1000);
|
|
157
166
|
core_1.CliUx.ux.action.stop(peer.ref);
|
|
158
167
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
168
|
+
}
|
|
169
|
+
catch (e) {
|
|
170
|
+
core_1.CliUx.ux.action.stop();
|
|
171
|
+
if (e.code === grpc.status.ALREADY_EXISTS) {
|
|
172
|
+
throw new errors_1.CLIError("This Peer already exist");
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
throw new errors_1.CLIError(e.message);
|
|
167
176
|
}
|
|
168
177
|
}
|
|
169
178
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
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.Peers({ endpoint, insecure });
|
|
35
|
+
try {
|
|
36
|
+
const peer = await api.getPeer(args.ref);
|
|
37
|
+
const jsonObj = {
|
|
38
|
+
Ref: peer.ref,
|
|
39
|
+
APIVersion: peer.apiVersion,
|
|
40
|
+
Name: peer.name,
|
|
41
|
+
Username: peer.username,
|
|
42
|
+
AOR: peer.aor,
|
|
43
|
+
"Balancing Algorithm": peer.balancingAlgorithm,
|
|
44
|
+
"Session Affinity?": peer.withSessionAffinity ? "Yes" : "No",
|
|
45
|
+
"Contact Address": peer.contactAddr,
|
|
46
|
+
Enabled: peer.enabled ? "Yes" : "No",
|
|
47
|
+
"Access Control List": peer.accessControlList
|
|
48
|
+
? {
|
|
49
|
+
Ref: peer.accessControlList.ref,
|
|
50
|
+
Name: peer.accessControlList.name,
|
|
51
|
+
Deny: peer.accessControlList.deny.join(","),
|
|
52
|
+
Allow: peer.accessControlList.allow.join(",")
|
|
53
|
+
}
|
|
54
|
+
: "None",
|
|
55
|
+
Credentials: peer.credentials
|
|
56
|
+
? {
|
|
57
|
+
Ref: peer.credentials.ref,
|
|
58
|
+
Username: peer.credentials.username
|
|
59
|
+
}
|
|
60
|
+
: "None",
|
|
61
|
+
Extended: peer.extended,
|
|
62
|
+
Created: (0, moment_1.default)(new Date(peer.createdAt * 1000)).toISOString(),
|
|
63
|
+
Updated: (0, moment_1.default)(new Date(peer.updatedAt * 1000)).toISOString()
|
|
64
|
+
};
|
|
65
|
+
this.log((0, prettyjson_1.render)(jsonObj, { noColor: true }));
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
throw new errors_1.CLIError(e.message);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.default = DescribeCommand;
|
|
73
|
+
DescribeCommand.description = "shows details for a Peer";
|
|
74
|
+
DescribeCommand.args = [
|
|
75
|
+
{
|
|
76
|
+
name: "ref",
|
|
77
|
+
required: false,
|
|
78
|
+
description: "reference to the Peer"
|
|
79
|
+
}
|
|
80
|
+
];
|
|
@@ -5,6 +5,7 @@ export default class GetCommand 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;
|
|
@@ -42,12 +42,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
42
42
|
* limitations under the License.
|
|
43
43
|
*/
|
|
44
44
|
/* eslint-disable require-jsdoc */
|
|
45
|
+
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
45
46
|
const core_1 = require("@oclif/core");
|
|
46
47
|
const base_1 = require("../../base");
|
|
47
48
|
const utils_1 = require("../../utils");
|
|
48
49
|
const common_1 = require("@routr/common");
|
|
49
50
|
const errors_1 = require("@oclif/core/lib/errors");
|
|
50
|
-
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
51
51
|
class GetCommand extends base_1.BaseCommand {
|
|
52
52
|
async run() {
|
|
53
53
|
const { args, flags } = await this.parse(GetCommand);
|
|
@@ -67,50 +67,9 @@ class GetCommand extends base_1.BaseCommand {
|
|
|
67
67
|
aor: {
|
|
68
68
|
header: "AOR"
|
|
69
69
|
},
|
|
70
|
-
balancingAlgorithm: {
|
|
71
|
-
header: "Balancing Algorithm"
|
|
72
|
-
},
|
|
73
|
-
withSessionAffinity: {
|
|
74
|
-
header: "Session Affinity",
|
|
75
|
-
get: (row) => row.withSessionAffinity ? "Yes" : "No"
|
|
76
|
-
},
|
|
77
|
-
contactAddr: {
|
|
78
|
-
header: "Contact Address",
|
|
79
|
-
extended: true
|
|
80
|
-
},
|
|
81
70
|
enabled: {
|
|
82
71
|
header: "Enabled",
|
|
83
|
-
get: (row) => (row.enabled ? "Yes" : "No")
|
|
84
|
-
extended: true
|
|
85
|
-
},
|
|
86
|
-
accessControlList: {
|
|
87
|
-
header: "IP Access Control List",
|
|
88
|
-
get: (row) => { var _a; return ((_a = row.accessControlList) === null || _a === void 0 ? void 0 : _a.name) || "None"; },
|
|
89
|
-
extended: true
|
|
90
|
-
},
|
|
91
|
-
credentials: {
|
|
92
|
-
header: "Credentials Name",
|
|
93
|
-
get: (row) => { var _a; return ((_a = row.credentials) === null || _a === void 0 ? void 0 : _a.name) || "None"; },
|
|
94
|
-
extended: true
|
|
95
|
-
},
|
|
96
|
-
createdAt: {
|
|
97
|
-
header: "Created",
|
|
98
|
-
get: (row) => new Date(row.createdAt * 1000),
|
|
99
|
-
extended: true
|
|
100
|
-
},
|
|
101
|
-
updatedAt: {
|
|
102
|
-
header: "Updated",
|
|
103
|
-
get: (row) => new Date(row.updatedAt * 1000),
|
|
104
|
-
extended: true
|
|
105
|
-
},
|
|
106
|
-
extended: {
|
|
107
|
-
header: "Extended",
|
|
108
|
-
get: (row) => row.extended || {},
|
|
109
|
-
extended: true
|
|
110
|
-
},
|
|
111
|
-
apiVersion: {
|
|
112
|
-
header: "API",
|
|
113
|
-
extended: true
|
|
72
|
+
get: (row) => (row.enabled ? "Yes" : "No")
|
|
114
73
|
}
|
|
115
74
|
}, {
|
|
116
75
|
"no-header": !showHeader,
|
|
@@ -148,6 +107,10 @@ GetCommand.flags = {
|
|
|
148
107
|
char: "s",
|
|
149
108
|
description: "the number of items to return",
|
|
150
109
|
default: 50
|
|
110
|
+
}),
|
|
111
|
+
extended: core_1.Flags.boolean({
|
|
112
|
+
char: "x",
|
|
113
|
+
description: "extended output format"
|
|
151
114
|
})
|
|
152
115
|
};
|
|
153
116
|
GetCommand.args = [
|
|
@@ -37,106 +37,115 @@ class UpdatePeerCommand extends base_1.BaseCommand {
|
|
|
37
37
|
const { args, flags } = await this.parse(UpdatePeerCommand);
|
|
38
38
|
const { endpoint, insecure } = flags;
|
|
39
39
|
const api = new sdk_1.default.Peers({ endpoint, insecure });
|
|
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
|
-
|
|
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
|
-
|
|
40
|
+
try {
|
|
41
|
+
const peerFromDB = await api.getPeer(args.ref);
|
|
42
|
+
// TODO: Fix hardcoded pageSize
|
|
43
|
+
const acls = await new sdk_1.default.ACL({ endpoint, insecure }).listACLs({
|
|
44
|
+
pageSize: 25,
|
|
45
|
+
pageToken: ""
|
|
46
|
+
});
|
|
47
|
+
// TODO: Fix hardcoded pageSize
|
|
48
|
+
const credentials = await new sdk_1.default.Credentials({
|
|
49
|
+
endpoint,
|
|
50
|
+
insecure
|
|
51
|
+
}).listCredentials({
|
|
52
|
+
pageSize: 25,
|
|
53
|
+
pageToken: ""
|
|
54
|
+
});
|
|
55
|
+
const aclList = ((_a = acls.items) === null || _a === void 0 ? void 0 : _a.map((acl) => {
|
|
56
|
+
return { name: acl.name, value: acl.ref };
|
|
57
|
+
})) || [];
|
|
58
|
+
const credentialsList = ((_b = credentials.items) === null || _b === void 0 ? void 0 : _b.map((credential) => {
|
|
59
|
+
return { name: credential.name, value: credential.ref };
|
|
60
|
+
})) || [];
|
|
61
|
+
this.log("This utility will help you update an existing Peer.");
|
|
62
|
+
this.log("Press ^C at any time to quit.");
|
|
63
|
+
const answers = await inquirer_1.default.prompt([
|
|
64
|
+
{
|
|
65
|
+
name: "name",
|
|
66
|
+
message: "Friendly Name",
|
|
67
|
+
type: "input",
|
|
68
|
+
default: peerFromDB.name,
|
|
69
|
+
validate: validators_1.nameValidator
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "aor",
|
|
73
|
+
message: "Adress of Record",
|
|
74
|
+
type: "input",
|
|
75
|
+
default: peerFromDB.aor,
|
|
76
|
+
validate: validators_1.aorValidator
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "contactAddr",
|
|
80
|
+
message: "Contact Address",
|
|
81
|
+
type: "input",
|
|
82
|
+
default: peerFromDB.contactAddr || undefined,
|
|
83
|
+
validate: validators_1.contactAddrValidator
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "accessControlListRef",
|
|
87
|
+
message: "IP Access Control List",
|
|
88
|
+
choices: [{ name: "None", value: undefined }, ...aclList],
|
|
89
|
+
type: "list",
|
|
90
|
+
default: peerFromDB.accessControlListRef
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "credentialsRef",
|
|
94
|
+
message: "Credentials Name",
|
|
95
|
+
choices: [{ name: "None", value: undefined }, ...credentialsList],
|
|
96
|
+
type: "list",
|
|
97
|
+
default: peerFromDB.credentialsRef
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "withSessionAffinity",
|
|
101
|
+
message: "Enable Session Affinity?",
|
|
102
|
+
type: "confirm",
|
|
103
|
+
default: peerFromDB.withSessionAffinity,
|
|
104
|
+
when: (answers) => answers.aor.startsWith("backend:")
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "balancingAlgorithm",
|
|
108
|
+
message: "Balancing Algorithm",
|
|
109
|
+
choices: [
|
|
110
|
+
{
|
|
111
|
+
name: "Round Robin",
|
|
112
|
+
value: common_1.CommonTypes.LoadBalancingAlgorithm.ROUND_ROBIN
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "Least Sessions",
|
|
116
|
+
value: common_1.CommonTypes.LoadBalancingAlgorithm.LEAST_SESSIONS
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
type: "list",
|
|
120
|
+
default: peerFromDB.balancingAlgorithm,
|
|
121
|
+
when: (answers) => answers.aor.startsWith("backend:")
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: "enabled",
|
|
125
|
+
message: "Enabled?",
|
|
126
|
+
type: "confirm",
|
|
127
|
+
default: peerFromDB.enabled
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "confirm",
|
|
131
|
+
message: "Ready?",
|
|
132
|
+
type: "confirm"
|
|
133
|
+
}
|
|
134
|
+
]);
|
|
135
|
+
answers.ref = args.ref;
|
|
136
|
+
if (!answers.confirm) {
|
|
137
|
+
this.warn("Aborted");
|
|
123
138
|
}
|
|
124
|
-
|
|
125
|
-
answers.ref = args.ref;
|
|
126
|
-
if (!answers.confirm) {
|
|
127
|
-
this.warn("Aborted");
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
try {
|
|
139
|
+
else {
|
|
131
140
|
core_1.CliUx.ux.action.start(`Updating Peer ${answers.name}`);
|
|
132
141
|
const acl = await api.updatePeer(answers);
|
|
133
142
|
await core_1.CliUx.ux.wait(1000);
|
|
134
143
|
core_1.CliUx.ux.action.stop(acl.ref);
|
|
135
144
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
145
|
+
}
|
|
146
|
+
catch (e) {
|
|
147
|
+
core_1.CliUx.ux.action.stop();
|
|
148
|
+
throw new errors_1.CLIError(e.message);
|
|
140
149
|
}
|
|
141
150
|
}
|
|
142
151
|
}
|