Search in sources :

Example 6 with ServiceLevelAgreement

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);
}
Also used : ServiceLevelAgreement(com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAgreement)

Example 7 with ServiceLevelAgreement

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();
}
Also used : ServiceLevelAgreement(com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAgreement) FeedExecutedSinceFeed(com.thinkbiganalytics.metadata.api.sla.FeedExecutedSinceFeed)

Example 8 with ServiceLevelAgreement

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();
}
Also used : ServiceLevelAgreement(com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAgreement) FeedServiceLevelAgreement(com.thinkbiganalytics.metadata.rest.model.sla.FeedServiceLevelAgreement) ServiceLevelAgreementGroup(com.thinkbiganalytics.feedmgr.sla.ServiceLevelAgreementGroup) ServiceLevelAgreementMetricTransformerHelper(com.thinkbiganalytics.feedmgr.sla.ServiceLevelAgreementMetricTransformerHelper) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 9 with ServiceLevelAgreement

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;
}
Also used : Obligation(com.thinkbiganalytics.metadata.rest.model.sla.Obligation) ServiceLevelAgreement(com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAgreement) Metric(com.thinkbiganalytics.metadata.sla.api.Metric) PolicyTransformException(com.thinkbiganalytics.policy.PolicyTransformException) ObligationGroup(com.thinkbiganalytics.metadata.rest.model.sla.ObligationGroup)

Aggregations

ServiceLevelAgreement (com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAgreement)9 FeedServiceLevelAgreement (com.thinkbiganalytics.metadata.rest.model.sla.FeedServiceLevelAgreement)3 ApiOperation (io.swagger.annotations.ApiOperation)3 ApiResponses (io.swagger.annotations.ApiResponses)3 Produces (javax.ws.rs.Produces)3 ServiceLevelAgreementGroup (com.thinkbiganalytics.feedmgr.sla.ServiceLevelAgreementGroup)2 ServiceLevelAgreementMetricTransformerHelper (com.thinkbiganalytics.feedmgr.sla.ServiceLevelAgreementMetricTransformerHelper)2 FeedServiceLevelAgreement (com.thinkbiganalytics.metadata.api.sla.FeedServiceLevelAgreement)2 Obligation (com.thinkbiganalytics.metadata.rest.model.sla.Obligation)2 Path (javax.ws.rs.Path)2 Lists (com.google.common.collect.Lists)1 Response (com.jayway.restassured.response.Response)1 ServicesApplicationStartupListener (com.thinkbiganalytics.app.ServicesApplicationStartupListener)1 VelocityTemplate (com.thinkbiganalytics.common.velocity.model.VelocityTemplate)1 VelocityTemplateProvider (com.thinkbiganalytics.common.velocity.service.VelocityTemplateProvider)1 FeedMetadata (com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata)1 FeedServicesAccessControl (com.thinkbiganalytics.feedmgr.security.FeedServicesAccessControl)1 FeedManagerFeedService (com.thinkbiganalytics.feedmgr.service.feed.FeedManagerFeedService)1 MetadataAccess (com.thinkbiganalytics.metadata.api.MetadataAccess)1 Feed (com.thinkbiganalytics.metadata.api.feed.Feed)1