1 # Licensed under the Apache License, Version 2.0 (the "License"); you may
2 # not use this file except in compliance with the License. You may obtain
3 # a copy of the License at
5 # http://www.apache.org/licenses/LICENSE-2.0
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10 # License for the specific language governing permissions and limitations
14 from toscaparser.common.exception import ExceptionCollector
15 from toscaparser.common.exception import UnsupportedTypeError
16 from toscaparser.utils.gettextutils import _
18 log = logging.getLogger('tosca')
21 class UnsupportedType(object):
23 """Note: TOSCA spec version related
25 The tosca.nodes.Storage.ObjectStorage and tosca.nodes.Storage.BlockStorage
26 used here as un_supported_types are part of the name changes in TOSCA spec
27 version 1.1. The original name as specified in version 1.0 are,
28 tosca.nodes.BlockStorage and tosca.nodes.ObjectStorage which are supported
29 by the tosca-parser. Since there are little overlapping in version support
30 currently in the tosca-parser, the names tosca.nodes.Storage.ObjectStorage
31 and tosca.nodes.Storage.BlockStorage are used here to demonstrate the usage
32 of un_supported_types. As tosca-parser move to provide support for version
33 1.1 and higher, they will be removed.
35 un_supported_types = ['tosca.test.invalidtype',
36 'tosca.nodes.Storage.ObjectStorage',
37 'tosca.nodes.Storage.BlockStorage']
43 def validate_type(entitytype):
44 if entitytype in UnsupportedType.un_supported_types:
45 ExceptionCollector.appendException(UnsupportedTypeError(