2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.openecomp.policy.controlloop.policy.guard.builder;
22 import org.openecomp.policy.controlloop.policy.builder.BuilderException;
23 import org.openecomp.policy.controlloop.policy.builder.Results;
24 import org.openecomp.policy.controlloop.policy.guard.Constraint;
25 import org.openecomp.policy.controlloop.policy.guard.ControlLoopGuard;
26 import org.openecomp.policy.controlloop.policy.guard.Guard;
27 import org.openecomp.policy.controlloop.policy.guard.GuardPolicy;
28 import org.openecomp.policy.controlloop.policy.guard.builder.impl.ControlLoopGuardBuilderImpl;
30 public interface ControlLoopGuardBuilder {
33 * Adds one or more guard policies to the Control Loop Guard
38 * @throws BuilderException
40 public ControlLoopGuardBuilder addGuardPolicy(GuardPolicy... policies) throws BuilderException;
43 * Removes one or more guard policies from the Control Loop Guard
48 * @throws BuilderException
50 public ControlLoopGuardBuilder removeGuardPolicy(GuardPolicy... policies) throws BuilderException;
53 * Removes all guard policies from the Control Loop Guard
58 * @throws BuilderException
60 public ControlLoopGuardBuilder removeAllGuardPolicies() throws BuilderException;
63 * Adds one or more time limit constraints to the guard policy
66 * @param id (guard policy id)
69 * @throws BuilderException
71 public ControlLoopGuardBuilder addLimitConstraint(String id, Constraint... constraints) throws BuilderException;
74 * Removes one or more time limit constraints from the guard policy
77 * @param id (guard policy id)
80 * @throws BuilderException
82 public ControlLoopGuardBuilder removeLimitConstraint(String id, Constraint... constraints) throws BuilderException;
85 * Removes all time limit constraints from the guard policy
88 * @param id (guard policy id)
90 * @throws BuilderException
92 public ControlLoopGuardBuilder removeAllLimitConstraints(String id) throws BuilderException;
95 * Simply return a copy of control loop guard
97 * @return ControlLoopGuard
99 public ControlLoopGuard getControlLoopGuard();
102 * This will compile and build the YAML specification for the Control Loop Guard. Please iterate the Results object for details.
103 * The Results object will contains warnings and errors. If the specification compiled successfully, you will be able to retrieve the
108 public Results buildSpecification();
111 * The Factory is used to build a ControlLoopGuardBuilder implementation.
114 public static class Factory {
118 * @return ControlLoopGuardBuilder object
119 * @throws BuilderException
121 public static ControlLoopGuardBuilder buildControlLoopGuard (Guard guard) throws BuilderException {
123 ControlLoopGuardBuilder builder = new ControlLoopGuardBuilderImpl(guard);