Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed build failure due to OSCore xcontent changes #637

Merged
merged 1 commit into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.opensearch.cluster.service.ClusterService
import org.opensearch.common.io.stream.NamedWriteableRegistry
import org.opensearch.common.settings.Setting
import org.opensearch.common.settings.Settings
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.core.xcontent.NamedXContentRegistry
import org.opensearch.env.Environment
import org.opensearch.env.NodeEnvironment
import org.opensearch.notifications.core.setting.PluginSettings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package org.opensearch.notifications.core.utils
import org.apache.logging.log4j.LogManager
import org.apache.logging.log4j.Logger
import org.opensearch.common.bytes.BytesReference
import org.opensearch.common.xcontent.XContentBuilder
import org.opensearch.core.xcontent.XContentBuilder

fun <T : Any> logger(forClass: Class<T>): Lazy<Logger> {
return lazy { LogManager.getLogger(forClass) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import org.opensearch.common.settings.IndexScopedSettings
import org.opensearch.common.settings.Setting
import org.opensearch.common.settings.Settings
import org.opensearch.common.settings.SettingsFilter
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.commons.notifications.action.NotificationsActions
import org.opensearch.commons.utils.logger
import org.opensearch.core.xcontent.NamedXContentRegistry
import org.opensearch.env.Environment
import org.opensearch.env.NodeEnvironment
import org.opensearch.notifications.action.CreateNotificationConfigAction
Expand Down Expand Up @@ -164,7 +164,7 @@ class NotificationPlugin : ActionPlugin, Plugin(), NotificationCoreExtension {
NotificationConfigRestHandler(),
NotificationFeaturesRestHandler(),
NotificationChannelListRestHandler(),
SendTestMessageRestHandler(),
SendTestMessageRestHandler()
// NotificationStatsRestHandler()
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import org.opensearch.action.ActionRequest
import org.opensearch.action.support.ActionFilters
import org.opensearch.client.Client
import org.opensearch.common.inject.Inject
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.commons.authuser.User
import org.opensearch.commons.notifications.action.CreateNotificationConfigRequest
import org.opensearch.commons.notifications.action.CreateNotificationConfigResponse
import org.opensearch.commons.notifications.action.NotificationsActions
import org.opensearch.commons.utils.recreateObject
import org.opensearch.core.xcontent.NamedXContentRegistry
import org.opensearch.notifications.index.ConfigIndexingActions
import org.opensearch.tasks.Task
import org.opensearch.transport.TransportService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import org.opensearch.action.ActionRequest
import org.opensearch.action.support.ActionFilters
import org.opensearch.client.Client
import org.opensearch.common.inject.Inject
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.commons.authuser.User
import org.opensearch.commons.notifications.action.DeleteNotificationConfigRequest
import org.opensearch.commons.notifications.action.DeleteNotificationConfigResponse
import org.opensearch.commons.notifications.action.NotificationsActions
import org.opensearch.commons.utils.recreateObject
import org.opensearch.core.xcontent.NamedXContentRegistry
import org.opensearch.notifications.index.ConfigIndexingActions
import org.opensearch.tasks.Task
import org.opensearch.transport.TransportService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import org.opensearch.action.ActionRequest
import org.opensearch.action.support.ActionFilters
import org.opensearch.client.Client
import org.opensearch.common.inject.Inject
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.commons.authuser.User
import org.opensearch.commons.notifications.action.GetChannelListRequest
import org.opensearch.commons.notifications.action.GetChannelListResponse
import org.opensearch.commons.notifications.action.NotificationsActions
import org.opensearch.commons.utils.recreateObject
import org.opensearch.core.xcontent.NamedXContentRegistry
import org.opensearch.notifications.index.ConfigIndexingActions
import org.opensearch.tasks.Task
import org.opensearch.transport.TransportService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import org.opensearch.action.ActionRequest
import org.opensearch.action.support.ActionFilters
import org.opensearch.client.Client
import org.opensearch.common.inject.Inject
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.commons.authuser.User
import org.opensearch.commons.notifications.action.GetNotificationConfigRequest
import org.opensearch.commons.notifications.action.GetNotificationConfigResponse
import org.opensearch.commons.notifications.action.NotificationsActions
import org.opensearch.commons.utils.recreateObject
import org.opensearch.core.xcontent.NamedXContentRegistry
import org.opensearch.notifications.index.ConfigIndexingActions
import org.opensearch.tasks.Task
import org.opensearch.transport.TransportService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import org.opensearch.action.ActionRequest
import org.opensearch.action.support.ActionFilters
import org.opensearch.client.Client
import org.opensearch.common.inject.Inject
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.commons.authuser.User
import org.opensearch.commons.notifications.action.GetPluginFeaturesRequest
import org.opensearch.commons.notifications.action.GetPluginFeaturesResponse
import org.opensearch.commons.notifications.action.NotificationsActions
import org.opensearch.commons.utils.recreateObject
import org.opensearch.core.xcontent.NamedXContentRegistry
import org.opensearch.notifications.CoreProvider
import org.opensearch.tasks.Task
import org.opensearch.transport.TransportService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import org.opensearch.action.ActionRequest
import org.opensearch.action.support.ActionFilters
import org.opensearch.client.Client
import org.opensearch.common.inject.Inject
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.commons.authuser.User
import org.opensearch.commons.notifications.action.LegacyPublishNotificationRequest
import org.opensearch.commons.notifications.action.LegacyPublishNotificationResponse
import org.opensearch.commons.notifications.action.NotificationsActions
import org.opensearch.commons.utils.recreateObject
import org.opensearch.core.xcontent.NamedXContentRegistry
import org.opensearch.notifications.send.SendMessageActionHelper
import org.opensearch.tasks.Task
import org.opensearch.transport.TransportService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import org.opensearch.action.ActionRequest
import org.opensearch.action.support.ActionFilters
import org.opensearch.client.Client
import org.opensearch.common.inject.Inject
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.commons.authuser.User
import org.opensearch.commons.notifications.action.NotificationsActions
import org.opensearch.commons.notifications.action.SendNotificationRequest
import org.opensearch.commons.notifications.action.SendNotificationResponse
import org.opensearch.commons.utils.recreateObject
import org.opensearch.core.xcontent.NamedXContentRegistry
import org.opensearch.notifications.send.SendMessageActionHelper
import org.opensearch.tasks.Task
import org.opensearch.transport.TransportService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import org.opensearch.action.support.HandledTransportAction
import org.opensearch.client.Client
import org.opensearch.client.node.NodeClient
import org.opensearch.common.inject.Inject
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.commons.notifications.NotificationsPluginInterface
import org.opensearch.commons.notifications.action.SendNotificationResponse
import org.opensearch.commons.utils.logger
import org.opensearch.core.xcontent.NamedXContentRegistry
import org.opensearch.notifications.NotificationPlugin.Companion.LOG_PREFIX
import org.opensearch.notifications.model.SendTestNotificationRequest
import org.opensearch.notifications.send.SendTestNotificationActionHelper
Expand All @@ -29,7 +29,7 @@ internal class SendTestNotificationAction @Inject constructor(
transportService: TransportService,
val client: Client,
actionFilters: ActionFilters,
val xContentRegistry: NamedXContentRegistry,
val xContentRegistry: NamedXContentRegistry
) : HandledTransportAction<SendTestNotificationRequest, SendNotificationResponse>(
NAME,
transportService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import org.opensearch.action.ActionRequest
import org.opensearch.action.support.ActionFilters
import org.opensearch.client.Client
import org.opensearch.common.inject.Inject
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.commons.authuser.User
import org.opensearch.commons.notifications.action.NotificationsActions
import org.opensearch.commons.notifications.action.UpdateNotificationConfigRequest
import org.opensearch.commons.notifications.action.UpdateNotificationConfigResponse
import org.opensearch.commons.utils.recreateObject
import org.opensearch.core.xcontent.NamedXContentRegistry
import org.opensearch.notifications.index.ConfigIndexingActions
import org.opensearch.tasks.Task
import org.opensearch.transport.TransportService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ object ConfigQueryHelper {
private val NESTED_KEYWORD_FIELDS = setOf(
// Text fields with keyword
"${EMAIL.tag}.$RECIPIENT_LIST_TAG.$RECIPIENT_TAG.$KEYWORD_SUFFIX",
"${EMAIL_GROUP.tag}.$RECIPIENT_LIST_TAG.$RECIPIENT_TAG.$KEYWORD_SUFFIX",
"${EMAIL_GROUP.tag}.$RECIPIENT_LIST_TAG.$RECIPIENT_TAG.$KEYWORD_SUFFIX"
)
private val NESTED_TEXT_FIELDS = setOf(
"${EMAIL.tag}.$RECIPIENT_LIST_TAG.$RECIPIENT_TAG",
"${EMAIL_GROUP.tag}.$RECIPIENT_LIST_TAG.$RECIPIENT_TAG",
"${EMAIL_GROUP.tag}.$RECIPIENT_LIST_TAG.$RECIPIENT_TAG"
)

private val METADATA_FIELDS = METADATA_RANGE_FIELDS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ import org.opensearch.cluster.service.ClusterService
import org.opensearch.common.unit.TimeValue
import org.opensearch.common.util.concurrent.ThreadContext
import org.opensearch.common.xcontent.LoggingDeprecationHandler
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.common.xcontent.XContentHelper
import org.opensearch.common.xcontent.XContentType
import org.opensearch.commons.notifications.action.GetNotificationConfigRequest
import org.opensearch.commons.notifications.model.NotificationConfigInfo
import org.opensearch.commons.notifications.model.NotificationConfigSearchResult
import org.opensearch.commons.notifications.model.SearchResults
import org.opensearch.commons.utils.logger
import org.opensearch.core.xcontent.NamedXContentRegistry
import org.opensearch.index.query.BoolQueryBuilder
import org.opensearch.index.query.QueryBuilders
import org.opensearch.notifications.NotificationPlugin.Companion.LOG_PREFIX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ enum class Metrics(val metricName: String, val counter: Counter<*>) {
RollingCounter()
),
NOTIFICATIONS_EXCEPTIONS_VERSION_CONFLICT_ENGINE_EXCEPTION(
"exception.version_conflict_engine", RollingCounter()
"exception.version_conflict_engine",
RollingCounter()
),
NOTIFICATIONS_EXCEPTIONS_INDEX_NOT_FOUND_EXCEPTION(
"exception.index_not_found",
Expand Down Expand Up @@ -84,20 +85,24 @@ enum class Metrics(val metricName: String, val counter: Counter<*>) {
RollingCounter()
),
NOTIFICATIONS_CONFIG_UPDATE_USER_ERROR_INVALID_CONFIG_ID(
"notifications_config.update.user_error.invalid_config_id", RollingCounter()
"notifications_config.update.user_error.invalid_config_id",
RollingCounter()
),
NOTIFICATIONS_CONFIG_UPDATE_SYSTEM_ERROR(
"notifications_config.update.system_error",
RollingCounter()
), // Notification config general user error
NOTIFICATIONS_CONFIG_USER_ERROR_INVALID_EMAIL_ACCOUNT_ID(
"notifications_config.user_error.invalid_email_account_id", RollingCounter()
"notifications_config.user_error.invalid_email_account_id",
RollingCounter()
),
NOTIFICATIONS_CONFIG_USER_ERROR_INVALID_EMAIL_GROUP_ID(
"notifications_config.user_error.invalid_email_group_id", RollingCounter()
"notifications_config.user_error.invalid_email_group_id",
RollingCounter()
),
NOTIFICATIONS_CONFIG_USER_ERROR_NEITHER_EMAIL_NOR_GROUP(
"notifications_config.user_error.neither_email_nor_group", RollingCounter()
"notifications_config.user_error.neither_email_nor_group",
RollingCounter()
), // DELETE _plugins/_notifications/configs/{configId}, Delete a notification config
NOTIFICATIONS_CONFIG_DELETE_TOTAL(
"notifications_config.delete.total",
Expand All @@ -108,10 +113,12 @@ enum class Metrics(val metricName: String, val counter: Counter<*>) {
RollingCounter()
),
NOTIFICATIONS_CONFIG_DELETE_USER_ERROR_INVALID_CONFIG_ID(
"notifications_config.delete.user_error.invalid_config_id", RollingCounter()
"notifications_config.delete.user_error.invalid_config_id",
RollingCounter()
),
NOTIFICATIONS_CONFIG_DELETE_USER_ERROR_SET_NOT_FOUND(
"notifications_config.delete.user_error.set_not_found", RollingCounter()
"notifications_config.delete.user_error.set_not_found",
RollingCounter()
),
NOTIFICATIONS_CONFIG_DELETE_SYSTEM_ERROR(
"notifications_config.delete.system_error",
Expand All @@ -126,20 +133,25 @@ enum class Metrics(val metricName: String, val counter: Counter<*>) {
RollingCounter()
), // add specific user errors for config GET operations
NOTIFICATIONS_CONFIG_INFO_USER_ERROR_INVALID_CONFIG_ID(
"notifications_config.info.user_error.invalid_config_id", RollingCounter()
"notifications_config.info.user_error.invalid_config_id",
RollingCounter()
),
NOTIFICATIONS_CONFIG_INFO_USER_ERROR_SET_NOT_FOUND(
"notifications_config.info.user_error.set_not_found", RollingCounter()
"notifications_config.info.user_error.set_not_found",
RollingCounter()
),

// Feature Channels Endpoints
// GET _plugins/_notifications/channels
NOTIFICATIONS_CHANNELS_INFO_TOTAL(
"notifications_channels.info.total",
BasicCounter()
),
NOTIFICATIONS_CHANNELS_INFO_INTERVAL_COUNT(
"notifications_channels.info.count", RollingCounter()
"notifications_channels.info.count",
RollingCounter()
),

// Features Endpoints
// GET _plugins/_notifications/features
NOTIFICATIONS_FEATURES_INFO_TOTAL(
Expand All @@ -150,6 +162,7 @@ enum class Metrics(val metricName: String, val counter: Counter<*>) {
"notifications_features.info.count",
RollingCounter()
),

// Send Message Endpoints
// POST _plugins/_notifications/send
NOTIFICATIONS_SEND_MESSAGE_TOTAL(
Expand All @@ -161,7 +174,8 @@ enum class Metrics(val metricName: String, val counter: Counter<*>) {
RollingCounter()
), // user errors for send message?
NOTIFICATIONS_SEND_MESSAGE_USER_ERROR_NOT_FOUND(
"notifications.send_message.user_error.not_found", RollingCounter()
"notifications.send_message.user_error.not_found",
RollingCounter()
),
NOTIFICATIONS_MESSAGE_DESTINATION_SLACK(
"notifications.message_destination.slack",
Expand All @@ -180,26 +194,31 @@ enum class Metrics(val metricName: String, val counter: Counter<*>) {
BasicCounter()
),
NOTIFICATIONS_MESSAGE_DESTINATION_SES_ACCOUNT(
"notifications.message_destination.ses_account", BasicCounter()
"notifications.message_destination.ses_account",
BasicCounter()
),
NOTIFICATIONS_MESSAGE_DESTINATION_SMTP_ACCOUNT(
"notifications.message_destination.smtp_account", BasicCounter()
"notifications.message_destination.smtp_account",
BasicCounter()
),
NOTIFICATIONS_MESSAGE_DESTINATION_EMAIL_GROUP(
"notifications.message_destination.email_group", BasicCounter()
"notifications.message_destination.email_group",
BasicCounter()
), // TODO: add after implementation added
NOTIFICATIONS_MESSAGE_DESTINATION_SNS(
"notifications.message_destination.sns",
BasicCounter()
),

// Send Test Message Endpoints
// GET _plugins/_notifications/feature/test/{configId}
NOTIFICATIONS_SEND_TEST_MESSAGE_TOTAL(
"notifications.send_test_message.total",
BasicCounter()
),
NOTIFICATIONS_SEND_TEST_MESSAGE_INTERVAL_COUNT(
"notifications.send_test_message.interval_count", RollingCounter()
"notifications.send_test_message.interval_count",
RollingCounter()
), // Send test message exceptions are thrown by the Send Message Action
NOTIFICATIONS_SECURITY_USER_ERROR(
"security_user_error",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

package org.opensearch.notifications.model

import org.opensearch.common.xcontent.ToXContent
import org.opensearch.common.xcontent.XContentBuilder
import org.opensearch.common.xcontent.XContentParser
import org.opensearch.common.xcontent.XContentParserUtils
import org.opensearch.commons.notifications.NotificationConstants.CREATED_TIME_TAG
import org.opensearch.commons.notifications.NotificationConstants.UPDATED_TIME_TAG
import org.opensearch.commons.utils.logger
import org.opensearch.commons.utils.stringList
import org.opensearch.core.xcontent.ToXContent
import org.opensearch.core.xcontent.XContentBuilder
import org.opensearch.core.xcontent.XContentParser
import java.time.Instant

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
*/
package org.opensearch.notifications.model

import org.opensearch.common.xcontent.ToXContent
import org.opensearch.common.xcontent.XContentBuilder
import org.opensearch.common.xcontent.XContentFactory
import org.opensearch.common.xcontent.XContentParser
import org.opensearch.common.xcontent.XContentParserUtils
import org.opensearch.commons.notifications.NotificationConstants.CONFIG_TAG
import org.opensearch.commons.notifications.model.NotificationConfig
import org.opensearch.commons.utils.logger
import org.opensearch.core.xcontent.ToXContent
import org.opensearch.core.xcontent.XContentBuilder
import org.opensearch.core.xcontent.XContentParser
import org.opensearch.notifications.model.DocMetadata.Companion.METADATA_TAG
import java.io.IOException

Expand Down
Loading