kourou 0.25.2 → 0.26.0
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 +118 -70
- package/lib/commands/app/debug-proxy.js +2 -0
- package/lib/commands/paas/deploy.d.ts +0 -1
- package/lib/commands/paas/deploy.js +0 -22
- package/lib/commands/paas/login.js +3 -2
- package/lib/commands/paas/logs.d.ts +0 -2
- package/lib/commands/paas/logs.js +0 -33
- package/lib/commands/paas/snapshots/cat.d.ts +17 -0
- package/lib/commands/paas/snapshots/cat.js +45 -0
- package/lib/commands/paas/snapshots/dump.d.ts +17 -0
- package/lib/commands/paas/snapshots/dump.js +45 -0
- package/lib/commands/paas/snapshots/restore.d.ts +17 -0
- package/lib/commands/paas/snapshots/restore.js +53 -0
- package/lib/support/PaasKommand.d.ts +1 -0
- package/lib/support/PaasKommand.js +10 -0
- package/lib/support/migrate/providers/elasticsearch.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The CLI that helps you manage your Kuzzle instances.
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
[](https://oclif.io)
|
|
6
7
|
[](https://npmjs.org/package/kourou)
|
|
7
8
|
[](https://npmjs.org/package/kourou)
|
|
@@ -26,7 +27,7 @@ $ npm install -g kourou
|
|
|
26
27
|
$ kourou COMMAND
|
|
27
28
|
running command...
|
|
28
29
|
$ kourou (-v|--version|version)
|
|
29
|
-
kourou/0.
|
|
30
|
+
kourou/0.26.0 linux-x64 node-v14.21.2
|
|
30
31
|
$ kourou --help [COMMAND]
|
|
31
32
|
USAGE
|
|
32
33
|
$ kourou COMMAND
|
|
@@ -125,61 +126,72 @@ All other arguments and options will be passed as-is to the `sdk:query` method.
|
|
|
125
126
|
# Commands
|
|
126
127
|
|
|
127
128
|
<!-- commands -->
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
129
|
+
- [kourou](#kourou)
|
|
130
|
+
- [Usage](#usage)
|
|
131
|
+
- [Connect and authenticate to Kuzzle API](#connect-and-authenticate-to-kuzzle-api)
|
|
132
|
+
- [User impersonation](#user-impersonation)
|
|
133
|
+
- [Automatic command infering for API actions](#automatic-command-infering-for-api-actions)
|
|
134
|
+
- [Commands](#commands)
|
|
135
|
+
- [`kourou api-key:check TOKEN`](#kourou-api-keycheck-token)
|
|
136
|
+
- [`kourou api-key:create USER`](#kourou-api-keycreate-user)
|
|
137
|
+
- [`kourou api-key:delete USER ID`](#kourou-api-keydelete-user-id)
|
|
138
|
+
- [`kourou api-key:search USER`](#kourou-api-keysearch-user)
|
|
139
|
+
- [`kourou app:debug-proxy`](#kourou-appdebug-proxy)
|
|
140
|
+
- [`kourou app:doctor`](#kourou-appdoctor)
|
|
141
|
+
- [`kourou app:scaffold DESTINATION`](#kourou-appscaffold-destination)
|
|
142
|
+
- [`kourou app:start-services`](#kourou-appstart-services)
|
|
143
|
+
- [`kourou autocomplete [SHELL]`](#kourou-autocomplete-shell)
|
|
144
|
+
- [`kourou collection:create INDEX COLLECTION [BODY]`](#kourou-collectioncreate-index-collection-body)
|
|
145
|
+
- [`kourou collection:export INDEX COLLECTION`](#kourou-collectionexport-index-collection)
|
|
146
|
+
- [`kourou collection:import PATH`](#kourou-collectionimport-path)
|
|
147
|
+
- [`kourou collection:migrate SCRIPT PATH`](#kourou-collectionmigrate-script-path)
|
|
148
|
+
- [`kourou config:diff FIRST SECOND`](#kourou-configdiff-first-second)
|
|
149
|
+
- [`kourou document:search INDEX COLLECTION [QUERY]`](#kourou-documentsearch-index-collection-query)
|
|
150
|
+
- [`kourou es:aliases:cat`](#kourou-esaliasescat)
|
|
151
|
+
- [`kourou es:indices:cat`](#kourou-esindicescat)
|
|
152
|
+
- [`kourou es:indices:get INDEX ID`](#kourou-esindicesget-index-id)
|
|
153
|
+
- [`kourou es:indices:insert INDEX`](#kourou-esindicesinsert-index)
|
|
154
|
+
- [`kourou es:migrate`](#kourou-esmigrate)
|
|
155
|
+
- [`kourou es:snapshot:create REPOSITORY NAME`](#kourou-essnapshotcreate-repository-name)
|
|
156
|
+
- [`kourou es:snapshot:create-repository REPOSITORY LOCATION`](#kourou-essnapshotcreate-repository-repository-location)
|
|
157
|
+
- [`kourou es:snapshot:list REPOSITORY`](#kourou-essnapshotlist-repository)
|
|
158
|
+
- [`kourou file:decrypt FILE`](#kourou-filedecrypt-file)
|
|
159
|
+
- [`kourou file:encrypt FILE`](#kourou-fileencrypt-file)
|
|
160
|
+
- [`kourou file:test FILE`](#kourou-filetest-file)
|
|
161
|
+
- [`kourou help [COMMAND]`](#kourou-help-command)
|
|
162
|
+
- [`kourou import PATH`](#kourou-import-path)
|
|
163
|
+
- [`kourou index:export INDEX`](#kourou-indexexport-index)
|
|
164
|
+
- [`kourou index:import PATH`](#kourou-indeximport-path)
|
|
165
|
+
- [`kourou instance:kill`](#kourou-instancekill)
|
|
166
|
+
- [`kourou instance:list`](#kourou-instancelist)
|
|
167
|
+
- [`kourou instance:logs`](#kourou-instancelogs)
|
|
168
|
+
- [`kourou instance:spawn`](#kourou-instancespawn)
|
|
169
|
+
- [`kourou paas:deploy ENVIRONMENT APPLICATIONID IMAGE`](#kourou-paasdeploy-environment-applicationid-image)
|
|
170
|
+
- [`kourou paas:init PROJECT`](#kourou-paasinit-project)
|
|
171
|
+
- [`kourou paas:login`](#kourou-paaslogin)
|
|
172
|
+
- [`kourou paas:snapshots:cat ENVIRONMENT APPLICATIONID`](#kourou-paassnapshotscat-environment-applicationid)
|
|
173
|
+
- [`kourou paas:snapshots:dump ENVIRONMENT APPLICATIONID`](#kourou-paassnapshotsdump-environment-applicationid)
|
|
174
|
+
- [`kourou paas:snapshots:restore ENVIRONMENT APPLICATIONID SNAPSHOTID`](#kourou-paassnapshotsrestore-environment-applicationid-snapshotid)
|
|
175
|
+
- [`kourou profile:export`](#kourou-profileexport)
|
|
176
|
+
- [`kourou profile:import PATH`](#kourou-profileimport-path)
|
|
177
|
+
- [`kourou realtime:subscribe INDEX COLLECTION [FILTERS]`](#kourou-realtimesubscribe-index-collection-filters)
|
|
178
|
+
- [`kourou redis:list-keys [MATCH]`](#kourou-redislist-keys-match)
|
|
179
|
+
- [`kourou role:export`](#kourou-roleexport)
|
|
180
|
+
- [`kourou role:import PATH`](#kourou-roleimport-path)
|
|
181
|
+
- [`kourou sdk:execute [CODE]`](#kourou-sdkexecute-code)
|
|
182
|
+
- [`kourou sdk:query CONTROLLER:ACTION`](#kourou-sdkquery-controlleraction)
|
|
183
|
+
- [`kourou user:export`](#kourou-userexport)
|
|
184
|
+
- [`kourou user:export-mappings`](#kourou-userexport-mappings)
|
|
185
|
+
- [`kourou user:import PATH`](#kourou-userimport-path)
|
|
186
|
+
- [`kourou user:import-mappings PATH`](#kourou-userimport-mappings-path)
|
|
187
|
+
- [`kourou vault:add SECRETS-FILE KEY VALUE`](#kourou-vaultadd-secrets-file-key-value)
|
|
188
|
+
- [`kourou vault:decrypt FILE`](#kourou-vaultdecrypt-file)
|
|
189
|
+
- [`kourou vault:encrypt FILE`](#kourou-vaultencrypt-file)
|
|
190
|
+
- [`kourou vault:show SECRETS-FILE [KEY]`](#kourou-vaultshow-secrets-file-key)
|
|
191
|
+
- [`kourou vault:test SECRETS-FILE`](#kourou-vaulttest-secrets-file)
|
|
192
|
+
- [Where does this weird name come from?](#where-does-this-weird-name-come-from)
|
|
193
|
+
- [Have fun with a quine](#have-fun-with-a-quine)
|
|
194
|
+
- [Telemetry](#telemetry)
|
|
183
195
|
|
|
184
196
|
## `kourou api-key:check TOKEN`
|
|
185
197
|
|
|
@@ -409,7 +421,7 @@ EXAMPLES
|
|
|
409
421
|
$ kourou autocomplete --refresh-cache
|
|
410
422
|
```
|
|
411
423
|
|
|
412
|
-
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v1.3.
|
|
424
|
+
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v1.3.0/src/commands/autocomplete/index.ts)_
|
|
413
425
|
|
|
414
426
|
## `kourou collection:create INDEX COLLECTION [BODY]`
|
|
415
427
|
|
|
@@ -873,7 +885,7 @@ OPTIONS
|
|
|
873
885
|
--all see all commands in CLI
|
|
874
886
|
```
|
|
875
887
|
|
|
876
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.
|
|
888
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.2/src/commands/help.ts)_
|
|
877
889
|
|
|
878
890
|
## `kourou import PATH`
|
|
879
891
|
|
|
@@ -1096,30 +1108,66 @@ OPTIONS
|
|
|
1096
1108
|
|
|
1097
1109
|
_See code: [src/commands/paas/login.ts](src/commands/paas/login.ts)_
|
|
1098
1110
|
|
|
1099
|
-
## `kourou paas:
|
|
1111
|
+
## `kourou paas:snapshots:cat ENVIRONMENT APPLICATIONID`
|
|
1112
|
+
|
|
1113
|
+
List all snapshots for a given kuzzle application in a environment
|
|
1114
|
+
|
|
1115
|
+
```
|
|
1116
|
+
USAGE
|
|
1117
|
+
$ kourou paas:snapshots:cat ENVIRONMENT APPLICATIONID
|
|
1118
|
+
|
|
1119
|
+
ARGUMENTS
|
|
1120
|
+
ENVIRONMENT Project environment name
|
|
1121
|
+
APPLICATIONID Application Identifier
|
|
1122
|
+
|
|
1123
|
+
OPTIONS
|
|
1124
|
+
--help show CLI help
|
|
1125
|
+
--project=project Current PaaS project
|
|
1126
|
+
--token=token Authentication token
|
|
1127
|
+
```
|
|
1128
|
+
|
|
1129
|
+
_See code: [src/commands/paas/snapshots/cat.ts](src/commands/paas/snapshots/cat.ts)_
|
|
1130
|
+
|
|
1131
|
+
## `kourou paas:snapshots:dump ENVIRONMENT APPLICATIONID`
|
|
1132
|
+
|
|
1133
|
+
List all snapshots for a given kuzzle application in a environment
|
|
1100
1134
|
|
|
1101
|
-
|
|
1135
|
+
```
|
|
1136
|
+
USAGE
|
|
1137
|
+
$ kourou paas:snapshots:dump ENVIRONMENT APPLICATIONID
|
|
1138
|
+
|
|
1139
|
+
ARGUMENTS
|
|
1140
|
+
ENVIRONMENT Project environment name
|
|
1141
|
+
APPLICATIONID Application Identifier
|
|
1142
|
+
|
|
1143
|
+
OPTIONS
|
|
1144
|
+
--help show CLI help
|
|
1145
|
+
--project=project Current PaaS project
|
|
1146
|
+
--token=token Authentication token
|
|
1147
|
+
```
|
|
1148
|
+
|
|
1149
|
+
_See code: [src/commands/paas/snapshots/dump.ts](src/commands/paas/snapshots/dump.ts)_
|
|
1150
|
+
|
|
1151
|
+
## `kourou paas:snapshots:restore ENVIRONMENT APPLICATIONID SNAPSHOTID`
|
|
1152
|
+
|
|
1153
|
+
List all snapshots for a given kuzzle application in a environment
|
|
1102
1154
|
|
|
1103
1155
|
```
|
|
1104
1156
|
USAGE
|
|
1105
|
-
$ kourou paas:
|
|
1157
|
+
$ kourou paas:snapshots:restore ENVIRONMENT APPLICATIONID SNAPSHOTID
|
|
1106
1158
|
|
|
1107
1159
|
ARGUMENTS
|
|
1108
|
-
ENVIRONMENT
|
|
1109
|
-
|
|
1160
|
+
ENVIRONMENT Project environment name
|
|
1161
|
+
APPLICATIONID Application Identifier
|
|
1162
|
+
SNAPSHOTID Snapshot Identifier
|
|
1110
1163
|
|
|
1111
1164
|
OPTIONS
|
|
1112
|
-
-f, --follow Follow log output
|
|
1113
|
-
-n, --tail=tail Number of lines to show from the end of the logs
|
|
1114
|
-
-t, --timestamp Show timestamp
|
|
1115
1165
|
--help show CLI help
|
|
1116
|
-
--podName=podName Name of the pod to show logs from
|
|
1117
1166
|
--project=project Current PaaS project
|
|
1118
|
-
--
|
|
1119
|
-
--until=until Display logs until a specific absolute (e.g. 2022/12/02 09:41) or relative (e.g. a minute ago) time
|
|
1167
|
+
--token=token Authentication token
|
|
1120
1168
|
```
|
|
1121
1169
|
|
|
1122
|
-
_See code: [src/commands/paas/
|
|
1170
|
+
_See code: [src/commands/paas/snapshots/restore.ts](src/commands/paas/snapshots/restore.ts)_
|
|
1123
1171
|
|
|
1124
1172
|
## `kourou profile:export`
|
|
1125
1173
|
|
|
@@ -17,6 +17,8 @@ function sendResponse(response, bodyObject) {
|
|
|
17
17
|
}
|
|
18
18
|
class DebugProxy extends common_1.Kommand {
|
|
19
19
|
async runSafe() {
|
|
20
|
+
// @ts-ignore Disable ping pong since when debugging Kuzzle might not be responding
|
|
21
|
+
clearInterval(this.sdk.sdk.protocol.pingIntervalId);
|
|
20
22
|
const nodeVersionResponse = (await this.sdk.query({
|
|
21
23
|
controller: "debug",
|
|
22
24
|
action: "nodeVersion",
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
|
|
5
3
|
const command_1 = require("@oclif/command");
|
|
6
|
-
const cli_ux_1 = (0, tslib_1.__importDefault)(require("cli-ux"));
|
|
7
|
-
const login_1 = (0, tslib_1.__importDefault)(require("./login"));
|
|
8
4
|
const PaasKommand_1 = require("../../support/PaasKommand");
|
|
9
5
|
class PaasDeploy extends PaasKommand_1.PaasKommand {
|
|
10
6
|
async runSafe() {
|
|
@@ -29,24 +25,6 @@ class PaasDeploy extends PaasKommand_1.PaasKommand {
|
|
|
29
25
|
});
|
|
30
26
|
this.logOk("Deployment in progress");
|
|
31
27
|
}
|
|
32
|
-
async getCredentials() {
|
|
33
|
-
const project = this.getProject();
|
|
34
|
-
const projectFile = this.fileProjectCredentials(project);
|
|
35
|
-
if (!fs_1.default.existsSync(projectFile)) {
|
|
36
|
-
this.log("");
|
|
37
|
-
const nextStep = await cli_ux_1.default.prompt("Cannot find credentials for this project. Do you want to login first? [Y/N]", { type: "single" });
|
|
38
|
-
this.log("");
|
|
39
|
-
if (nextStep.toLowerCase().startsWith("y")) {
|
|
40
|
-
await login_1.default.run(["--project", project]);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
this.logKo("Aborting.");
|
|
44
|
-
process.exit(1);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const credentials = JSON.parse(fs_1.default.readFileSync(projectFile, "utf8"));
|
|
48
|
-
return credentials.apiKey;
|
|
49
|
-
}
|
|
50
28
|
}
|
|
51
29
|
PaasDeploy.description = "Deploy a new version of the application in the PaaS";
|
|
52
30
|
PaasDeploy.flags = {
|
|
@@ -21,9 +21,9 @@ class PaasLogin extends PaasKommand_1.PaasKommand {
|
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
await this.initPaasClient({ username, password });
|
|
24
|
+
await this.authenticateNPM(username, password);
|
|
24
25
|
const apiKey = await this.paas.auth.createApiKey("Kourou PaaS API Key");
|
|
25
26
|
this.createProjectCredentials(apiKey);
|
|
26
|
-
await this.authenticateNPM(username, password);
|
|
27
27
|
this.logOk(`Successfully logged in as ${username}. Your Kuzzle Enterprise license is now enabled on this host.`);
|
|
28
28
|
}
|
|
29
29
|
createProjectCredentials(apiKey) {
|
|
@@ -49,7 +49,8 @@ class PaasLogin extends PaasKommand_1.PaasKommand {
|
|
|
49
49
|
password,
|
|
50
50
|
}),
|
|
51
51
|
};
|
|
52
|
-
const
|
|
52
|
+
const targetUrl = `https://${this.packagesHost}/-/user/org.couchdb.user:${username}`;
|
|
53
|
+
const response = await (0, node_fetch_1.default)(targetUrl, options);
|
|
53
54
|
const json = await response.json();
|
|
54
55
|
if (response.status !== 201) {
|
|
55
56
|
throw new Error(json.error);
|
|
@@ -32,8 +32,6 @@ declare class PaasLogs extends PaasKommand {
|
|
|
32
32
|
*/
|
|
33
33
|
private podsColor;
|
|
34
34
|
runSafe(): Promise<void>;
|
|
35
|
-
getCredentials(): Promise<any>;
|
|
36
|
-
getNumberOfSpaces(names: string[], currentName: string): number;
|
|
37
35
|
/**
|
|
38
36
|
* Returns the color to use for a pod name.
|
|
39
37
|
* @param podName Name of the pod.
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
|
|
5
4
|
const readline = (0, tslib_1.__importStar)(require("readline"));
|
|
6
5
|
const command_1 = require("@oclif/command");
|
|
7
6
|
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
|
|
8
7
|
const chrono = (0, tslib_1.__importStar)(require("chrono-node"));
|
|
9
|
-
const cli_ux_1 = require("cli-ux");
|
|
10
|
-
const login_1 = (0, tslib_1.__importDefault)(require("./login"));
|
|
11
8
|
const PaasKommand_1 = require("../../support/PaasKommand");
|
|
12
9
|
class PaasLogs extends PaasKommand_1.PaasKommand {
|
|
13
10
|
constructor() {
|
|
@@ -99,36 +96,6 @@ class PaasLogs extends PaasKommand_1.PaasKommand {
|
|
|
99
96
|
finally { if (e_1) throw e_1.error; }
|
|
100
97
|
}
|
|
101
98
|
}
|
|
102
|
-
async getCredentials() {
|
|
103
|
-
const project = this.getProject();
|
|
104
|
-
const projectFile = this.fileProjectCredentials(project);
|
|
105
|
-
if (!fs_1.default.existsSync(projectFile)) {
|
|
106
|
-
this.log("");
|
|
107
|
-
const nextStep = await cli_ux_1.cli.prompt("Cannot find credentials for this project. Do you want to login first? [Y/N]", { type: "single" });
|
|
108
|
-
this.log("");
|
|
109
|
-
if (nextStep.toLowerCase().startsWith("y")) {
|
|
110
|
-
await login_1.default.run(["--project", project]);
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
this.logKo("Aborting.");
|
|
114
|
-
process.exit(1);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
const credentials = JSON.parse(fs_1.default.readFileSync(projectFile, "utf8"));
|
|
118
|
-
return credentials.apiKey;
|
|
119
|
-
}
|
|
120
|
-
getNumberOfSpaces(names, currentName) {
|
|
121
|
-
const end = 10;
|
|
122
|
-
let max = { name: "", length: 0 };
|
|
123
|
-
for (const name of names) {
|
|
124
|
-
if (max.length < name.length) {
|
|
125
|
-
max = { name: name, length: name.length };
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return currentName === max.name
|
|
129
|
-
? end
|
|
130
|
-
: end + (max.length - currentName.length);
|
|
131
|
-
}
|
|
132
99
|
/**
|
|
133
100
|
* Returns the color to use for a pod name.
|
|
134
101
|
* @param podName Name of the pod.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { flags } from "@oclif/command";
|
|
2
|
+
import { PaasKommand } from "../../../support/PaasKommand";
|
|
3
|
+
declare class PaasSnapshotsCat extends PaasKommand {
|
|
4
|
+
static description: string;
|
|
5
|
+
static flags: {
|
|
6
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
7
|
+
token: flags.IOptionFlag<string | undefined>;
|
|
8
|
+
project: flags.IOptionFlag<string | undefined>;
|
|
9
|
+
};
|
|
10
|
+
static args: {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
required: boolean;
|
|
14
|
+
}[];
|
|
15
|
+
runSafe(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export default PaasSnapshotsCat;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const command_1 = require("@oclif/command");
|
|
4
|
+
const PaasKommand_1 = require("../../../support/PaasKommand");
|
|
5
|
+
class PaasSnapshotsCat extends PaasKommand_1.PaasKommand {
|
|
6
|
+
async runSafe() {
|
|
7
|
+
const apiKey = await this.getCredentials();
|
|
8
|
+
await this.initPaasClient({ apiKey });
|
|
9
|
+
const user = await this.paas.auth.getCurrentUser();
|
|
10
|
+
this.logInfo(`Logged as "${user._id}" for project "${this.flags.project || this.getProject()}"`);
|
|
11
|
+
const { result } = await this.paas.query({
|
|
12
|
+
controller: "application",
|
|
13
|
+
action: "snapshots",
|
|
14
|
+
environmentId: this.args.environment,
|
|
15
|
+
projectId: this.flags.project || this.getProject(),
|
|
16
|
+
applicationId: this.args.applicationId,
|
|
17
|
+
body: {},
|
|
18
|
+
});
|
|
19
|
+
this.logInfo(JSON.stringify(result, null, 2));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
PaasSnapshotsCat.description = "List all snapshots for a given kuzzle application in a environment";
|
|
23
|
+
PaasSnapshotsCat.flags = {
|
|
24
|
+
help: command_1.flags.help(),
|
|
25
|
+
token: command_1.flags.string({
|
|
26
|
+
default: process.env.KUZZLE_PAAS_TOKEN,
|
|
27
|
+
description: "Authentication token",
|
|
28
|
+
}),
|
|
29
|
+
project: command_1.flags.string({
|
|
30
|
+
description: "Current PaaS project",
|
|
31
|
+
}),
|
|
32
|
+
};
|
|
33
|
+
PaasSnapshotsCat.args = [
|
|
34
|
+
{
|
|
35
|
+
name: "environment",
|
|
36
|
+
description: "Project environment name",
|
|
37
|
+
required: true,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "applicationId",
|
|
41
|
+
description: "Application Identifier",
|
|
42
|
+
required: true,
|
|
43
|
+
}
|
|
44
|
+
];
|
|
45
|
+
exports.default = PaasSnapshotsCat;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { flags } from "@oclif/command";
|
|
2
|
+
import { PaasKommand } from "../../../support/PaasKommand";
|
|
3
|
+
declare class PaasSnapshotsDump extends PaasKommand {
|
|
4
|
+
static description: string;
|
|
5
|
+
static flags: {
|
|
6
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
7
|
+
token: flags.IOptionFlag<string | undefined>;
|
|
8
|
+
project: flags.IOptionFlag<string | undefined>;
|
|
9
|
+
};
|
|
10
|
+
static args: {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
required: boolean;
|
|
14
|
+
}[];
|
|
15
|
+
runSafe(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export default PaasSnapshotsDump;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const command_1 = require("@oclif/command");
|
|
4
|
+
const PaasKommand_1 = require("../../../support/PaasKommand");
|
|
5
|
+
class PaasSnapshotsDump extends PaasKommand_1.PaasKommand {
|
|
6
|
+
async runSafe() {
|
|
7
|
+
const apiKey = await this.getCredentials();
|
|
8
|
+
await this.initPaasClient({ apiKey });
|
|
9
|
+
const user = await this.paas.auth.getCurrentUser();
|
|
10
|
+
this.logInfo(`Logged as "${user._id}" for project "${this.flags.project || this.getProject()}"`);
|
|
11
|
+
const { result } = await this.paas.query({
|
|
12
|
+
controller: "application",
|
|
13
|
+
action: "dump",
|
|
14
|
+
environmentId: this.args.environment,
|
|
15
|
+
projectId: this.flags.project || this.getProject(),
|
|
16
|
+
applicationId: this.args.applicationId,
|
|
17
|
+
body: {},
|
|
18
|
+
});
|
|
19
|
+
this.logOk(result.body);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
PaasSnapshotsDump.description = "List all snapshots for a given kuzzle application in a environment";
|
|
23
|
+
PaasSnapshotsDump.flags = {
|
|
24
|
+
help: command_1.flags.help(),
|
|
25
|
+
token: command_1.flags.string({
|
|
26
|
+
default: process.env.KUZZLE_PAAS_TOKEN,
|
|
27
|
+
description: "Authentication token",
|
|
28
|
+
}),
|
|
29
|
+
project: command_1.flags.string({
|
|
30
|
+
description: "Current PaaS project",
|
|
31
|
+
}),
|
|
32
|
+
};
|
|
33
|
+
PaasSnapshotsDump.args = [
|
|
34
|
+
{
|
|
35
|
+
name: "environment",
|
|
36
|
+
description: "Project environment name",
|
|
37
|
+
required: true,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "applicationId",
|
|
41
|
+
description: "Application Identifier",
|
|
42
|
+
required: true,
|
|
43
|
+
}
|
|
44
|
+
];
|
|
45
|
+
exports.default = PaasSnapshotsDump;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { flags } from "@oclif/command";
|
|
2
|
+
import { PaasKommand } from "../../../support/PaasKommand";
|
|
3
|
+
declare class PaasSnapshotsRestore extends PaasKommand {
|
|
4
|
+
static description: string;
|
|
5
|
+
static flags: {
|
|
6
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
7
|
+
token: flags.IOptionFlag<string | undefined>;
|
|
8
|
+
project: flags.IOptionFlag<string | undefined>;
|
|
9
|
+
};
|
|
10
|
+
static args: {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
required: boolean;
|
|
14
|
+
}[];
|
|
15
|
+
runSafe(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export default PaasSnapshotsRestore;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const command_1 = require("@oclif/command");
|
|
4
|
+
const PaasKommand_1 = require("../../../support/PaasKommand");
|
|
5
|
+
class PaasSnapshotsRestore extends PaasKommand_1.PaasKommand {
|
|
6
|
+
async runSafe() {
|
|
7
|
+
const apiKey = await this.getCredentials();
|
|
8
|
+
await this.initPaasClient({ apiKey });
|
|
9
|
+
const user = await this.paas.auth.getCurrentUser();
|
|
10
|
+
this.logInfo(`Logged as "${user._id}" for project "${this.flags.project || this.getProject()}"`);
|
|
11
|
+
await this.paas.query({
|
|
12
|
+
controller: "application",
|
|
13
|
+
action: "restore",
|
|
14
|
+
environmentId: this.args.environment,
|
|
15
|
+
projectId: this.flags.project || this.getProject(),
|
|
16
|
+
applicationId: this.args.applicationId,
|
|
17
|
+
body: {
|
|
18
|
+
repository: "automated",
|
|
19
|
+
snapshot: this.args.snapshotId,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
this.logInfo("Ok");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
PaasSnapshotsRestore.description = "List all snapshots for a given kuzzle application in a environment";
|
|
26
|
+
PaasSnapshotsRestore.flags = {
|
|
27
|
+
help: command_1.flags.help(),
|
|
28
|
+
token: command_1.flags.string({
|
|
29
|
+
default: process.env.KUZZLE_PAAS_TOKEN,
|
|
30
|
+
description: "Authentication token",
|
|
31
|
+
}),
|
|
32
|
+
project: command_1.flags.string({
|
|
33
|
+
description: "Current PaaS project",
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
PaasSnapshotsRestore.args = [
|
|
37
|
+
{
|
|
38
|
+
name: "environment",
|
|
39
|
+
description: "Project environment name",
|
|
40
|
+
required: true,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "applicationId",
|
|
44
|
+
description: "Application Identifier",
|
|
45
|
+
required: true,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "snapshotId",
|
|
49
|
+
description: "Snapshot Identifier",
|
|
50
|
+
required: true,
|
|
51
|
+
}
|
|
52
|
+
];
|
|
53
|
+
exports.default = PaasSnapshotsRestore;
|
|
@@ -56,6 +56,16 @@ class PaasKommand extends common_1.Kommand {
|
|
|
56
56
|
}
|
|
57
57
|
return this.flags.project;
|
|
58
58
|
}
|
|
59
|
+
async getCredentials() {
|
|
60
|
+
const project = this.getProject();
|
|
61
|
+
const projectFile = this.fileProjectCredentials(project);
|
|
62
|
+
if (!fs_1.default.existsSync(projectFile)) {
|
|
63
|
+
this.logKo("You are not logged in. You should run paas:login first. Aborting.");
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
const credentials = JSON.parse(fs_1.default.readFileSync(projectFile, "utf8"));
|
|
67
|
+
return credentials.apiKey;
|
|
68
|
+
}
|
|
59
69
|
}
|
|
60
70
|
exports.PaasKommand = PaasKommand;
|
|
61
71
|
PaasKommand.initSdk = false;
|
|
@@ -24,6 +24,7 @@ class Elasticsearch {
|
|
|
24
24
|
delete specifications.settings.index.uuid;
|
|
25
25
|
delete specifications.settings.index.version;
|
|
26
26
|
delete specifications.settings.index.routing;
|
|
27
|
+
delete specifications.settings.index.history;
|
|
27
28
|
return specifications;
|
|
28
29
|
}
|
|
29
30
|
async createIndex(index, specifications) {
|