use of com.thinkbiganalytics.feedmgr.sla.ServiceLevelAgreementGroup in project kylo by Teradata.
the class ServiceLevelAgreementRestController method getSlaAsForm.
@GET
@Path("/{slaId}/form-object")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation("Gets the form for editing the specified SLA.")
@ApiResponses({ @ApiResponse(code = 200, message = "Returns the SLA form.", response = ServiceLevelAgreementGroup.class), @ApiResponse(code = 400, message = "The slaId is not a valid UUID.", response = RestResponseStatus.class) })
public Response getSlaAsForm(@UUID @PathParam("slaId") String slaId) {
accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.ACCESS_SERVICE_LEVEL_AGREEMENTS);
ServiceLevelAgreementGroup agreement = serviceLevelAgreementService.getServiceLevelAgreementAsFormObject(slaId);
return Response.ok(agreement).build();
}
use of com.thinkbiganalytics.feedmgr.sla.ServiceLevelAgreementGroup in project kylo by Teradata.
the class ServiceLevelAgreementRestController method saveAndScheduleFeedSla.
/**
* Save an SLA and attach the ref to the Feed
*/
@POST
@Path("/feed/{feedId}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation("Saves the SLA and attaches it to the specified feed.")
@ApiResponses({ @ApiResponse(code = 200, message = "Returns the SLA.", response = ServiceLevelAgreementGroup.class), @ApiResponse(code = 400, message = "The feedId is not a valid UUID.", response = RestResponseStatus.class), @ApiResponse(code = 500, message = "The SLA could not be saved.", response = RestResponseStatus.class) })
public Response saveAndScheduleFeedSla(@UUID @PathParam("feedId") String feedId, ServiceLevelAgreementGroup sla) {
accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.EDIT_SERVICE_LEVEL_AGREEMENTS);
ServiceLevelAgreement serviceLevelAgreement = serviceLevelAgreementService.saveAndScheduleFeedSla(sla, feedId);
ServiceLevelAgreementMetricTransformerHelper helper = new ServiceLevelAgreementMetricTransformerHelper();
ServiceLevelAgreementGroup serviceLevelAgreementGroup = helper.toServiceLevelAgreementGroup(serviceLevelAgreement);
return Response.ok(serviceLevelAgreementGroup).build();
}
use of com.thinkbiganalytics.feedmgr.sla.ServiceLevelAgreementGroup in project kylo by Teradata.
the class SlaIT method testSla.
@Test
public void testSla() throws IOException {
copyDataToDropzone(TEST_FILE);
LocalDateTime now = LocalDateTime.now();
String systemName = now.format(DateTimeFormatter.ofPattern("HH_mm_ss_SSS"));
FeedMetadata response = createSimpleFeed("sla_" + systemName, TEST_FILE);
waitForFeedToComplete();
ServiceLevelAgreementGroup oneHourAgoSla = createOneHourAgoFeedProcessingDeadlineSla(response.getCategoryAndFeedName(), response.getFeedId());
triggerSla(oneHourAgoSla.getName());
assertSLA(oneHourAgoSla.getId(), FAILURE);
assertFilterByFailuresContains(oneHourAgoSla.getId());
assertFilterBySuccessContainsNot(oneHourAgoSla.getId());
assertFailedSlaAppearsInAlerts(oneHourAgoSla.getId());
ServiceLevelAgreementGroup oneHourAheadSla = createOneHourAheadFeedProcessingDeadlineSla(response.getCategoryAndFeedName(), response.getFeedId());
triggerSla(oneHourAheadSla.getName());
assertFilterByFailuresContainsNot(oneHourAheadSla.getId());
assertFilterBySuccessContains(oneHourAheadSla.getId());
assertSuccessfulSlaAppearsNotInAlerts(oneHourAheadSla.getId());
deleteExistingSla();
}
use of com.thinkbiganalytics.feedmgr.sla.ServiceLevelAgreementGroup in project kylo by Teradata.
the class ServiceLevelAgreementRestController method saveSla.
/**
* Save the General SLA coming in from the UI that is not related to a Feed
*/
@POST
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation("Saves the specified SLA.")
@ApiResponses({ @ApiResponse(code = 200, message = "Returns the SLA.", response = ServiceLevelAgreementGroup.class), @ApiResponse(code = 500, message = "The SLA could not be saved.", response = RestResponseStatus.class) })
public Response saveSla(ServiceLevelAgreementGroup sla) {
accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.EDIT_SERVICE_LEVEL_AGREEMENTS);
ServiceLevelAgreement serviceLevelAgreement = serviceLevelAgreementService.saveAndScheduleSla(sla);
ServiceLevelAgreementMetricTransformerHelper helper = new ServiceLevelAgreementMetricTransformerHelper();
ServiceLevelAgreementGroup serviceLevelAgreementGroup = helper.toServiceLevelAgreementGroup(serviceLevelAgreement);
return Response.ok(serviceLevelAgreementGroup).build();
}
use of com.thinkbiganalytics.feedmgr.sla.ServiceLevelAgreementGroup in project kylo by Teradata.
the class IntegrationTestBase method createFeedProcessingDeadlineSla.
private ServiceLevelAgreementGroup createFeedProcessingDeadlineSla(String feedName, String feedId, LocalDateTime deadline, String noLaterThanHours) {
int hourOfDay = deadline.get(ChronoField.HOUR_OF_DAY);
int minuteOfHour = deadline.get(ChronoField.MINUTE_OF_HOUR);
String cronExpression = String.format("0 %s %s 1/1 * ? *", minuteOfHour, hourOfDay);
ServiceLevelAgreementGroup sla = new ServiceLevelAgreementGroup();
String time = deadline.format(DateTimeFormatter.ofPattern("HH:mm"));
sla.setName("Before " + time + " (cron: " + cronExpression + ")");
sla.setDescription("The feed should complete before given date and time");
List<ServiceLevelAgreementRule> rules = new ArrayList<>();
ServiceLevelAgreementRule rule = new ServiceLevelAgreementRule();
rule.setName("Feed Processing deadline");
rule.setDisplayName("Feed Processing deadline");
rule.setDescription("Ensure a Feed processes data by a specified time");
rule.setObjectClassType("com.thinkbiganalytics.metadata.sla.api.core.FeedOnTimeArrivalMetric");
rule.setObjectShortClassType("FeedOnTimeArrivalMetric");
rule.setCondition(ObligationGroup.Condition.REQUIRED);
rule.setProperties(newFieldRuleProperties(newFieldRuleProperty("FeedName", "feedName", feedName), newFieldRuleProperty("ExpectedDeliveryTime", "cronString", cronExpression), newFieldRuleProperty("NoLaterThanTime", "lateTime", noLaterThanHours), newFieldRuleProperty("NoLaterThanUnits", "lateUnits", "hrs")));
rules.add(rule);
sla.setRules(rules);
Response response = given(ServiceLevelAgreementRestController.V1_FEEDMGR_SLA).body(sla).when().post(String.format("feed/%s", feedId));
response.then().statusCode(HTTP_OK);
return response.as(ServiceLevelAgreementGroup.class);
}
Aggregations