-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Signed-off-by: Subhobrata Dey <sbcd90@gmail.com>
- Loading branch information
1 parent
2daf1d4
commit cbb56f6
Showing
62 changed files
with
5,935 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/main/java/org/opensearch/securityanalytics/action/CorrelatedFindingAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.opensearch.securityanalytics.action; | ||
|
||
import org.opensearch.action.ActionType; | ||
|
||
public class CorrelatedFindingAction extends ActionType<CorrelatedFindingResponse> { | ||
public static final CorrelatedFindingAction INSTANCE = new CorrelatedFindingAction(); | ||
public static final String NAME = "cluster:admin/opensearch/securityanalytics/findings/correlated"; | ||
|
||
public CorrelatedFindingAction() { | ||
super(NAME, CorrelatedFindingResponse::new); | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
src/main/java/org/opensearch/securityanalytics/action/CorrelatedFindingRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.opensearch.securityanalytics.action; | ||
|
||
import org.opensearch.action.ActionRequest; | ||
import org.opensearch.action.ActionRequestValidationException; | ||
import org.opensearch.common.io.stream.StreamInput; | ||
import org.opensearch.common.io.stream.StreamOutput; | ||
import org.opensearch.securityanalytics.model.Detector; | ||
|
||
import java.io.IOException; | ||
|
||
public class CorrelatedFindingRequest extends ActionRequest { | ||
|
||
private Detector.DetectorType detectorType; | ||
|
||
private String findingId; | ||
|
||
private long timeWindow; | ||
|
||
private int noOfNearbyFindings; | ||
|
||
public CorrelatedFindingRequest(String findingId, Detector.DetectorType detectorType, long timeWindow, int noOfNearbyFindings) { | ||
super(); | ||
this.findingId = findingId; | ||
this.detectorType = detectorType; | ||
this.timeWindow = timeWindow; | ||
this.noOfNearbyFindings = noOfNearbyFindings; | ||
} | ||
|
||
public CorrelatedFindingRequest(StreamInput sin) throws IOException { | ||
this( | ||
sin.readString(), | ||
sin.readEnum(Detector.DetectorType.class), | ||
sin.readLong(), | ||
sin.readInt() | ||
); | ||
} | ||
|
||
@Override | ||
public ActionRequestValidationException validate() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
out.writeString(findingId); | ||
out.writeEnum(detectorType); | ||
out.writeLong(timeWindow); | ||
out.writeInt(noOfNearbyFindings); | ||
} | ||
|
||
public String getFindingId() { | ||
return findingId; | ||
} | ||
|
||
public Detector.DetectorType getDetectorType() { | ||
return detectorType; | ||
} | ||
|
||
public long getTimeWindow() { | ||
return timeWindow; | ||
} | ||
|
||
public int getNoOfNearbyFindings() { | ||
return noOfNearbyFindings; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/org/opensearch/securityanalytics/action/CorrelatedFindingResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.opensearch.securityanalytics.action; | ||
|
||
import org.opensearch.action.ActionResponse; | ||
import org.opensearch.common.io.stream.StreamInput; | ||
import org.opensearch.common.io.stream.StreamOutput; | ||
import org.opensearch.core.xcontent.ToXContentObject; | ||
import org.opensearch.core.xcontent.XContentBuilder; | ||
import org.opensearch.securityanalytics.model.FindingWithScore; | ||
|
||
import java.io.IOException; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
public class CorrelatedFindingResponse extends ActionResponse implements ToXContentObject { | ||
|
||
private List<FindingWithScore> findings; | ||
|
||
protected static final String FINDINGS = "findings"; | ||
|
||
public CorrelatedFindingResponse(List<FindingWithScore> findings) { | ||
super(); | ||
this.findings = findings; | ||
} | ||
|
||
public CorrelatedFindingResponse(StreamInput sin) throws IOException { | ||
this( | ||
Collections.unmodifiableList(sin.readList(FindingWithScore::new)) | ||
); | ||
} | ||
|
||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
out.writeCollection(findings); | ||
} | ||
|
||
@Override | ||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { | ||
builder.startObject() | ||
.field(FINDINGS, findings) | ||
.endObject(); | ||
return builder; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/org/opensearch/securityanalytics/action/DeleteCorrelationRuleAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.securityanalytics.action; | ||
|
||
import org.opensearch.action.ActionType; | ||
import org.opensearch.action.support.master.AcknowledgedResponse; | ||
|
||
public class DeleteCorrelationRuleAction extends ActionType<AcknowledgedResponse> { | ||
|
||
public static final DeleteCorrelationRuleAction INSTANCE = new DeleteCorrelationRuleAction(); | ||
public static final String NAME = "cluster:admin/index/correlation/rules/delete"; | ||
|
||
private DeleteCorrelationRuleAction() { | ||
super(NAME, AcknowledgedResponse::new); | ||
} | ||
} |
Oops, something went wrong.