+++ /dev/null
-{"swagger":"2.0","info":{"description":"Provides create, retrieve, restore and delete snapshot services for Operations for Elastic stack. ","version":"version not available","title":"Acumos ELk Client REST API","termsOfService":"Terms of service","contact":{"name":"Acumos Team","url":"https://acumos.org/to-be-determined","email":"contact@acumos.org"},"license":{"name":"Apache 2.0 License","url":"http://www.apache.org/licenses/LICENSE-2.0"}},"host":"localhost:9006","basePath":"/elkclient","tags":[{"name":"elastic-search-service-controller","description":"Set of endpoints for Creating, Retrieving, Updating and Deleting Elasticstack data."}],"paths":{"/all/indices":{"get":{"tags":["elastic-search-service-controller"],"summary":"Get all the indices of Elasticstack.","operationId":"getElkIndicesUsingGET","produces":["application/json"],"responses":{"200":{"description":"OK","schema":{"type":"array","items":{"$ref":"#/definitions/ElasticStackIndices","originalRef":"ElasticStackIndices"}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}},"/all/repositories":{"get":{"tags":["elastic-search-service-controller"],"summary":"Get all the elasticsearch repositories details of Elasticstack.","operationId":"getElkRepositoryUsingGET","produces":["application/json"],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/ElkGetRepositoriesResponse","originalRef":"ElkGetRepositoriesResponse"}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}},"/all/snapshot":{"get":{"tags":["elastic-search-service-controller"],"summary":"Get all the elasticsearch snapshot.","operationId":"getElkSnapshotUsingGET","produces":["application/json"],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/ElkSnapshotsResponse","originalRef":"ElkSnapshotsResponse"}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}},"/create/repositories":{"post":{"tags":["elastic-search-service-controller"],"summary":"Create Elasticstack repository.","operationId":"createElkRepositoryUsingPOST","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"elkCreateRepositoriesRequest","description":"elkCreateRepositoriesRequest","required":true,"schema":{"$ref":"#/definitions/ElkRepositoriesRequest","originalRef":"ElkRepositoriesRequest"}}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}},"/create/snapshot":{"post":{"tags":["elastic-search-service-controller"],"summary":"Create elasticstack snapshot.","operationId":"createElkSnapshotUsingPOST","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"createSnapshotRequest","description":"createSnapshotRequest","required":true,"schema":{"$ref":"#/definitions/ElkCreateSnapshotRequest","originalRef":"ElkCreateSnapshotRequest"}}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/ElkSnapshotsResponse","originalRef":"ElkSnapshotsResponse"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}},"/delete/indices":{"post":{"tags":["elastic-search-service-controller"],"summary":"Delete elasticstack Indices.","operationId":"deleteElkSnapshotUsingPOST","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"elasticStackIndices","description":"elasticStackIndices","required":true,"schema":{"$ref":"#/definitions/ElasticStackIndices","originalRef":"ElasticStackIndices"}}],"responses":{"200":{"description":"OK","schema":{"type":"array","items":{"$ref":"#/definitions/ElasticStackIndices","originalRef":"ElasticStackIndices"}}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}},"/delete/repositories":{"post":{"tags":["elastic-search-service-controller"],"summary":"Delete Elasticstack repository.","operationId":"deleteElkRepositoryUsingPOST","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"elkDeleteRepositoriesRequest","description":"elkDeleteRepositoriesRequest","required":true,"schema":{"$ref":"#/definitions/ElkRepositoriesRequest","originalRef":"ElkRepositoriesRequest"}}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}},"/delete/snapshot":{"post":{"tags":["elastic-search-service-controller"],"summary":"Delete elasticstack snapshot.","operationId":"deleteElkSnapshotUsingPOST_1","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"elkDeleteSnapshotRequest","description":"elkDeleteSnapshotRequest","required":true,"schema":{"$ref":"#/definitions/ElkDeleteSnapshotRequest","originalRef":"ElkDeleteSnapshotRequest"}}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/ElkSnapshotsResponse","originalRef":"ElkSnapshotsResponse"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}},"/restore/snapshot":{"post":{"tags":["elastic-search-service-controller"],"summary":"Restore elasticstack snapshot.","operationId":"restoreElkSnapshotUsingPOST","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"elkRestoreSnapshotRequest","description":"elkRestoreSnapshotRequest","required":true,"schema":{"$ref":"#/definitions/ElkRestoreSnapshotRequest","originalRef":"ElkRestoreSnapshotRequest"}}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/ElasticStackIndiceResponse","originalRef":"ElasticStackIndiceResponse"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}}},"definitions":{"CreateSnapshot":{"type":"object","required":["repositoryName"],"properties":{"indices":{"type":"array","description":"indices names","items":{"type":"string"}},"repositoryName":{"type":"string","example":"logstashBackup","description":"ElasticStack repository name"}},"title":"CreateSnapshot"},"DeleteSnapshot":{"type":"object","required":["repositoryName"],"properties":{"repositoryName":{"type":"string","example":"logstash","description":"ElasticStack repository name"},"snapShotId":{"type":"string","example":"snapshot-2019-03-28t08-53-41","description":"snapshot-2019-03-28t08-53-41"}},"title":"DeleteSnapshot"},"ELkRepositoryMetaData":{"type":"object","properties":{"name":{"type":"string","example":"logstash","description":"ElasticStack repository name"},"settings":{"type":"object","additionalProperties":{"type":"object"}},"type":{"type":"string","example":"fs","description":"ElasticStack repository type"}},"title":"ELkRepositoryMetaData"},"ElasticStackIndiceResponse":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"string"}},"title":"ElasticStackIndiceResponse"},"ElasticStackIndices":{"type":"object","properties":{"indices":{"type":"array","description":"metricbeat-6.2.4-2019.04.04","items":{"type":"string"}}},"title":"ElasticStackIndices"},"ElasticsearchSnapshotsResponse":{"type":"object","properties":{"repositoryName":{"type":"string","example":"logstash","description":"ElasticStack repository name"},"snapshots":{"type":"array","items":{"$ref":"#/definitions/ElkGetSnapshotMetaData","originalRef":"ElkGetSnapshotMetaData"}}},"title":"ElasticsearchSnapshotsResponse"},"ElkCreateSnapshotRequest":{"type":"object","required":["nodeTimeout"],"properties":{"createSnapshots":{"type":"array","description":"CreateSnapshot is required","items":{"$ref":"#/definitions/CreateSnapshot","originalRef":"CreateSnapshot"}},"nodeTimeout":{"type":"string","example":1,"description":"Value numeric values, ideal value is between 1 to 3"}},"title":"ElkCreateSnapshotRequest"},"ElkDeleteSnapshotRequest":{"type":"object","required":["nodeTimeout"],"properties":{"deleteSnapshots":{"type":"array","description":"DeleteSnapshots is required","items":{"$ref":"#/definitions/DeleteSnapshot","originalRef":"DeleteSnapshot"}},"nodeTimeout":{"type":"string","example":1,"description":"Value numeric values, ideal value is between 1 to 3"}},"title":"ElkDeleteSnapshotRequest"},"ElkGetRepositoriesResponse":{"type":"object","properties":{"repositories":{"type":"array","items":{"$ref":"#/definitions/ELkRepositoryMetaData","originalRef":"ELkRepositoryMetaData"}}},"title":"ElkGetRepositoriesResponse"},"ElkGetSnapshotMetaData":{"type":"object","properties":{"endTime":{"type":"string","example":"2019-03-28 08-53-41","description":"2019-03-28 08-53-41"},"indices":{"type":"array","example":"metricbeat-6.2.4-2019.04.04","description":"metricbeat-6.2.4-2019.04.04","items":{"type":"string"}},"snapShotId":{"type":"string","example":"snapshot-2019-03-28t08-53-41","description":"snapshot-2019-03-28t08-53-41"},"startTime":{"type":"string","example":"2019-03-28 08-53-41","description":"2019-03-28 08-53-41"},"state":{"type":"string","example":"SUCCESS","description":"SUCCESS"},"status":{"type":"string","example":"Snapshot creation is in progress. Will take some time due size of data' or 'OK","description":"Snapshot creation is in progress. Will take some time due size of data or OK"}},"title":"ElkGetSnapshotMetaData"},"ElkRepositoriesRequest":{"type":"object","required":["repositoryName"],"properties":{"nodeTimeout":{"type":"string"},"repositoryName":{"type":"string","example":"logstash","description":"ElasticStack repository name"}},"title":"ElkRepositoriesRequest"},"ElkRestoreSnapshotRequest":{"type":"object","required":["nodeTimeout","repositoryName"],"properties":{"nodeTimeout":{"type":"string","example":1,"description":"Value numeric values, ideal value is between 1 to 3"},"repositoryName":{"type":"string","example":"logstash","description":"ElasticStack repository name"},"restoreSnapshots":{"type":"array","description":"RestoreSnapshot is required","items":{"$ref":"#/definitions/RestoreSnapshot","originalRef":"RestoreSnapshot"}}},"title":"ElkRestoreSnapshotRequest"},"ElkSnapshotsResponse":{"type":"object","properties":{"elasticsearchSnapshots":{"type":"array","items":{"$ref":"#/definitions/ElasticsearchSnapshotsResponse","originalRef":"ElasticsearchSnapshotsResponse"}}},"title":"ElkSnapshotsResponse"},"RestoreSnapshot":{"type":"object","properties":{"snapshotName":{"type":"string"}},"title":"RestoreSnapshot"}}}
\ No newline at end of file
--- /dev/null
+{"swagger":"2.0","info":{"description":"Provides create, retrieve, restore and delete snapshot services for Operations for Elastic stack. ","version":"3.0.0-SNAPSHOT-b0","title":"Acumos ELk Client REST API","termsOfService":"Terms of service","contact":{"name":"Acumos Team","url":"https://acumos.org/to-be-determined","email":"contact@acumos.org"},"license":{"name":"Apache 2.0 License","url":"http://www.apache.org/licenses/LICENSE-2.0"}},"host":"localhost:9007","basePath":"/elkclient","tags":[{"name":"elastic-search-service-controller","description":"Elastic Search Service Controller"}],"paths":{"/all/archive":{"get":{"tags":["elastic-search-service-controller"],"summary":"Ger all the archive snapshot.","operationId":"getAllArchiveInfoElkSnapshotUsingGET","produces":["application/json"],"responses":{"200":{"description":"OK","schema":{"originalRef":"ElkArchiveResponse","$ref":"#/definitions/ElkArchiveResponse"}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}},"/all/indices":{"get":{"tags":["elastic-search-service-controller"],"summary":"Get all the indices of Elasticstack.","operationId":"getElkIndicesUsingGET","produces":["application/json"],"responses":{"200":{"description":"OK","schema":{"originalRef":"ElasticStackIndices","$ref":"#/definitions/ElasticStackIndices"}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}},"/all/repositories":{"get":{"tags":["elastic-search-service-controller"],"summary":"Get all the elasticsearch repositories details of Elasticstack.","operationId":"getElkRepositoryUsingGET","produces":["application/json"],"responses":{"200":{"description":"OK","schema":{"originalRef":"ElkGetRepositoriesResponse","$ref":"#/definitions/ElkGetRepositoriesResponse"}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}},"/all/snapshot":{"get":{"tags":["elastic-search-service-controller"],"summary":"Get all the elasticsearch snapshot.","operationId":"getElkSnapshotUsingGET","produces":["application/json"],"responses":{"200":{"description":"OK","schema":{"originalRef":"ElkSnapshotsResponse","$ref":"#/definitions/ElkSnapshotsResponse"}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}},"/archive/action":{"post":{"tags":["elastic-search-service-controller"],"summary":"Archive and Restore elasticstack snapshot.","operationId":"archiveElkSnapshotUsingPOST","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"archiveRequest","description":"archiveRequest","required":true,"schema":{"originalRef":"ElkArchiveRequest","$ref":"#/definitions/ElkArchiveRequest"}}],"responses":{"200":{"description":"OK","schema":{"originalRef":"ElkArchiveResponse","$ref":"#/definitions/ElkArchiveResponse"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}},"/create/repositories":{"post":{"tags":["elastic-search-service-controller"],"summary":"Create Elasticstack repository.","operationId":"createElkRepositoryUsingPOST","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"elkCreateRepositoriesRequest","description":"elkCreateRepositoriesRequest","required":true,"schema":{"originalRef":"ElkRepositoriesRequest","$ref":"#/definitions/ElkRepositoriesRequest"}}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}},"/create/snapshot":{"post":{"tags":["elastic-search-service-controller"],"summary":"Create elasticstack snapshot.","operationId":"createElkSnapshotUsingPOST","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"createSnapshotRequest","description":"createSnapshotRequest","required":true,"schema":{"originalRef":"ElkCreateSnapshotRequest","$ref":"#/definitions/ElkCreateSnapshotRequest"}}],"responses":{"200":{"description":"OK","schema":{"originalRef":"ElkSnapshotsResponse","$ref":"#/definitions/ElkSnapshotsResponse"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}},"/delete/indices":{"post":{"tags":["elastic-search-service-controller"],"summary":"Delete elasticstack Indices.","operationId":"deleteElkSnapshotUsingPOST","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"elasticStackIndices","description":"elasticStackIndices","required":true,"schema":{"originalRef":"ElasticStackIndices","$ref":"#/definitions/ElasticStackIndices"}}],"responses":{"200":{"description":"OK","schema":{"originalRef":"ElasticStackIndiceResponse","$ref":"#/definitions/ElasticStackIndiceResponse"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}},"/delete/repositories":{"post":{"tags":["elastic-search-service-controller"],"summary":"Delete Elasticstack repository.","operationId":"deleteElkRepositoryUsingPOST","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"elkDeleteRepositoriesRequest","description":"elkDeleteRepositoriesRequest","required":true,"schema":{"originalRef":"ElkRepositoriesRequest","$ref":"#/definitions/ElkRepositoriesRequest"}}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}},"/delete/snapshot":{"post":{"tags":["elastic-search-service-controller"],"summary":"Delete elasticstack snapshot.","operationId":"deleteElkSnapshotUsingPOST_1","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"elkDeleteSnapshotRequest","description":"elkDeleteSnapshotRequest","required":true,"schema":{"originalRef":"ElkDeleteSnapshotRequest","$ref":"#/definitions/ElkDeleteSnapshotRequest"}}],"responses":{"200":{"description":"OK","schema":{"originalRef":"ElkSnapshotsResponse","$ref":"#/definitions/ElkSnapshotsResponse"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}},"/restore/snapshot":{"post":{"tags":["elastic-search-service-controller"],"summary":"Restore elasticstack snapshot.","operationId":"restoreElkSnapshotUsingPOST","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"elkRestoreSnapshotRequest","description":"elkRestoreSnapshotRequest","required":true,"schema":{"originalRef":"ElkRestoreSnapshotRequest","$ref":"#/definitions/ElkRestoreSnapshotRequest"}}],"responses":{"200":{"description":"OK","schema":{"originalRef":"ElasticStackIndiceResponse","$ref":"#/definitions/ElasticStackIndiceResponse"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":false}}},"definitions":{"ArchiveInfo":{"type":"object","required":["backUpName","date"],"properties":{"backUpName":{"type":"string","description":"snapshot name."},"date":{"type":"string","description":"snapshot creation date"}},"title":"ArchiveInfo"},"CreateSnapshot":{"type":"object","required":["repositoryName","snapshotName"],"properties":{"indices":{"type":"array","description":"indices names","items":{"type":"string"}},"repositoryName":{"type":"string","example":"logstashBackup","description":"ElasticStack repository name"},"snapshotName":{"type":"string","example":"snapshotName","description":"ElasticStack snapshot name, \"default\" for default snapshot name."}},"title":"CreateSnapshot"},"DeleteSnapshot":{"type":"object","required":["repositoryName"],"properties":{"repositoryName":{"type":"string","example":"logstash","description":"ElasticStack repository name"},"snapShotId":{"type":"string","example":"snapshot-2019-03-28t08-53-41","description":"snapshot-2019-03-28t08-53-41"}},"title":"DeleteSnapshot"},"ELkRepositoryMetaData":{"type":"object","properties":{"name":{"type":"string","example":"logstash","description":"ElasticStack repository name"},"settings":{"type":"object","additionalProperties":{"type":"object"}},"type":{"type":"string","example":"fs","description":"ElasticStack repository type"}},"title":"ELkRepositoryMetaData"},"ElasticStackIndiceResponse":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"string"}},"title":"ElasticStackIndiceResponse"},"ElasticStackIndices":{"type":"object","properties":{"indices":{"type":"array","description":"metricbeat-6.2.4-2019.04.04","items":{"type":"string"}}},"title":"ElasticStackIndices"},"ElasticsearchSnapshotsResponse":{"type":"object","properties":{"repositoryName":{"type":"string","example":"logstash","description":"ElasticStack repository name"},"snapshots":{"type":"array","items":{"originalRef":"ElkGetSnapshotMetaData","$ref":"#/definitions/ElkGetSnapshotMetaData"}}},"title":"ElasticsearchSnapshotsResponse"},"ElkArchiveRequest":{"type":"object","required":["action","repositoryName"],"properties":{"action":{"type":"string","example":"archive/restore","description":"String value archive/restore"},"repositoryName":{"type":"array","items":{"type":"string"}}},"title":"ElkArchiveRequest"},"ElkArchiveResponse":{"type":"object","properties":{"archiveInfo":{"type":"array","description":"archive names","items":{"originalRef":"ArchiveInfo","$ref":"#/definitions/ArchiveInfo"}},"msg":{"type":"string"},"status":{"type":"string"}},"title":"ElkArchiveResponse"},"ElkCreateSnapshotRequest":{"type":"object","required":["nodeTimeout"],"properties":{"createSnapshots":{"type":"array","description":"CreateSnapshot is required","items":{"originalRef":"CreateSnapshot","$ref":"#/definitions/CreateSnapshot"}},"nodeTimeout":{"type":"string","example":1,"description":"Value numeric values, ideal value is between 1 to 3"}},"title":"ElkCreateSnapshotRequest"},"ElkDeleteSnapshotRequest":{"type":"object","required":["nodeTimeout"],"properties":{"deleteSnapshots":{"type":"array","description":"DeleteSnapshots is required","items":{"originalRef":"DeleteSnapshot","$ref":"#/definitions/DeleteSnapshot"}},"nodeTimeout":{"type":"string","example":1,"description":"Value numeric values, ideal value is between 1 to 3"}},"title":"ElkDeleteSnapshotRequest"},"ElkGetRepositoriesResponse":{"type":"object","properties":{"repositories":{"type":"array","items":{"originalRef":"ELkRepositoryMetaData","$ref":"#/definitions/ELkRepositoryMetaData"}}},"title":"ElkGetRepositoriesResponse"},"ElkGetSnapshotMetaData":{"type":"object","properties":{"endTime":{"type":"string","example":"2019-03-28 08-53-41","description":"2019-03-28 08-53-41"},"indices":{"type":"array","example":"metricbeat-6.2.4-2019.04.04","description":"metricbeat-6.2.4-2019.04.04","items":{"type":"string"}},"snapShotId":{"type":"string","example":"snapshot-2019-03-28t08-53-41","description":"snapshot-2019-03-28t08-53-41"},"startTime":{"type":"string","example":"2019-03-28 08-53-41","description":"2019-03-28 08-53-41"},"state":{"type":"string","example":"SUCCESS","description":"SUCCESS"},"status":{"type":"string","example":"Snapshot creation is in progress. Will take some time due size of data' or 'OK","description":"Snapshot creation is in progress. Will take some time due size of data or OK"}},"title":"ElkGetSnapshotMetaData"},"ElkRepositoriesRequest":{"type":"object","required":["repositoryName"],"properties":{"nodeTimeout":{"type":"string"},"repositoryName":{"type":"string","example":"logstash","description":"ElasticStack repository name"}},"title":"ElkRepositoriesRequest"},"ElkRestoreSnapshotRequest":{"type":"object","required":["nodeTimeout","repositoryName"],"properties":{"nodeTimeout":{"type":"string","example":1,"description":"Value numeric values, ideal value is between 1 to 3"},"repositoryName":{"type":"string","example":"logstash","description":"ElasticStack repository name"},"restoreSnapshots":{"type":"array","description":"RestoreSnapshot is required","items":{"originalRef":"RestoreSnapshot","$ref":"#/definitions/RestoreSnapshot"}}},"title":"ElkRestoreSnapshotRequest"},"ElkSnapshotsResponse":{"type":"object","properties":{"elasticsearchSnapshots":{"type":"array","items":{"originalRef":"ElasticsearchSnapshotsResponse","$ref":"#/definitions/ElasticsearchSnapshotsResponse"}}},"title":"ElkSnapshotsResponse"},"RestoreSnapshot":{"type":"object","properties":{"snapshotName":{"type":"string"}},"title":"RestoreSnapshot"}}}
\ No newline at end of file
* Delete elastic search snapshot.
* Restore elastic search snapshot.
-ELK Client APIs in Boreas Release
+ELK Client APIs in Clio Release
---------------------------------
-This section lists the methods in version 2.2.4.
+This section lists the methods in version 3.0.0.
+
+.. swaggerv2doc:: api/elkclient-api-docs-3.0.0.json
-.. swaggerv2doc:: api/elkclient-api-docs-2.2.4.json
\ No newline at end of file
Platform Operations, Administration, and Management (OA&M) Release Notes
========================================================================
+Version 3.0.0, 19 August 2019
+-------------------------------
+* Archival API is required (`ACUMOS-3301 <https://jira.acumos.org/browse/ACUMOS-3301>`_)
+
Version 2.2.4, 01 August 2019
-------------------------------
* Update docs for elk-client (`ACUMOS-3308 <https://jira.acumos.org/browse/ACUMOS-3308>`_)
<groupId>org.acumos.elk-client</groupId>
<artifactId>elk-client</artifactId>
- <version>2.2.4-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>elk-client</name>
<json.simple.version>1.1.1</json.simple.version>
<elasticsearch.version>6.5.4</elasticsearch.version>
<elasticsearch.client.version>6.5.4</elasticsearch.client.version>
-
<!-- tests still depend on Azure host -->
<skipTests>false</skipTests>
<!-- Jenkins invokes mvn with argument -Dbuild.number=${BUILD_NUMBER} -->
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
- <version>0.23.0</version>
+ <version>0.30.0</version>
<configuration>
<verbose>true</verbose>
<!-- docker runs on the LF build minion so the default value is ok -->
<assembly>
<inline>
<files>
+ <file>
+ <source>script/archive_script.sh</source>
+ <outputDirectory />
+ <destName>es_archive_script/archive_script.sh</destName>
+ </file>
<file>
<source>target/${project.artifactId}-${project.version}.${project.packaging}</source>
<outputDirectory />
--- /dev/null
+#!/bin/bash
+# Copyright 2019 AT&T Intellectual Property, Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# What this is: Script to scan Acumos model artifacts and documents as dumped
+# from an Acumos platform by dump_model.sh
+#
+# Usage:
+# $ bash archive_script.sh <actionname> <reponame>
+# actionname: action performed via archive_script.sh
+# reponame: Repository name on which action is performed.
+#
+
+function init_log() {
+ set +x
+ fname=$(caller 0 | awk '{print $2}')
+ fline=$(caller 0 | awk '{print $1}')
+ if [[ ! -d ../logs/platform-oam/elk-client ]]; then
+ mkdir -p ../logs/platform-oam/elk-client
+ echo; echo "$(date +%Y-%m-%d:%H:%M:%SZ), archive_script.sh($fname:$fline), $1" >>../logs/platform-oam/elk-client/archive-es.log
+ fi
+ set -x
+}
+
+function log() {
+set +x
+ init_log
+ fname=$(caller 0 | awk '{print $2}')
+ fline=$(caller 0 | awk '{print $1}')
+ if [[ "$1" == "ERROR" ]]; then logit $fname $fline $1 "$2"
+ elif [[ "$1" == "INFO" ]]; then logit $fname $fline $1 "$2"
+ elif [[ "$1" == "DEBUG" ]]; then logit $fname $fline $1 "$2"
+ fi
+ set -x
+}
+
+function logit() {
+ cat <<EOF >>../logs/platform-oam/elk-client/archive-es.log
+$(date +%Y-%m-%d:%H:%M:%SZ), $3, archive_script.sh($1:$2), $4
+EOF
+}
+
+function archive_esdata() {
+ log INFO "Inside archive_esdata:"
+ if [ -e "$directory_name" ]
+ then
+ if [ -e "../../elasticsearch/data/backup/$repo" ]
+ then
+ if [ -e "../../elasticsearch/data/archive-es-data/$repo" ]
+ then
+ log DEBUG "Archiving is already done for $repo, deleting the $repo from $directory_name and recreating"
+ rm -rf ../../elasticsearch/data/archive-es-data/$repo
+ fi
+ log DEBUG "Archiving Eleasticserach data to $directory_name"
+ log DEBUG "Archiving started: $repo"
+ mv -f ../../elasticsearch/data/backup/$repo/ ../../elasticsearch/data/archive-es-data/
+ log DEBUG "Archive Done:$repo"
+ echo "$(date +%Y-%m-%d:%H:%M:%SZ),$repo"
+ else
+ log ERROR "$repo:Repository not present"
+ echo "$repo:Repository not present | Back up is done"
+ fi
+ else
+ log ERROR "$PWD/$directory_name: Directory not present"
+ mkdir -p ../../elasticsearch/data/$directory_name
+ log INFO "Created archive location directory: $directory_name"
+ if [ -e "../../elasticsearch/data/backup/$repo" ]
+ then
+ mv ../../elasticsearch/data/backup/$repo/ ../../elasticsearch/data/archive-es-data/
+ log DEBUG "Archive Done:$repo"
+ echo "$(date +%Y-%m-%d:%H:%M:%SZ),$repo"
+ else
+ log ERROR "$repo:Repository not present"
+ echo "$repo:Repository not present | Back up is done"
+ fi
+ fi
+}
+
+function restore_esdata() {
+log INFO "Inside restore_esdata:"
+ if [ -e "$directory_name" ]
+ then
+ log INFO "Restore started:$repo"
+ if [ -e "$directory_name/$repo" ]
+ then
+ cp -r --preserve=all $directory_name/$repo/ ../../elasticsearch/data/backup/$repo/
+ chown '1000:1000' ../../elasticsearch/data/backup/$repo
+ log INFO "Restore done:$(date +%Y-%m-%d:%H:%M:%SZ),$repo"
+ echo "$(date +%Y-%m-%d:%H:%M:%SZ),$repo"
+ else
+ log ERROR "$repo:Repository not found | No data available to restore"
+ echo "No data present to restore"
+ fi
+ else
+ log ERROR "$directory_name: Repository not found | No data available to restore"
+ echo "No data present to restore"
+ fi
+}
+
+function archive_info() {
+log INFO "Inside archive_info:"
+ if [ -e "$directory_name" ]
+ then
+ fileExist=$(ls -l ../../elasticsearch/data/archive-es-data | head -1 | awk '{print $2}')
+ if [ $fileExist -gt 0 ]
+ then
+ #Below command is used to get list of archival with archive date in csv format
+ ls -l ../../elasticsearch/data/archive-es-data --time-style="+%Y-%m-%d:%H:%M:%SZ" | awk '{print $6, $7}' | sed 's/[ \t]/,/g' | sed 's/[ /]/,/g' | awk '{if(NR>1)print}'
+ else
+ echo "No data present in archive location"
+ log ERROR "$directory_name: No data present in archive location"
+ fi
+ else
+ echo "No data present in archive location"
+ log ERROR "$directory_name: No data present in archive location"
+ fi
+}
+directory_name=../../elasticsearch/data/archive-es-data
+WORK_DIR=$(pwd)
+action=${1,,}
+repo=$2
+log INFO "Action Performed: $action"
+if [ $action == 'archive' ]
+then
+ archive_esdata
+elif [ $action == 'restore' ]
+then
+ restore_esdata
+elif [ $action == 'info' ]
+then
+ archive_info
+else
+ log INFO "wrong action passed"
+fi
import org.acumos.elk.client.service.ISnapshotRepositoryService;
import org.acumos.elk.client.service.ISnapshotService;
+import org.acumos.elk.client.transport.ElasticStackIndiceResponse;
+import org.acumos.elk.client.transport.ElasticStackIndices;
+import org.acumos.elk.client.transport.ElkArchiveRequest;
+import org.acumos.elk.client.transport.ElkArchiveResponse;
import org.acumos.elk.client.transport.ElkCreateSnapshotRequest;
import org.acumos.elk.client.transport.ElkDeleteSnapshotRequest;
import org.acumos.elk.client.transport.ElkGetRepositoriesResponse;
-import org.acumos.elk.client.transport.ElasticStackIndiceResponse;
-import org.acumos.elk.client.transport.ElasticStackIndices;
import org.acumos.elk.client.transport.ElkRepositoriesRequest;
import org.acumos.elk.client.transport.ElkRestoreSnapshotRequest;
import org.acumos.elk.client.transport.ElkSnapshotsResponse;
LogConfig.clearMDCDetails();
return new ResponseEntity<ElasticStackIndices>(response, null, HttpStatus.OK);
}
-
+
@ApiOperation(value = "Delete elasticstack Indices.")
@RequestMapping(value = ElkClientConstants.DELETE_INDICES, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ElasticStackIndiceResponse> deleteElkSnapshot(
return new ResponseEntity<ElasticStackIndiceResponse>(elasticStackIndiceResponse, null, HttpStatus.OK);
}
+ @ApiOperation(value = "Ger all the archive snapshot.")
+ @RequestMapping(value = ElkClientConstants.GET_ALL_ARCHIVE_INFO, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<ElkArchiveResponse> getAllArchiveInfoElkSnapshot()throws Exception {
+ LogConfig.setEnteringMDCs("elk-client",ElkClientConstants.GET_ALL_ARCHIVE_INFO);
+ logger.debug("Inside getAllArchiveInfoElkSnapshot");
+ ElkArchiveResponse archiveResponse = snapshotGetRepositoryService.getArchiveElkRepository();
+ logger.debug("method call ended.");
+ LogConfig.clearMDCDetails();
+ return new ResponseEntity<ElkArchiveResponse>(archiveResponse, null, HttpStatus.OK);
+ }
+
+ @ApiOperation(value = "Archive and Restore elasticstack snapshot.")
+ @RequestMapping(value = ElkClientConstants.ARCHIVE_REQUEST, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<ElkArchiveResponse> archiveElkSnapshot(@RequestBody ElkArchiveRequest archiveRequest)throws Exception {
+ LogConfig.setEnteringMDCs("elk-client", ElkClientConstants.ARCHIVE_REQUEST);
+ logger.debug("Inside archiveElkSnapshot");
+ ElkArchiveResponse archiveResponse = snapshotGetRepositoryService.archiveElkRepository(archiveRequest);
+ logger.debug("method call ended.");
+ LogConfig.clearMDCDetails();
+ return new ResponseEntity<ElkArchiveResponse>(archiveResponse, null, HttpStatus.OK);
+ }
+
@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(ErrorTransport.class)
public ResponseEntity<ErrorDetails> handleTransportError(ErrorTransport ex, WebRequest request) {
*/
package org.acumos.elk.client.service;
+import org.acumos.elk.client.transport.ElkArchiveRequest;
+import org.acumos.elk.client.transport.ElkArchiveResponse;
import org.acumos.elk.client.transport.ElkGetRepositoriesResponse;
import org.acumos.elk.client.transport.ElkRepositoriesRequest;
*/
public String deleteElkRepository(ElkRepositoriesRequest elkDeleteRepositoriesRequest);
+ /**
+ * This method is used to get archive repository.
+ * @return archive repository name.
+ * @throws Exception
+ */
+ public ElkArchiveResponse getArchiveElkRepository() throws Exception;
+
+ /**
+ * This method is used to archive and restore repository.
+ * @param archiveRequest
+ * @return archive repository name.
+ * @throws Exception
+ */
+ public ElkArchiveResponse archiveElkRepository(ElkArchiveRequest archiveRequest) throws Exception;
+
+
+
}
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
+import java.util.function.Function;
+import org.acumos.elk.client.transport.ArchiveInfo;
import org.acumos.elk.client.transport.ELkRepositoryMetaData;
+import org.acumos.elk.client.transport.ElkArchiveRequest;
+import org.acumos.elk.client.transport.ElkArchiveResponse;
import org.acumos.elk.client.transport.ElkGetRepositoriesResponse;
import org.acumos.elk.client.transport.ElkRepositoriesRequest;
import org.acumos.elk.client.transport.ErrorTransport;
import org.acumos.elk.client.utils.ElkClientConstants;
+import org.acumos.elk.client.utils.ElkServiceUtils;
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequest;
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest;
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.cluster.metadata.RepositoryMetaData;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.repositories.fs.FsRepository;
import org.json.simple.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
/**
* Implementation of operation related to elastic stack repository.
public class SnapshotRepositoryServiceImpl extends AbstractELKClientConnection implements ISnapshotRepositoryService {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
+
@Override
public ElkGetRepositoriesResponse getAllElkRepository() {
}
public String createElkRepository(ElkRepositoriesRequest elkCreateRepositoriesRequest) {
-
logger.debug("Inside createElkRepository ");
+ if (StringUtils.isEmpty(elkCreateRepositoriesRequest.getRepositoryName())) {
+ return "false | RepositoryName empty is not allowed";
+ }
+ ElkGetRepositoriesResponse response = getAllElkRepository();
+ List<ELkRepositoryMetaData> elkRepositoryMetaDataList = response.getRepositories();
+ Set<String> repositoryNameSet = new HashSet<>();
+ for (ELkRepositoryMetaData eLkRepositoryMetaData : elkRepositoryMetaDataList) {
+ repositoryNameSet.add(eLkRepositoryMetaData.getName());
+ }
+ if (repositoryNameSet.contains(elkCreateRepositoriesRequest.getRepositoryName())) {
+ return "false | RepositoryName already exist";
+ }
RestHighLevelClient client = restHighLevelClientConnection();
PutRepositoryRequest request = new PutRepositoryRequest();
String locationKey = FsRepository.LOCATION_SETTING.getKey();
- String locationValue = ".";
+ String locationValue = elkCreateRepositoriesRequest.getRepositoryName().trim();
String compressKey = FsRepository.COMPRESS_SETTING.getKey();
boolean compressValue = true;
Settings settings = Settings.builder().put(locationKey, locationValue).put(compressKey, compressValue).build();
request.settings(settings);
- request.name(elkCreateRepositoriesRequest.getRepositoryName());
+ request.name(elkCreateRepositoriesRequest.getRepositoryName().trim());
request.type(FsRepository.TYPE);
- request.masterNodeTimeout(TimeValue.timeValueMinutes(1));
- request.masterNodeTimeout(ElkClientConstants.TIME_ONE_MINT_OUT);
+ if (StringUtils.isEmpty(elkCreateRepositoriesRequest.getNodeTimeout())) {
+ request.masterNodeTimeout(ElkClientConstants.TIME_ONE_MINT_OUT);
+ } else {
+ request.masterNodeTimeout(elkCreateRepositoriesRequest.getNodeTimeout());
+ }
request.verify(true);
AcknowledgedResponse acknowledgedResponse;
boolean acknowledged = false;
return String.valueOf(deleteAcknowledged);
}
+ @Override
+ public ElkArchiveResponse getArchiveElkRepository() throws Exception {
+ String action = ElkClientConstants.INFO;
+ ElkArchiveResponse elkArchiveResponse = archiveOperation(null, action);
+ return elkArchiveResponse;
+ }
+
+ @Override
+ public ElkArchiveResponse archiveElkRepository(ElkArchiveRequest archiveRequest) throws Exception {
+ logger.debug("Inside archiveElkRepository");
+ String action = archiveRequest.getAction();
+ ElkArchiveResponse elkArchiveResponse = archiveOperation(archiveRequest, action);
+ return elkArchiveResponse;
+ }
+
+ private ElkArchiveResponse archiveOperation(ElkArchiveRequest archiveRequest, String action) throws Exception {
+ logger.debug("Inside archiveOperation action:{}", action);
+ Function<String, ArchiveInfo> f = str -> {
+ String[] p = str.split(",");
+ ArchiveInfo archiveInfo1 = new ArchiveInfo();
+ if (p[0] != null && p[0].length() > 0 && p[1] != null && p[1].length() > 0) {
+ archiveInfo1 = new ArchiveInfo(p[0], p[1]);
+ }
+ return archiveInfo1;
+ };
+
+ String result = null;
+ String[] archiveInfoArray;
+ List<String> resultList = new ArrayList<>();
+ if (action.equalsIgnoreCase(ElkClientConstants.INFO)) {
+ try {
+ result = ElkServiceUtils.executeScript(action, "NA");
+ resultList.add(result.trim());
+ } catch (Exception ex) {
+ logger.debug("Exception:", ex);
+ throw new Exception("Error occured elk archive operation");
+ }
+ } else {
+ try {
+ for (String repoName : archiveRequest.getRepositoryName()) {
+ result = ElkServiceUtils.executeScript(action, repoName);
+ resultList.add(result.trim());
+ }
+ } catch (Exception ex) {
+ logger.debug("Exception:", ex);
+ throw new Exception("Error occured elk archive operation");
+ }
+ }
+ boolean chkCSV = result.contains(",");
+ logger.debug("chkCSV:{}", chkCSV);
+ ElkArchiveResponse elkArchiveResponse = new ElkArchiveResponse();
+ List<ArchiveInfo> archiveInfoList = new ArrayList<ArchiveInfo>();
+ if (chkCSV) {
+ for (String resultOuput : resultList) {
+ archiveInfoArray = resultOuput.split("\n");
+ for (String archiveInfo : archiveInfoArray) {
+ archiveInfoList.add(f.apply(archiveInfo));
+ }
+ }
+ elkArchiveResponse.setMsg("Action:" + action + " done");
+ elkArchiveResponse.setStatus(ElkClientConstants.SUCCESS);
+ elkArchiveResponse.setArchiveInfo(archiveInfoList);
+ logger.debug("archiveInfoList:" + archiveInfoList);
+ if (action.equalsIgnoreCase("RESTORE")) {
+ for (ArchiveInfo archiveInfo : archiveInfoList) {
+ ElkRepositoriesRequest elkCreateRepositoriesRequest = new ElkRepositoriesRequest();
+ elkCreateRepositoriesRequest.setRepositoryName(archiveInfo.getBackUpName());
+ elkCreateRepositoriesRequest.setNodeTimeout(ElkClientConstants.TIME_ONE_MINT_OUT);
+ createElkRepository(elkCreateRepositoriesRequest);
+ }
+ }
+
+ } else {
+ result = result.replace("\n", "");
+ elkArchiveResponse.setStatus(ElkClientConstants.FAIL);
+ elkArchiveResponse.setMsg(result);
+ }
+ return elkArchiveResponse;
+ }
+
}
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
+import java.util.function.Predicate;
import org.acumos.elk.client.transport.CreateSnapshot;
import org.acumos.elk.client.transport.DeleteSnapshot;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
import com.carrotsearch.hppc.cursors.ObjectCursor;
/**
- * Implementation of operation related to elastic stack snapshot.
+ * Implementation of operation related to elastic stack snapshot.
*
*/
@Service
-public class SnapshotServiceImpl extends AbstractELKClientConnection implements ISnapshotService {
+public class SnapshotServiceImpl extends AbstractELKClientConnection implements ISnapshotService {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Autowired
SnapshotRepositoryServiceImpl snapshotRepositoryServiceImpl;
-
+
@Override
public ElkSnapshotsResponse getAllElasticSearchSnapshot(ElkRepositoriesRequest elkRepositoriesRequest) {
logger.debug("inside getAllElasticSearchSnapshot method ");
+ Predicate<ElasticsearchSnapshotsResponse> chkSnapshots = obj -> (obj.getSnapshots() != null
+ && obj.getSnapshots().size() > 0);
+
ElkSnapshotsResponse elkSnapshotsResponse = new ElkSnapshotsResponse();
List<ElasticsearchSnapshotsResponse> elasticsearchSnapshotsResponseList = new ArrayList<>();
ElkGetRepositoriesResponse elkGetRepositoriesResponse = snapshotRepositoryServiceImpl.getAllElkRepository();
for (ELkRepositoryMetaData eLkRepositoryMetaData : repositories) {
ElasticsearchSnapshotsResponse elasticsearchSnapshotsResponse = getElasticsearchSnapshotDetails(
elkRepositoriesRequest, eLkRepositoryMetaData.getName());
- elasticsearchSnapshotsResponse.setRepositoryName(eLkRepositoryMetaData.getName());
- elasticsearchSnapshotsResponseList.add(elasticsearchSnapshotsResponse);
+ if (chkSnapshots.test(elasticsearchSnapshotsResponse)) {
+ elasticsearchSnapshotsResponseList.add(elasticsearchSnapshotsResponse);
+ }
}
elkSnapshotsResponse.setElasticsearchSnapshots(elasticsearchSnapshotsResponseList);
return elkSnapshotsResponse;
String dateWithTime = dateTime.toString().replaceAll(":", "-")
.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;
RequestOptions.DEFAULT);
elasticStackIndiceResponse.setMessage(
"ElasticStack Snapshot restore is in progress, depending size it will take some time");
- elasticStackIndiceResponse.setStatus(ElkClientConstants.SUCCESS);
- logger.debug("RestoreSnapshotResponse : {}", elasticStackIndiceResponse.getMessage());
+ elasticStackIndiceResponse.setStatus(restoreSnapshotResponse.getRestoreInfo().status().toString());
+ logger.debug("RestoreSnapshotResponse : {}, Status: {}", elasticStackIndiceResponse.getMessage(),
+ restoreSnapshotResponse.getRestoreInfo().status().toString());
} catch (IOException e) {
logger.error("IOException: ", e);
throw new ErrorTransport("Unable to connect Elasticserach");
ImmutableOpenMap<String, Settings> indexMap = getSettingsResponse.getIndexToDefaultSettings();
for (ObjectCursor<String> key : indexMap.keys()) {
logger.debug("key.value: {}", key.value);
- indices.add(key.value);
+ if (key.value != ".kibana") {
+ indices.add(key.value);
+ }
}
elkIndicesResponse.setIndices(indices);
+
} catch (IOException e1) {
logger.debug("IOException: {}", e1);
throw new ErrorTransport("Unable to connect Elasticserach");
elkGetSnapshotMetaData.setIndices(indices);
snapshotMetaDatas.add(elkGetSnapshotMetaData);
}
+ snapshotResponse.setRepositoryName(repositoryName);
snapshotResponse.setSnapshots(snapshotMetaDatas);
return snapshotResponse;
}
--- /dev/null
+/*-
+ * ===============LICENSE_START=======================================================
+ * Acumos
+ * ===================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property & Tech Mahindra. All rights reserved.
+ * ===================================================================================
+ * This Acumos software file is distributed by AT&T and Tech Mahindra
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * This file is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ===============LICENSE_END=========================================================
+ */
+package org.acumos.elk.client.transport;
+
+import io.swagger.annotations.ApiModelProperty;
+
+public class ArchiveInfo {
+
+ @ApiModelProperty(required = true, value = "snapshot creation date")
+ String date;
+
+ @ApiModelProperty(required = true, value = "snapshot name.")
+ String backUpName;
+
+ public ArchiveInfo(String date, String backUpName) {
+ super();
+ this.date = date;
+ this.backUpName = backUpName;
+ }
+
+ public ArchiveInfo() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public String getDate() {
+ return date;
+ }
+
+ public String getBackUpName() {
+ return backUpName;
+ }
+
+ @Override
+ public String toString() {
+ return "ArchiveInfo [date=" + date + ", backUpName=" + backUpName + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((backUpName == null) ? 0 : backUpName.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ArchiveInfo other = (ArchiveInfo) obj;
+ if (backUpName == null) {
+ if (other.backUpName != null)
+ return false;
+ } else if (!backUpName.equals(other.backUpName))
+ return false;
+ return true;
+ }
+
+}
@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 = "snapshotName")
+ private String snapshotName;
@ApiModelProperty(value = "indices names")
private List<String> indices;
this.repositoryName = repositoryName;
}
+ public String getSnapshotName() {
+ return snapshotName;
+ }
+
+ public void setSnapshotName(String snapshotName) {
+ this.snapshotName = snapshotName;
+ }
+
public List<String> getIndices() {
return indices;
}
--- /dev/null
+/*-
+ * ===============LICENSE_START=======================================================
+ * Acumos
+ * ===================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property & Tech Mahindra. All rights reserved.
+ * ===================================================================================
+ * This Acumos software file is distributed by AT&T and Tech Mahindra
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * This file is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ===============LICENSE_END=========================================================
+ */
+package org.acumos.elk.client.transport;
+
+import java.util.List;
+
+import io.swagger.annotations.ApiModelProperty;
+
+public class ElkArchiveRequest {
+
+ @ApiModelProperty(required = true, value = "String value archive/restore", example = "archive/restore")
+ private String action;
+
+ @ApiModelProperty(required = true)
+ private List<String> repositoryName;
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public List<String> getRepositoryName() {
+ return repositoryName;
+ }
+
+ public void setRepositoryName(List<String> repositoryName) {
+ this.repositoryName = repositoryName;
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/*-
+ * ===============LICENSE_START=======================================================
+ * Acumos
+ * ===================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property & Tech Mahindra. All rights reserved.
+ * ===================================================================================
+ * This Acumos software file is distributed by AT&T and Tech Mahindra
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * This file is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ===============LICENSE_END=========================================================
+ */
+package org.acumos.elk.client.transport;
+
+import java.util.List;
+
+import io.swagger.annotations.ApiModelProperty;
+
+public class ElkArchiveResponse {
+
+ @ApiModelProperty(value = "archive names")
+ private List<ArchiveInfo> archiveInfo;
+ private String msg;
+ private String status;
+
+ public List<ArchiveInfo> getArchiveInfo() {
+ return archiveInfo;
+ }
+ public void setArchiveInfo(List<ArchiveInfo> archiveInfo) {
+ this.archiveInfo = archiveInfo;
+ }
+ public String getMsg() {
+ return msg;
+ }
+ public void setMsg(String msg) {
+ this.msg = msg;
+ }
+ public String getStatus() {
+ return status;
+ }
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+}
\ No newline at end of file
public static final String CREATE_SNAPSHOT_REQUEST = "/create/snapshot";
public static final String DELETE_SNAPSHOT_REQUEST = "/delete/snapshot";
public static final String RESTORE_SNAPSHOT_REQUEST = "/restore/snapshot";
+ public static final String GET_ALL_ARCHIVE_INFO = "/all/archive";
+ public static final String ARCHIVE_REQUEST = "/archive/action";
public static final String TRUE = "true";
public static final String TIME_ONE_MINT_OUT = "1m";
public static final String TIME_TWO_MINT_OUT = "2m";
public static final String SUCCESS = "success";
public static final String FAIL = "fail";
+ public static final String INFO = "INFO";
}
--- /dev/null
+/*-
+ * ===============LICENSE_START=======================================================
+ * Acumos
+ * ===================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property & Tech Mahindra. All rights reserved.
+ * ===================================================================================
+ * This Acumos software file is distributed by AT&T and Tech Mahindra
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * This file is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ===============LICENSE_END=========================================================
+ */
+package org.acumos.elk.client.utils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.lang.invoke.MethodHandles;
+import java.util.concurrent.TimeUnit;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ElkServiceUtils {
+
+ private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
+ public static String executeScript(String action, String repoName) throws Exception {
+ logger.debug("Inside executeScript action: {}", action);
+ String scriptFileName = "/maven/es_archive_script/archive_script.sh";
+ ProcessBuilder processBuilder = null;
+ Process process = null;
+ BufferedReader reader = null;
+ StringBuilder result = new StringBuilder();
+ try {
+
+ String[] cmd = { "bash", scriptFileName, action, repoName };
+ processBuilder = new ProcessBuilder(cmd);
+ if (processBuilder != null) {
+ process = processBuilder.start();
+ int errCode = process.waitFor();
+ logger.debug("cmd action:{} , Echo command executed, any errors? {}", action,
+ (errCode == 0 ? "No" : "Yes"));
+ String line = null;
+ reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ while ((line = reader.readLine()) != null) {
+ result.append(line + System.getProperty("line.separator"));
+ }
+ }
+ logger.debug("cmd>>{}", result.toString());
+
+ } finally {
+ if (null != process) {
+ process.waitFor(10, TimeUnit.SECONDS);
+ process.destroy();
+ }
+ if (null != reader) {
+ try {
+ reader.close();
+ } catch (IOException e) {
+ logger.error("executeScript failed {}", e);
+ throw e;
+ }
+ }
+ }
+ return String.valueOf(result);
+ }
+
+}
\ No newline at end of file
export ELASTICSEARCH_IMAGE=acumos-elasticsearch:2.2.2
export LOGSTASH_IMAGE=acumos-logstash:2.2.2
export KIBANA_IMAGE=acumos-kibana:2.2.2
-export ELK_CLIENT=elk-client:2.2.4
+export ELK_CLIENT=elk-client:3.0.0
- ${ACUMOS_ELK_CLIENT_PORT}:9006
volumes:
- acumos-logs:/maven/logs
+ - acumos-esdata:/elasticsearch/data
logging:
driver: json-file