vFW and vDNS support added to azure-plugin
[multicloud/azure.git] / azure / aria / aria-extension-cloudify / src / aria / aria / orchestrator / topology / common.py
1 # Licensed to the Apache Software Foundation (ASF) under one or more
2 # contributor license agreements.  See the NOTICE file distributed with
3 # this work for additional information regarding copyright ownership.
4 # The ASF licenses this file to You under the Apache License, Version 2.0
5 # (the "License"); you may not use this file except in compliance with
6 # the License.  You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16
17 class HandlerBase(object):
18     def __init__(self, topology, model):
19         self._topology = topology
20         self._model = model
21
22     def coerce(self, **kwargs):
23         raise NotImplementedError
24
25     def _coerce(self, *models, **kwargs):
26         for template in models:
27             self._topology.coerce(template, **kwargs)
28
29     def validate(self, **kwargs):
30         raise NotImplementedError
31
32     def _validate(self, *models, **kwargs):
33         for template in models:
34             self._topology.validate(template, **kwargs)
35
36     def dump(self, out_stream):
37         raise NotImplementedError
38
39
40 class TemplateHandlerBase(HandlerBase):
41     """
42     Base handler for template based models
43     """
44
45     def instantiate(self, instance_cls, **kwargs):
46         raise NotImplementedError
47
48
49 class InstanceHandlerBase(HandlerBase):
50     """
51     Base handler for instance based models
52
53     """
54     def validate(self, **kwargs):
55         raise NotImplementedError
56
57     def coerce(self, **kwargs):
58         raise NotImplementedError
59
60     def dump(self, out_stream):
61         raise NotImplementedError
62
63
64 class ActorHandlerBase(HandlerBase):
65     """
66     Base handler for any model which has (or contains a field which references) an operation
67     """
68     def configure_operations(self):
69         raise NotImplementedError