use of com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAgreement in project kylo by Teradata.
the class IntegrationTestBase method deleteExistingSla.
protected void deleteExistingSla() {
LOG.info("Deleting existing SLAs");
ServiceLevelAgreement[] agreements = getSla();
for (ServiceLevelAgreement agreement : agreements) {
deleteSla(agreement.getId());
}
agreements = getSla();
Assert.assertTrue(agreements.length == 0);
}
use of com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAgreement in project kylo by Teradata.
the class ServiceLevelAgreementClientTest method testCreateSLA.
// @Test
public void testCreateSLA() {
ServiceLevelAgreement sla = new ServiceLevelAgreement("TestSLA1", new FeedExecutedSinceFeed("category", "FeedA", "category", "FeedX"), new FeedExecutedSinceFeed("category", "FeedB", "category", "FeedX"));
ServiceLevelAgreement result = client.createSla(sla);
assertThat(result).isNotNull();
}
use of com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAgreement 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.metadata.rest.model.sla.ServiceLevelAgreement in project kylo by Teradata.
the class ServiceLevelAgreementMetricTransformerHelper method getServiceLevelAgreement.
public ServiceLevelAgreement getServiceLevelAgreement(ServiceLevelAgreementGroup serviceLevelAgreement) {
ServiceLevelAgreement transformedSla = new ServiceLevelAgreement();
transformedSla.setId(serviceLevelAgreement.getId());
transformedSla.setName(serviceLevelAgreement.getName());
transformedSla.setDescription(serviceLevelAgreement.getDescription());
for (ServiceLevelAgreementRule rule : serviceLevelAgreement.getRules()) {
try {
ObligationGroup group = new ObligationGroup();
Metric policy = ServiceLevelAgreementMetricTransformer.instance().fromUiModel(rule);
Obligation obligation = new Obligation(policy.getDescription());
obligation.setMetrics(Lists.newArrayList(policy));
group.addObligation(obligation);
group.setCondition(rule.getCondition().name());
transformedSla.addGroup(group);
} catch (PolicyTransformException e) {
throw new RuntimeException(e);
}
}
return transformedSla;
}
Aggregations