X-Pack Notification: Settings refactoring, removed 'service'
The service part is now obsolete with moving to `xpack.notification`. Original commit: elastic/x-pack-elasticsearch@a7907f24a5
This commit is contained in:
parent
627b88b753
commit
27f0a68a28
|
@ -72,18 +72,18 @@ public class HipChatServiceIT extends AbstractWatcherIntegrationTestCase {
|
||||||
.put(super.nodeSettings(nodeOrdinal))
|
.put(super.nodeSettings(nodeOrdinal))
|
||||||
|
|
||||||
// this is for the `test-watcher-integration` group level integration in HipChat
|
// this is for the `test-watcher-integration` group level integration in HipChat
|
||||||
.put("xpack.notification.hipchat.service.account.integration_account.profile", "integration")
|
.put("xpack.notification.hipchat.account.integration_account.profile", "integration")
|
||||||
.put("xpack.notification.hipchat.service.account.integration_account.auth_token",
|
.put("xpack.notification.hipchat.account.integration_account.auth_token",
|
||||||
"huuS9v7ccuOy3ZBWWWr1vt8Lqu3sQnLUE81nrLZU")
|
"huuS9v7ccuOy3ZBWWWr1vt8Lqu3sQnLUE81nrLZU")
|
||||||
.put("xpack.notification.hipchat.service.account.integration_account.room", "test-watcher")
|
.put("xpack.notification.hipchat.account.integration_account.room", "test-watcher")
|
||||||
|
|
||||||
// this is for the Watcher Test account in HipChat
|
// this is for the Watcher Test account in HipChat
|
||||||
.put("xpack.notification.hipchat.service.account.user_account.profile", "user")
|
.put("xpack.notification.hipchat.account.user_account.profile", "user")
|
||||||
.put("xpack.notification.hipchat.service.account.user_account.auth_token", "FYVx16oDH78ZW9r13wtXbcszyoyA7oX5tiMWg9X0")
|
.put("xpack.notification.hipchat.account.user_account.auth_token", "FYVx16oDH78ZW9r13wtXbcszyoyA7oX5tiMWg9X0")
|
||||||
|
|
||||||
// this is for the `test-watcher-v1` notification token
|
// this is for the `test-watcher-v1` notification token
|
||||||
.put("xpack.notification.hipchat.service.account.v1_account.profile", "v1")
|
.put("xpack.notification.hipchat.account.v1_account.profile", "v1")
|
||||||
.put("xpack.notification.hipchat.service.account.v1_account.auth_token", "a734baf62df618b96dda55b323fc30")
|
.put("xpack.notification.hipchat.account.v1_account.auth_token", "a734baf62df618b96dda55b323fc30")
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class PagerDutyServiceIT extends AbstractWatcherIntegrationTestCase {
|
||||||
protected Settings nodeSettings(int nodeOrdinal) {
|
protected Settings nodeSettings(int nodeOrdinal) {
|
||||||
return Settings.builder()
|
return Settings.builder()
|
||||||
.put(super.nodeSettings(nodeOrdinal))
|
.put(super.nodeSettings(nodeOrdinal))
|
||||||
.put("xpack.notification.pagerduty.service.account.test_account.service_api_key", "fc082467005d4072a914e0bb041882d0")
|
.put("xpack.notification.pagerduty.account.test_account.service_api_key", "fc082467005d4072a914e0bb041882d0")
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class SlackServiceIT extends AbstractWatcherIntegrationTestCase {
|
||||||
.put(super.nodeSettings(nodeOrdinal))
|
.put(super.nodeSettings(nodeOrdinal))
|
||||||
|
|
||||||
// this is for the `test-watcher-integration` group level integration in HipChat
|
// this is for the `test-watcher-integration` group level integration in HipChat
|
||||||
.put("xpack.notification.slack.service.account.test_account.url",
|
.put("xpack.notification.slack.account.test_account.url",
|
||||||
"https://hooks.slack.com/services/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")
|
"https://hooks.slack.com/services/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")
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class InternalEmailService extends AbstractLifecycleComponent<EmailServic
|
||||||
|
|
||||||
private final SecretService secretService;
|
private final SecretService secretService;
|
||||||
public static final Setting<Settings> EMAIL_ACCOUNT_SETTING =
|
public static final Setting<Settings> EMAIL_ACCOUNT_SETTING =
|
||||||
Setting.groupSetting("xpack.notification.email.service.", Setting.Property.Dynamic, Setting.Property.NodeScope);
|
Setting.groupSetting("xpack.notification.email.", Setting.Property.Dynamic, Setting.Property.NodeScope);
|
||||||
|
|
||||||
private volatile Accounts accounts;
|
private volatile Accounts accounts;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class InternalHipChatService extends AbstractLifecycleComponent<HipChatSe
|
||||||
private final HttpClient httpClient;
|
private final HttpClient httpClient;
|
||||||
private volatile HipChatAccounts accounts;
|
private volatile HipChatAccounts accounts;
|
||||||
public static final Setting<Settings> HIPCHAT_ACCOUNT_SETTING =
|
public static final Setting<Settings> HIPCHAT_ACCOUNT_SETTING =
|
||||||
Setting.groupSetting("xpack.notification.hipchat.service.", Setting.Property.Dynamic, Setting.Property.NodeScope);
|
Setting.groupSetting("xpack.notification.hipchat.", Setting.Property.Dynamic, Setting.Property.NodeScope);
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public InternalHipChatService(Settings settings, HttpClient httpClient, ClusterSettings clusterSettings) {
|
public InternalHipChatService(Settings settings, HttpClient httpClient, ClusterSettings clusterSettings) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.elasticsearch.watcher.support.http.HttpClient;
|
||||||
public class InternalPagerDutyService extends AbstractLifecycleComponent<PagerDutyService> implements PagerDutyService {
|
public class InternalPagerDutyService extends AbstractLifecycleComponent<PagerDutyService> implements PagerDutyService {
|
||||||
|
|
||||||
public static final Setting<Settings> PAGERDUTY_ACCOUNT_SETTING =
|
public static final Setting<Settings> PAGERDUTY_ACCOUNT_SETTING =
|
||||||
Setting.groupSetting("xpack.notification.pagerduty.service.", Setting.Property.Dynamic, Setting.Property.NodeScope);
|
Setting.groupSetting("xpack.notification.pagerduty.", Setting.Property.Dynamic, Setting.Property.NodeScope);
|
||||||
|
|
||||||
private final HttpClient httpClient;
|
private final HttpClient httpClient;
|
||||||
private volatile PagerDutyAccounts accounts;
|
private volatile PagerDutyAccounts accounts;
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class InternalSlackService extends AbstractLifecycleComponent<SlackServic
|
||||||
|
|
||||||
private final HttpClient httpClient;
|
private final HttpClient httpClient;
|
||||||
public static final Setting<Settings> SLACK_ACCOUNT_SETTING =
|
public static final Setting<Settings> SLACK_ACCOUNT_SETTING =
|
||||||
Setting.groupSetting("xpack.notification.slack.service.", Setting.Property.Dynamic, Setting.Property.NodeScope);
|
Setting.groupSetting("xpack.notification.slack.", Setting.Property.Dynamic, Setting.Property.NodeScope);
|
||||||
private volatile SlackAccounts accounts;
|
private volatile SlackAccounts accounts;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
@ -66,9 +66,9 @@ public class EmailSecretsIntegrationTests extends AbstractWatcherIntegrationTest
|
||||||
}
|
}
|
||||||
return Settings.builder()
|
return Settings.builder()
|
||||||
.put(super.nodeSettings(nodeOrdinal))
|
.put(super.nodeSettings(nodeOrdinal))
|
||||||
.put("xpack.notification.email.service.account.test.smtp.auth", true)
|
.put("xpack.notification.email.account.test.smtp.auth", true)
|
||||||
.put("xpack.notification.email.service.account.test.smtp.port", server.port())
|
.put("xpack.notification.email.account.test.smtp.port", server.port())
|
||||||
.put("xpack.notification.email.service.account.test.smtp.host", "localhost")
|
.put("xpack.notification.email.account.test.smtp.host", "localhost")
|
||||||
.put("xpack.watcher.shield.encrypt_sensitive_data", encryptSensitiveData)
|
.put("xpack.watcher.shield.encrypt_sensitive_data", encryptSensitiveData)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,13 +44,13 @@ public class InternalHipChatServiceTests extends ESTestCase {
|
||||||
HipChatMessage.Format defaultFormat = randomBoolean() ? null : randomFrom(HipChatMessage.Format.values());
|
HipChatMessage.Format defaultFormat = randomBoolean() ? null : randomFrom(HipChatMessage.Format.values());
|
||||||
Boolean defaultNotify = randomBoolean() ? null : (Boolean) randomBoolean();
|
Boolean defaultNotify = randomBoolean() ? null : (Boolean) randomBoolean();
|
||||||
Settings.Builder settingsBuilder = Settings.builder()
|
Settings.Builder settingsBuilder = Settings.builder()
|
||||||
.put("xpack.notification.hipchat.service.account." + accountName + ".profile", HipChatAccount.Profile.V1.value())
|
.put("xpack.notification.hipchat.account." + accountName + ".profile", HipChatAccount.Profile.V1.value())
|
||||||
.put("xpack.notification.hipchat.service.account." + accountName + ".auth_token", "_token");
|
.put("xpack.notification.hipchat.account." + accountName + ".auth_token", "_token");
|
||||||
if (host != null) {
|
if (host != null) {
|
||||||
settingsBuilder.put("xpack.notification.hipchat.service.account." + accountName + ".host", host);
|
settingsBuilder.put("xpack.notification.hipchat.account." + accountName + ".host", host);
|
||||||
}
|
}
|
||||||
if (port > 0) {
|
if (port > 0) {
|
||||||
settingsBuilder.put("xpack.notification.hipchat.service.account." + accountName + ".port", port);
|
settingsBuilder.put("xpack.notification.hipchat.account." + accountName + ".port", port);
|
||||||
}
|
}
|
||||||
buildMessageDefaults(accountName, settingsBuilder, defaultRoom, null, defaultFrom, defaultColor, defaultFormat, defaultNotify);
|
buildMessageDefaults(accountName, settingsBuilder, defaultRoom, null, defaultFrom, defaultColor, defaultFormat, defaultNotify);
|
||||||
InternalHipChatService service = new InternalHipChatService(settingsBuilder.build(), httpClient,
|
InternalHipChatService service = new InternalHipChatService(settingsBuilder.build(), httpClient,
|
||||||
|
@ -91,15 +91,15 @@ public class InternalHipChatServiceTests extends ESTestCase {
|
||||||
HipChatMessage.Format defaultFormat = randomBoolean() ? null : randomFrom(HipChatMessage.Format.values());
|
HipChatMessage.Format defaultFormat = randomBoolean() ? null : randomFrom(HipChatMessage.Format.values());
|
||||||
Boolean defaultNotify = randomBoolean() ? null : (Boolean) randomBoolean();
|
Boolean defaultNotify = randomBoolean() ? null : (Boolean) randomBoolean();
|
||||||
Settings.Builder settingsBuilder = Settings.builder()
|
Settings.Builder settingsBuilder = Settings.builder()
|
||||||
.put("xpack.notification.hipchat.service.account." + accountName + ".profile",
|
.put("xpack.notification.hipchat.account." + accountName + ".profile",
|
||||||
HipChatAccount.Profile.INTEGRATION.value())
|
HipChatAccount.Profile.INTEGRATION.value())
|
||||||
.put("xpack.notification.hipchat.service.account." + accountName + ".auth_token", "_token")
|
.put("xpack.notification.hipchat.account." + accountName + ".auth_token", "_token")
|
||||||
.put("xpack.notification.hipchat.service.account." + accountName + ".room", room);
|
.put("xpack.notification.hipchat.account." + accountName + ".room", room);
|
||||||
if (host != null) {
|
if (host != null) {
|
||||||
settingsBuilder.put("xpack.notification.hipchat.service.account." + accountName + ".host", host);
|
settingsBuilder.put("xpack.notification.hipchat.account." + accountName + ".host", host);
|
||||||
}
|
}
|
||||||
if (port > 0) {
|
if (port > 0) {
|
||||||
settingsBuilder.put("xpack.notification.hipchat.service.account." + accountName + ".port", port);
|
settingsBuilder.put("xpack.notification.hipchat.account." + accountName + ".port", port);
|
||||||
}
|
}
|
||||||
buildMessageDefaults(accountName, settingsBuilder, null, null, defaultFrom, defaultColor, defaultFormat, defaultNotify);
|
buildMessageDefaults(accountName, settingsBuilder, null, null, defaultFrom, defaultColor, defaultFormat, defaultNotify);
|
||||||
InternalHipChatService service = new InternalHipChatService(settingsBuilder.build(), httpClient,
|
InternalHipChatService service = new InternalHipChatService(settingsBuilder.build(), httpClient,
|
||||||
|
@ -128,9 +128,9 @@ public class InternalHipChatServiceTests extends ESTestCase {
|
||||||
public void testSingleAccountIntegrationNoRoomSetting() throws Exception {
|
public void testSingleAccountIntegrationNoRoomSetting() throws Exception {
|
||||||
String accountName = randomAsciiOfLength(10);
|
String accountName = randomAsciiOfLength(10);
|
||||||
Settings.Builder settingsBuilder = Settings.builder()
|
Settings.Builder settingsBuilder = Settings.builder()
|
||||||
.put("xpack.notification.hipchat.service.account." + accountName + ".profile",
|
.put("xpack.notification.hipchat.account." + accountName + ".profile",
|
||||||
HipChatAccount.Profile.INTEGRATION.value())
|
HipChatAccount.Profile.INTEGRATION.value())
|
||||||
.put("xpack.notification.hipchat.service.account." + accountName + ".auth_token", "_token");
|
.put("xpack.notification.hipchat.account." + accountName + ".auth_token", "_token");
|
||||||
try (InternalHipChatService service = new InternalHipChatService(settingsBuilder.build(), httpClient,
|
try (InternalHipChatService service = new InternalHipChatService(settingsBuilder.build(), httpClient,
|
||||||
new ClusterSettings(settingsBuilder.build(), Collections.singleton(InternalHipChatService.HIPCHAT_ACCOUNT_SETTING)))) {
|
new ClusterSettings(settingsBuilder.build(), Collections.singleton(InternalHipChatService.HIPCHAT_ACCOUNT_SETTING)))) {
|
||||||
service.start();
|
service.start();
|
||||||
|
@ -150,13 +150,13 @@ public class InternalHipChatServiceTests extends ESTestCase {
|
||||||
HipChatMessage.Format defaultFormat = randomBoolean() ? null : randomFrom(HipChatMessage.Format.values());
|
HipChatMessage.Format defaultFormat = randomBoolean() ? null : randomFrom(HipChatMessage.Format.values());
|
||||||
Boolean defaultNotify = randomBoolean() ? null : (Boolean) randomBoolean();
|
Boolean defaultNotify = randomBoolean() ? null : (Boolean) randomBoolean();
|
||||||
Settings.Builder settingsBuilder = Settings.builder()
|
Settings.Builder settingsBuilder = Settings.builder()
|
||||||
.put("xpack.notification.hipchat.service.account." + accountName + ".profile", HipChatAccount.Profile.USER.value())
|
.put("xpack.notification.hipchat.account." + accountName + ".profile", HipChatAccount.Profile.USER.value())
|
||||||
.put("xpack.notification.hipchat.service.account." + accountName + ".auth_token", "_token");
|
.put("xpack.notification.hipchat.account." + accountName + ".auth_token", "_token");
|
||||||
if (host != null) {
|
if (host != null) {
|
||||||
settingsBuilder.put("xpack.notification.hipchat.service.account." + accountName + ".host", host);
|
settingsBuilder.put("xpack.notification.hipchat.account." + accountName + ".host", host);
|
||||||
}
|
}
|
||||||
if (port > 0) {
|
if (port > 0) {
|
||||||
settingsBuilder.put("xpack.notification.hipchat.service.account." + accountName + ".port", port);
|
settingsBuilder.put("xpack.notification.hipchat.account." + accountName + ".port", port);
|
||||||
}
|
}
|
||||||
buildMessageDefaults(accountName, settingsBuilder, defaultRoom, defaultUser, null, defaultColor, defaultFormat, defaultNotify);
|
buildMessageDefaults(accountName, settingsBuilder, defaultRoom, defaultUser, null, defaultColor, defaultFormat, defaultNotify);
|
||||||
InternalHipChatService service = new InternalHipChatService(settingsBuilder.build(), httpClient,
|
InternalHipChatService service = new InternalHipChatService(settingsBuilder.build(), httpClient,
|
||||||
|
@ -197,17 +197,17 @@ public class InternalHipChatServiceTests extends ESTestCase {
|
||||||
Boolean defaultNotify = randomBoolean() ? null : (Boolean) randomBoolean();
|
Boolean defaultNotify = randomBoolean() ? null : (Boolean) randomBoolean();
|
||||||
Settings.Builder settingsBuilder = Settings.builder();
|
Settings.Builder settingsBuilder = Settings.builder();
|
||||||
String defaultAccount = "_a" + randomIntBetween(0, 4);
|
String defaultAccount = "_a" + randomIntBetween(0, 4);
|
||||||
settingsBuilder.put("xpack.notification.hipchat.service.default_account", defaultAccount);
|
settingsBuilder.put("xpack.notification.hipchat.default_account", defaultAccount);
|
||||||
|
|
||||||
boolean customGlobalServer = randomBoolean();
|
boolean customGlobalServer = randomBoolean();
|
||||||
if (customGlobalServer) {
|
if (customGlobalServer) {
|
||||||
settingsBuilder.put("xpack.notification.hipchat.service.host", "_host_global");
|
settingsBuilder.put("xpack.notification.hipchat.host", "_host_global");
|
||||||
settingsBuilder.put("xpack.notification.hipchat.service.port", 299);
|
settingsBuilder.put("xpack.notification.hipchat.port", 299);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
String name = "_a" + i;
|
String name = "_a" + i;
|
||||||
String prefix = "xpack.notification.hipchat.service.account." + name;
|
String prefix = "xpack.notification.hipchat.account." + name;
|
||||||
HipChatAccount.Profile profile = randomFrom(HipChatAccount.Profile.values());
|
HipChatAccount.Profile profile = randomFrom(HipChatAccount.Profile.values());
|
||||||
settingsBuilder.put(prefix + ".profile", profile);
|
settingsBuilder.put(prefix + ".profile", profile);
|
||||||
settingsBuilder.put(prefix + ".auth_token", "_token" + i);
|
settingsBuilder.put(prefix + ".auth_token", "_token" + i);
|
||||||
|
@ -256,22 +256,22 @@ public class InternalHipChatServiceTests extends ESTestCase {
|
||||||
private void buildMessageDefaults(String account, Settings.Builder settingsBuilder, String room, String user, String from,
|
private void buildMessageDefaults(String account, Settings.Builder settingsBuilder, String room, String user, String from,
|
||||||
HipChatMessage.Color color, HipChatMessage.Format format, Boolean notify) {
|
HipChatMessage.Color color, HipChatMessage.Format format, Boolean notify) {
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
settingsBuilder.put("xpack.notification.hipchat.service.account." + account + ".message_defaults.room", room);
|
settingsBuilder.put("xpack.notification.hipchat.account." + account + ".message_defaults.room", room);
|
||||||
}
|
}
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
settingsBuilder.put("xpack.notification.hipchat.service.account." + account + ".message_defaults.user", user);
|
settingsBuilder.put("xpack.notification.hipchat.account." + account + ".message_defaults.user", user);
|
||||||
}
|
}
|
||||||
if (from != null) {
|
if (from != null) {
|
||||||
settingsBuilder.put("xpack.notification.hipchat.service.account." + account + ".message_defaults.from", from);
|
settingsBuilder.put("xpack.notification.hipchat.account." + account + ".message_defaults.from", from);
|
||||||
}
|
}
|
||||||
if (color != null) {
|
if (color != null) {
|
||||||
settingsBuilder.put("xpack.notification.hipchat.service.account." + account + ".message_defaults.color", color.value());
|
settingsBuilder.put("xpack.notification.hipchat.account." + account + ".message_defaults.color", color.value());
|
||||||
}
|
}
|
||||||
if (format != null) {
|
if (format != null) {
|
||||||
settingsBuilder.put("xpack.notification.hipchat.service.account." + account + ".message_defaults.format", format);
|
settingsBuilder.put("xpack.notification.hipchat.account." + account + ".message_defaults.format", format);
|
||||||
}
|
}
|
||||||
if (notify != null) {
|
if (notify != null) {
|
||||||
settingsBuilder.put("xpack.notification.hipchat.service.account." + account + ".message_defaults.notify", notify);
|
settingsBuilder.put("xpack.notification.hipchat.account." + account + ".message_defaults.notify", notify);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,7 +183,6 @@ public class Watcher {
|
||||||
module.registerSetting(Setting.boolSetting(XPackPlugin.featureEnabledSetting(Watcher.NAME), true, Setting.Property.NodeScope));
|
module.registerSetting(Setting.boolSetting(XPackPlugin.featureEnabledSetting(Watcher.NAME), true, Setting.Property.NodeScope));
|
||||||
module.registerSetting(SecretService.Secure.ENCRYPT_SENSITIVE_DATA_SETTING);
|
module.registerSetting(SecretService.Secure.ENCRYPT_SENSITIVE_DATA_SETTING);
|
||||||
|
|
||||||
// TODO add real settings for these
|
|
||||||
module.registerSetting(Setting.simpleString("xpack.watcher.internal.ops.search.default_timeout", Setting.Property.NodeScope));
|
module.registerSetting(Setting.simpleString("xpack.watcher.internal.ops.search.default_timeout", Setting.Property.NodeScope));
|
||||||
module.registerSetting(Setting.simpleString("xpack.watcher.internal.ops.bulk.default_timeout", Setting.Property.NodeScope));
|
module.registerSetting(Setting.simpleString("xpack.watcher.internal.ops.bulk.default_timeout", Setting.Property.NodeScope));
|
||||||
module.registerSetting(Setting.simpleString("xpack.watcher.internal.ops.index.default_timeout", Setting.Property.NodeScope));
|
module.registerSetting(Setting.simpleString("xpack.watcher.internal.ops.index.default_timeout", Setting.Property.NodeScope));
|
||||||
|
@ -201,12 +200,12 @@ public class Watcher {
|
||||||
module.registerSetting(Setting.simpleString("xpack.watcher.start_immediately", Setting.Property.NodeScope));
|
module.registerSetting(Setting.simpleString("xpack.watcher.start_immediately", Setting.Property.NodeScope));
|
||||||
module.registerSetting(Setting.simpleString("xpack.watcher.http.default_connection_timeout", Setting.Property.NodeScope));
|
module.registerSetting(Setting.simpleString("xpack.watcher.http.default_connection_timeout", Setting.Property.NodeScope));
|
||||||
|
|
||||||
module.registerSettingsFilter("xpack.notification.email.service.account.*.smtp.password");
|
module.registerSettingsFilter("xpack.notification.email.account.*.smtp.password");
|
||||||
module.registerSettingsFilter("xpack.notification.slack.service.account.*.url");
|
module.registerSettingsFilter("xpack.notification.slack.account.*.url");
|
||||||
module.registerSettingsFilter("xpack.notification.pagerduty.service.account.*.url");
|
module.registerSettingsFilter("xpack.notification.pagerduty.account.*.url");
|
||||||
module.registerSettingsFilter("xpack.notification.pagerduty.service." + PagerDutyAccount.SERVICE_KEY_SETTING);
|
module.registerSettingsFilter("xpack.notification.pagerduty." + PagerDutyAccount.SERVICE_KEY_SETTING);
|
||||||
module.registerSettingsFilter("xpack.notification.pagerduty.service.account.*." + PagerDutyAccount.SERVICE_KEY_SETTING);
|
module.registerSettingsFilter("xpack.notification.pagerduty.account.*." + PagerDutyAccount.SERVICE_KEY_SETTING);
|
||||||
module.registerSettingsFilter("xpack.notification.hipchat.service.account.*.auth_token");
|
module.registerSettingsFilter("xpack.notification.hipchat.account.*.auth_token");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onModule(NetworkModule module) {
|
public void onModule(NetworkModule module) {
|
||||||
|
|
|
@ -7,10 +7,7 @@ package org.elasticsearch.watcher;
|
||||||
|
|
||||||
|
|
||||||
import org.elasticsearch.common.inject.AbstractModule;
|
import org.elasticsearch.common.inject.AbstractModule;
|
||||||
import org.elasticsearch.common.inject.multibindings.Multibinder;
|
|
||||||
import org.elasticsearch.common.inject.util.Providers;
|
import org.elasticsearch.common.inject.util.Providers;
|
||||||
import org.elasticsearch.common.settings.Setting;
|
|
||||||
import org.elasticsearch.common.settings.Settings;
|
|
||||||
import org.elasticsearch.watcher.support.WatcherIndexTemplateRegistry;
|
import org.elasticsearch.watcher.support.WatcherIndexTemplateRegistry;
|
||||||
import org.elasticsearch.watcher.support.validation.WatcherSettingsValidation;
|
import org.elasticsearch.watcher.support.validation.WatcherSettingsValidation;
|
||||||
import org.elasticsearch.xpack.XPackPlugin;
|
import org.elasticsearch.xpack.XPackPlugin;
|
||||||
|
|
|
@ -38,23 +38,23 @@ public class WatcherF {
|
||||||
settings.put("cluster.name", WatcherF.class.getSimpleName());
|
settings.put("cluster.name", WatcherF.class.getSimpleName());
|
||||||
|
|
||||||
// this is for the `test-watcher-integration` group level integration in HipChat
|
// this is for the `test-watcher-integration` group level integration in HipChat
|
||||||
settings.put("xpack.notification.hipchat.service.account.integration.profile", "integration");
|
settings.put("xpack.notification.hipchat.account.integration.profile", "integration");
|
||||||
settings.put("xpack.notification.hipchat.service.account.integration.auth_token", "huuS9v7ccuOy3ZBWWWr1vt8Lqu3sQnLUE81nrLZU");
|
settings.put("xpack.notification.hipchat.account.integration.auth_token", "huuS9v7ccuOy3ZBWWWr1vt8Lqu3sQnLUE81nrLZU");
|
||||||
settings.put("xpack.notification.hipchat.service.account.integration.room", "test-watcher");
|
settings.put("xpack.notification.hipchat.account.integration.room", "test-watcher");
|
||||||
|
|
||||||
// this is for the Watcher Test account in HipChat
|
// this is for the Watcher Test account in HipChat
|
||||||
settings.put("xpack.notification.hipchat.service.account.user.profile", "user");
|
settings.put("xpack.notification.hipchat.account.user.profile", "user");
|
||||||
settings.put("xpack.notification.hipchat.service.account.user.auth_token", "FYVx16oDH78ZW9r13wtXbcszyoyA7oX5tiMWg9X0");
|
settings.put("xpack.notification.hipchat.account.user.auth_token", "FYVx16oDH78ZW9r13wtXbcszyoyA7oX5tiMWg9X0");
|
||||||
|
|
||||||
// this is for the `test-watcher-v1` notification token (hipchat)
|
// this is for the `test-watcher-v1` notification token (hipchat)
|
||||||
settings.put("xpack.notification.hipchat.service.account.v1.profile", "v1");
|
settings.put("xpack.notification.hipchat.account.v1.profile", "v1");
|
||||||
settings.put("xpack.notification.hipchat.service.account.v1.auth_token", "a734baf62df618b96dda55b323fc30");
|
settings.put("xpack.notification.hipchat.account.v1.auth_token", "a734baf62df618b96dda55b323fc30");
|
||||||
|
|
||||||
// this is for our test slack incoming webhook (under elasticsearch team)
|
// this is for our test slack incoming webhook (under elasticsearch team)
|
||||||
System.setProperty("es.xpack.notification.slack.service.account.a1.url",
|
System.setProperty("es.xpack.notification.slack.account.a1.url",
|
||||||
"https://hooks.slack.com/services/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");
|
"https://hooks.slack.com/services/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");
|
||||||
|
|
||||||
System.setProperty("es.xpack.notification.pagerduty.service.account.service1.service_api_key",
|
System.setProperty("es.xpack.notification.pagerduty.account.service1.service_api_key",
|
||||||
"fc082467005d4072a914e0bb041882d0");
|
"fc082467005d4072a914e0bb041882d0");
|
||||||
|
|
||||||
final CountDownLatch latch = new CountDownLatch(1);
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
|
|
|
@ -93,11 +93,11 @@ public class EmailAttachmentTests extends AbstractWatcherIntegrationTestCase {
|
||||||
}
|
}
|
||||||
return Settings.builder()
|
return Settings.builder()
|
||||||
.put(super.nodeSettings(nodeOrdinal))
|
.put(super.nodeSettings(nodeOrdinal))
|
||||||
.put("xpack.notification.email.service.account.test.smtp.auth", true)
|
.put("xpack.notification.email.account.test.smtp.auth", true)
|
||||||
.put("xpack.notification.email.service.account.test.smtp.user", USERNAME)
|
.put("xpack.notification.email.account.test.smtp.user", USERNAME)
|
||||||
.put("xpack.notification.email.service.account.test.smtp.password", PASSWORD)
|
.put("xpack.notification.email.account.test.smtp.password", PASSWORD)
|
||||||
.put("xpack.notification.email.service.account.test.smtp.port", server.port())
|
.put("xpack.notification.email.account.test.smtp.port", server.port())
|
||||||
.put("xpack.notification.email.service.account.test.smtp.host", "localhost")
|
.put("xpack.notification.email.account.test.smtp.host", "localhost")
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,11 +62,11 @@ public class HistoryTemplateEmailMappingsTests extends AbstractWatcherIntegratio
|
||||||
.put(super.nodeSettings(nodeOrdinal))
|
.put(super.nodeSettings(nodeOrdinal))
|
||||||
|
|
||||||
// email
|
// email
|
||||||
.put("xpack.notification.email.service.account.test.smtp.auth", true)
|
.put("xpack.notification.email.account.test.smtp.auth", true)
|
||||||
.put("xpack.notification.email.service.account.test.smtp.user", USERNAME)
|
.put("xpack.notification.email.account.test.smtp.user", USERNAME)
|
||||||
.put("xpack.notification.email.service.account.test.smtp.password", PASSWORD)
|
.put("xpack.notification.email.account.test.smtp.password", PASSWORD)
|
||||||
.put("xpack.notification.email.service.account.test.smtp.port", server.port())
|
.put("xpack.notification.email.account.test.smtp.port", server.port())
|
||||||
.put("xpack.notification.email.service.account.test.smtp.host", "localhost")
|
.put("xpack.notification.email.account.test.smtp.host", "localhost")
|
||||||
|
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,10 +44,10 @@ public class WatcherSettingsFilterTests extends AbstractWatcherIntegrationTestCa
|
||||||
return Settings.builder()
|
return Settings.builder()
|
||||||
.put(super.nodeSettings(nodeOrdinal))
|
.put(super.nodeSettings(nodeOrdinal))
|
||||||
.put(NetworkModule.HTTP_ENABLED.getKey(), true)
|
.put(NetworkModule.HTTP_ENABLED.getKey(), true)
|
||||||
.put("xpack.notification.email.service.account._email.smtp.host", "host.domain")
|
.put("xpack.notification.email.account._email.smtp.host", "host.domain")
|
||||||
.put("xpack.notification.email.service.account._email.smtp.port", 587)
|
.put("xpack.notification.email.account._email.smtp.port", 587)
|
||||||
.put("xpack.notification.email.service.account._email.smtp.user", "_user")
|
.put("xpack.notification.email.account._email.smtp.user", "_user")
|
||||||
.put("xpack.notification.email.service.account._email.smtp.password", "_passwd")
|
.put("xpack.notification.email.account._email.smtp.password", "_passwd")
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,9 +57,9 @@ public class WatcherSettingsFilterTests extends AbstractWatcherIntegrationTestCa
|
||||||
Map<String, Object> nodes = (Map<String, Object>) response.get("nodes");
|
Map<String, Object> nodes = (Map<String, Object>) response.get("nodes");
|
||||||
for (Object node : nodes.values()) {
|
for (Object node : nodes.values()) {
|
||||||
Map<String, Object> settings = (Map<String, Object>) ((Map<String, Object>) node).get("settings");
|
Map<String, Object> settings = (Map<String, Object>) ((Map<String, Object>) node).get("settings");
|
||||||
assertThat(XContentMapValues.extractValue("xpack.notification.email.service.account._email.smtp.user", settings),
|
assertThat(XContentMapValues.extractValue("xpack.notification.email.account._email.smtp.user", settings),
|
||||||
is((Object) "_user"));
|
is((Object) "_user"));
|
||||||
assertThat(XContentMapValues.extractValue("xpack.notification.email.service.account._email.smtp.password", settings),
|
assertThat(XContentMapValues.extractValue("xpack.notification.email.account._email.smtp.password", settings),
|
||||||
nullValue());
|
nullValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue