Create Snapshot API 66/5066/1
authorAMIT M <am00474504@techmahindra.com>
Wed, 21 Aug 2019 13:28:01 +0000 (18:58 +0530)
committerAMIT M <am00474504@techmahindra.com>
Wed, 21 Aug 2019 13:30:41 +0000 (19:00 +0530)
Issue-ID: ACUMOS-3347
- Updated the logic for snapshot name

Change-Id: I4c62824f151873533e869d8e087bab7d351b82ac
Signed-off-by: AMIT M <am00474504@techmahindra.com>
docs/release-notes.rst
elk-client/pom.xml
elk-client/src/main/java/org/acumos/elk/client/service/SnapshotServiceImpl.java
elk-client/src/main/java/org/acumos/elk/client/transport/CreateSnapshot.java

index 7017855..510a55c 100644 (file)
 Platform Operations, Administration, and Management (OA&M) Release Notes
 ========================================================================
 
+Version 3.0.2, 21 August 2019
+-------------------------------
+* Create Snapshot API (`ACUMOS-3347 <https://jira.acumos.org/browse/ACUMOS-3347>`_)
+
 Version 3.0.1, 20 August 2019
 -------------------------------
 * Archival API is required (`ACUMOS-3301 <https://jira.acumos.org/browse/ACUMOS-3301>`_)
index 4bd9efa..c906062 100644 (file)
@@ -16,7 +16,7 @@
 
        <groupId>org.acumos.elk-client</groupId>
        <artifactId>elk-client</artifactId>
-       <version>3.0.1-SNAPSHOT</version>
+       <version>3.0.2-SNAPSHOT</version>
        <packaging>jar</packaging>
 
        <name>elk-client</name>
index 2dddf82..24fae36 100644 (file)
@@ -135,7 +135,12 @@ public class SnapshotServiceImpl extends AbstractELKClientConnection implements
                                                .substring(0, dateTime.toString().length() - 4).toLowerCase();
                                snapshotName = "snapshot-" + dateWithTime;
 
-                               createSnapshotRequest.snapshot(snapshotName);
+                               if (createSnapshot.getSnapshotName() != null
+                                               && !createSnapshot.getSnapshotName().equalsIgnoreCase("default")) {
+                                       createSnapshotRequest.snapshot(createSnapshot.getSnapshotName());
+                               } else {
+                                       createSnapshotRequest.snapshot(snapshotName);
+                               }
 
                                RestHighLevelClient client = restHighLevelClientConnection();
                                CreateSnapshotResponse createSnapshotResponse;
index e3ef26d..f678e2c 100644 (file)
@@ -27,6 +27,9 @@ public class CreateSnapshot {
 
        @ApiModelProperty(required = true, value = "ElasticStack repository name", example = "logstashBackup")
        private String repositoryName;
+       
+       @ApiModelProperty(required = true, value = "ElasticStack snapshot name, \"default\" for default snapshot name.", example = "default")
+       private String snapshotName;
 
        @ApiModelProperty(value = "indices names")
        private List<String> indices;
@@ -39,6 +42,14 @@ public class CreateSnapshot {
                this.repositoryName = repositoryName;
        }
 
+       public String getSnapshotName() {
+               return snapshotName;
+       }
+
+       public void setSnapshotName(String snapshotName) {
+               this.snapshotName = snapshotName;
+       }
+
        public List<String> getIndices() {
                return indices;
        }