Search in sources :

Example 6 with Obligation

use of com.thinkbiganalytics.metadata.rest.model.sla.Obligation 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)

Example 7 with Obligation

use of com.thinkbiganalytics.metadata.rest.model.sla.Obligation in project kylo by Teradata.

the class FeedExecutedSinceFeeds method buildPreconditionObligation.

/**
 * Builds the ObligationGroup that holds the metric that will be used to assess if this precondition is met or not
 */
public com.thinkbiganalytics.metadata.rest.model.sla.ObligationGroup buildPreconditionObligation() {
    Set<Metric> metrics = new HashSet<>();
    for (String categoryAndFeed : categoryAndFeedList) {
        FeedExecutedSinceFeed metric = new FeedExecutedSinceFeed(sinceCategoryAndFeedName, categoryAndFeed);
        metrics.add(metric);
    }
    Obligation obligation = new Obligation();
    obligation.setMetrics(Lists.newArrayList(metrics));
    com.thinkbiganalytics.metadata.rest.model.sla.ObligationGroup group = new com.thinkbiganalytics.metadata.rest.model.sla.ObligationGroup();
    group.addObligation(obligation);
    group.setCondition(ObligationGroup.Condition.REQUIRED.name());
    return group;
}
Also used : Obligation(com.thinkbiganalytics.metadata.rest.model.sla.Obligation) FeedExecutedSinceFeed(com.thinkbiganalytics.metadata.api.sla.FeedExecutedSinceFeed) Metric(com.thinkbiganalytics.metadata.sla.api.Metric) ObligationGroup(com.thinkbiganalytics.metadata.sla.api.ObligationGroup) HashSet(java.util.HashSet)

Aggregations

Obligation (com.thinkbiganalytics.metadata.rest.model.sla.Obligation)7 ObligationGroup (com.thinkbiganalytics.metadata.sla.api.ObligationGroup)4 HashSet (java.util.HashSet)4 Metric (com.thinkbiganalytics.metadata.sla.api.Metric)3 FeedMetadata (com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata)2 FeedServicesAccessControl (com.thinkbiganalytics.feedmgr.security.FeedServicesAccessControl)2 MetadataAccess (com.thinkbiganalytics.metadata.api.MetadataAccess)2 ServiceLevelAgreementActionConfiguration (com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreementActionConfiguration)2 ArrayList (java.util.ArrayList)2 Stopwatch (com.google.common.base.Stopwatch)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 Lists (com.google.common.collect.Lists)1 Sets (com.google.common.collect.Sets)1 ServicesApplicationStartupListener (com.thinkbiganalytics.app.ServicesApplicationStartupListener)1 VelocityTemplate (com.thinkbiganalytics.common.velocity.model.VelocityTemplate)1 VelocityTemplateProvider (com.thinkbiganalytics.common.velocity.service.VelocityTemplateProvider)1 HadoopAuthorizationService (com.thinkbiganalytics.datalake.authorization.service.HadoopAuthorizationService)1 CreateFeedBuilder (com.thinkbiganalytics.feedmgr.nifi.CreateFeedBuilder)1 PropertyExpressionResolver (com.thinkbiganalytics.feedmgr.nifi.PropertyExpressionResolver)1 TemplateConnectionUtil (com.thinkbiganalytics.feedmgr.nifi.TemplateConnectionUtil)1