@routr/ctl 2.0.8-alpha.21

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.
Files changed (78) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +973 -0
  3. package/bin/dev +17 -0
  4. package/bin/dev.cmd +3 -0
  5. package/bin/run +25 -0
  6. package/bin/run.cmd +3 -0
  7. package/dist/base.d.ts +8 -0
  8. package/dist/base.js +42 -0
  9. package/dist/commands/acl/create.d.ts +6 -0
  10. package/dist/commands/acl/create.js +122 -0
  11. package/dist/commands/acl/delete.d.ts +6 -0
  12. package/dist/commands/acl/delete.js +40 -0
  13. package/dist/commands/acl/get.d.ts +19 -0
  14. package/dist/commands/acl/get.js +135 -0
  15. package/dist/commands/acl/update.d.ts +11 -0
  16. package/dist/commands/acl/update.js +100 -0
  17. package/dist/commands/agents/create.d.ts +6 -0
  18. package/dist/commands/agents/create.js +179 -0
  19. package/dist/commands/agents/delete.d.ts +6 -0
  20. package/dist/commands/agents/delete.js +40 -0
  21. package/dist/commands/agents/get.d.ts +19 -0
  22. package/dist/commands/agents/get.js +149 -0
  23. package/dist/commands/agents/update.d.ts +11 -0
  24. package/dist/commands/agents/update.js +150 -0
  25. package/dist/commands/credentials/create.d.ts +6 -0
  26. package/dist/commands/credentials/create.js +122 -0
  27. package/dist/commands/credentials/delete.d.ts +6 -0
  28. package/dist/commands/credentials/delete.js +40 -0
  29. package/dist/commands/credentials/get.d.ts +19 -0
  30. package/dist/commands/credentials/get.js +130 -0
  31. package/dist/commands/credentials/update.d.ts +11 -0
  32. package/dist/commands/credentials/update.js +98 -0
  33. package/dist/commands/domains/create.d.ts +6 -0
  34. package/dist/commands/domains/create.js +187 -0
  35. package/dist/commands/domains/delete.d.ts +6 -0
  36. package/dist/commands/domains/delete.js +40 -0
  37. package/dist/commands/domains/get.d.ts +19 -0
  38. package/dist/commands/domains/get.js +142 -0
  39. package/dist/commands/domains/update.d.ts +11 -0
  40. package/dist/commands/domains/update.js +163 -0
  41. package/dist/commands/numbers/create.d.ts +6 -0
  42. package/dist/commands/numbers/create.js +171 -0
  43. package/dist/commands/numbers/delete.d.ts +6 -0
  44. package/dist/commands/numbers/delete.js +40 -0
  45. package/dist/commands/numbers/get.d.ts +19 -0
  46. package/dist/commands/numbers/get.js +147 -0
  47. package/dist/commands/numbers/update.d.ts +11 -0
  48. package/dist/commands/numbers/update.js +130 -0
  49. package/dist/commands/peers/create.d.ts +6 -0
  50. package/dist/commands/peers/create.js +177 -0
  51. package/dist/commands/peers/delete.d.ts +6 -0
  52. package/dist/commands/peers/delete.js +40 -0
  53. package/dist/commands/peers/get.d.ts +19 -0
  54. package/dist/commands/peers/get.js +159 -0
  55. package/dist/commands/peers/update.d.ts +11 -0
  56. package/dist/commands/peers/update.js +156 -0
  57. package/dist/commands/trunks/create.d.ts +6 -0
  58. package/dist/commands/trunks/create.js +231 -0
  59. package/dist/commands/trunks/delete.d.ts +6 -0
  60. package/dist/commands/trunks/delete.js +40 -0
  61. package/dist/commands/trunks/get.d.ts +19 -0
  62. package/dist/commands/trunks/get.js +145 -0
  63. package/dist/commands/trunks/update.d.ts +11 -0
  64. package/dist/commands/trunks/update.js +217 -0
  65. package/dist/countries.d.ts +4 -0
  66. package/dist/countries.js +270 -0
  67. package/dist/delete.d.ts +9 -0
  68. package/dist/delete.js +46 -0
  69. package/dist/help.d.ts +6 -0
  70. package/dist/help.js +84 -0
  71. package/dist/index.d.ts +1 -0
  72. package/dist/index.js +23 -0
  73. package/dist/utils.d.ts +22 -0
  74. package/dist/utils.js +97 -0
  75. package/dist/validators.d.ts +16 -0
  76. package/dist/validators.js +180 -0
  77. package/oclif.manifest.json +1 -0
  78. package/package.json +89 -0
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ /*
27
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
28
+ * http://github.com/fonoster
29
+ *
30
+ * This file is part of Routr.
31
+ *
32
+ * Licensed under the MIT License (the "License");
33
+ * you may not use this file except in compliance with
34
+ * the License. You may obtain a copy of the License at
35
+ *
36
+ * https://opensource.org/licenses/MIT
37
+ *
38
+ * Unless required by applicable law or agreed to in writing, software
39
+ * distributed under the License is distributed on an "AS IS" BASIS,
40
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
41
+ * See the License for the specific language governing permissions and
42
+ * limitations under the License.
43
+ */
44
+ /* eslint-disable require-jsdoc */
45
+ const grpc = __importStar(require("@grpc/grpc-js"));
46
+ const core_1 = require("@oclif/core");
47
+ const base_1 = require("../../base");
48
+ const utils_1 = require("../../utils");
49
+ const common_1 = require("@routr/common");
50
+ const errors_1 = require("@oclif/core/lib/errors");
51
+ class GetNumbersCommand extends base_1.BaseCommand {
52
+ async run() {
53
+ const { args, flags } = await this.parse(GetNumbersCommand);
54
+ const showTable = (request) => {
55
+ const { showHeader, data, self, flags } = request;
56
+ core_1.CliUx.ux.table(data, {
57
+ ref: {
58
+ minWidth: 7,
59
+ extended: true
60
+ },
61
+ name: {
62
+ minWidth: 7
63
+ },
64
+ telUrl: {
65
+ header: "Telephony URL"
66
+ },
67
+ aorLink: {
68
+ header: "AOR Link"
69
+ },
70
+ sessionAffinityHeader: {
71
+ header: "Session Affinity Header",
72
+ extended: true
73
+ },
74
+ geo: {
75
+ header: "Geo",
76
+ // Combine city, country and countryIsoCode
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
+ }
103
+ }, {
104
+ "no-header": !showHeader,
105
+ printLine: self.log.bind(self),
106
+ ...flags // parsed flags
107
+ });
108
+ };
109
+ await (0, utils_1.showPaginatedList)({
110
+ showTable,
111
+ args,
112
+ flags,
113
+ kind: common_1.CommonConnect.Kind.NUMBER,
114
+ self: this
115
+ });
116
+ }
117
+ async catch(error) {
118
+ // To be handled globally
119
+ if ("code" in error && error.code === grpc.status.NOT_FOUND) {
120
+ const { args } = await this.parse(GetNumbersCommand);
121
+ throw new errors_1.CLIError("the Number you are looking for does not exist: " + args.ref);
122
+ }
123
+ throw new errors_1.CLIError(error.message);
124
+ }
125
+ }
126
+ exports.default = GetNumbersCommand;
127
+ GetNumbersCommand.description = "Shows a list of paginated Numbers or a single Number if ref is provided";
128
+ GetNumbersCommand.examples = [
129
+ `<%= config.bin %> <%= command.id %>
130
+ Ref Name Telephony URL AOR Link Geo
131
+ a134487f-a668-4509-9ddd-dcbc98175468 (785) 317-8070 +17853178070 sip:1001@sip.local Cameron, USA (US)
132
+ `
133
+ ];
134
+ GetNumbersCommand.flags = {
135
+ size: core_1.Flags.integer({
136
+ char: "s",
137
+ description: "the number of items to return",
138
+ default: 50
139
+ })
140
+ };
141
+ GetNumbersCommand.args = [
142
+ {
143
+ name: "ref",
144
+ required: false,
145
+ description: "optional reference to a Number"
146
+ }
147
+ ];
@@ -0,0 +1,11 @@
1
+ import { BaseCommand } from "../../base";
2
+ export default class UpdateCommand extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ name: string;
7
+ required: boolean;
8
+ description: string;
9
+ }[];
10
+ run(): Promise<void>;
11
+ }
@@ -0,0 +1,130 @@
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 core_1 = require("@oclif/core");
26
+ const base_1 = require("../../base");
27
+ const errors_1 = require("@oclif/core/lib/errors");
28
+ const validators_1 = require("../../validators");
29
+ const utils_1 = require("../../utils");
30
+ const sdk_1 = __importDefault(require("@routr/sdk"));
31
+ // NOTE: Newer versions of inquirer have a bug that causes the following error:
32
+ // (node:75345) [ERR_REQUIRE_ESM] Error Plugin: @routr/ctl [ERR_REQUIRE_ESM]: require() of ES Module
33
+ const inquirer_1 = __importDefault(require("inquirer"));
34
+ class UpdateCommand extends base_1.BaseCommand {
35
+ async run() {
36
+ var _a;
37
+ const { args, flags } = await this.parse(UpdateCommand);
38
+ const { endpoint, insecure } = flags;
39
+ const api = new sdk_1.default.Numbers({ endpoint, insecure });
40
+ this.log("This utility will help you update an existing Number.");
41
+ this.log("Press ^C at any time to quit.");
42
+ const numberFromDB = await api.getNumber(args.ref);
43
+ const trunks = await new sdk_1.default.Trunks({ endpoint, insecure }).listTrunks({
44
+ pageSize: 25,
45
+ pageToken: ""
46
+ });
47
+ const trunksChoices = trunks.items.map((trunk) => {
48
+ return {
49
+ name: trunk.name,
50
+ value: trunk.ref
51
+ };
52
+ });
53
+ const answers = await inquirer_1.default.prompt([
54
+ {
55
+ name: "name",
56
+ message: "Friendly Name",
57
+ type: "input",
58
+ default: numberFromDB.name,
59
+ validate: validators_1.nameValidator
60
+ },
61
+ {
62
+ name: "aorLink",
63
+ message: "AOR Link",
64
+ type: "input",
65
+ default: numberFromDB.aorLink || undefined,
66
+ validate: validators_1.aorLinkValidator
67
+ },
68
+ {
69
+ name: "trunkRef",
70
+ message: "Trunk",
71
+ type: "list",
72
+ choices: [{ name: "None", value: undefined }, ...trunksChoices],
73
+ default: numberFromDB.trunkRef
74
+ },
75
+ {
76
+ name: "sessionAffinityHeader",
77
+ message: "Session Affinity Header",
78
+ type: "input",
79
+ default: numberFromDB.sessionAffinityHeader || undefined,
80
+ validate: validators_1.sessionAffinityHeaderValidator
81
+ },
82
+ {
83
+ name: "extraHeaders",
84
+ message: "Extra Headers",
85
+ type: "input",
86
+ default: ((_a = numberFromDB.extraHeaders) === null || _a === void 0 ? void 0 : _a.map((header) => {
87
+ return `${header.name}:${header.value}`;
88
+ }).join(",")) || undefined,
89
+ validate: validators_1.headersValidator
90
+ },
91
+ {
92
+ name: "confirm",
93
+ message: "Ready?",
94
+ type: "confirm"
95
+ }
96
+ ]);
97
+ answers.ref = args.ref;
98
+ // Re-write extraHeaders
99
+ answers.extraHeaders = (0, utils_1.stringToHeaders)(answers.extraHeaders);
100
+ if (!answers.confirm) {
101
+ this.warn("Aborted");
102
+ }
103
+ else {
104
+ try {
105
+ core_1.CliUx.ux.action.start(`Updating Number ${answers.name}`);
106
+ const number = await api.updateNumber(answers);
107
+ await core_1.CliUx.ux.wait(1000);
108
+ core_1.CliUx.ux.action.stop(number.ref);
109
+ }
110
+ catch (e) {
111
+ core_1.CliUx.ux.action.stop();
112
+ throw new errors_1.CLIError(e.message);
113
+ }
114
+ }
115
+ }
116
+ }
117
+ exports.default = UpdateCommand;
118
+ UpdateCommand.description = "Updates an existing set of Credentials";
119
+ UpdateCommand.examples = [
120
+ `<%= config.bin %> <%= command.id %>
121
+ Updating Number (785) 317-8070... 80181ca6-d4aa-4575-9375-8f72b07d5555
122
+ `
123
+ ];
124
+ UpdateCommand.args = [
125
+ {
126
+ name: "ref",
127
+ required: true,
128
+ description: "reference to an existing Number"
129
+ }
130
+ ];
@@ -0,0 +1,6 @@
1
+ import { BaseCommand } from "../../base";
2
+ export default class CreateCommand extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ run(): Promise<void>;
6
+ }
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ /*
30
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
31
+ * http://github.com/fonoster
32
+ *
33
+ * This file is part of Routr.
34
+ *
35
+ * Licensed under the MIT License (the "License");
36
+ * you may not use this file except in compliance with
37
+ * the License. You may obtain a copy of the License at
38
+ *
39
+ * https://opensource.org/licenses/MIT
40
+ *
41
+ * Unless required by applicable law or agreed to in writing, software
42
+ * distributed under the License is distributed on an "AS IS" BASIS,
43
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
44
+ * See the License for the specific language governing permissions and
45
+ * limitations under the License.
46
+ */
47
+ /* eslint-disable require-jsdoc */
48
+ const grpc = __importStar(require("@grpc/grpc-js"));
49
+ const core_1 = require("@oclif/core");
50
+ const base_1 = require("../../base");
51
+ const errors_1 = require("@oclif/core/lib/errors");
52
+ const common_1 = require("@routr/common");
53
+ const sdk_1 = __importDefault(require("@routr/sdk"));
54
+ // NOTE: Newer versions of inquirer have a bug that causes the following error:
55
+ // (node:75345) [ERR_REQUIRE_ESM] Error Plugin: @routr/ctl [ERR_REQUIRE_ESM]: require() of ES Module
56
+ const inquirer_1 = __importDefault(require("inquirer"));
57
+ const validators_1 = require("../../validators");
58
+ class CreateCommand extends base_1.BaseCommand {
59
+ async run() {
60
+ var _a, _b;
61
+ const { flags } = await this.parse(CreateCommand);
62
+ const { endpoint, insecure } = flags;
63
+ this.log("This utility will help you create a new Peer.");
64
+ this.log("Press ^C at any time to quit.");
65
+ // TODO: Fix hardcoded pageSize
66
+ const acls = await new sdk_1.default.ACL({ endpoint, insecure }).listACLs({
67
+ pageSize: 25,
68
+ pageToken: ""
69
+ });
70
+ // TODO: Fix hardcoded pageSize
71
+ const credentials = await new sdk_1.default.Credentials({
72
+ endpoint,
73
+ insecure
74
+ }).listCredentials({
75
+ pageSize: 25,
76
+ pageToken: ""
77
+ });
78
+ const aclList = ((_a = acls.items) === null || _a === void 0 ? void 0 : _a.map((acl) => {
79
+ return { name: acl.name, value: acl.ref };
80
+ })) || [];
81
+ const credentialsList = ((_b = credentials.items) === null || _b === void 0 ? void 0 : _b.map((credential) => {
82
+ return { name: credential.name, value: credential.ref };
83
+ })) || [];
84
+ const answers = await inquirer_1.default.prompt([
85
+ {
86
+ name: "name",
87
+ message: "Friendly Name",
88
+ type: "input",
89
+ validate: validators_1.nameValidator
90
+ },
91
+ {
92
+ name: "username",
93
+ message: "Username",
94
+ type: "input",
95
+ validate: validators_1.usernameValidator
96
+ },
97
+ {
98
+ name: "aor",
99
+ message: "Adress of Record",
100
+ type: "input",
101
+ validate: validators_1.aorValidator
102
+ },
103
+ {
104
+ name: "contactAddr",
105
+ message: "Contact Address",
106
+ type: "input",
107
+ validate: validators_1.contactAddrValidator
108
+ },
109
+ {
110
+ name: "accessControlListRef",
111
+ message: "IP Access Control List",
112
+ choices: [{ name: "None", value: undefined }, ...aclList],
113
+ type: "list"
114
+ },
115
+ {
116
+ name: "credentialsRef",
117
+ message: "Credentials Name",
118
+ choices: [{ name: "None", value: undefined }, ...credentialsList],
119
+ type: "list"
120
+ },
121
+ {
122
+ name: "withSessionAffinity",
123
+ message: "Enable Session Affinity?",
124
+ type: "confirm",
125
+ default: false,
126
+ when: (answers) => answers.aor.startsWith("backend:")
127
+ },
128
+ {
129
+ name: "balancingAlgorithm",
130
+ message: "Balancing Algorithm",
131
+ choices: [
132
+ { name: "Round Robin", value: common_1.CommonTypes.LoadBalancingAlgorithm.ROUND_ROBIN },
133
+ {
134
+ name: "Least Sessions",
135
+ value: common_1.CommonTypes.LoadBalancingAlgorithm.LEAST_SESSIONS
136
+ }
137
+ ],
138
+ type: "list",
139
+ default: common_1.CommonTypes.LoadBalancingAlgorithm.ROUND_ROBIN,
140
+ when: (answers) => answers.aor.startsWith("backend:")
141
+ },
142
+ {
143
+ name: "confirm",
144
+ message: "Ready?",
145
+ type: "confirm"
146
+ }
147
+ ]);
148
+ if (!answers.confirm) {
149
+ this.warn("Aborted");
150
+ }
151
+ else {
152
+ try {
153
+ core_1.CliUx.ux.action.start(`Creating Peer ${answers.name}`);
154
+ const api = new sdk_1.default.Peers({ endpoint, insecure });
155
+ const peer = await api.createPeer(answers);
156
+ await core_1.CliUx.ux.wait(1000);
157
+ core_1.CliUx.ux.action.stop(peer.ref);
158
+ }
159
+ catch (e) {
160
+ core_1.CliUx.ux.action.stop();
161
+ if (e.code === grpc.status.ALREADY_EXISTS) {
162
+ throw new errors_1.CLIError("This Peer already exist");
163
+ }
164
+ else {
165
+ throw new errors_1.CLIError(e.message);
166
+ }
167
+ }
168
+ }
169
+ }
170
+ }
171
+ exports.default = CreateCommand;
172
+ CreateCommand.description = "Creates a new Peer";
173
+ CreateCommand.examples = [
174
+ `<%= config.bin %> <%= command.id %>
175
+ Creating Peer Asterisk Conference... b148b4b4-6884-4c06-bb7e-bd098f5fe793
176
+ `
177
+ ];
@@ -0,0 +1,6 @@
1
+ import DeleteCommand from "../../delete";
2
+ export default class DeletePeerCommand extends DeleteCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ run(): Promise<void>;
6
+ }
@@ -0,0 +1,40 @@
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 delete_1 = __importDefault(require("../../delete"));
26
+ const sdk_1 = __importDefault(require("@routr/sdk"));
27
+ class DeletePeerCommand extends delete_1.default {
28
+ async run() {
29
+ const { flags } = await this.parse(DeletePeerCommand);
30
+ const { endpoint, insecure } = flags;
31
+ await super.deleteResource(new sdk_1.default.Peers({ endpoint, insecure }), "deletePeer");
32
+ }
33
+ }
34
+ exports.default = DeletePeerCommand;
35
+ DeletePeerCommand.description = "Deletes a Peer";
36
+ DeletePeerCommand.examples = [
37
+ `<%= config.bin %> <%= command.id %>
38
+ Deleting item 80181ca6-d4aa-4575-9375-8f72b071111... Done
39
+ `
40
+ ];
@@ -0,0 +1,19 @@
1
+ import { BaseCommand } from "../../base";
2
+ import { CommandError } from "@oclif/core/lib/interfaces";
3
+ export default class GetCommand extends BaseCommand {
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: {
7
+ size: import("@oclif/core/lib/interfaces").OptionFlag<number>;
8
+ };
9
+ static args: {
10
+ name: string;
11
+ required: boolean;
12
+ description: string;
13
+ }[];
14
+ run(): Promise<void>;
15
+ catch(error: {
16
+ code: number;
17
+ message: string;
18
+ } | CommandError): Promise<void>;
19
+ }