63db854ab6d603456e80d4b6800da62c582aaae1
[policy/clamp.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.clamp.acm.participant.intermediary.api;
22
23 import org.onap.policy.models.base.PfModelException;
24
25 /**
26  * This interface is implemented by participant implementations to receive updates on automation composition elements.
27  */
28 public interface AutomationCompositionElementListener {
29     /**
30      * Handle a deployment on an automation composition element.
31      *
32      * @param compositionElement the information of the Automation Composition Definition Element
33      * @param instanceElement    the information of the Automation Composition Instance Element
34      * @throws PfModelException from Policy framework
35      */
36     void deploy(CompositionElementDto compositionElement, InstanceElementDto instanceElement) throws PfModelException;
37
38     /**
39      * Handle an udeploy on an automation composition element.
40      *
41      * @param compositionElement the information of the Automation Composition Definition Element
42      * @param instanceElement    the information of the Automation Composition Instance Element
43      * @throws PfModelException in case of a model exception
44      */
45     void undeploy(CompositionElementDto compositionElement, InstanceElementDto instanceElement) throws PfModelException;
46
47     /**
48      * Handle a lock on an automation composition element.
49      *
50      * @param compositionElement the information of the Automation Composition Definition Element
51      * @param instanceElement    the information of the Automation Composition Instance Element
52      * @throws PfModelException in case of a model exception
53      */
54     void lock(CompositionElementDto compositionElement, InstanceElementDto instanceElement) throws PfModelException;
55
56     /**
57      * Handle an unlock on an automation composition element.
58      *
59      * @param compositionElement the information of the Automation Composition Definition Element
60      * @param instanceElement    the information of the Automation Composition Instance Element
61      * @throws PfModelException in case of a model exception
62      */
63     void unlock(CompositionElementDto compositionElement, InstanceElementDto instanceElement) throws PfModelException;
64
65     /**
66      * Handle delete on an automation composition element.
67      *
68      * @param compositionElement the information of the Automation Composition Definition Element
69      * @param instanceElement    the information of the Automation Composition Instance Element
70      * @throws PfModelException in case of a model exception
71      */
72     void delete(CompositionElementDto compositionElement, InstanceElementDto instanceElement) throws PfModelException;
73
74     /**
75      * Handle an update on an automation composition element.
76      *
77      * @param compositionElement     the information of the Automation Composition Definition Element
78      * @param instanceElement        the information of the Automation Composition Instance Element
79      * @param instanceElementUpdated the information of the Automation Composition Instance Element updated
80      * @throws PfModelException from Policy framework
81      */
82     void update(CompositionElementDto compositionElement, InstanceElementDto instanceElement,
83                 InstanceElementDto instanceElementUpdated) throws PfModelException;
84
85     void prime(CompositionDto composition) throws PfModelException;
86
87     void deprime(CompositionDto composition) throws PfModelException;
88
89     /**
90      * Handle an update on an automation composition element.
91      *
92      * @param compositionElement       the information of the Automation Composition Definition Element
93      * @param compositionElementTarget the information of the Automation Composition Definition Element Target
94      * @param instanceElement          the information of the Automation Composition Instance Element
95      * @param instanceElementMigrate   the information of the Automation Composition Instance Element updated
96      * @param nextStage                the next stage
97      * @throws PfModelException from Policy framework
98      */
99     void migrate(CompositionElementDto compositionElement, CompositionElementDto compositionElementTarget,
100                  InstanceElementDto instanceElement, InstanceElementDto instanceElementMigrate,
101                  int nextStage) throws PfModelException;
102
103     void migratePrecheck(CompositionElementDto compositionElement, CompositionElementDto compositionElementTarget,
104                          InstanceElementDto instanceElement, InstanceElementDto instanceElementMigrate)
105         throws PfModelException;
106
107     void review(CompositionElementDto compositionElement, InstanceElementDto instanceElement)
108         throws PfModelException;
109
110     void prepare(CompositionElementDto compositionElement, InstanceElementDto instanceElement, int nextStage)
111         throws PfModelException;
112
113     /**
114      * Rollback migration changes done to a composition.
115      *
116      * @param compositionElement the composition to roll back the changes
117      * @param instanceElement    instance to roll back the changes
118      * @param nextStage         in which stage should the instance be after the rollback
119      * @throws PfModelException if anything goes wrong
120      */
121     void rollbackMigration(CompositionElementDto compositionElement,
122                            InstanceElementDto instanceElement, int nextStage)
123         throws PfModelException;
124 }