Merge "Add deployment scripts for vRNC"
[parser.git] / tosca2heat / heat-translator / translator / hot / syntax / hot_parameter.py
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License"); you may
3 # not use this file except in compliance with the License. You may obtain
4 # a copy of the License at
5 #
6 # http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11 # License for the specific language governing permissions and limitations
12 # under the License.
13
14 from collections import OrderedDict
15 import logging
16 from toscaparser.utils.gettextutils import _
17
18 KEYS = (TYPE, DESCRIPTION, DEFAULT, CONSTRAINTS, HIDDEN, LABEL) = \
19        ('type', 'description', 'default', 'constraints', 'hidden', 'label')
20
21 log = logging.getLogger('heat-translator')
22
23
24 class HotParameter(object):
25     '''Attributes for HOT parameter section.'''
26
27     def __init__(self, name, type, label=None, description=None, default=None,
28                  hidden=None, constraints=None):
29         self.name = name
30         self.type = type
31         self.label = label
32         self.description = description
33         self.default = default
34         self.hidden = hidden
35         self.constraints = constraints
36         log.info(_('Initialized the input parameters.'))
37
38     def get_dict_output(self):
39         param_sections = OrderedDict()
40         param_sections[TYPE] = self.type
41         if self.label:
42             param_sections[LABEL] = self.label
43         if self.description:
44             param_sections[DESCRIPTION] = self.description
45         if self.default:
46             param_sections[DEFAULT] = self.default
47         if self.hidden:
48             param_sections[HIDDEN] = self.hidden
49         if self.constraints:
50             param_sections[CONSTRAINTS] = self.constraints
51
52         return {self.name: param_sections}