@routr/ctl 2.0.8-alpha.24 → 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/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 +4 -19
- package/dist/commands/agents/create.js +1 -1
- 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 +1 -1
- 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/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/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/peers/create.js +6 -0
- 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 +6 -0
- package/dist/commands/trunks/create.js +15 -11
- 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 +15 -11
- package/oclif.manifest.json +267 -183
- package/package.json +8 -5
package/dist/commands/acl/get.js
CHANGED
|
@@ -68,25 +68,6 @@ class GetCommand extends base_1.BaseCommand {
|
|
|
68
68
|
allow: {
|
|
69
69
|
header: "Allow CIDR Networks",
|
|
70
70
|
get: (row) => row.allow.join(", ")
|
|
71
|
-
},
|
|
72
|
-
createdAt: {
|
|
73
|
-
header: "Created",
|
|
74
|
-
get: (row) => new Date(row.createdAt * 1000),
|
|
75
|
-
extended: true
|
|
76
|
-
},
|
|
77
|
-
updatedAt: {
|
|
78
|
-
header: "Updated",
|
|
79
|
-
get: (row) => new Date(row.updatedAt * 1000),
|
|
80
|
-
extended: true
|
|
81
|
-
},
|
|
82
|
-
extended: {
|
|
83
|
-
header: "Extended",
|
|
84
|
-
get: (row) => row.extended || {},
|
|
85
|
-
extended: true
|
|
86
|
-
},
|
|
87
|
-
apiVersion: {
|
|
88
|
-
header: "API",
|
|
89
|
-
extended: true
|
|
90
71
|
}
|
|
91
72
|
}, {
|
|
92
73
|
"no-header": !showHeader,
|
|
@@ -124,6 +105,10 @@ GetCommand.flags = {
|
|
|
124
105
|
char: "s",
|
|
125
106
|
description: "the number of items to return",
|
|
126
107
|
default: 50
|
|
108
|
+
}),
|
|
109
|
+
extended: core_1.Flags.boolean({
|
|
110
|
+
char: "x",
|
|
111
|
+
description: "extended output format"
|
|
127
112
|
})
|
|
128
113
|
};
|
|
129
114
|
GetCommand.args = [
|
|
@@ -0,0 +1,72 @@
|
|
|
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 utils_1 = require("../../utils");
|
|
29
|
+
const sdk_1 = __importDefault(require("@routr/sdk"));
|
|
30
|
+
const moment_1 = __importDefault(require("moment"));
|
|
31
|
+
class DescribeCommand extends base_1.BaseCommand {
|
|
32
|
+
async run() {
|
|
33
|
+
var _a;
|
|
34
|
+
const { args, flags } = await this.parse(DescribeCommand);
|
|
35
|
+
const { endpoint, insecure } = flags;
|
|
36
|
+
const api = new sdk_1.default.Agents({ endpoint, insecure });
|
|
37
|
+
try {
|
|
38
|
+
const agent = await api.getAgent(args.ref);
|
|
39
|
+
const jsonObj = {
|
|
40
|
+
Ref: agent.ref,
|
|
41
|
+
APIVersion: agent.apiVersion,
|
|
42
|
+
Name: agent.name,
|
|
43
|
+
Username: agent.username,
|
|
44
|
+
Domain: ((_a = agent.domain) === null || _a === void 0 ? void 0 : _a.domainUri) || "None",
|
|
45
|
+
Privacy: (0, utils_1.capitalize)(agent.privacy),
|
|
46
|
+
Credentials: agent.credentials
|
|
47
|
+
? {
|
|
48
|
+
Ref: agent.credentials.ref,
|
|
49
|
+
Username: agent.credentials.username
|
|
50
|
+
}
|
|
51
|
+
: "None",
|
|
52
|
+
Enabled: agent.enabled ? "Yes" : "No",
|
|
53
|
+
Extended: agent.extended,
|
|
54
|
+
Created: (0, moment_1.default)(new Date(agent.createdAt * 1000)).toISOString(),
|
|
55
|
+
Updated: (0, moment_1.default)(new Date(agent.updatedAt * 1000)).toISOString()
|
|
56
|
+
};
|
|
57
|
+
this.log((0, prettyjson_1.render)(jsonObj, { noColor: true }));
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
throw new errors_1.CLIError(e.message);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.default = DescribeCommand;
|
|
65
|
+
DescribeCommand.description = "shows details of an Agent";
|
|
66
|
+
DescribeCommand.args = [
|
|
67
|
+
{
|
|
68
|
+
name: "ref",
|
|
69
|
+
required: false,
|
|
70
|
+
description: "reference to the Agent"
|
|
71
|
+
}
|
|
72
|
+
];
|
|
@@ -5,6 +5,7 @@ export default class GetAgentsCommand 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;
|
|
@@ -72,35 +72,9 @@ class GetAgentsCommand extends base_1.BaseCommand {
|
|
|
72
72
|
header: "Privacy",
|
|
73
73
|
get: (row) => (0, utils_1.capitalize)(row.privacy)
|
|
74
74
|
},
|
|
75
|
-
credentials: {
|
|
76
|
-
header: "Credentials Name",
|
|
77
|
-
get: (row) => row.credentials
|
|
78
|
-
? `${row.credentials.name} (${row.credentials.username})`
|
|
79
|
-
: "None",
|
|
80
|
-
extended: true
|
|
81
|
-
},
|
|
82
75
|
enabled: {
|
|
83
76
|
header: "Enabled",
|
|
84
77
|
get: (row) => (row.enabled ? "Yes" : "No")
|
|
85
|
-
},
|
|
86
|
-
createdAt: {
|
|
87
|
-
header: "Created",
|
|
88
|
-
get: (row) => new Date(row.createdAt * 1000),
|
|
89
|
-
extended: true
|
|
90
|
-
},
|
|
91
|
-
updatedAt: {
|
|
92
|
-
header: "Updated",
|
|
93
|
-
get: (row) => new Date(row.updatedAt * 1000),
|
|
94
|
-
extended: true
|
|
95
|
-
},
|
|
96
|
-
extended: {
|
|
97
|
-
header: "Extended",
|
|
98
|
-
get: (row) => row.extended || {},
|
|
99
|
-
extended: true
|
|
100
|
-
},
|
|
101
|
-
apiVersion: {
|
|
102
|
-
header: "API",
|
|
103
|
-
extended: true
|
|
104
78
|
}
|
|
105
79
|
}, {
|
|
106
80
|
"no-header": !showHeader,
|
|
@@ -138,6 +112,10 @@ GetAgentsCommand.flags = {
|
|
|
138
112
|
char: "s",
|
|
139
113
|
description: "The number of items to return",
|
|
140
114
|
default: 50
|
|
115
|
+
}),
|
|
116
|
+
extended: core_1.Flags.boolean({
|
|
117
|
+
char: "x",
|
|
118
|
+
description: "extended output format"
|
|
141
119
|
})
|
|
142
120
|
};
|
|
143
121
|
GetAgentsCommand.args = [
|
|
@@ -0,0 +1,61 @@
|
|
|
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.Credentials({ endpoint, insecure });
|
|
35
|
+
try {
|
|
36
|
+
const credentials = await api.getCredentials(args.ref);
|
|
37
|
+
const jsonObj = {
|
|
38
|
+
Ref: credentials.ref,
|
|
39
|
+
APIVersion: credentials.apiVersion,
|
|
40
|
+
Name: credentials.name,
|
|
41
|
+
Username: credentials.username,
|
|
42
|
+
Extended: credentials.extended,
|
|
43
|
+
Created: (0, moment_1.default)(new Date(credentials.createdAt * 1000)).toISOString(),
|
|
44
|
+
Updated: (0, moment_1.default)(new Date(credentials.updatedAt * 1000)).toISOString()
|
|
45
|
+
};
|
|
46
|
+
this.log((0, prettyjson_1.render)(jsonObj, { noColor: true }));
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
throw new errors_1.CLIError(e.message);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.default = DescribeCommand;
|
|
54
|
+
DescribeCommand.description = "shows details for a set of Credentials";
|
|
55
|
+
DescribeCommand.args = [
|
|
56
|
+
{
|
|
57
|
+
name: "ref",
|
|
58
|
+
required: false,
|
|
59
|
+
description: "reference to the set of Credentials"
|
|
60
|
+
}
|
|
61
|
+
];
|
|
@@ -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);
|
|
@@ -63,25 +63,6 @@ class GetCommand extends base_1.BaseCommand {
|
|
|
63
63
|
},
|
|
64
64
|
username: {
|
|
65
65
|
header: "Username"
|
|
66
|
-
},
|
|
67
|
-
createdAt: {
|
|
68
|
-
header: "Created",
|
|
69
|
-
get: (row) => new Date(row.createdAt * 1000),
|
|
70
|
-
extended: true
|
|
71
|
-
},
|
|
72
|
-
updatedAt: {
|
|
73
|
-
header: "Updated",
|
|
74
|
-
get: (row) => new Date(row.updatedAt * 1000),
|
|
75
|
-
extended: true
|
|
76
|
-
},
|
|
77
|
-
extended: {
|
|
78
|
-
header: "Extended",
|
|
79
|
-
get: (row) => row.extended || {},
|
|
80
|
-
extended: true
|
|
81
|
-
},
|
|
82
|
-
apiVersion: {
|
|
83
|
-
header: "API",
|
|
84
|
-
extended: true
|
|
85
66
|
}
|
|
86
67
|
}, {
|
|
87
68
|
"no-header": !showHeader,
|
|
@@ -119,6 +100,10 @@ GetCommand.flags = {
|
|
|
119
100
|
char: "s",
|
|
120
101
|
description: "the number of items to return",
|
|
121
102
|
default: 50
|
|
103
|
+
}),
|
|
104
|
+
extended: core_1.Flags.boolean({
|
|
105
|
+
char: "x",
|
|
106
|
+
description: "extended output format"
|
|
122
107
|
})
|
|
123
108
|
};
|
|
124
109
|
GetCommand.args = [
|
|
@@ -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 = [
|
|
@@ -0,0 +1,72 @@
|
|
|
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.Numbers({ endpoint, insecure });
|
|
35
|
+
try {
|
|
36
|
+
const number = await api.getNumber(args.ref);
|
|
37
|
+
const jsonObj = {
|
|
38
|
+
Ref: number.ref,
|
|
39
|
+
APIVersion: number.apiVersion,
|
|
40
|
+
Name: number.name,
|
|
41
|
+
"Tel URL": number.telUrl,
|
|
42
|
+
"AOR Link": number.aorLink,
|
|
43
|
+
"Trunk Ref": number.trunkRef,
|
|
44
|
+
"Geo Info": {
|
|
45
|
+
City: number.city,
|
|
46
|
+
"Country Name": number.country,
|
|
47
|
+
"Country Code": number.countryIsoCode
|
|
48
|
+
},
|
|
49
|
+
"Session Affinity Header": number.sessionAffinityHeader,
|
|
50
|
+
"Extra Headers": number.extraHeaders
|
|
51
|
+
? number.extraHeaders.join(",")
|
|
52
|
+
: "None",
|
|
53
|
+
Extended: number.extended,
|
|
54
|
+
Created: (0, moment_1.default)(new Date(number.createdAt * 1000)).toISOString(),
|
|
55
|
+
Updated: (0, moment_1.default)(new Date(number.updatedAt * 1000)).toISOString()
|
|
56
|
+
};
|
|
57
|
+
this.log((0, prettyjson_1.render)(jsonObj, { noColor: true }));
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
throw new errors_1.CLIError(e.message);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.default = DescribeCommand;
|
|
65
|
+
DescribeCommand.description = "shows details for a Number";
|
|
66
|
+
DescribeCommand.args = [
|
|
67
|
+
{
|
|
68
|
+
name: "ref",
|
|
69
|
+
required: false,
|
|
70
|
+
description: "reference to the Number"
|
|
71
|
+
}
|
|
72
|
+
];
|
|
@@ -5,6 +5,7 @@ export default class GetNumbersCommand 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;
|
|
@@ -75,30 +75,6 @@ class GetNumbersCommand extends base_1.BaseCommand {
|
|
|
75
75
|
header: "Geo",
|
|
76
76
|
// Combine city, country and countryIsoCode
|
|
77
77
|
get: (row) => `${row.city}, ${row.country} (${row.countryIsoCode})`
|
|
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
|
-
extraHeaders: {
|
|
90
|
-
header: "Extra Headers",
|
|
91
|
-
get: (row) => row.extraHeaders || [{}],
|
|
92
|
-
extended: true
|
|
93
|
-
},
|
|
94
|
-
extended: {
|
|
95
|
-
header: "Extended",
|
|
96
|
-
get: (row) => row.extended || {},
|
|
97
|
-
extended: true
|
|
98
|
-
},
|
|
99
|
-
apiVersion: {
|
|
100
|
-
header: "API",
|
|
101
|
-
extended: true
|
|
102
78
|
}
|
|
103
79
|
}, {
|
|
104
80
|
"no-header": !showHeader,
|
|
@@ -136,6 +112,10 @@ GetNumbersCommand.flags = {
|
|
|
136
112
|
char: "s",
|
|
137
113
|
description: "the number of items to return",
|
|
138
114
|
default: 50
|
|
115
|
+
}),
|
|
116
|
+
extended: core_1.Flags.boolean({
|
|
117
|
+
char: "x",
|
|
118
|
+
description: "extended output format"
|
|
139
119
|
})
|
|
140
120
|
};
|
|
141
121
|
GetNumbersCommand.args = [
|
|
@@ -143,6 +143,12 @@ class CreateCommand extends base_1.BaseCommand {
|
|
|
143
143
|
default: common_1.CommonTypes.LoadBalancingAlgorithm.ROUND_ROBIN,
|
|
144
144
|
when: (answers) => answers.aor.startsWith("backend:")
|
|
145
145
|
},
|
|
146
|
+
{
|
|
147
|
+
name: "enabled",
|
|
148
|
+
message: "Enabled?",
|
|
149
|
+
type: "confirm",
|
|
150
|
+
default: true
|
|
151
|
+
},
|
|
146
152
|
{
|
|
147
153
|
name: "confirm",
|
|
148
154
|
message: "Ready?",
|