From eaafe18830908d28a1a025d698a534e8198ff9af Mon Sep 17 00:00:00 2001 From: Zhongnan Su Date: Tue, 9 Feb 2021 17:26:41 -0800 Subject: [PATCH] Initialize notifications kibana plugin (#25) --- ...notifications-test-and-build-workflow.yml} | 7 +- .gitignore | 312 +----------------- .idea/.gitignore | 12 - .idea/.name | 1 - .idea/checkstyle-idea.xml | 16 - .idea/codeStyles/Project.xml | 40 --- .idea/codeStyles/codeStyleConfig.xml | 5 - .idea/copyright/Apache.xml | 6 - .idea/copyright/profiles_settings.xml | 7 - .idea/kotlinc.xml | 6 - .idea/misc.xml | 10 - .idea/vcs.xml | 6 - notifications-kibana-plugin/.eslintrc.js | 7 + notifications-kibana-plugin/.gitignore | 2 + notifications-kibana-plugin/.i18nrc.json | 7 + notifications-kibana-plugin/README.md | 19 ++ notifications-kibana-plugin/common/index.ts | 2 + notifications-kibana-plugin/kibana.json | 9 + notifications-kibana-plugin/package.json | 10 + .../public/application.tsx | 23 ++ .../public/components/app.tsx | 119 +++++++ notifications-kibana-plugin/public/index.scss | 0 notifications-kibana-plugin/public/index.ts | 13 + notifications-kibana-plugin/public/plugin.ts | 58 ++++ notifications-kibana-plugin/public/types.ts | 11 + notifications-kibana-plugin/server/index.ts | 14 + notifications-kibana-plugin/server/plugin.ts | 43 +++ .../server/routes/index.ts | 17 + notifications-kibana-plugin/server/types.ts | 4 + .../translations/ja-JP.json | 81 +++++ notifications-kibana-plugin/tsconfig.json | 16 + .codecov.yml => notifications/.codecov.yml | 0 .editorconfig => notifications/.editorconfig | 0 notifications/.gitignore | 297 +++++++++++++++++ .../CODE_OF_CONDUCT.md | 0 .../CONTRIBUTING.md | 0 LICENSE => notifications/LICENSE | 0 NOTICE => notifications/NOTICE | 0 .../build-tools}/esplugin-coverage.gradle | 0 .../build-tools}/pkgbuild.gradle | 0 build.gradle => notifications/build.gradle | 0 .../config}/checkstyle/checkstyle.xml | 0 .../config}/checkstyle/google_checks.xml | 0 .../config}/checkstyle/suppressions.xml | 0 detekt.yml => notifications/detekt.yml | 0 .../gradle.properties | 0 .../gradle}/wrapper/gradle-wrapper.jar | Bin .../gradle}/wrapper/gradle-wrapper.properties | 0 gradlew => notifications/gradlew | 0 gradlew.bat => notifications/gradlew.bat | 0 .../settings.gradle | 0 .../src}/main/config/notifications.yml | 4 +- .../notifications/NotificationPlugin.kt | 0 .../notifications/action/PluginBaseAction.kt | 0 .../notifications/action/SendMessageAction.kt | 0 .../notifications/channel/ChannelFactory.kt | 0 .../notifications/channel/ChannelProvider.kt | 0 .../notifications/channel/EmptyChannel.kt | 0 .../channel/NotificationChannel.kt | 0 .../channel/email/BaseEmailChannel.kt | 0 .../channel/email/EmailChannelFactory.kt | 0 .../channel/email/EmailMimeProvider.kt | 0 .../notifications/channel/email/SesChannel.kt | 0 .../channel/email/SmtpChannel.kt | 0 .../notifications/model/BaseResponse.kt | 0 .../notifications/model/ChannelMessage.kt | 0 .../model/ChannelMessageResponse.kt | 0 .../notifications/model/SendMessageRequest.kt | 0 .../model/SendMessageResponse.kt | 0 .../RestResponseToXContentListener.kt | 0 .../resthandler/SendMessageRestHandler.kt | 0 .../notifications/security/SecurityAccess.kt | 0 .../settings/EmailChannelType.kt | 0 .../notifications/settings/PluginSettings.kt | 0 .../notifications/throttle/Accountant.kt | 0 .../notifications/throttle/CounterIndex.kt | 0 .../throttle/CounterIndexModel.kt | 0 .../notifications/throttle/Counters.kt | 0 .../throttle/EmptyMessageCounter.kt | 0 .../notifications/throttle/MessageCounter.kt | 0 .../notifications/util/Helpers.kt | 0 .../notifications/util/OpenForTesting.kt | 0 .../notifications/util/SecureIndexClient.kt | 0 .../plugin-metadata/plugin-security.policy | 0 ...ndistro-notifications-counter-settings.yml | 0 .../opendistro-notifications-counter.yml | 0 .../NotificationsRestTestCase.kt | 0 .../notifications/ODFERestTestCase.kt | 0 .../notifications/TestHelpers.kt | 0 .../notifications/channel/SesChannelIT.kt | 0 .../notifications/channel/SmtpChannelIT.kt | 0 .../resthandler/SendMessageRestHandlerIT.kt | 0 .../SendMessageRestHandlerTests.kt | 0 93 files changed, 776 insertions(+), 408 deletions(-) rename .github/workflows/{test-and-build-workflow.yml => notifications-test-and-build-workflow.yml} (81%) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/.name delete mode 100644 .idea/checkstyle-idea.xml delete mode 100644 .idea/codeStyles/Project.xml delete mode 100644 .idea/codeStyles/codeStyleConfig.xml delete mode 100644 .idea/copyright/Apache.xml delete mode 100644 .idea/copyright/profiles_settings.xml delete mode 100644 .idea/kotlinc.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/vcs.xml create mode 100644 notifications-kibana-plugin/.eslintrc.js create mode 100644 notifications-kibana-plugin/.gitignore create mode 100644 notifications-kibana-plugin/.i18nrc.json create mode 100755 notifications-kibana-plugin/README.md create mode 100644 notifications-kibana-plugin/common/index.ts create mode 100644 notifications-kibana-plugin/kibana.json create mode 100644 notifications-kibana-plugin/package.json create mode 100644 notifications-kibana-plugin/public/application.tsx create mode 100644 notifications-kibana-plugin/public/components/app.tsx create mode 100644 notifications-kibana-plugin/public/index.scss create mode 100644 notifications-kibana-plugin/public/index.ts create mode 100644 notifications-kibana-plugin/public/plugin.ts create mode 100644 notifications-kibana-plugin/public/types.ts create mode 100644 notifications-kibana-plugin/server/index.ts create mode 100644 notifications-kibana-plugin/server/plugin.ts create mode 100644 notifications-kibana-plugin/server/routes/index.ts create mode 100644 notifications-kibana-plugin/server/types.ts create mode 100644 notifications-kibana-plugin/translations/ja-JP.json create mode 100644 notifications-kibana-plugin/tsconfig.json rename .codecov.yml => notifications/.codecov.yml (100%) rename .editorconfig => notifications/.editorconfig (100%) create mode 100644 notifications/.gitignore rename CODE_OF_CONDUCT.md => notifications/CODE_OF_CONDUCT.md (100%) rename CONTRIBUTING.md => notifications/CONTRIBUTING.md (100%) rename LICENSE => notifications/LICENSE (100%) rename NOTICE => notifications/NOTICE (100%) rename {build-tools => notifications/build-tools}/esplugin-coverage.gradle (100%) rename {build-tools => notifications/build-tools}/pkgbuild.gradle (100%) rename build.gradle => notifications/build.gradle (100%) rename {config => notifications/config}/checkstyle/checkstyle.xml (100%) rename {config => notifications/config}/checkstyle/google_checks.xml (100%) rename {config => notifications/config}/checkstyle/suppressions.xml (100%) rename detekt.yml => notifications/detekt.yml (100%) rename gradle.properties => notifications/gradle.properties (100%) rename {gradle => notifications/gradle}/wrapper/gradle-wrapper.jar (100%) rename {gradle => notifications/gradle}/wrapper/gradle-wrapper.properties (100%) rename gradlew => notifications/gradlew (100%) rename gradlew.bat => notifications/gradlew.bat (100%) rename settings.gradle => notifications/settings.gradle (100%) rename {src => notifications/src}/main/config/notifications.yml (90%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/NotificationPlugin.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/action/PluginBaseAction.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/action/SendMessageAction.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/ChannelFactory.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/ChannelProvider.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/EmptyChannel.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/NotificationChannel.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/BaseEmailChannel.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/EmailChannelFactory.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/EmailMimeProvider.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/SesChannel.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/SmtpChannel.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/BaseResponse.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/ChannelMessage.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/ChannelMessageResponse.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/SendMessageRequest.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/SendMessageResponse.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/RestResponseToXContentListener.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/SendMessageRestHandler.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/security/SecurityAccess.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/settings/EmailChannelType.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/settings/PluginSettings.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/Accountant.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/CounterIndex.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/CounterIndexModel.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/Counters.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/EmptyMessageCounter.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/MessageCounter.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/util/Helpers.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/util/OpenForTesting.kt (100%) rename {src => notifications/src}/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/util/SecureIndexClient.kt (100%) rename {src => notifications/src}/main/plugin-metadata/plugin-security.policy (100%) rename {src => notifications/src}/main/resources/opendistro-notifications-counter-settings.yml (100%) rename {src => notifications/src}/main/resources/opendistro-notifications-counter.yml (100%) rename {src => notifications/src}/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/NotificationsRestTestCase.kt (100%) rename {src => notifications/src}/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/ODFERestTestCase.kt (100%) rename {src => notifications/src}/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/TestHelpers.kt (100%) rename {src => notifications/src}/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/SesChannelIT.kt (100%) rename {src => notifications/src}/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/SmtpChannelIT.kt (100%) rename {src => notifications/src}/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/SendMessageRestHandlerIT.kt (100%) rename {src => notifications/src}/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/SendMessageRestHandlerTests.kt (100%) diff --git a/.github/workflows/test-and-build-workflow.yml b/.github/workflows/notifications-test-and-build-workflow.yml similarity index 81% rename from .github/workflows/test-and-build-workflow.yml rename to .github/workflows/notifications-test-and-build-workflow.yml index 8645431c..d4afc575 100644 --- a/.github/workflows/test-and-build-workflow.yml +++ b/.github/workflows/notifications-test-and-build-workflow.yml @@ -21,7 +21,6 @@ on: [push, pull_request] jobs: build: - runs-on: ubuntu-latest steps: @@ -33,12 +32,14 @@ jobs: java-version: 1.14 - name: Build with Gradle - run: ./gradlew build -x :integTestRunner -x :jacocoTestReport # exclude integTest task to avoid permission denied issue + run: | + cd notifications + ./gradlew build -x :integTestRunner -x :jacocoTestReport # exclude integTest task to avoid permission denied issue - name: Create Artifact Path run: | mkdir -p notifications-build - cp -r ./build/distributions/*.zip notifications-build/ + cp -r ./notifications/build/distributions/*.zip notifications-build/ - name: Upload Artifacts uses: actions/upload-artifact@v1 diff --git a/.gitignore b/.gitignore index 0f8de107..49e3e9c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,297 +1,21 @@ -### Java ### -# Compiled class file -*.class - -# Log file -*.log - -# BlueJ files -*.ctxt - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* - -### Kotlin ### -# Compiled class file - -# Log file - -# BlueJ files - -# Mobile Tools for Java (J2ME) - -# Package Files # - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml - -### Gradle ### -.gradle -build/ - -# Ignore Gradle GUI config -gradle-app.setting - -# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) -!gradle-wrapper.jar - -# Cache of project -.gradletasknamecache - -# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 -# gradle/wrapper/gradle-wrapper.properties - -### Gradle Patch ### -**/build/ - -### macOS ### -# General .DS_Store -.AppleDouble -.LSOverride -# Icon must end with two \r -Icon - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -### Windows ### -# Windows thumbnail cache files -Thumbs.db -Thumbs.db:encryptable -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk - -### Intellij ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -.idea/artifacts -.idea/compiler.xml -.idea/jarRepositories.xml -.idea/modules.xml -.idea/*.iml -.idea/modules *.iml -*.ipr - -# CMake -cmake-build-*/ - -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - -# File-based project format -*.iws - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# AWS plugin -.idea/aws.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -# Editor-based Rest Client -.idea/httpRequests - -# Android studio 3.1+ serialized cache file -.idea/caches/build_file_checksums.ser - -### Intellij Patch ### -# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 - -# *.iml -# modules.xml -# .idea/misc.xml -# *.ipr - -# Sonarlint plugin -# https://plugins.jetbrains.com/plugin/7973-sonarlint -.idea/**/sonarlint/ - -# SonarQube Plugin -# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin -.idea/**/sonarIssues.xml - -# Markdown Navigator plugin -# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced -.idea/**/markdown-navigator.xml -.idea/**/markdown-navigator-enh.xml -.idea/**/markdown-navigator/ - -# Cache file creation bug -# See https://youtrack.jetbrains.com/issue/JBR-2257 -.idea/$CACHE_FILE$ - -# CodeStream plugin -# https://plugins.jetbrains.com/plugin/12206-codestream -.idea/codestream.xml - - -### Maven ### -target/ -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next -release.properties -dependency-reduced-pom.xml -buildNumber.properties -.mvn/timing.properties -# https://github.com/takari/maven-wrapper#usage-without-binary-jar -.mvn/wrapper/maven-wrapper.jar - - -### Eclipse ### -.metadata -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.settings/ -.loadpath -.recommenders - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# PyDev specific (Python IDE for Eclipse) -*.pydevproject - -# CDT-specific (C/C++ Development Tooling) -.cproject - -# CDT- autotools -.autotools - -# Java annotation processor (APT) -.factorypath - -# PDT-specific (PHP Development Tools) -.buildpath - -# sbteclipse plugin -.target - -# Tern plugin -.tern-project - -# TeXlipse plugin -.texlipse - -# STS (Spring Tool Suite) -.springBeans - -# Code Recommenders -.recommenders/ - -# Annotation Processing -.apt_generated/ -.apt_generated_test/ - -# Scala IDE specific (Scala & Java development for Eclipse) -.cache-main -.scala_dependencies -.worksheet - -# Uncomment this line if you wish to ignore the project description file. -# Typically, this file would be tracked if it contains build/dependency configurations: -#.project - -### Eclipse Patch ### -# Spring Boot Tooling -.sts4-cache/ \ No newline at end of file +.gradle +out +local-test +.local-* + +npm-debug.log* +node_modules +/build/ +/public/app.css +.idea/ +.vscode/ +yarn-error.log +/coverage/ +.history/ +.eslintcache + +# Kibana +.empty diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 7011544e..00000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Project exclude paths -/. -# Project exclude paths -/. \ No newline at end of file diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index fb81d5c2..00000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -opendistro-notifications \ No newline at end of file diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml deleted file mode 100644 index c5c6f1f9..00000000 --- a/.idea/checkstyle-idea.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index a58b712e..00000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index 79ee123c..00000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/copyright/Apache.xml b/.idea/copyright/Apache.xml deleted file mode 100644 index 214c0a21..00000000 --- a/.idea/copyright/Apache.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index bee28e35..00000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml deleted file mode 100644 index 0dd4b354..00000000 --- a/.idea/kotlinc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 7844d451..00000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7f..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/notifications-kibana-plugin/.eslintrc.js b/notifications-kibana-plugin/.eslintrc.js new file mode 100644 index 00000000..b2670184 --- /dev/null +++ b/notifications-kibana-plugin/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + root: true, + extends: ['@elastic/eslint-config-kibana', 'plugin:@elastic/eui/recommended'], + rules: { + '@kbn/eslint/require-license-header': 'off', + }, +}; diff --git a/notifications-kibana-plugin/.gitignore b/notifications-kibana-plugin/.gitignore new file mode 100644 index 00000000..c3dca1b9 --- /dev/null +++ b/notifications-kibana-plugin/.gitignore @@ -0,0 +1,2 @@ +/build +/target diff --git a/notifications-kibana-plugin/.i18nrc.json b/notifications-kibana-plugin/.i18nrc.json new file mode 100644 index 00000000..2428b5bc --- /dev/null +++ b/notifications-kibana-plugin/.i18nrc.json @@ -0,0 +1,7 @@ +{ + "prefix": "opendistroNotificationsKibana", + "paths": { + "opendistroNotificationsKibana": "." + }, + "translations": ["translations/ja-JP.json"] +} diff --git a/notifications-kibana-plugin/README.md b/notifications-kibana-plugin/README.md new file mode 100755 index 00000000..694c3b05 --- /dev/null +++ b/notifications-kibana-plugin/README.md @@ -0,0 +1,19 @@ +# opendistroNotificationsKibana + +A Kibana plugin + +--- + +## Development + +See the [kibana contributing guide](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md) for instructions setting up your development environment. + +## Scripts + +
+
yarn kbn bootstrap
+
Execute this to install node_modules and setup the dependencies in your plugin and in Kibana
+ +
yarn plugin-helpers build
+
Execute this to create a distributable version of this plugin that can be installed in Kibana
+
diff --git a/notifications-kibana-plugin/common/index.ts b/notifications-kibana-plugin/common/index.ts new file mode 100644 index 00000000..646f4bd7 --- /dev/null +++ b/notifications-kibana-plugin/common/index.ts @@ -0,0 +1,2 @@ +export const PLUGIN_ID = "opendistroNotificationsKibana"; +export const PLUGIN_NAME = "opendistroNotificationsKibana"; diff --git a/notifications-kibana-plugin/kibana.json b/notifications-kibana-plugin/kibana.json new file mode 100644 index 00000000..92d623ab --- /dev/null +++ b/notifications-kibana-plugin/kibana.json @@ -0,0 +1,9 @@ +{ + "id": "opendistroNotificationsKibana", + "version": "1.0.0", + "kibanaVersion": "kibana", + "server": true, + "ui": true, + "requiredPlugins": ["navigation"], + "optionalPlugins": [] +} diff --git a/notifications-kibana-plugin/package.json b/notifications-kibana-plugin/package.json new file mode 100644 index 00000000..503f544e --- /dev/null +++ b/notifications-kibana-plugin/package.json @@ -0,0 +1,10 @@ +{ + "name": "opendistroNotificationsKibana", + "version": "0.0.0", + "private": true, + "scripts": { + "build": "yarn plugin-helpers build", + "plugin-helpers": "node ../../scripts/plugin_helpers", + "kbn": "node ../../scripts/kbn" + } +} diff --git a/notifications-kibana-plugin/public/application.tsx b/notifications-kibana-plugin/public/application.tsx new file mode 100644 index 00000000..6666da16 --- /dev/null +++ b/notifications-kibana-plugin/public/application.tsx @@ -0,0 +1,23 @@ +import React from "react"; +import ReactDOM from "react-dom"; +import { AppMountParameters, CoreStart } from "../../../src/core/public"; +import { AppPluginStartDependencies } from "./types"; +import { opendistroNotificationsKibanaApp } from "./components/app"; + +export const renderApp = ( + { notifications, http }: CoreStart, + { navigation }: AppPluginStartDependencies, + { appBasePath, element }: AppMountParameters +) => { + ReactDOM.render( + , + element + ); + + return () => ReactDOM.unmountComponentAtNode(element); +}; diff --git a/notifications-kibana-plugin/public/components/app.tsx b/notifications-kibana-plugin/public/components/app.tsx new file mode 100644 index 00000000..b73ffd02 --- /dev/null +++ b/notifications-kibana-plugin/public/components/app.tsx @@ -0,0 +1,119 @@ +import React, { useState } from "react"; +import { i18n } from "@kbn/i18n"; +import { FormattedMessage, I18nProvider } from "@kbn/i18n/react"; +import { BrowserRouter as Router } from "react-router-dom"; + +import { + EuiButton, + EuiHorizontalRule, + EuiPage, + EuiPageBody, + EuiPageContent, + EuiPageContentBody, + EuiPageContentHeader, + EuiPageHeader, + EuiTitle, + EuiText, +} from "@elastic/eui"; + +import { CoreStart } from "../../../../src/core/public"; +import { NavigationPublicPluginStart } from "../../../../src/plugins/navigation/public"; + +import { PLUGIN_ID, PLUGIN_NAME } from "../../common"; + +interface opendistroNotificationsKibanaAppDeps { + basename: string; + notifications: CoreStart["notifications"]; + http: CoreStart["http"]; + navigation: NavigationPublicPluginStart; +} + +export const opendistroNotificationsKibanaApp = ({ + basename, + notifications, + http, + navigation, +}: opendistroNotificationsKibanaAppDeps) => { + // Use React hooks to manage state. + const [timestamp, setTimestamp] = useState(); + + const onClickHandler = () => { + // Use the core http service to make a response to the server API. + http.get("/api/opendistro_notification_kibana/example").then((res) => { + setTimestamp(res.time); + // Use the core notifications service to display a success message. + notifications.toasts.addSuccess( + i18n.translate("opendistroNotificationsKibana.dataUpdated", { + defaultMessage: "Data updated", + }) + ); + }); + }; + + // Render the application DOM. + // Note that `navigation.ui.TopNavMenu` is a stateful component exported on the `navigation` plugin's start contract. + return ( + + + <> + + + + + +

+ +

+
+
+ + + +

+ +

+
+
+ + +

+ +

+ +

+ +

+ + + +
+
+
+
+
+ +
+
+ ); +}; diff --git a/notifications-kibana-plugin/public/index.scss b/notifications-kibana-plugin/public/index.scss new file mode 100644 index 00000000..e69de29b diff --git a/notifications-kibana-plugin/public/index.ts b/notifications-kibana-plugin/public/index.ts new file mode 100644 index 00000000..4c7a5b83 --- /dev/null +++ b/notifications-kibana-plugin/public/index.ts @@ -0,0 +1,13 @@ +import "./index.scss"; + +import { opendistroNotificationsKibanaPlugin } from "./plugin"; + +// This exports static code and TypeScript types, +// as well as, Kibana Platform `plugin()` initializer. +export function plugin() { + return new opendistroNotificationsKibanaPlugin(); +} +export { + opendistroNotificationsKibanaPluginSetup, + opendistroNotificationsKibanaPluginStart, +} from "./types"; diff --git a/notifications-kibana-plugin/public/plugin.ts b/notifications-kibana-plugin/public/plugin.ts new file mode 100644 index 00000000..39f2b7d4 --- /dev/null +++ b/notifications-kibana-plugin/public/plugin.ts @@ -0,0 +1,58 @@ +import { i18n } from "@kbn/i18n"; +import { + AppMountParameters, + CoreSetup, + CoreStart, + Plugin, +} from "../../../src/core/public"; +import { + opendistroNotificationsKibanaPluginSetup, + opendistroNotificationsKibanaPluginStart, + AppPluginStartDependencies, +} from "./types"; +import { PLUGIN_NAME } from "../common"; + +export class opendistroNotificationsKibanaPlugin + implements + Plugin< + opendistroNotificationsKibanaPluginSetup, + opendistroNotificationsKibanaPluginStart + > { + public setup(core: CoreSetup): opendistroNotificationsKibanaPluginSetup { + // Register an application into the side navigation menu + core.application.register({ + id: "opendistroNotificationsKibana", + title: PLUGIN_NAME, + async mount(params: AppMountParameters) { + // Load application bundle + const { renderApp } = await import("./application"); + // Get start services as specified in kibana.json + const [coreStart, depsStart] = await core.getStartServices(); + // Render the application + return renderApp( + coreStart, + depsStart as AppPluginStartDependencies, + params + ); + }, + }); + + // Return methods that should be available to other plugins + return { + getGreeting() { + return i18n.translate("opendistroNotificationsKibana.greetingText", { + defaultMessage: "Hello from {name}!", + values: { + name: PLUGIN_NAME, + }, + }); + }, + }; + } + + public start(core: CoreStart): opendistroNotificationsKibanaPluginStart { + return {}; + } + + public stop() {} +} diff --git a/notifications-kibana-plugin/public/types.ts b/notifications-kibana-plugin/public/types.ts new file mode 100644 index 00000000..5cc0434d --- /dev/null +++ b/notifications-kibana-plugin/public/types.ts @@ -0,0 +1,11 @@ +import { NavigationPublicPluginStart } from "../../../src/plugins/navigation/public"; + +export interface opendistroNotificationsKibanaPluginSetup { + getGreeting: () => string; +} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface opendistroNotificationsKibanaPluginStart {} + +export interface AppPluginStartDependencies { + navigation: NavigationPublicPluginStart; +} diff --git a/notifications-kibana-plugin/server/index.ts b/notifications-kibana-plugin/server/index.ts new file mode 100644 index 00000000..a79144a5 --- /dev/null +++ b/notifications-kibana-plugin/server/index.ts @@ -0,0 +1,14 @@ +import { PluginInitializerContext } from "../../../src/core/server"; +import { opendistroNotificationsKibanaPlugin } from "./plugin"; + +// This exports static code and TypeScript types, +// as well as, Kibana Platform `plugin()` initializer. + +export function plugin(initializerContext: PluginInitializerContext) { + return new opendistroNotificationsKibanaPlugin(initializerContext); +} + +export { + opendistroNotificationsKibanaPluginSetup, + opendistroNotificationsKibanaPluginStart, +} from "./types"; diff --git a/notifications-kibana-plugin/server/plugin.ts b/notifications-kibana-plugin/server/plugin.ts new file mode 100644 index 00000000..0044b0f5 --- /dev/null +++ b/notifications-kibana-plugin/server/plugin.ts @@ -0,0 +1,43 @@ +import { + PluginInitializerContext, + CoreSetup, + CoreStart, + Plugin, + Logger, +} from "../../../src/core/server"; + +import { + opendistroNotificationsKibanaPluginSetup, + opendistroNotificationsKibanaPluginStart, +} from "./types"; +import { defineRoutes } from "./routes"; + +export class opendistroNotificationsKibanaPlugin + implements + Plugin< + opendistroNotificationsKibanaPluginSetup, + opendistroNotificationsKibanaPluginStart + > { + private readonly logger: Logger; + + constructor(initializerContext: PluginInitializerContext) { + this.logger = initializerContext.logger.get(); + } + + public setup(core: CoreSetup) { + this.logger.debug("opendistroNotificationsKibana: Setup"); + const router = core.http.createRouter(); + + // Register server side APIs + defineRoutes(router); + + return {}; + } + + public start(core: CoreStart) { + this.logger.debug("opendistroNotificationsKibana: Started"); + return {}; + } + + public stop() {} +} diff --git a/notifications-kibana-plugin/server/routes/index.ts b/notifications-kibana-plugin/server/routes/index.ts new file mode 100644 index 00000000..9cc27039 --- /dev/null +++ b/notifications-kibana-plugin/server/routes/index.ts @@ -0,0 +1,17 @@ +import { IRouter } from '../../../../src/core/server'; + +export function defineRoutes(router: IRouter) { + router.get( + { + path: '/api/opendistro_notification_kibana/example', + validate: false, + }, + async (context, request, response) => { + return response.ok({ + body: { + time: new Date().toISOString(), + }, + }); + } + ); +} diff --git a/notifications-kibana-plugin/server/types.ts b/notifications-kibana-plugin/server/types.ts new file mode 100644 index 00000000..7c0fae1a --- /dev/null +++ b/notifications-kibana-plugin/server/types.ts @@ -0,0 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface opendistroNotificationsKibanaPluginSetup {} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface opendistroNotificationsKibanaPluginStart {} diff --git a/notifications-kibana-plugin/translations/ja-JP.json b/notifications-kibana-plugin/translations/ja-JP.json new file mode 100644 index 00000000..921d78ed --- /dev/null +++ b/notifications-kibana-plugin/translations/ja-JP.json @@ -0,0 +1,81 @@ +{ + "formats": { + "number": { + "currency": { + "style": "currency" + }, + "percent": { + "style": "percent" + } + }, + "date": { + "short": { + "month": "numeric", + "day": "numeric", + "year": "2-digit" + }, + "medium": { + "month": "short", + "day": "numeric", + "year": "numeric" + }, + "long": { + "month": "long", + "day": "numeric", + "year": "numeric" + }, + "full": { + "weekday": "long", + "month": "long", + "day": "numeric", + "year": "numeric" + } + }, + "time": { + "short": { + "hour": "numeric", + "minute": "numeric" + }, + "medium": { + "hour": "numeric", + "minute": "numeric", + "second": "numeric" + }, + "long": { + "hour": "numeric", + "minute": "numeric", + "second": "numeric", + "timeZoneName": "short" + }, + "full": { + "hour": "numeric", + "minute": "numeric", + "second": "numeric", + "timeZoneName": "short" + } + }, + "relative": { + "years": { + "units": "year" + }, + "months": { + "units": "month" + }, + "days": { + "units": "day" + }, + "hours": { + "units": "hour" + }, + "minutes": { + "units": "minute" + }, + "seconds": { + "units": "second" + } + } + }, + "messages": { + "opendistroNotificationsKibana.buttonText": "Translate me to Japanese" + } +} diff --git a/notifications-kibana-plugin/tsconfig.json b/notifications-kibana-plugin/tsconfig.json new file mode 100644 index 00000000..7fa03739 --- /dev/null +++ b/notifications-kibana-plugin/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "./target", + "skipLibCheck": true + }, + "include": [ + "index.ts", + "common/**/*.ts", + "public/**/*.ts", + "public/**/*.tsx", + "server/**/*.ts", + "../../typings/**/*" + ], + "exclude": [] +} diff --git a/.codecov.yml b/notifications/.codecov.yml similarity index 100% rename from .codecov.yml rename to notifications/.codecov.yml diff --git a/.editorconfig b/notifications/.editorconfig similarity index 100% rename from .editorconfig rename to notifications/.editorconfig diff --git a/notifications/.gitignore b/notifications/.gitignore new file mode 100644 index 00000000..0f8de107 --- /dev/null +++ b/notifications/.gitignore @@ -0,0 +1,297 @@ +### Java ### +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +### Kotlin ### +# Compiled class file + +# Log file + +# BlueJ files + +# Mobile Tools for Java (J2ME) + +# Package Files # + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml + +### Gradle ### +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Cache of project +.gradletasknamecache + +# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 +# gradle/wrapper/gradle-wrapper.properties + +### Gradle Patch ### +**/build/ + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### Intellij ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +.idea/artifacts +.idea/compiler.xml +.idea/jarRepositories.xml +.idea/modules.xml +.idea/*.iml +.idea/modules +*.iml +*.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# AWS plugin +.idea/aws.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +# https://plugins.jetbrains.com/plugin/7973-sonarlint +.idea/**/sonarlint/ + +# SonarQube Plugin +# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin +.idea/**/sonarIssues.xml + +# Markdown Navigator plugin +# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced +.idea/**/markdown-navigator.xml +.idea/**/markdown-navigator-enh.xml +.idea/**/markdown-navigator/ + +# Cache file creation bug +# See https://youtrack.jetbrains.com/issue/JBR-2257 +.idea/$CACHE_FILE$ + +# CodeStream plugin +# https://plugins.jetbrains.com/plugin/12206-codestream +.idea/codestream.xml + + +### Maven ### +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +# https://github.com/takari/maven-wrapper#usage-without-binary-jar +.mvn/wrapper/maven-wrapper.jar + + +### Eclipse ### +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# CDT- autotools +.autotools + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# sbteclipse plugin +.target + +# Tern plugin +.tern-project + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ + +# Annotation Processing +.apt_generated/ +.apt_generated_test/ + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet + +# Uncomment this line if you wish to ignore the project description file. +# Typically, this file would be tracked if it contains build/dependency configurations: +#.project + +### Eclipse Patch ### +# Spring Boot Tooling +.sts4-cache/ \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/notifications/CODE_OF_CONDUCT.md similarity index 100% rename from CODE_OF_CONDUCT.md rename to notifications/CODE_OF_CONDUCT.md diff --git a/CONTRIBUTING.md b/notifications/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to notifications/CONTRIBUTING.md diff --git a/LICENSE b/notifications/LICENSE similarity index 100% rename from LICENSE rename to notifications/LICENSE diff --git a/NOTICE b/notifications/NOTICE similarity index 100% rename from NOTICE rename to notifications/NOTICE diff --git a/build-tools/esplugin-coverage.gradle b/notifications/build-tools/esplugin-coverage.gradle similarity index 100% rename from build-tools/esplugin-coverage.gradle rename to notifications/build-tools/esplugin-coverage.gradle diff --git a/build-tools/pkgbuild.gradle b/notifications/build-tools/pkgbuild.gradle similarity index 100% rename from build-tools/pkgbuild.gradle rename to notifications/build-tools/pkgbuild.gradle diff --git a/build.gradle b/notifications/build.gradle similarity index 100% rename from build.gradle rename to notifications/build.gradle diff --git a/config/checkstyle/checkstyle.xml b/notifications/config/checkstyle/checkstyle.xml similarity index 100% rename from config/checkstyle/checkstyle.xml rename to notifications/config/checkstyle/checkstyle.xml diff --git a/config/checkstyle/google_checks.xml b/notifications/config/checkstyle/google_checks.xml similarity index 100% rename from config/checkstyle/google_checks.xml rename to notifications/config/checkstyle/google_checks.xml diff --git a/config/checkstyle/suppressions.xml b/notifications/config/checkstyle/suppressions.xml similarity index 100% rename from config/checkstyle/suppressions.xml rename to notifications/config/checkstyle/suppressions.xml diff --git a/detekt.yml b/notifications/detekt.yml similarity index 100% rename from detekt.yml rename to notifications/detekt.yml diff --git a/gradle.properties b/notifications/gradle.properties similarity index 100% rename from gradle.properties rename to notifications/gradle.properties diff --git a/gradle/wrapper/gradle-wrapper.jar b/notifications/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from gradle/wrapper/gradle-wrapper.jar rename to notifications/gradle/wrapper/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/notifications/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from gradle/wrapper/gradle-wrapper.properties rename to notifications/gradle/wrapper/gradle-wrapper.properties diff --git a/gradlew b/notifications/gradlew similarity index 100% rename from gradlew rename to notifications/gradlew diff --git a/gradlew.bat b/notifications/gradlew.bat similarity index 100% rename from gradlew.bat rename to notifications/gradlew.bat diff --git a/settings.gradle b/notifications/settings.gradle similarity index 100% rename from settings.gradle rename to notifications/settings.gradle diff --git a/src/main/config/notifications.yml b/notifications/src/main/config/notifications.yml similarity index 90% rename from src/main/config/notifications.yml rename to notifications/src/main/config/notifications.yml index 1870892a..aa500a38 100644 --- a/src/main/config/notifications.yml +++ b/notifications/src/main/config/notifications.yml @@ -20,8 +20,8 @@ opendistro.notifications: general: operationTimeoutMs: 60000 # 60 seconds, Minimum 100ms email: - channel: "smtp" # ses or smtp, provide corresponding sections - fromAddress: "from@email.com" + channel: "ses" # ses or smtp, provide corresponding sections + fromAddress: "banantha@amazon.com" monthlyLimit: 200 sizeLimit: 10000000 # 10MB Email size limit ses: # Configuration for Amazon SES email delivery diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/NotificationPlugin.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/NotificationPlugin.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/NotificationPlugin.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/NotificationPlugin.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/action/PluginBaseAction.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/action/PluginBaseAction.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/action/PluginBaseAction.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/action/PluginBaseAction.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/action/SendMessageAction.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/action/SendMessageAction.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/action/SendMessageAction.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/action/SendMessageAction.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/ChannelFactory.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/ChannelFactory.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/ChannelFactory.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/ChannelFactory.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/ChannelProvider.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/ChannelProvider.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/ChannelProvider.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/ChannelProvider.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/EmptyChannel.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/EmptyChannel.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/EmptyChannel.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/EmptyChannel.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/NotificationChannel.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/NotificationChannel.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/NotificationChannel.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/NotificationChannel.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/BaseEmailChannel.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/BaseEmailChannel.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/BaseEmailChannel.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/BaseEmailChannel.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/EmailChannelFactory.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/EmailChannelFactory.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/EmailChannelFactory.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/EmailChannelFactory.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/EmailMimeProvider.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/EmailMimeProvider.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/EmailMimeProvider.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/EmailMimeProvider.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/SesChannel.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/SesChannel.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/SesChannel.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/SesChannel.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/SmtpChannel.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/SmtpChannel.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/SmtpChannel.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/email/SmtpChannel.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/BaseResponse.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/BaseResponse.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/BaseResponse.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/BaseResponse.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/ChannelMessage.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/ChannelMessage.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/ChannelMessage.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/ChannelMessage.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/ChannelMessageResponse.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/ChannelMessageResponse.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/ChannelMessageResponse.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/ChannelMessageResponse.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/SendMessageRequest.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/SendMessageRequest.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/SendMessageRequest.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/SendMessageRequest.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/SendMessageResponse.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/SendMessageResponse.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/SendMessageResponse.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/model/SendMessageResponse.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/RestResponseToXContentListener.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/RestResponseToXContentListener.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/RestResponseToXContentListener.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/RestResponseToXContentListener.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/SendMessageRestHandler.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/SendMessageRestHandler.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/SendMessageRestHandler.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/SendMessageRestHandler.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/security/SecurityAccess.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/security/SecurityAccess.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/security/SecurityAccess.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/security/SecurityAccess.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/settings/EmailChannelType.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/settings/EmailChannelType.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/settings/EmailChannelType.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/settings/EmailChannelType.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/settings/PluginSettings.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/settings/PluginSettings.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/settings/PluginSettings.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/settings/PluginSettings.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/Accountant.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/Accountant.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/Accountant.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/Accountant.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/CounterIndex.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/CounterIndex.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/CounterIndex.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/CounterIndex.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/CounterIndexModel.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/CounterIndexModel.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/CounterIndexModel.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/CounterIndexModel.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/Counters.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/Counters.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/Counters.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/Counters.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/EmptyMessageCounter.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/EmptyMessageCounter.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/EmptyMessageCounter.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/EmptyMessageCounter.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/MessageCounter.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/MessageCounter.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/MessageCounter.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/throttle/MessageCounter.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/util/Helpers.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/util/Helpers.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/util/Helpers.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/util/Helpers.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/util/OpenForTesting.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/util/OpenForTesting.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/util/OpenForTesting.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/util/OpenForTesting.kt diff --git a/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/util/SecureIndexClient.kt b/notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/util/SecureIndexClient.kt similarity index 100% rename from src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/util/SecureIndexClient.kt rename to notifications/src/main/kotlin/com/amazon/opendistroforelasticsearch/notifications/util/SecureIndexClient.kt diff --git a/src/main/plugin-metadata/plugin-security.policy b/notifications/src/main/plugin-metadata/plugin-security.policy similarity index 100% rename from src/main/plugin-metadata/plugin-security.policy rename to notifications/src/main/plugin-metadata/plugin-security.policy diff --git a/src/main/resources/opendistro-notifications-counter-settings.yml b/notifications/src/main/resources/opendistro-notifications-counter-settings.yml similarity index 100% rename from src/main/resources/opendistro-notifications-counter-settings.yml rename to notifications/src/main/resources/opendistro-notifications-counter-settings.yml diff --git a/src/main/resources/opendistro-notifications-counter.yml b/notifications/src/main/resources/opendistro-notifications-counter.yml similarity index 100% rename from src/main/resources/opendistro-notifications-counter.yml rename to notifications/src/main/resources/opendistro-notifications-counter.yml diff --git a/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/NotificationsRestTestCase.kt b/notifications/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/NotificationsRestTestCase.kt similarity index 100% rename from src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/NotificationsRestTestCase.kt rename to notifications/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/NotificationsRestTestCase.kt diff --git a/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/ODFERestTestCase.kt b/notifications/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/ODFERestTestCase.kt similarity index 100% rename from src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/ODFERestTestCase.kt rename to notifications/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/ODFERestTestCase.kt diff --git a/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/TestHelpers.kt b/notifications/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/TestHelpers.kt similarity index 100% rename from src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/TestHelpers.kt rename to notifications/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/TestHelpers.kt diff --git a/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/SesChannelIT.kt b/notifications/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/SesChannelIT.kt similarity index 100% rename from src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/SesChannelIT.kt rename to notifications/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/SesChannelIT.kt diff --git a/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/SmtpChannelIT.kt b/notifications/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/SmtpChannelIT.kt similarity index 100% rename from src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/SmtpChannelIT.kt rename to notifications/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/channel/SmtpChannelIT.kt diff --git a/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/SendMessageRestHandlerIT.kt b/notifications/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/SendMessageRestHandlerIT.kt similarity index 100% rename from src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/SendMessageRestHandlerIT.kt rename to notifications/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/SendMessageRestHandlerIT.kt diff --git a/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/SendMessageRestHandlerTests.kt b/notifications/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/SendMessageRestHandlerTests.kt similarity index 100% rename from src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/SendMessageRestHandlerTests.kt rename to notifications/src/test/kotlin/com/amazon/opendistroforelasticsearch/notifications/resthandler/SendMessageRestHandlerTests.kt