From 9defda7d96431153b5419886a08ae9f52cee3e2c Mon Sep 17 00:00:00 2001 From: AWSHurneyt Date: Mon, 3 Apr 2023 17:15:41 -0700 Subject: [PATCH 1/3] Bumped version to 2.7. Signed-off-by: AWSHurneyt --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 5f0b43a40..3c368566c 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ import org.opensearch.gradle.test.RestIntegTestTask buildscript { ext { - opensearch_version = System.getProperty("opensearch.version", "2.6.0-SNAPSHOT") + opensearch_version = System.getProperty("opensearch.version", "2.7.0-SNAPSHOT") isSnapshot = "true" == System.getProperty("build.snapshot", "true") buildVersionQualifier = System.getProperty("build.version_qualifier", "") version_tokens = opensearch_version.tokenize('-') From f6c3ef2a6266fc2152036a75e0703b6bbf1ccbfb Mon Sep 17 00:00:00 2001 From: Stevan Buzejic Date: Wed, 5 Apr 2023 23:42:41 +0200 Subject: [PATCH 2/3] Bumped version to 2.7. Changed package from common to core Signed-off-by: Stevan Buzejic --- .../securityanalytics/SecurityAnalyticsPlugin.java | 2 +- .../securityanalytics/action/AckAlertsRequest.java | 4 ++-- .../securityanalytics/action/AckAlertsResponse.java | 4 ++-- .../securityanalytics/action/AlertDto.java | 4 ++-- .../action/CreateIndexMappingsRequest.java | 6 +++--- .../action/DeleteDetectorResponse.java | 4 ++-- .../action/DeleteRuleResponse.java | 4 ++-- .../securityanalytics/action/FindingDto.java | 6 +++--- .../securityanalytics/action/GetAlertsResponse.java | 4 ++-- .../action/GetAllRuleCategoriesResponse.java | 4 ++-- .../action/GetDetectorRequest.java | 2 +- .../action/GetDetectorResponse.java | 4 ++-- .../action/GetFindingsResponse.java | 4 ++-- .../action/GetIndexMappingsRequest.java | 2 +- .../action/GetIndexMappingsResponse.java | 8 ++++---- .../action/GetMappingsViewRequest.java | 2 +- .../action/GetMappingsViewResponse.java | 6 +++--- .../action/IndexDetectorResponse.java | 4 ++-- .../securityanalytics/action/IndexRuleResponse.java | 4 ++-- .../action/UpdateIndexMappingsRequest.java | 6 +++--- .../action/ValidateRulesRequest.java | 6 +++--- .../action/ValidateRulesResponse.java | 6 +++--- .../mapper/IndexTemplateManager.java | 2 +- .../mapper/IndexTemplateUtils.java | 3 +-- .../securityanalytics/mapper/MappingsTraverser.java | 6 +++--- .../securityanalytics/model/Detector.java | 13 ++++++------- .../securityanalytics/model/DetectorInput.java | 10 +++++----- .../securityanalytics/model/DetectorRule.java | 6 +++--- .../securityanalytics/model/DetectorTrigger.java | 11 ++++++----- .../opensearch/securityanalytics/model/Rule.java | 12 ++++++------ .../securityanalytics/model/RuleCategory.java | 4 ++-- .../opensearch/securityanalytics/model/Value.java | 6 +++--- .../resthandler/RestAcknowledgeAlertsAction.java | 2 +- .../resthandler/RestCreateIndexMappingsAction.java | 2 +- .../resthandler/RestGetDetectorAction.java | 2 +- .../resthandler/RestGetIndexMappingsAction.java | 2 +- .../resthandler/RestGetMappingsViewAction.java | 2 +- .../resthandler/RestIndexDetectorAction.java | 4 ++-- .../resthandler/RestIndexRuleAction.java | 2 +- .../resthandler/RestSearchDetectorAction.java | 6 +++--- .../resthandler/RestSearchRuleAction.java | 6 +++--- .../resthandler/RestUpdateIndexMappingsAction.java | 2 +- .../resthandler/RestValidateRulesAction.java | 4 ++-- .../rules/backend/OSQueryBackend.java | 8 ++++---- .../transport/TransportAcknowledgeAlertsAction.java | 2 +- .../transport/TransportDeleteDetectorAction.java | 4 ++-- .../transport/TransportDeleteRuleAction.java | 4 ++-- .../transport/TransportGetAlertsAction.java | 2 +- .../transport/TransportGetDetectorAction.java | 6 ++---- .../transport/TransportGetFindingsAction.java | 2 +- .../transport/TransportIndexDetectorAction.java | 6 +++--- .../transport/TransportIndexRuleAction.java | 6 +++--- .../transport/TransportSearchDetectorAction.java | 2 +- .../transport/TransportValidateRulesAction.java | 2 +- .../securityanalytics/util/DetectorUtils.java | 4 ++-- .../securityanalytics/util/IndexUtils.java | 4 ++-- .../securityanalytics/util/RuleIndices.java | 2 +- .../securityanalytics/util/RuleValidator.java | 4 ++-- .../util/SecurityAnalyticsException.java | 2 +- .../securityanalytics/util/XContentUtils.java | 2 +- .../SecurityAnalyticsClientUtils.java | 6 +++--- .../SecurityAnalyticsRestTestCase.java | 12 ++++++------ .../opensearch/securityanalytics/TestHelpers.java | 8 ++++---- .../action/CreateIndexMappingsRequestTests.java | 2 +- .../action/GetIndexMappingsRequestTests.java | 2 +- .../action/UpdateIndexMappingsRequestTests.java | 2 +- .../action/ValidateRulesRequestTests.java | 2 +- .../action/ValidateRulesResponseTests.java | 4 ++-- .../securityanalytics/mapper/MapperRestApiIT.java | 6 +++--- .../mapping/CreateIndexMappingsRequestTests.java | 2 +- .../mapping/GetIndexMappingsRequestTests.java | 2 +- .../mapping/UpdateIndexMappingsRequestTests.java | 2 +- .../securityanalytics/model/DetectorInputTests.java | 4 ++-- .../resthandler/RuleRestApiIT.java | 6 +++--- 74 files changed, 161 insertions(+), 164 deletions(-) diff --git a/src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java b/src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java index ce2ea6220..18c723a79 100644 --- a/src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java +++ b/src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java @@ -21,7 +21,7 @@ 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.core.xcontent.NamedXContentRegistry; import org.opensearch.env.Environment; import org.opensearch.env.NodeEnvironment; import org.opensearch.plugins.ActionPlugin; diff --git a/src/main/java/org/opensearch/securityanalytics/action/AckAlertsRequest.java b/src/main/java/org/opensearch/securityanalytics/action/AckAlertsRequest.java index 13fb962d7..09e0dfc61 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/AckAlertsRequest.java +++ b/src/main/java/org/opensearch/securityanalytics/action/AckAlertsRequest.java @@ -9,8 +9,8 @@ import org.opensearch.action.ValidateActions; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.common.xcontent.ToXContent; -import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.ToXContent; +import org.opensearch.core.xcontent.XContentBuilder; import java.io.IOException; import java.util.Collections; diff --git a/src/main/java/org/opensearch/securityanalytics/action/AckAlertsResponse.java b/src/main/java/org/opensearch/securityanalytics/action/AckAlertsResponse.java index 834f7897c..d83bec12c 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/AckAlertsResponse.java +++ b/src/main/java/org/opensearch/securityanalytics/action/AckAlertsResponse.java @@ -7,8 +7,8 @@ import org.opensearch.action.ActionResponse; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; import java.io.IOException; import java.util.Collections; diff --git a/src/main/java/org/opensearch/securityanalytics/action/AlertDto.java b/src/main/java/org/opensearch/securityanalytics/action/AlertDto.java index 1adf8e657..f2b46cdb7 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/AlertDto.java +++ b/src/main/java/org/opensearch/securityanalytics/action/AlertDto.java @@ -11,12 +11,12 @@ import org.opensearch.common.io.stream.StreamOutput; import org.opensearch.common.io.stream.Writeable; import org.opensearch.common.lucene.uid.Versions; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.commons.alerting.alerts.AlertError; import org.opensearch.commons.alerting.model.ActionExecutionResult; import org.opensearch.commons.alerting.model.AggregationResultBucket; import org.opensearch.commons.alerting.model.Alert; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; public class AlertDto implements ToXContentObject, Writeable { diff --git a/src/main/java/org/opensearch/securityanalytics/action/CreateIndexMappingsRequest.java b/src/main/java/org/opensearch/securityanalytics/action/CreateIndexMappingsRequest.java index e7e69e9dd..a0a9ffefc 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/CreateIndexMappingsRequest.java +++ b/src/main/java/org/opensearch/securityanalytics/action/CreateIndexMappingsRequest.java @@ -11,11 +11,11 @@ import org.opensearch.common.Strings; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.common.xcontent.ToXContentObject; -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.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.XContentParser; import java.io.IOException; import java.util.HashMap; diff --git a/src/main/java/org/opensearch/securityanalytics/action/DeleteDetectorResponse.java b/src/main/java/org/opensearch/securityanalytics/action/DeleteDetectorResponse.java index bab600d64..4981cbc47 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/DeleteDetectorResponse.java +++ b/src/main/java/org/opensearch/securityanalytics/action/DeleteDetectorResponse.java @@ -7,8 +7,8 @@ import org.opensearch.action.ActionResponse; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.rest.RestStatus; import java.io.IOException; diff --git a/src/main/java/org/opensearch/securityanalytics/action/DeleteRuleResponse.java b/src/main/java/org/opensearch/securityanalytics/action/DeleteRuleResponse.java index 2169b2346..ffeb6bf4f 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/DeleteRuleResponse.java +++ b/src/main/java/org/opensearch/securityanalytics/action/DeleteRuleResponse.java @@ -7,8 +7,8 @@ import org.opensearch.action.ActionResponse; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.rest.RestStatus; import java.io.IOException; diff --git a/src/main/java/org/opensearch/securityanalytics/action/FindingDto.java b/src/main/java/org/opensearch/securityanalytics/action/FindingDto.java index 6916b318e..f94a08c81 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/FindingDto.java +++ b/src/main/java/org/opensearch/securityanalytics/action/FindingDto.java @@ -10,12 +10,12 @@ import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; import org.opensearch.common.io.stream.Writeable; -import org.opensearch.common.xcontent.ToXContent; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.commons.alerting.model.DocLevelQuery; import org.opensearch.commons.alerting.model.FindingDocument; import org.opensearch.commons.alerting.model.FindingWithDocs; +import org.opensearch.core.xcontent.ToXContent; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; public class FindingDto implements ToXContentObject, Writeable { diff --git a/src/main/java/org/opensearch/securityanalytics/action/GetAlertsResponse.java b/src/main/java/org/opensearch/securityanalytics/action/GetAlertsResponse.java index 78bf88064..7b0f6e01b 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/GetAlertsResponse.java +++ b/src/main/java/org/opensearch/securityanalytics/action/GetAlertsResponse.java @@ -11,10 +11,10 @@ import org.opensearch.action.ActionResponse; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.commons.alerting.model.Alert; import org.opensearch.commons.alerting.model.FindingWithDocs; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.rest.RestStatus; import org.opensearch.securityanalytics.model.Detector; diff --git a/src/main/java/org/opensearch/securityanalytics/action/GetAllRuleCategoriesResponse.java b/src/main/java/org/opensearch/securityanalytics/action/GetAllRuleCategoriesResponse.java index b06144554..c182fac48 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/GetAllRuleCategoriesResponse.java +++ b/src/main/java/org/opensearch/securityanalytics/action/GetAllRuleCategoriesResponse.java @@ -9,8 +9,8 @@ import org.opensearch.action.ActionResponse; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.securityanalytics.model.RuleCategory; public class GetAllRuleCategoriesResponse extends ActionResponse implements ToXContentObject { diff --git a/src/main/java/org/opensearch/securityanalytics/action/GetDetectorRequest.java b/src/main/java/org/opensearch/securityanalytics/action/GetDetectorRequest.java index ee5a10b66..15743690a 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/GetDetectorRequest.java +++ b/src/main/java/org/opensearch/securityanalytics/action/GetDetectorRequest.java @@ -8,8 +8,8 @@ import org.opensearch.action.ActionRequestValidationException; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParserUtils; +import org.opensearch.core.xcontent.XContentParser; import java.io.IOException; import java.util.Locale; diff --git a/src/main/java/org/opensearch/securityanalytics/action/GetDetectorResponse.java b/src/main/java/org/opensearch/securityanalytics/action/GetDetectorResponse.java index 6e166d5e5..318429bb6 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/GetDetectorResponse.java +++ b/src/main/java/org/opensearch/securityanalytics/action/GetDetectorResponse.java @@ -7,8 +7,8 @@ import org.opensearch.action.ActionResponse; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.rest.RestStatus; import org.opensearch.securityanalytics.model.Detector; diff --git a/src/main/java/org/opensearch/securityanalytics/action/GetFindingsResponse.java b/src/main/java/org/opensearch/securityanalytics/action/GetFindingsResponse.java index 82177b99e..3bc483b91 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/GetFindingsResponse.java +++ b/src/main/java/org/opensearch/securityanalytics/action/GetFindingsResponse.java @@ -11,9 +11,9 @@ import org.opensearch.action.ActionResponse; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.commons.alerting.model.FindingWithDocs; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.rest.RestStatus; import org.opensearch.securityanalytics.model.Detector; diff --git a/src/main/java/org/opensearch/securityanalytics/action/GetIndexMappingsRequest.java b/src/main/java/org/opensearch/securityanalytics/action/GetIndexMappingsRequest.java index 46c784e9a..089920350 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/GetIndexMappingsRequest.java +++ b/src/main/java/org/opensearch/securityanalytics/action/GetIndexMappingsRequest.java @@ -8,8 +8,8 @@ import org.opensearch.action.ActionRequestValidationException; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParserUtils; +import org.opensearch.core.xcontent.XContentParser; import java.io.IOException; import java.util.Locale; diff --git a/src/main/java/org/opensearch/securityanalytics/action/GetIndexMappingsResponse.java b/src/main/java/org/opensearch/securityanalytics/action/GetIndexMappingsResponse.java index f4dc1dab0..5ead9f1d4 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/GetIndexMappingsResponse.java +++ b/src/main/java/org/opensearch/securityanalytics/action/GetIndexMappingsResponse.java @@ -10,15 +10,15 @@ import org.opensearch.Version; import org.opensearch.action.ActionResponse; import org.opensearch.cluster.metadata.MappingMetadata; -import org.opensearch.common.ParseField; import org.opensearch.common.Strings; import org.opensearch.common.collect.ImmutableOpenMap; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.common.xcontent.ToXContent; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentFactory; +import org.opensearch.core.ParseField; +import org.opensearch.core.xcontent.ToXContent; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.index.mapper.MapperService; import java.io.IOException; diff --git a/src/main/java/org/opensearch/securityanalytics/action/GetMappingsViewRequest.java b/src/main/java/org/opensearch/securityanalytics/action/GetMappingsViewRequest.java index e5f83a779..f784f8501 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/GetMappingsViewRequest.java +++ b/src/main/java/org/opensearch/securityanalytics/action/GetMappingsViewRequest.java @@ -11,8 +11,8 @@ import org.opensearch.common.collect.ImmutableOpenMap; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParserUtils; +import org.opensearch.core.xcontent.XContentParser; import static org.opensearch.action.ValidateActions.addValidationError; diff --git a/src/main/java/org/opensearch/securityanalytics/action/GetMappingsViewResponse.java b/src/main/java/org/opensearch/securityanalytics/action/GetMappingsViewResponse.java index 01c178ea7..4af7cfb10 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/GetMappingsViewResponse.java +++ b/src/main/java/org/opensearch/securityanalytics/action/GetMappingsViewResponse.java @@ -10,11 +10,11 @@ import org.opensearch.common.Strings; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.common.xcontent.ToXContent; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentFactory; import org.opensearch.securityanalytics.mapper.MapperUtils; +import org.opensearch.core.xcontent.ToXContent; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; import java.io.IOException; import java.util.ArrayList; diff --git a/src/main/java/org/opensearch/securityanalytics/action/IndexDetectorResponse.java b/src/main/java/org/opensearch/securityanalytics/action/IndexDetectorResponse.java index 78b0fb91f..6e5a128c7 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/IndexDetectorResponse.java +++ b/src/main/java/org/opensearch/securityanalytics/action/IndexDetectorResponse.java @@ -7,8 +7,8 @@ import org.opensearch.action.ActionResponse; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.rest.RestStatus; import org.opensearch.securityanalytics.model.Detector; diff --git a/src/main/java/org/opensearch/securityanalytics/action/IndexRuleResponse.java b/src/main/java/org/opensearch/securityanalytics/action/IndexRuleResponse.java index b4308a200..02e612ac7 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/IndexRuleResponse.java +++ b/src/main/java/org/opensearch/securityanalytics/action/IndexRuleResponse.java @@ -7,8 +7,8 @@ import org.opensearch.action.ActionResponse; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.rest.RestStatus; import org.opensearch.securityanalytics.model.Detector; import org.opensearch.securityanalytics.model.Rule; diff --git a/src/main/java/org/opensearch/securityanalytics/action/UpdateIndexMappingsRequest.java b/src/main/java/org/opensearch/securityanalytics/action/UpdateIndexMappingsRequest.java index 36dc66f53..e9bef0c4d 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/UpdateIndexMappingsRequest.java +++ b/src/main/java/org/opensearch/securityanalytics/action/UpdateIndexMappingsRequest.java @@ -8,10 +8,10 @@ import org.opensearch.action.ActionRequestValidationException; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParserUtils; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.XContentParser; import java.io.IOException; import java.util.Locale; diff --git a/src/main/java/org/opensearch/securityanalytics/action/ValidateRulesRequest.java b/src/main/java/org/opensearch/securityanalytics/action/ValidateRulesRequest.java index 6dc37faf4..926c0a4e0 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/ValidateRulesRequest.java +++ b/src/main/java/org/opensearch/securityanalytics/action/ValidateRulesRequest.java @@ -17,10 +17,10 @@ import org.opensearch.common.Strings; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentFactory; -import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParserUtils; diff --git a/src/main/java/org/opensearch/securityanalytics/action/ValidateRulesResponse.java b/src/main/java/org/opensearch/securityanalytics/action/ValidateRulesResponse.java index 3bb04aae2..b68878400 100644 --- a/src/main/java/org/opensearch/securityanalytics/action/ValidateRulesResponse.java +++ b/src/main/java/org/opensearch/securityanalytics/action/ValidateRulesResponse.java @@ -10,10 +10,10 @@ import org.opensearch.common.Strings; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.common.xcontent.ToXContent; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentFactory; +import org.opensearch.core.xcontent.ToXContent; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; import java.io.IOException; import java.util.ArrayList; diff --git a/src/main/java/org/opensearch/securityanalytics/mapper/IndexTemplateManager.java b/src/main/java/org/opensearch/securityanalytics/mapper/IndexTemplateManager.java index b7a085dea..ecc684005 100644 --- a/src/main/java/org/opensearch/securityanalytics/mapper/IndexTemplateManager.java +++ b/src/main/java/org/opensearch/securityanalytics/mapper/IndexTemplateManager.java @@ -35,7 +35,7 @@ import org.opensearch.cluster.service.ClusterService; import org.opensearch.common.compress.CompressedXContent; import org.opensearch.common.regex.Regex; -import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.NamedXContentRegistry; import org.opensearch.securityanalytics.model.CreateMappingResult; import org.opensearch.securityanalytics.util.DetectorUtils; import org.opensearch.securityanalytics.util.IndexUtils; diff --git a/src/main/java/org/opensearch/securityanalytics/mapper/IndexTemplateUtils.java b/src/main/java/org/opensearch/securityanalytics/mapper/IndexTemplateUtils.java index 462c16a34..26074dee3 100644 --- a/src/main/java/org/opensearch/securityanalytics/mapper/IndexTemplateUtils.java +++ b/src/main/java/org/opensearch/securityanalytics/mapper/IndexTemplateUtils.java @@ -15,11 +15,10 @@ import org.opensearch.cluster.metadata.Template; import org.opensearch.common.bytes.BytesReference; import org.opensearch.common.compress.CompressedXContent; -import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentFactory; import org.opensearch.common.xcontent.XContentHelper; import org.opensearch.common.xcontent.XContentType; - +import org.opensearch.core.xcontent.XContentBuilder; import static org.opensearch.index.mapper.MapperService.SINGLE_MAPPING_NAME; import static org.opensearch.securityanalytics.mapper.IndexTemplateManager.OPENSEARCH_SAP_COMPONENT_TEMPLATE_PREFIX; diff --git a/src/main/java/org/opensearch/securityanalytics/mapper/MappingsTraverser.java b/src/main/java/org/opensearch/securityanalytics/mapper/MappingsTraverser.java index 16335894b..fbddaa31c 100644 --- a/src/main/java/org/opensearch/securityanalytics/mapper/MappingsTraverser.java +++ b/src/main/java/org/opensearch/securityanalytics/mapper/MappingsTraverser.java @@ -10,10 +10,10 @@ import java.util.ListIterator; import org.apache.commons.lang3.tuple.Pair; import org.opensearch.cluster.metadata.MappingMetadata; -import org.opensearch.common.xcontent.DeprecationHandler; -import org.opensearch.common.xcontent.NamedXContentRegistry; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.json.JsonXContent; +import org.opensearch.core.xcontent.DeprecationHandler; +import org.opensearch.core.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.index.mapper.MapperService; import org.opensearch.securityanalytics.rules.condition.ConditionListener; diff --git a/src/main/java/org/opensearch/securityanalytics/model/Detector.java b/src/main/java/org/opensearch/securityanalytics/model/Detector.java index c1c28a7da..7fd5fd1eb 100644 --- a/src/main/java/org/opensearch/securityanalytics/model/Detector.java +++ b/src/main/java/org/opensearch/securityanalytics/model/Detector.java @@ -8,20 +8,19 @@ import java.util.Map; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.opensearch.common.ParseField; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; import org.opensearch.common.io.stream.Writeable; -import org.opensearch.common.xcontent.NamedXContentRegistry; -import org.opensearch.common.xcontent.ToXContent; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParserUtils; import org.opensearch.commons.alerting.model.CronSchedule; import org.opensearch.commons.alerting.model.Schedule; import org.opensearch.commons.authuser.User; - +import org.opensearch.core.ParseField; +import org.opensearch.core.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.ToXContent; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.XContentParser; import java.io.IOException; import java.time.Instant; import java.util.ArrayList; diff --git a/src/main/java/org/opensearch/securityanalytics/model/DetectorInput.java b/src/main/java/org/opensearch/securityanalytics/model/DetectorInput.java index 0f7b7ef10..da7d65cb2 100644 --- a/src/main/java/org/opensearch/securityanalytics/model/DetectorInput.java +++ b/src/main/java/org/opensearch/securityanalytics/model/DetectorInput.java @@ -4,15 +4,15 @@ */ package org.opensearch.securityanalytics.model; -import org.opensearch.common.ParseField; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; import org.opensearch.common.io.stream.Writeable; -import org.opensearch.common.xcontent.NamedXContentRegistry; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParserUtils; +import org.opensearch.core.ParseField; +import org.opensearch.core.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.XContentParser; import java.io.IOException; import java.util.ArrayList; diff --git a/src/main/java/org/opensearch/securityanalytics/model/DetectorRule.java b/src/main/java/org/opensearch/securityanalytics/model/DetectorRule.java index 5a1b2ed7a..c002687d9 100644 --- a/src/main/java/org/opensearch/securityanalytics/model/DetectorRule.java +++ b/src/main/java/org/opensearch/securityanalytics/model/DetectorRule.java @@ -7,10 +7,10 @@ import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; import org.opensearch.common.io.stream.Writeable; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParserUtils; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.XContentParser; import java.io.IOException; import java.util.ArrayList; diff --git a/src/main/java/org/opensearch/securityanalytics/model/DetectorTrigger.java b/src/main/java/org/opensearch/securityanalytics/model/DetectorTrigger.java index 33e381558..3291c07ae 100644 --- a/src/main/java/org/opensearch/securityanalytics/model/DetectorTrigger.java +++ b/src/main/java/org/opensearch/securityanalytics/model/DetectorTrigger.java @@ -6,17 +6,18 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.opensearch.common.ParseField; + import org.opensearch.common.UUIDs; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; import org.opensearch.common.io.stream.Writeable; -import org.opensearch.common.xcontent.NamedXContentRegistry; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParserUtils; import org.opensearch.commons.alerting.model.action.Action; +import org.opensearch.core.ParseField; +import org.opensearch.core.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.script.Script; import org.opensearch.script.ScriptType; diff --git a/src/main/java/org/opensearch/securityanalytics/model/Rule.java b/src/main/java/org/opensearch/securityanalytics/model/Rule.java index e54c2ccce..810492229 100644 --- a/src/main/java/org/opensearch/securityanalytics/model/Rule.java +++ b/src/main/java/org/opensearch/securityanalytics/model/Rule.java @@ -7,16 +7,16 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.opensearch.common.ParseField; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; import org.opensearch.common.io.stream.Writeable; -import org.opensearch.common.xcontent.NamedXContentRegistry; -import org.opensearch.common.xcontent.ToXContent; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParserUtils; +import org.opensearch.core.ParseField; +import org.opensearch.core.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.ToXContent; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.securityanalytics.rules.aggregation.AggregationItem; import org.opensearch.securityanalytics.rules.backend.OSQueryBackend.AggregationQueries; import org.opensearch.securityanalytics.rules.condition.ConditionItem; diff --git a/src/main/java/org/opensearch/securityanalytics/model/RuleCategory.java b/src/main/java/org/opensearch/securityanalytics/model/RuleCategory.java index 2a1bd2ec4..d189465b7 100644 --- a/src/main/java/org/opensearch/securityanalytics/model/RuleCategory.java +++ b/src/main/java/org/opensearch/securityanalytics/model/RuleCategory.java @@ -18,10 +18,10 @@ import org.opensearch.common.io.stream.StreamOutput; import org.opensearch.common.io.stream.Writeable; import org.opensearch.common.settings.SettingsException; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentHelper; import org.opensearch.common.xcontent.json.JsonXContent; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; public class RuleCategory implements Writeable, ToXContentObject { diff --git a/src/main/java/org/opensearch/securityanalytics/model/Value.java b/src/main/java/org/opensearch/securityanalytics/model/Value.java index d55e702b6..89298ae71 100644 --- a/src/main/java/org/opensearch/securityanalytics/model/Value.java +++ b/src/main/java/org/opensearch/securityanalytics/model/Value.java @@ -9,10 +9,10 @@ import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; import org.opensearch.common.io.stream.Writeable; -import org.opensearch.common.xcontent.ToXContentObject; -import org.opensearch.common.xcontent.XContentBuilder; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParserUtils; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.XContentParser; import java.io.IOException; diff --git a/src/main/java/org/opensearch/securityanalytics/resthandler/RestAcknowledgeAlertsAction.java b/src/main/java/org/opensearch/securityanalytics/resthandler/RestAcknowledgeAlertsAction.java index df20ac15b..f02479c48 100644 --- a/src/main/java/org/opensearch/securityanalytics/resthandler/RestAcknowledgeAlertsAction.java +++ b/src/main/java/org/opensearch/securityanalytics/resthandler/RestAcknowledgeAlertsAction.java @@ -5,7 +5,7 @@ package org.opensearch.securityanalytics.resthandler; import org.opensearch.client.node.NodeClient; -import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.RestRequest; import org.opensearch.rest.action.RestToXContentListener; diff --git a/src/main/java/org/opensearch/securityanalytics/resthandler/RestCreateIndexMappingsAction.java b/src/main/java/org/opensearch/securityanalytics/resthandler/RestCreateIndexMappingsAction.java index f5f500dce..b0871c835 100644 --- a/src/main/java/org/opensearch/securityanalytics/resthandler/RestCreateIndexMappingsAction.java +++ b/src/main/java/org/opensearch/securityanalytics/resthandler/RestCreateIndexMappingsAction.java @@ -5,8 +5,8 @@ package org.opensearch.securityanalytics.resthandler; import org.opensearch.client.node.NodeClient; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParserUtils; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.RestRequest; import org.opensearch.rest.action.RestToXContentListener; diff --git a/src/main/java/org/opensearch/securityanalytics/resthandler/RestGetDetectorAction.java b/src/main/java/org/opensearch/securityanalytics/resthandler/RestGetDetectorAction.java index 317843d64..b23cb93fa 100644 --- a/src/main/java/org/opensearch/securityanalytics/resthandler/RestGetDetectorAction.java +++ b/src/main/java/org/opensearch/securityanalytics/resthandler/RestGetDetectorAction.java @@ -8,7 +8,7 @@ import org.apache.logging.log4j.Logger; import org.opensearch.client.node.NodeClient; -import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.RestRequest; import org.opensearch.rest.RestResponse; diff --git a/src/main/java/org/opensearch/securityanalytics/resthandler/RestGetIndexMappingsAction.java b/src/main/java/org/opensearch/securityanalytics/resthandler/RestGetIndexMappingsAction.java index e9d73402b..5f6e6c681 100644 --- a/src/main/java/org/opensearch/securityanalytics/resthandler/RestGetIndexMappingsAction.java +++ b/src/main/java/org/opensearch/securityanalytics/resthandler/RestGetIndexMappingsAction.java @@ -5,7 +5,7 @@ package org.opensearch.securityanalytics.resthandler; import org.opensearch.client.node.NodeClient; -import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.RestRequest; import org.opensearch.rest.action.RestToXContentListener; diff --git a/src/main/java/org/opensearch/securityanalytics/resthandler/RestGetMappingsViewAction.java b/src/main/java/org/opensearch/securityanalytics/resthandler/RestGetMappingsViewAction.java index 38c30f48c..486ca0fc1 100644 --- a/src/main/java/org/opensearch/securityanalytics/resthandler/RestGetMappingsViewAction.java +++ b/src/main/java/org/opensearch/securityanalytics/resthandler/RestGetMappingsViewAction.java @@ -7,7 +7,7 @@ import java.io.IOException; import java.util.List; import org.opensearch.client.node.NodeClient; -import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.RestRequest; import org.opensearch.rest.action.RestToXContentListener; diff --git a/src/main/java/org/opensearch/securityanalytics/resthandler/RestIndexDetectorAction.java b/src/main/java/org/opensearch/securityanalytics/resthandler/RestIndexDetectorAction.java index 26a87448c..62a59980e 100644 --- a/src/main/java/org/opensearch/securityanalytics/resthandler/RestIndexDetectorAction.java +++ b/src/main/java/org/opensearch/securityanalytics/resthandler/RestIndexDetectorAction.java @@ -8,9 +8,9 @@ import org.apache.logging.log4j.Logger; import org.opensearch.action.support.WriteRequest; import org.opensearch.client.node.NodeClient; -import org.opensearch.common.xcontent.ToXContent; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParserUtils; +import org.opensearch.core.xcontent.ToXContent; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.BytesRestResponse; import org.opensearch.rest.RestChannel; diff --git a/src/main/java/org/opensearch/securityanalytics/resthandler/RestIndexRuleAction.java b/src/main/java/org/opensearch/securityanalytics/resthandler/RestIndexRuleAction.java index a6d064538..65484ec19 100644 --- a/src/main/java/org/opensearch/securityanalytics/resthandler/RestIndexRuleAction.java +++ b/src/main/java/org/opensearch/securityanalytics/resthandler/RestIndexRuleAction.java @@ -8,7 +8,7 @@ import org.apache.logging.log4j.Logger; import org.opensearch.action.support.WriteRequest; import org.opensearch.client.node.NodeClient; -import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.core.xcontent.ToXContent; import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.BytesRestResponse; import org.opensearch.rest.RestChannel; diff --git a/src/main/java/org/opensearch/securityanalytics/resthandler/RestSearchDetectorAction.java b/src/main/java/org/opensearch/securityanalytics/resthandler/RestSearchDetectorAction.java index c5a49f34c..34f6af368 100644 --- a/src/main/java/org/opensearch/securityanalytics/resthandler/RestSearchDetectorAction.java +++ b/src/main/java/org/opensearch/securityanalytics/resthandler/RestSearchDetectorAction.java @@ -14,11 +14,11 @@ import org.opensearch.client.node.NodeClient; import org.opensearch.common.bytes.BytesReference; import org.opensearch.common.xcontent.LoggingDeprecationHandler; -import org.opensearch.common.xcontent.ToXContent; -import org.opensearch.common.xcontent.XContentBuilder; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentFactory; import org.opensearch.common.xcontent.XContentType; +import org.opensearch.core.xcontent.ToXContent; +import org.opensearch.core.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.BytesRestResponse; import org.opensearch.rest.RestChannel; diff --git a/src/main/java/org/opensearch/securityanalytics/resthandler/RestSearchRuleAction.java b/src/main/java/org/opensearch/securityanalytics/resthandler/RestSearchRuleAction.java index 67df61303..83e092f5c 100644 --- a/src/main/java/org/opensearch/securityanalytics/resthandler/RestSearchRuleAction.java +++ b/src/main/java/org/opensearch/securityanalytics/resthandler/RestSearchRuleAction.java @@ -11,10 +11,10 @@ import org.opensearch.client.node.NodeClient; import org.opensearch.common.bytes.BytesReference; import org.opensearch.common.xcontent.LoggingDeprecationHandler; -import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentFactory; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentType; +import org.opensearch.core.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.index.query.QueryBuilder; import org.opensearch.index.query.QueryBuilders; import org.opensearch.rest.BaseRestHandler; @@ -35,7 +35,7 @@ import java.util.List; import java.util.Locale; -import static org.opensearch.common.xcontent.ToXContent.EMPTY_PARAMS; +import static org.opensearch.core.xcontent.ToXContent.EMPTY_PARAMS; public class RestSearchRuleAction extends BaseRestHandler { diff --git a/src/main/java/org/opensearch/securityanalytics/resthandler/RestUpdateIndexMappingsAction.java b/src/main/java/org/opensearch/securityanalytics/resthandler/RestUpdateIndexMappingsAction.java index 61ff75036..2f8371aa1 100644 --- a/src/main/java/org/opensearch/securityanalytics/resthandler/RestUpdateIndexMappingsAction.java +++ b/src/main/java/org/opensearch/securityanalytics/resthandler/RestUpdateIndexMappingsAction.java @@ -5,8 +5,8 @@ package org.opensearch.securityanalytics.resthandler; import org.opensearch.client.node.NodeClient; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParserUtils; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.RestRequest; import org.opensearch.rest.action.RestToXContentListener; diff --git a/src/main/java/org/opensearch/securityanalytics/resthandler/RestValidateRulesAction.java b/src/main/java/org/opensearch/securityanalytics/resthandler/RestValidateRulesAction.java index 8e291d608..7abf5421f 100644 --- a/src/main/java/org/opensearch/securityanalytics/resthandler/RestValidateRulesAction.java +++ b/src/main/java/org/opensearch/securityanalytics/resthandler/RestValidateRulesAction.java @@ -11,9 +11,9 @@ import org.apache.logging.log4j.Logger; import org.opensearch.action.support.WriteRequest; import org.opensearch.client.node.NodeClient; -import org.opensearch.common.xcontent.ToXContent; -import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.core.xcontent.ToXContent; import org.opensearch.common.xcontent.XContentParserUtils; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.BytesRestResponse; import org.opensearch.rest.RestChannel; diff --git a/src/main/java/org/opensearch/securityanalytics/rules/backend/OSQueryBackend.java b/src/main/java/org/opensearch/securityanalytics/rules/backend/OSQueryBackend.java index b243c884c..f8bdd8406 100644 --- a/src/main/java/org/opensearch/securityanalytics/rules/backend/OSQueryBackend.java +++ b/src/main/java/org/opensearch/securityanalytics/rules/backend/OSQueryBackend.java @@ -10,13 +10,13 @@ import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; import org.opensearch.common.io.stream.Writeable; -import org.opensearch.common.xcontent.ToXContent; -import org.opensearch.common.xcontent.ToXContentObject; -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.alerting.aggregation.bucketselectorext.BucketSelectorExtAggregationBuilder; +import org.opensearch.core.xcontent.ToXContent; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.script.Script; import org.opensearch.search.aggregations.AggregationBuilder; import org.opensearch.search.aggregations.bucket.terms.TermsAggregationBuilder; diff --git a/src/main/java/org/opensearch/securityanalytics/transport/TransportAcknowledgeAlertsAction.java b/src/main/java/org/opensearch/securityanalytics/transport/TransportAcknowledgeAlertsAction.java index 59a0fc39e..6535901a8 100644 --- a/src/main/java/org/opensearch/securityanalytics/transport/TransportAcknowledgeAlertsAction.java +++ b/src/main/java/org/opensearch/securityanalytics/transport/TransportAcknowledgeAlertsAction.java @@ -16,10 +16,10 @@ import org.opensearch.cluster.service.ClusterService; import org.opensearch.common.inject.Inject; import org.opensearch.common.settings.Settings; -import org.opensearch.common.xcontent.NamedXContentRegistry; import org.opensearch.commons.alerting.action.GetAlertsResponse; import org.opensearch.commons.alerting.model.Table; import org.opensearch.commons.authuser.User; +import org.opensearch.core.xcontent.NamedXContentRegistry; import org.opensearch.rest.RestStatus; import org.opensearch.securityanalytics.action.AckAlertsRequest; import org.opensearch.securityanalytics.action.AckAlertsResponse; diff --git a/src/main/java/org/opensearch/securityanalytics/transport/TransportDeleteDetectorAction.java b/src/main/java/org/opensearch/securityanalytics/transport/TransportDeleteDetectorAction.java index 0b5153d1a..9f0fd7bb9 100644 --- a/src/main/java/org/opensearch/securityanalytics/transport/TransportDeleteDetectorAction.java +++ b/src/main/java/org/opensearch/securityanalytics/transport/TransportDeleteDetectorAction.java @@ -27,13 +27,13 @@ import org.opensearch.client.node.NodeClient; import org.opensearch.common.inject.Inject; import org.opensearch.common.xcontent.LoggingDeprecationHandler; -import org.opensearch.common.xcontent.NamedXContentRegistry; import org.opensearch.common.xcontent.XContentHelper; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentType; import org.opensearch.commons.alerting.AlertingPluginInterface; import org.opensearch.commons.alerting.action.DeleteMonitorRequest; import org.opensearch.commons.alerting.action.DeleteMonitorResponse; +import org.opensearch.core.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.rest.RestStatus; import org.opensearch.securityanalytics.action.DeleteDetectorAction; import org.opensearch.securityanalytics.action.DeleteDetectorRequest; diff --git a/src/main/java/org/opensearch/securityanalytics/transport/TransportDeleteRuleAction.java b/src/main/java/org/opensearch/securityanalytics/transport/TransportDeleteRuleAction.java index bd233610a..639f8c823 100644 --- a/src/main/java/org/opensearch/securityanalytics/transport/TransportDeleteRuleAction.java +++ b/src/main/java/org/opensearch/securityanalytics/transport/TransportDeleteRuleAction.java @@ -19,10 +19,10 @@ import org.opensearch.client.Client; import org.opensearch.common.inject.Inject; import org.opensearch.common.xcontent.LoggingDeprecationHandler; -import org.opensearch.common.xcontent.NamedXContentRegistry; import org.opensearch.common.xcontent.XContentHelper; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentType; +import org.opensearch.core.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.index.query.QueryBuilder; import org.opensearch.index.query.QueryBuilders; import org.opensearch.index.reindex.BulkByScrollResponse; diff --git a/src/main/java/org/opensearch/securityanalytics/transport/TransportGetAlertsAction.java b/src/main/java/org/opensearch/securityanalytics/transport/TransportGetAlertsAction.java index 2eefc0a03..bfc73ac97 100644 --- a/src/main/java/org/opensearch/securityanalytics/transport/TransportGetAlertsAction.java +++ b/src/main/java/org/opensearch/securityanalytics/transport/TransportGetAlertsAction.java @@ -20,8 +20,8 @@ import org.opensearch.cluster.service.ClusterService; import org.opensearch.common.inject.Inject; import org.opensearch.common.settings.Settings; -import org.opensearch.common.xcontent.NamedXContentRegistry; import org.opensearch.commons.authuser.User; +import org.opensearch.core.xcontent.NamedXContentRegistry; import org.opensearch.index.query.NestedQueryBuilder; import org.opensearch.index.query.QueryBuilders; import org.opensearch.rest.RestStatus; diff --git a/src/main/java/org/opensearch/securityanalytics/transport/TransportGetDetectorAction.java b/src/main/java/org/opensearch/securityanalytics/transport/TransportGetDetectorAction.java index c38deaac8..47c2e07e5 100644 --- a/src/main/java/org/opensearch/securityanalytics/transport/TransportGetDetectorAction.java +++ b/src/main/java/org/opensearch/securityanalytics/transport/TransportGetDetectorAction.java @@ -22,12 +22,10 @@ import org.opensearch.common.xcontent.XContentHelper; import org.opensearch.rest.RestResponse; import org.opensearch.rest.BytesRestResponse; - import org.opensearch.common.xcontent.LoggingDeprecationHandler; -import org.opensearch.common.xcontent.NamedXContentRegistry; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentType; - +import org.opensearch.core.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.rest.RestStatus; import org.opensearch.securityanalytics.action.GetDetectorAction; import org.opensearch.securityanalytics.model.Detector; diff --git a/src/main/java/org/opensearch/securityanalytics/transport/TransportGetFindingsAction.java b/src/main/java/org/opensearch/securityanalytics/transport/TransportGetFindingsAction.java index 388e75a88..4ec9adeb5 100644 --- a/src/main/java/org/opensearch/securityanalytics/transport/TransportGetFindingsAction.java +++ b/src/main/java/org/opensearch/securityanalytics/transport/TransportGetFindingsAction.java @@ -20,8 +20,8 @@ import org.opensearch.cluster.service.ClusterService; import org.opensearch.common.inject.Inject; import org.opensearch.common.settings.Settings; -import org.opensearch.common.xcontent.NamedXContentRegistry; import org.opensearch.commons.authuser.User; +import org.opensearch.core.xcontent.NamedXContentRegistry; import org.opensearch.index.query.NestedQueryBuilder; import org.opensearch.index.query.QueryBuilders; import org.opensearch.rest.RestStatus; diff --git a/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexDetectorAction.java b/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexDetectorAction.java index 5c89f727d..0f1f620c8 100644 --- a/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexDetectorAction.java +++ b/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexDetectorAction.java @@ -37,11 +37,9 @@ import org.opensearch.common.settings.Settings; import org.opensearch.common.unit.TimeValue; import org.opensearch.common.xcontent.LoggingDeprecationHandler; -import org.opensearch.common.xcontent.NamedXContentRegistry; -import org.opensearch.common.xcontent.ToXContent; import org.opensearch.common.xcontent.XContentFactory; import org.opensearch.common.xcontent.XContentHelper; -import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentType; import org.opensearch.commons.alerting.AlertingPluginInterface; import org.opensearch.commons.alerting.action.DeleteMonitorRequest; @@ -58,6 +56,8 @@ import org.opensearch.commons.alerting.model.SearchInput; import org.opensearch.commons.alerting.model.action.Action; import org.opensearch.commons.authuser.User; +import org.opensearch.core.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.ToXContent; import org.opensearch.index.query.BoolQueryBuilder; import org.opensearch.index.IndexNotFoundException; import org.opensearch.index.query.QueryBuilder; diff --git a/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexRuleAction.java b/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexRuleAction.java index d9dff94aa..818f3f6a4 100644 --- a/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexRuleAction.java +++ b/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexRuleAction.java @@ -25,11 +25,11 @@ import org.opensearch.common.settings.Settings; import org.opensearch.common.unit.TimeValue; import org.opensearch.common.xcontent.LoggingDeprecationHandler; -import org.opensearch.common.xcontent.NamedXContentRegistry; -import org.opensearch.common.xcontent.ToXContent; import org.opensearch.common.xcontent.XContentFactory; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentType; +import org.opensearch.core.xcontent.XContentParser; +import org.opensearch.core.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.ToXContent; import org.opensearch.index.query.QueryBuilder; import org.opensearch.index.query.QueryBuilders; import org.opensearch.rest.RestRequest; diff --git a/src/main/java/org/opensearch/securityanalytics/transport/TransportSearchDetectorAction.java b/src/main/java/org/opensearch/securityanalytics/transport/TransportSearchDetectorAction.java index f4bab3762..41f7917af 100644 --- a/src/main/java/org/opensearch/securityanalytics/transport/TransportSearchDetectorAction.java +++ b/src/main/java/org/opensearch/securityanalytics/transport/TransportSearchDetectorAction.java @@ -18,7 +18,7 @@ import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.settings.Settings; import org.opensearch.cluster.service.ClusterService; -import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.NamedXContentRegistry; import org.opensearch.rest.RestStatus; import org.opensearch.securityanalytics.action.SearchDetectorAction; import org.opensearch.securityanalytics.action.SearchDetectorRequest; diff --git a/src/main/java/org/opensearch/securityanalytics/transport/TransportValidateRulesAction.java b/src/main/java/org/opensearch/securityanalytics/transport/TransportValidateRulesAction.java index 9ce59a088..2023c25bc 100644 --- a/src/main/java/org/opensearch/securityanalytics/transport/TransportValidateRulesAction.java +++ b/src/main/java/org/opensearch/securityanalytics/transport/TransportValidateRulesAction.java @@ -14,7 +14,7 @@ import org.opensearch.cluster.metadata.IndexMetadata; import org.opensearch.cluster.service.ClusterService; import org.opensearch.common.inject.Inject; -import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.NamedXContentRegistry; import org.opensearch.rest.RestStatus; import org.opensearch.securityanalytics.action.ValidateRulesAction; import org.opensearch.securityanalytics.action.ValidateRulesRequest; diff --git a/src/main/java/org/opensearch/securityanalytics/util/DetectorUtils.java b/src/main/java/org/opensearch/securityanalytics/util/DetectorUtils.java index a8c19bee7..49864e6cf 100644 --- a/src/main/java/org/opensearch/securityanalytics/util/DetectorUtils.java +++ b/src/main/java/org/opensearch/securityanalytics/util/DetectorUtils.java @@ -14,9 +14,9 @@ import org.opensearch.action.search.SearchResponse; import org.opensearch.client.Client; import org.opensearch.common.xcontent.LoggingDeprecationHandler; -import org.opensearch.common.xcontent.NamedXContentRegistry; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentType; +import org.opensearch.core.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.search.SearchHit; import org.opensearch.search.builder.SearchSourceBuilder; import org.opensearch.search.fetch.subphase.FetchSourceContext; diff --git a/src/main/java/org/opensearch/securityanalytics/util/IndexUtils.java b/src/main/java/org/opensearch/securityanalytics/util/IndexUtils.java index 3358f5d12..85673c1e9 100644 --- a/src/main/java/org/opensearch/securityanalytics/util/IndexUtils.java +++ b/src/main/java/org/opensearch/securityanalytics/util/IndexUtils.java @@ -15,9 +15,9 @@ import org.opensearch.cluster.metadata.IndexMetadata; import org.opensearch.cluster.metadata.IndexNameExpressionResolver; import org.opensearch.common.xcontent.LoggingDeprecationHandler; -import org.opensearch.common.xcontent.NamedXContentRegistry; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentType; +import org.opensearch.core.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.XContentParser; import java.io.IOException; import java.util.HashMap; diff --git a/src/main/java/org/opensearch/securityanalytics/util/RuleIndices.java b/src/main/java/org/opensearch/securityanalytics/util/RuleIndices.java index 8fd1bc941..aaa3c0d82 100644 --- a/src/main/java/org/opensearch/securityanalytics/util/RuleIndices.java +++ b/src/main/java/org/opensearch/securityanalytics/util/RuleIndices.java @@ -30,8 +30,8 @@ import org.opensearch.common.io.PathUtils; import org.opensearch.common.settings.Settings; import org.opensearch.common.unit.TimeValue; -import org.opensearch.common.xcontent.ToXContent; import org.opensearch.common.xcontent.XContentFactory; +import org.opensearch.core.xcontent.ToXContent; import org.opensearch.index.query.QueryBuilders; import org.opensearch.index.reindex.BulkByScrollResponse; import org.opensearch.index.reindex.DeleteByQueryAction; diff --git a/src/main/java/org/opensearch/securityanalytics/util/RuleValidator.java b/src/main/java/org/opensearch/securityanalytics/util/RuleValidator.java index 0b53e9a35..937265908 100644 --- a/src/main/java/org/opensearch/securityanalytics/util/RuleValidator.java +++ b/src/main/java/org/opensearch/securityanalytics/util/RuleValidator.java @@ -14,9 +14,9 @@ import org.opensearch.action.search.SearchResponse; import org.opensearch.client.Client; import org.opensearch.common.xcontent.LoggingDeprecationHandler; -import org.opensearch.common.xcontent.NamedXContentRegistry; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentType; +import org.opensearch.core.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.index.query.QueryBuilder; import org.opensearch.index.query.QueryBuilders; import org.opensearch.search.SearchHit; diff --git a/src/main/java/org/opensearch/securityanalytics/util/SecurityAnalyticsException.java b/src/main/java/org/opensearch/securityanalytics/util/SecurityAnalyticsException.java index 696862b25..257fb3e24 100644 --- a/src/main/java/org/opensearch/securityanalytics/util/SecurityAnalyticsException.java +++ b/src/main/java/org/opensearch/securityanalytics/util/SecurityAnalyticsException.java @@ -8,8 +8,8 @@ import org.apache.logging.log4j.Logger; import org.opensearch.OpenSearchException; import org.opensearch.common.Strings; -import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentFactory; +import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.rest.RestStatus; import java.io.IOException; diff --git a/src/main/java/org/opensearch/securityanalytics/util/XContentUtils.java b/src/main/java/org/opensearch/securityanalytics/util/XContentUtils.java index 86368ea16..1b3c21e8b 100644 --- a/src/main/java/org/opensearch/securityanalytics/util/XContentUtils.java +++ b/src/main/java/org/opensearch/securityanalytics/util/XContentUtils.java @@ -8,10 +8,10 @@ import java.io.IOException; import java.util.Map; import org.opensearch.common.bytes.BytesReference; -import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentFactory; import org.opensearch.common.xcontent.XContentHelper; import org.opensearch.common.xcontent.XContentType; +import org.opensearch.core.xcontent.XContentBuilder; public class XContentUtils { diff --git a/src/test/java/org/opensearch/securityanalytics/SecurityAnalyticsClientUtils.java b/src/test/java/org/opensearch/securityanalytics/SecurityAnalyticsClientUtils.java index af8adac95..73d81abb2 100644 --- a/src/test/java/org/opensearch/securityanalytics/SecurityAnalyticsClientUtils.java +++ b/src/test/java/org/opensearch/securityanalytics/SecurityAnalyticsClientUtils.java @@ -12,11 +12,11 @@ import org.opensearch.cluster.ClusterModule; import org.opensearch.cluster.metadata.MappingMetadata; import org.opensearch.common.collect.ImmutableOpenMap; -import org.opensearch.common.xcontent.DeprecationHandler; -import org.opensearch.common.xcontent.NamedXContentRegistry; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParserUtils; import org.opensearch.common.xcontent.json.JsonXContent; +import org.opensearch.core.xcontent.DeprecationHandler; +import org.opensearch.core.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.index.mapper.MapperService; import org.opensearch.test.rest.OpenSearchRestTestCase; diff --git a/src/test/java/org/opensearch/securityanalytics/SecurityAnalyticsRestTestCase.java b/src/test/java/org/opensearch/securityanalytics/SecurityAnalyticsRestTestCase.java index 59f250545..0237feaa9 100644 --- a/src/test/java/org/opensearch/securityanalytics/SecurityAnalyticsRestTestCase.java +++ b/src/test/java/org/opensearch/securityanalytics/SecurityAnalyticsRestTestCase.java @@ -34,12 +34,7 @@ import org.opensearch.common.collect.ImmutableOpenMap; import org.opensearch.common.io.PathUtils; import org.opensearch.common.settings.Settings; -import org.opensearch.common.xcontent.DeprecationHandler; -import org.opensearch.common.xcontent.NamedXContentRegistry; -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.common.xcontent.XContentType; import org.opensearch.common.xcontent.json.JsonXContent; @@ -47,6 +42,11 @@ import org.opensearch.commons.alerting.util.IndexUtilsKt; import org.opensearch.commons.rest.SecureRestClientBuilder; import org.opensearch.commons.ConfigConstants; +import org.opensearch.core.xcontent.DeprecationHandler; +import org.opensearch.core.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.ToXContent; +import org.opensearch.core.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.index.IndexSettings; import org.opensearch.index.mapper.MapperService; import org.opensearch.rest.RestStatus; @@ -182,7 +182,7 @@ protected String createTestIndex(String index, String mapping, Settings settings protected String createTestIndex(RestClient client, String index, String mapping, Settings settings) throws IOException { Request request = new Request("PUT", "/" + index); - String entity = "{\"settings\": " + Strings.toString(settings); + String entity = "{\"settings\": " + settings.toString(); if (mapping != null) { entity = entity + ",\"mappings\" : {" + mapping + "}"; } diff --git a/src/test/java/org/opensearch/securityanalytics/TestHelpers.java b/src/test/java/org/opensearch/securityanalytics/TestHelpers.java index fd820b839..c0095aa9b 100644 --- a/src/test/java/org/opensearch/securityanalytics/TestHelpers.java +++ b/src/test/java/org/opensearch/securityanalytics/TestHelpers.java @@ -8,17 +8,17 @@ import org.apache.lucene.tests.util.LuceneTestCase; import org.opensearch.common.bytes.BytesReference; import org.opensearch.common.xcontent.LoggingDeprecationHandler; -import org.opensearch.common.xcontent.NamedXContentRegistry; -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.XContentType; import org.opensearch.commons.alerting.model.IntervalSchedule; import org.opensearch.commons.alerting.model.Schedule; import org.opensearch.commons.alerting.model.action.Action; import org.opensearch.commons.alerting.model.action.Throttle; import org.opensearch.commons.authuser.User; +import org.opensearch.core.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.ToXContent; +import org.opensearch.core.xcontent.XContentBuilder; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.script.Script; import org.opensearch.script.ScriptType; import org.opensearch.securityanalytics.model.Detector; diff --git a/src/test/java/org/opensearch/securityanalytics/action/CreateIndexMappingsRequestTests.java b/src/test/java/org/opensearch/securityanalytics/action/CreateIndexMappingsRequestTests.java index ac687a733..a4beab5a4 100644 --- a/src/test/java/org/opensearch/securityanalytics/action/CreateIndexMappingsRequestTests.java +++ b/src/test/java/org/opensearch/securityanalytics/action/CreateIndexMappingsRequestTests.java @@ -8,8 +8,8 @@ import org.opensearch.action.ActionRequestValidationException; import org.opensearch.common.io.stream.BytesStreamOutput; import org.opensearch.common.io.stream.StreamInput; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.json.JsonXContent; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.securityanalytics.action.CreateIndexMappingsRequest; import org.opensearch.test.OpenSearchTestCase; diff --git a/src/test/java/org/opensearch/securityanalytics/action/GetIndexMappingsRequestTests.java b/src/test/java/org/opensearch/securityanalytics/action/GetIndexMappingsRequestTests.java index b6636e2b6..dc9753a06 100644 --- a/src/test/java/org/opensearch/securityanalytics/action/GetIndexMappingsRequestTests.java +++ b/src/test/java/org/opensearch/securityanalytics/action/GetIndexMappingsRequestTests.java @@ -8,8 +8,8 @@ import org.opensearch.action.ActionRequestValidationException; import org.opensearch.common.io.stream.BytesStreamOutput; import org.opensearch.common.io.stream.StreamInput; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.json.JsonXContent; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.securityanalytics.action.GetIndexMappingsRequest; import org.opensearch.test.OpenSearchTestCase; diff --git a/src/test/java/org/opensearch/securityanalytics/action/UpdateIndexMappingsRequestTests.java b/src/test/java/org/opensearch/securityanalytics/action/UpdateIndexMappingsRequestTests.java index 5b5028b71..80d6ad048 100644 --- a/src/test/java/org/opensearch/securityanalytics/action/UpdateIndexMappingsRequestTests.java +++ b/src/test/java/org/opensearch/securityanalytics/action/UpdateIndexMappingsRequestTests.java @@ -8,8 +8,8 @@ import org.opensearch.action.ActionRequestValidationException; import org.opensearch.common.io.stream.BytesStreamOutput; import org.opensearch.common.io.stream.StreamInput; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.json.JsonXContent; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.securityanalytics.action.UpdateIndexMappingsRequest; import org.opensearch.test.OpenSearchTestCase; diff --git a/src/test/java/org/opensearch/securityanalytics/action/ValidateRulesRequestTests.java b/src/test/java/org/opensearch/securityanalytics/action/ValidateRulesRequestTests.java index 338b21f57..02cc9d35c 100644 --- a/src/test/java/org/opensearch/securityanalytics/action/ValidateRulesRequestTests.java +++ b/src/test/java/org/opensearch/securityanalytics/action/ValidateRulesRequestTests.java @@ -11,9 +11,9 @@ import org.opensearch.action.support.WriteRequest; import org.opensearch.common.io.stream.BytesStreamOutput; import org.opensearch.common.io.stream.StreamInput; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParserUtils; import org.opensearch.common.xcontent.json.JsonXContent; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.rest.RestRequest; import org.opensearch.test.OpenSearchTestCase; diff --git a/src/test/java/org/opensearch/securityanalytics/action/ValidateRulesResponseTests.java b/src/test/java/org/opensearch/securityanalytics/action/ValidateRulesResponseTests.java index 575c96b4a..0066c1b70 100644 --- a/src/test/java/org/opensearch/securityanalytics/action/ValidateRulesResponseTests.java +++ b/src/test/java/org/opensearch/securityanalytics/action/ValidateRulesResponseTests.java @@ -11,11 +11,11 @@ import org.opensearch.common.bytes.BytesReference; import org.opensearch.common.io.stream.BytesStreamOutput; import org.opensearch.common.io.stream.StreamInput; -import org.opensearch.common.xcontent.ToXContent; import org.opensearch.common.xcontent.XContentFactory; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParserUtils; import org.opensearch.common.xcontent.json.JsonXContent; +import org.opensearch.core.xcontent.ToXContent; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.test.OpenSearchTestCase; diff --git a/src/test/java/org/opensearch/securityanalytics/mapper/MapperRestApiIT.java b/src/test/java/org/opensearch/securityanalytics/mapper/MapperRestApiIT.java index 15911fc6b..22952b4e9 100644 --- a/src/test/java/org/opensearch/securityanalytics/mapper/MapperRestApiIT.java +++ b/src/test/java/org/opensearch/securityanalytics/mapper/MapperRestApiIT.java @@ -27,11 +27,11 @@ import org.opensearch.client.ResponseException; import org.opensearch.common.Strings; import org.opensearch.common.settings.Settings; -import org.opensearch.common.xcontent.DeprecationHandler; -import org.opensearch.common.xcontent.NamedXContentRegistry; import org.opensearch.common.xcontent.XContentFactory; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.json.JsonXContent; +import org.opensearch.core.xcontent.DeprecationHandler; +import org.opensearch.core.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.search.SearchHit; import org.opensearch.securityanalytics.SecurityAnalyticsClientUtils; import org.opensearch.securityanalytics.SecurityAnalyticsPlugin; diff --git a/src/test/java/org/opensearch/securityanalytics/mapper/action/mapping/CreateIndexMappingsRequestTests.java b/src/test/java/org/opensearch/securityanalytics/mapper/action/mapping/CreateIndexMappingsRequestTests.java index 7bee983a1..f7cf63195 100644 --- a/src/test/java/org/opensearch/securityanalytics/mapper/action/mapping/CreateIndexMappingsRequestTests.java +++ b/src/test/java/org/opensearch/securityanalytics/mapper/action/mapping/CreateIndexMappingsRequestTests.java @@ -8,8 +8,8 @@ import org.opensearch.action.ActionRequestValidationException; import org.opensearch.common.io.stream.BytesStreamOutput; import org.opensearch.common.io.stream.StreamInput; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.json.JsonXContent; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.securityanalytics.action.CreateIndexMappingsRequest; import org.opensearch.test.OpenSearchTestCase; diff --git a/src/test/java/org/opensearch/securityanalytics/mapper/action/mapping/GetIndexMappingsRequestTests.java b/src/test/java/org/opensearch/securityanalytics/mapper/action/mapping/GetIndexMappingsRequestTests.java index caaa0be4c..33c678f66 100644 --- a/src/test/java/org/opensearch/securityanalytics/mapper/action/mapping/GetIndexMappingsRequestTests.java +++ b/src/test/java/org/opensearch/securityanalytics/mapper/action/mapping/GetIndexMappingsRequestTests.java @@ -8,8 +8,8 @@ import org.opensearch.action.ActionRequestValidationException; import org.opensearch.common.io.stream.BytesStreamOutput; import org.opensearch.common.io.stream.StreamInput; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.json.JsonXContent; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.securityanalytics.action.GetIndexMappingsRequest; import org.opensearch.test.OpenSearchTestCase; diff --git a/src/test/java/org/opensearch/securityanalytics/mapper/action/mapping/UpdateIndexMappingsRequestTests.java b/src/test/java/org/opensearch/securityanalytics/mapper/action/mapping/UpdateIndexMappingsRequestTests.java index b3cb97bc1..593ae7556 100644 --- a/src/test/java/org/opensearch/securityanalytics/mapper/action/mapping/UpdateIndexMappingsRequestTests.java +++ b/src/test/java/org/opensearch/securityanalytics/mapper/action/mapping/UpdateIndexMappingsRequestTests.java @@ -8,8 +8,8 @@ import org.opensearch.action.ActionRequestValidationException; import org.opensearch.common.io.stream.BytesStreamOutput; import org.opensearch.common.io.stream.StreamInput; -import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.json.JsonXContent; +import org.opensearch.core.xcontent.XContentParser; import org.opensearch.securityanalytics.action.UpdateIndexMappingsRequest; import org.opensearch.test.OpenSearchTestCase; diff --git a/src/test/java/org/opensearch/securityanalytics/model/DetectorInputTests.java b/src/test/java/org/opensearch/securityanalytics/model/DetectorInputTests.java index 398cdfd3e..8ba5a991a 100644 --- a/src/test/java/org/opensearch/securityanalytics/model/DetectorInputTests.java +++ b/src/test/java/org/opensearch/securityanalytics/model/DetectorInputTests.java @@ -6,9 +6,9 @@ import org.junit.Assert; import org.opensearch.common.bytes.BytesReference; -import org.opensearch.common.xcontent.ToXContent; -import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentType; +import org.opensearch.core.xcontent.ToXContent; +import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.test.OpenSearchTestCase; import java.io.IOException; diff --git a/src/test/java/org/opensearch/securityanalytics/resthandler/RuleRestApiIT.java b/src/test/java/org/opensearch/securityanalytics/resthandler/RuleRestApiIT.java index f9cbe8401..627142828 100644 --- a/src/test/java/org/opensearch/securityanalytics/resthandler/RuleRestApiIT.java +++ b/src/test/java/org/opensearch/securityanalytics/resthandler/RuleRestApiIT.java @@ -12,13 +12,13 @@ import org.opensearch.client.Response; import org.opensearch.client.ResponseException; import org.opensearch.common.xcontent.LoggingDeprecationHandler; -import org.opensearch.common.xcontent.NamedXContentRegistry; import org.opensearch.common.xcontent.XContentFactory; -import org.opensearch.common.xcontent.XContentParser; -import org.opensearch.common.xcontent.XContentParser.Token; import org.opensearch.common.xcontent.XContentParserUtils; import org.opensearch.common.xcontent.XContentType; import org.opensearch.commons.alerting.aggregation.bucketselectorext.BucketSelectorExtAggregationBuilder; +import org.opensearch.core.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.XContentParser; +import org.opensearch.core.xcontent.XContentParser.Token; import org.opensearch.rest.RestStatus; import org.opensearch.search.SearchHit; import org.opensearch.search.aggregations.AggregatorFactories; From 407d07fc1d763d74dd8bc662c041482689ce85d7 Mon Sep 17 00:00:00 2001 From: Subhobrata Dey Date: Thu, 6 Apr 2023 03:46:55 +0000 Subject: [PATCH 3/3] upgrade main to 2.7.0 Signed-off-by: Subhobrata Dey --- build.gradle | 62 ++++++------------- .../rules/backend/QueryBackend.java | 3 +- .../rules/objects/SigmaRule.java | 2 +- .../SecurityAnalyticsPluginRestApiIT.java | 2 +- .../model/XContentTests.java | 2 +- .../rules/objects/SigmaDetectionsTests.java | 13 ++-- 6 files changed, 32 insertions(+), 52 deletions(-) diff --git a/build.gradle b/build.gradle index 3c368566c..fcb0344c4 100644 --- a/build.gradle +++ b/build.gradle @@ -134,8 +134,14 @@ repositories { mavenCentral() maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } } +configurations.all { + resolutionStrategy.cacheChangingModulesFor 0, 'seconds' +} sourceSets.main.java.srcDirs = ['src/main/generated','src/main/java'] +configurations { + zipArchive +} dependencies { javaRestTestImplementation project.sourceSets.main.runtimeClasspath @@ -145,6 +151,11 @@ dependencies { api "org.opensearch:common-utils:${common_utils_version}" api "org.opensearch.client:opensearch-rest-client:${opensearch_version}" implementation "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}" + + // Needed for integ tests + zipArchive group: 'org.opensearch.plugin', name:'alerting', version: "${opensearch_build}" + zipArchive group: 'org.opensearch.plugin', name:'opensearch-notifications-core', version: "${opensearch_build}" + zipArchive group: 'org.opensearch.plugin', name:'notifications', version: "${opensearch_build}" } // RPM & Debian build @@ -220,15 +231,6 @@ integTest.getClusters().forEach{c -> { c.plugin(project.getObjects().fileProperty().value(bundle.getArchiveFile())) }} -String alertingFilePath = "src/test/resources/alerting" -String alertingPlugin = "opensearch-alerting-" + plugin_no_snapshot + ".zip" -String alertingRemoteFile = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/" + opensearch_no_snapshot + "/latest/linux/x64/tar/builds/opensearch/plugins/" + alertingPlugin -String notificationsFilePath = "src/test/resources/notifications" -String notificationsCoreFilePath = "src/test/resources/notifications-core" -String notificationsPlugin = "opensearch-notifications-" + plugin_no_snapshot + ".zip" -String notificationsCorePlugin = "opensearch-notifications-core-" + plugin_no_snapshot + ".zip" -String notificationsRemoteFile = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/" + opensearch_no_snapshot + "/latest/linux/x64/tar/builds/opensearch/plugins/" + notificationsPlugin -String notificationsCoreRemoteFile = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/" + opensearch_no_snapshot + "/latest/linux/x64/tar/builds/opensearch/plugins/" + notificationsCorePlugin testClusters.integTest { testDistribution = 'ARCHIVE' @@ -249,17 +251,9 @@ testClusters.integTest { new RegularFile() { @Override File getAsFile() { - File dir = new File(rootDir.path + "/" + alertingFilePath) - - if (!dir.exists()) { - dir.mkdirs() - } - - File f = new File(dir, alertingPlugin) - if (!f.exists()) { - new URL(alertingRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }} - } - fileTree(alertingFilePath).getSingleFile() + return configurations.zipArchive.asFileTree.matching { + include '**/opensearch-notifications-core*' + }.singleFile } } })) @@ -267,17 +261,9 @@ testClusters.integTest { new RegularFile() { @Override File getAsFile() { - File dir = new File(rootDir.path + "/" + notificationsCoreFilePath) - - if (!dir.exists()) { - dir.mkdirs() - } - - File f = new File(dir, notificationsCorePlugin) - if (!f.exists()) { - new URL(notificationsCoreRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }} - } - fileTree(notificationsCoreFilePath).getSingleFile() + return configurations.zipArchive.asFileTree.matching { + include '**/notifications*' + }.singleFile } } })) @@ -285,17 +271,9 @@ testClusters.integTest { new RegularFile() { @Override File getAsFile() { - File dir = new File(rootDir.path + "/" + notificationsFilePath) - - if (!dir.exists()) { - dir.mkdirs() - } - - File f = new File(dir, notificationsPlugin) - if (!f.exists()) { - new URL(notificationsRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }} - } - fileTree(notificationsFilePath).getSingleFile() + return configurations.zipArchive.asFileTree.matching { + include '**/alerting*' + }.singleFile } } })) diff --git a/src/main/java/org/opensearch/securityanalytics/rules/backend/QueryBackend.java b/src/main/java/org/opensearch/securityanalytics/rules/backend/QueryBackend.java index 35eae1993..1b868054e 100644 --- a/src/main/java/org/opensearch/securityanalytics/rules/backend/QueryBackend.java +++ b/src/main/java/org/opensearch/securityanalytics/rules/backend/QueryBackend.java @@ -31,6 +31,7 @@ import org.opensearch.securityanalytics.rules.utils.AnyOneOf; import org.opensearch.securityanalytics.rules.utils.Either; import org.apache.commons.lang3.tuple.Pair; +import org.yaml.snakeyaml.LoaderOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.SafeConstructor; @@ -71,7 +72,7 @@ public QueryBackend(String ruleCategory, boolean convertAndAsIn, boolean enableF assert is != null; String content = new String(is.readAllBytes(), Charset.defaultCharset()); - Yaml yaml = new Yaml(new SafeConstructor()); + Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions())); Map fieldMappingsObj = yaml.load(content); this.fieldMappings = (Map) fieldMappingsObj.get("fieldmappings"); diff --git a/src/main/java/org/opensearch/securityanalytics/rules/objects/SigmaRule.java b/src/main/java/org/opensearch/securityanalytics/rules/objects/SigmaRule.java index 6236713d1..e3de43649 100644 --- a/src/main/java/org/opensearch/securityanalytics/rules/objects/SigmaRule.java +++ b/src/main/java/org/opensearch/securityanalytics/rules/objects/SigmaRule.java @@ -174,7 +174,7 @@ public static SigmaRule fromYaml(String rule, boolean collectErrors) throws Sigm LoaderOptions loaderOptions = new LoaderOptions(); loaderOptions.setNestingDepthLimit(10); - Yaml yaml = new Yaml(new SafeConstructor(), new Representer(), new DumperOptions(), loaderOptions); + Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions()), new Representer(new DumperOptions()), new DumperOptions(), loaderOptions); Map ruleMap = yaml.load(rule); return fromDict(ruleMap, collectErrors); } diff --git a/src/test/java/org/opensearch/securityanalytics/SecurityAnalyticsPluginRestApiIT.java b/src/test/java/org/opensearch/securityanalytics/SecurityAnalyticsPluginRestApiIT.java index 69019bbc5..9ad61870a 100644 --- a/src/test/java/org/opensearch/securityanalytics/SecurityAnalyticsPluginRestApiIT.java +++ b/src/test/java/org/opensearch/securityanalytics/SecurityAnalyticsPluginRestApiIT.java @@ -8,8 +8,8 @@ import org.opensearch.client.Request; import org.opensearch.client.Response; import org.opensearch.common.xcontent.LoggingDeprecationHandler; -import org.opensearch.common.xcontent.NamedXContentRegistry; import org.opensearch.common.xcontent.json.JsonXContent; +import org.opensearch.core.xcontent.NamedXContentRegistry; import java.io.IOException; import java.util.List; diff --git a/src/test/java/org/opensearch/securityanalytics/model/XContentTests.java b/src/test/java/org/opensearch/securityanalytics/model/XContentTests.java index ce1ae3806..6300740f7 100644 --- a/src/test/java/org/opensearch/securityanalytics/model/XContentTests.java +++ b/src/test/java/org/opensearch/securityanalytics/model/XContentTests.java @@ -8,8 +8,8 @@ import java.util.List; import org.junit.Assert; import org.opensearch.common.bytes.BytesReference; -import org.opensearch.common.xcontent.ToXContent; import org.opensearch.commons.authuser.User; +import org.opensearch.core.xcontent.ToXContent; import org.opensearch.test.OpenSearchTestCase; diff --git a/src/test/java/org/opensearch/securityanalytics/rules/objects/SigmaDetectionsTests.java b/src/test/java/org/opensearch/securityanalytics/rules/objects/SigmaDetectionsTests.java index 762261217..dba65b1d0 100644 --- a/src/test/java/org/opensearch/securityanalytics/rules/objects/SigmaDetectionsTests.java +++ b/src/test/java/org/opensearch/securityanalytics/rules/objects/SigmaDetectionsTests.java @@ -20,6 +20,7 @@ import org.opensearch.securityanalytics.rules.utils.AnyOneOf; import org.opensearch.securityanalytics.rules.utils.Either; import org.opensearch.test.OpenSearchTestCase; +import org.yaml.snakeyaml.LoaderOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.SafeConstructor; @@ -30,7 +31,7 @@ public class SigmaDetectionsTests extends OpenSearchTestCase { public void testSigmaDetectionsFromDict() throws SigmaError{ - Yaml yaml = new Yaml(new SafeConstructor()); + Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions())); Map detectionsMap = yaml.load( " selection:\n" + " EventID: 16\n" + @@ -62,7 +63,7 @@ public void testSigmaDetectionsFromDict() throws SigmaError{ } public void testSigmaDetectionsFromDictNoDetections() { - Yaml yaml = new Yaml(new SafeConstructor()); + Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions())); Map detectionsMap = yaml.load( " condition: selection"); Exception exception = assertThrows(SigmaDetectionError.class, () -> { @@ -76,7 +77,7 @@ public void testSigmaDetectionsFromDictNoDetections() { } public void testSigmaDetectionsFromDictNoCondition() { - Yaml yaml = new Yaml(new SafeConstructor()); + Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions())); Map detectionsMap = yaml.load( " selection:\n" + " EventID: 16\n" + @@ -94,7 +95,7 @@ public void testSigmaDetectionsFromDictNoCondition() { } public void testDetectionItemAllModifiedKeyPlainValuesPostProcess() throws SigmaError{ - Yaml yaml = new Yaml(new SafeConstructor()); + Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions())); Map detectionsMap = yaml.load( " selection:\n" + " field|all: [\"val1\", \"val2\", 123]\n" + @@ -112,7 +113,7 @@ public void testDetectionItemAllModifiedKeyPlainValuesPostProcess() throws Sigma } public void testDetectionItemAllModifiedUnboundPlainValuesPostProcess() throws SigmaError { - Yaml yaml = new Yaml(new SafeConstructor()); + Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions())); Map detectionsMap = yaml.load( " selection:\n" + " \"|all\": [\"val1\", \"val2\", 123]\n" + @@ -130,7 +131,7 @@ public void testDetectionItemAllModifiedUnboundPlainValuesPostProcess() throws S } public void testDetectionItemAllModifiedKeySpecialValuesPostProcess() throws SigmaError { - Yaml yaml = new Yaml(new SafeConstructor()); + Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions())); Map detectionsMap = yaml.load( " selection:\n" + " field|all: [\"val1*\", \"val2\", 123]\n" +