use of org.opensearch.ad.transport.EntityProfileRequest in project anomaly-detection by opensearch-project.
the class EntityProfileRunner method prepareEntityProfile.
private void prepareEntityProfile(ActionListener<EntityProfile> listener, String detectorId, Entity entityValue, Set<EntityProfileName> profilesToCollect, AnomalyDetector detector, String categoryField) {
EntityProfileRequest request = new EntityProfileRequest(detectorId, entityValue, profilesToCollect);
client.execute(EntityProfileAction.INSTANCE, request, ActionListener.wrap(r -> getJob(detectorId, entityValue, profilesToCollect, detector, r, listener), listener::onFailure));
}
use of org.opensearch.ad.transport.EntityProfileRequest in project anomaly-detection by opensearch-project.
the class BwcTests method setUpEntityProfileRequest.
private void setUpEntityProfileRequest() {
profilesToCollect = new HashSet<EntityProfileName>();
profilesToCollect.add(EntityProfileName.STATE);
entityProfileRequest1_1 = new EntityProfileRequest(detectorId, entity, profilesToCollect);
entityProfileRequest1_0 = new EntityProfileRequest1_0(detectorId, categoryValue, profilesToCollect);
}
use of org.opensearch.ad.transport.EntityProfileRequest in project anomaly-detection by opensearch-project.
the class BwcTests method testDeserializeEntityProfileRequest1_1.
/**
* For EntityResultRequest, the input is a 1.1 stream.
* @throws IOException when serialization/deserialization has issues.
*/
public void testDeserializeEntityProfileRequest1_1() throws IOException {
setUpEntityProfileRequest();
entityProfileRequest1_1.writeTo(output1_1);
StreamInput streamInput = output1_1.bytes().streamInput();
streamInput.setVersion(V_1_1_0);
EntityProfileRequest readRequest = new EntityProfileRequest(streamInput);
assertThat(readRequest.getAdID(), equalTo(detectorId));
assertThat(readRequest.getEntityValue(), equalTo(entity));
assertThat(readRequest.getProfilesToCollect(), equalTo(profilesToCollect));
}
use of org.opensearch.ad.transport.EntityProfileRequest in project anomaly-detection by opensearch-project.
the class BwcTests method testDeserializeEntityProfileRequest1_0.
/**
* For EntityResultRequest, the input is a 1.0 stream.
* @throws IOException when serialization/deserialization has issues.
*/
public void testDeserializeEntityProfileRequest1_0() throws IOException {
setUpEntityProfileRequest();
entityProfileRequest1_0.writeTo(output1_0);
StreamInput streamInput = output1_0.bytes().streamInput();
streamInput.setVersion(Version.V_1_0_0);
EntityProfileRequest readRequest = new EntityProfileRequest(streamInput);
assertThat(readRequest.getAdID(), equalTo(detectorId));
assertThat(readRequest.getEntityValue(), equalTo(convertedEntity));
assertThat(readRequest.getProfilesToCollect(), equalTo(profilesToCollect));
}
Aggregations