kourou 0.28.0 → 0.28.1

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 CHANGED
@@ -27,7 +27,7 @@ $ npm install -g kourou
27
27
  $ kourou COMMAND
28
28
  running command...
29
29
  $ kourou (-v|--version|version)
30
- kourou/0.28.0 darwin-arm64 node-v20.10.0
30
+ kourou/0.28.1 darwin-arm64 node-v20.10.0
31
31
  $ kourou --help [COMMAND]
32
32
  USAGE
33
33
  $ kourou COMMAND
@@ -149,6 +149,7 @@ All other arguments and options will be passed as-is to the `sdk:query` method.
149
149
  * [`kourou es:snapshot:create REPOSITORY NAME`](#kourou-essnapshotcreate-repository-name)
150
150
  * [`kourou es:snapshot:create-repository REPOSITORY LOCATION`](#kourou-essnapshotcreate-repository-repository-location)
151
151
  * [`kourou es:snapshot:list REPOSITORY`](#kourou-essnapshotlist-repository)
152
+ * [`kourou es:snapshot:restore REPOSITORY NAME`](#kourou-essnapshotrestore-repository-name)
152
153
  * [`kourou file:decrypt FILE`](#kourou-filedecrypt-file)
153
154
  * [`kourou file:encrypt FILE`](#kourou-fileencrypt-file)
154
155
  * [`kourou file:test FILE`](#kourou-filetest-file)
@@ -795,6 +796,23 @@ OPTIONS
795
796
 
796
797
  _See code: [lib/commands/es/snapshot/list.js](lib/commands/es/snapshot/list.js)_
797
798
 
799
+ ## `kourou es:snapshot:restore REPOSITORY NAME`
800
+
801
+ Restore a snapshot repository inside an ES instance
802
+
803
+ ```
804
+ USAGE
805
+ $ kourou es:snapshot:restore REPOSITORY NAME
806
+
807
+ ARGUMENTS
808
+ REPOSITORY ES repository name
809
+ NAME ES snapshot name
810
+
811
+ OPTIONS
812
+ -n, --node=node [default: http://localhost:9200] Elasticsearch server URL
813
+ --help show CLI help
814
+ ```
815
+
798
816
  ## `kourou file:decrypt FILE`
799
817
 
800
818
  Decrypts an encrypted file.
@@ -9,7 +9,11 @@ class EsSnapshotsCreate extends common_1.Kommand {
9
9
  const esRequest = {
10
10
  repository: this.args.repository,
11
11
  snapshot: this.args.name,
12
- body: {},
12
+ body: {
13
+ indices: "*",
14
+ include_global_state: false,
15
+ partial: false,
16
+ },
13
17
  };
14
18
  const response = await esClient.snapshot.create(esRequest);
15
19
  this.logOk(`Success ${JSON.stringify(response.body)}`);
@@ -0,0 +1,16 @@
1
+ import { flags } from "@oclif/command";
2
+ import { Kommand } from "../../../common";
3
+ export default class EsSnapshotsRestore extends Kommand {
4
+ static initSdk: boolean;
5
+ static description: string;
6
+ static flags: {
7
+ node: flags.IOptionFlag<string>;
8
+ help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
9
+ };
10
+ static args: {
11
+ name: string;
12
+ description: string;
13
+ required: boolean;
14
+ }[];
15
+ runSafe(): Promise<void>;
16
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("@oclif/command");
4
+ const elasticsearch_1 = require("@elastic/elasticsearch");
5
+ const common_1 = require("../../../common");
6
+ class EsSnapshotsRestore extends common_1.Kommand {
7
+ async runSafe() {
8
+ const esClient = new elasticsearch_1.Client({ node: this.flags.node });
9
+ await esClient.indices.close({
10
+ index: "*",
11
+ expand_wildcards: "all",
12
+ });
13
+ const esRequest = {
14
+ repository: this.args.repository,
15
+ snapshot: this.args.name,
16
+ body: {
17
+ feature_states: ["none"],
18
+ include_global_state: false,
19
+ indices: "*",
20
+ },
21
+ };
22
+ const response = await esClient.snapshot.restore(esRequest);
23
+ this.logOk(`Success ${JSON.stringify(response.body)}`);
24
+ }
25
+ }
26
+ exports.default = EsSnapshotsRestore;
27
+ EsSnapshotsRestore.initSdk = false;
28
+ EsSnapshotsRestore.description = "Restore a snapshot repository inside an ES instance";
29
+ EsSnapshotsRestore.flags = {
30
+ node: command_1.flags.string({
31
+ char: "n",
32
+ description: "Elasticsearch server URL",
33
+ default: "http://localhost:9200",
34
+ }),
35
+ help: command_1.flags.help(),
36
+ };
37
+ EsSnapshotsRestore.args = [
38
+ { name: "repository", description: "ES repository name", required: true },
39
+ { name: "name", description: "ES snapshot name", required: true },
40
+ ];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kourou",
3
3
  "description": "The CLI that helps you manage your Kuzzle instances",
4
- "version": "0.28.0",
4
+ "version": "0.28.1",
5
5
  "author": "The Kuzzle Team <support@kuzzle.io>",
6
6
  "bin": {
7
7
  "kourou": "./bin/run"