summaryrefslogtreecommitdiffstats
path: root/azure/aria/aria-extension-cloudify/src/aria/extensions/aria_extension_tosca/simple_v1_0/templates.py
blob: 3c36bb8a6f2b8e7c2de6f49039c135e917e96e0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from aria.utils.collections import (FrozenDict, FrozenList)
from aria.utils.caching import cachedmethod
from aria.parser import implements_specification
from aria.parser.presentation import (has_fields, primitive_field, primitive_list_field,
                                      object_field, object_list_field, object_dict_field,
                                      object_sequenced_list_field, field_validator,
                                      type_validator, list_type_validator)

from .assignments import (PropertyAssignment, AttributeAssignment, RequirementAssignment,
                          CapabilityAssignment, InterfaceAssignment, ArtifactAssignment)
from .definitions import ParameterDefinition
from .filters import NodeFilter
from .misc import (Description, MetaData, Repository, Import, SubstitutionMappings)
from .modeling.parameters import (get_assigned_and_defined_parameter_values, get_parameter_values)
from .modeling.interfaces import get_template_interfaces
from .modeling.requirements import get_template_requirements
from .modeling.capabilities import get_template_capabilities
from .modeling.artifacts import get_inherited_artifact_definitions
from .modeling.policies import get_policy_targets
from .modeling.copy import get_default_raw_from_copy
from .presentation.extensible import ExtensiblePresentation
from .presentation.field_validators import copy_validator, policy_targets_validator
from .presentation.types import (convert_name_to_full_type_name, get_type_by_name)
from .types import (ArtifactType, DataType, CapabilityType, InterfaceType, RelationshipType,
                    NodeType, GroupType, PolicyType)


@has_fields
@implements_specification('3.7.3', 'tosca-simple-1.0')
class NodeTemplate(ExtensiblePresentation):
    """
    A Node Template specifies the occurrence of a manageable software component as part of an
    application's topology model which is defined in a TOSCA Service Template. A Node template is an
    instance of a specified Node Type and can provide customized properties, constraints or
    operations which override the defaults provided by its Node Type and its implementations.

    See the `TOSCA Simple Profile v1.0 cos01 specification <http://docs.oasis-open.org/tosca
    /TOSCA-Simple-Profile-YAML/v1.0/cos01/TOSCA-Simple-Profile-YAML-v1.0-cos01.html
    #DEFN_ENTITY_NODE_TEMPLATE>`__
    """

    @field_validator(type_validator('node type', convert_name_to_full_type_name, 'node_types'))
    @primitive_field(str, required=True)
    def type(self):
        """
        The required name of the Node Type the Node Template is based upon.

        :type: :obj:`basestring`
        """

    @object_field(Description)
    def description(self):
        """
        An optional description for the Node Template.

        :type: :class:`Description`
        """

    @primitive_list_field(str)
    def directives(self):
        """
        An optional list of directive values to provide processing instructions to orchestrators and
        tooling.

        :type: [:obj:`basestring`]
        """

    @object_dict_field(PropertyAssignment)
    def properties(self):
        """
        An optional list of property value assignments for the Node Template.

        :type: {:obj:`basestring`: :class:`PropertyAssignment`}
        """

    @object_dict_field(AttributeAssignment)
    def attributes(self):
        """
        An optional list of attribute value assignments for the Node Template.

        :type: {:obj:`basestring`: :class:`AttributeAssignment`}
        """

    @object_sequenced_list_field(RequirementAssignment)
    def requirements(self):
        """
        An optional sequenced list of requirement assignments for the Node Template.

        :type: list of (str, :class:`RequirementAssignment`)
        """

    @object_dict_field(CapabilityAssignment)
    def capabilities(self):
        """
        An optional list of capability assignments for the Node Template.

        :type: {:obj:`basestring`: :class:`CapabilityAssignment`}
        """

    @object_dict_field(InterfaceAssignment)
    def interfaces(self):
        """
        An optional list of named interface definitions for the Node Template.

        :type: {:obj:`basestring`: :class:`InterfaceAssignment`}
        """

    @object_dict_field(ArtifactAssignment)
    def artifacts(self):
        """
        An optional list of named artifact definitions for the Node Template.

        :type: {:obj:`basestring`: :class:`ArtifactAssignment`}
        """

    @object_field(NodeFilter)
    def node_filter(self):
        """
        The optional filter definition that TOSCA orchestrators would use to select the correct
        target node. This keyname is only valid if the directive has the value of "selectable" set.

        :type: :class:`NodeFilter`
        """

    @field_validator(copy_validator('node template', 'node_templates'))
    @primitive_field(str)
    def copy(self):
        """
        The optional (symbolic) name of another node template to copy into (all keynames and values)
        and use as a basis for this node template.

        :type: :obj:`basestring`
        """

    @cachedmethod
    def _get_default_raw(self):
        return get_default_raw_from_copy(self, 'node_templates')

    @cachedmethod
    def _get_type(self, context):
        return get_type_by_name(context, self.type, 'node_types')

    @cachedmethod
    def _get_property_values(self, context):
        return FrozenDict(get_assigned_and_defined_parameter_values(context, self, 'property'))

    @cachedmethod
    def _get_attribute_default_values(self, context):
        return FrozenDict(get_assigned_and_defined_parameter_values(context, self, 'attribute'))

    @cachedmethod
    def _get_requirements(self, context):
        return FrozenList(get_template_requirements(context, self))

    @cachedmethod
    def _get_capabilities(self, context):
        return FrozenDict(get_template_capabilities(context, self))

    @cachedmethod
    def _get_interfaces(self, context):
        return FrozenDict(get_template_interfaces(context, self, 'node template'))

    @cachedmethod
    def _get_artifacts(self, context):
        return FrozenDict(get_inherited_artifact_definitions(context, self))

    def _validate(self, context):
        super(NodeTemplate, self)._validate(context)
        self._get_property_values(context)
        self._get_requirements(context)
        self._get_capabilities(context)
        self._get_interfaces(context)
        self._get_artifacts(context)

    def _dump(self, context):
        self._dump_content(context, (
            'description',
            'type',
            'directives',
            'properties',
            'attributes',
            'requirements',
            'capabilities',
            'interfaces',
            'artifacts',
            'node_filter',
            'copy'))


@has_fields
@implements_specification('3.7.4', 'tosca-simple-1.0')
class RelationshipTemplate(ExtensiblePresentation):
    """
    A Relationship Template specifies the occurrence of a manageable relationship between node
    templates as part of an application's topology model that is defined in a TOSCA Service
    Template. A Relationship template is an instance of a specified Relationship Type and can
    provide customized properties, constraints or operations which override the defaults provided by
    its Relationship Type and its implementations.

    See the `TOSCA Simple Profile v1.0 cos01 specification <http://docs.oasis-open.org/tosca
    /TOSCA-Simple-Profile-YAML/v1.0/cos01/TOSCA-Simple-Profile-YAML-v1.0-cos01.html
    #DEFN_ENTITY_RELATIONSHIP_TEMPLATE>`__
    """

    @field_validator(type_validator('relationship type', convert_name_to_full_type_name,
                                    'relationship_types'))
    @primitive_field(str, required=True)
    def type(self):
        """
        The required name of the Relationship Type the Relationship Template is based upon.

        :type: :obj:`basestring`
        """

    @object_field(Description)
    def description(self):
        """
        An optional description for the Relationship Template.

        :type: :class:`Description`
        """

    @object_dict_field(PropertyAssignment)
    def properties(self):
        """
        An optional list of property assignments for the Relationship Template.

        :type: {:obj:`basestring`: :class:`PropertyAssignment`}
        """

    @object_dict_field(AttributeAssignment)
    def attributes(self):
        """
        An optional list of attribute assignments for the Relationship Template.

        :type: {:obj:`basestring`: :class:`AttributeAssignment`}
        """

    @object_dict_field(InterfaceAssignment)
    def interfaces(self):
        """
        An optional list of named interface definitions for the Node Template.

        ARIA NOTE: Spec is wrong here, should be Relationship Template.

        :type: {:obj:`basestring`: :class:`InterfaceAssignment`}
        """

    @field_validator(copy_validator('relationship template', 'relationship_templates'))
    @primitive_field(str)
    def copy(self):
        """
        The optional (symbolic) name of another relationship template to copy into (all keynames and
        values) and use as a basis for this relationship template.

        :type: :obj:`basestring`
        """

    @cachedmethod
    def _get_default_raw(self):
        return get_default_raw_from_copy(self, 'relationship_templates')

    @cachedmethod
    def _get_type(self, context):
        return get_type_by_name(context, self.type, 'relationship_types')

    @cachedmethod
    def _get_property_values(self, context):
        return FrozenDict(get_assigned_and_defined_parameter_values(context, self, 'property'))

    @cachedmethod
    def _get_interfaces(self, context):
        return FrozenDict(get_template_interfaces(context, self, 'relationship template'))

    def _validate(self, context):
        super(RelationshipTemplate, self)._validate(context)
        self._get_property_values(context)
        self._get_interfaces(context)

    def _dump(self, context):
        self._dump_content(context, (
            'description',
            'type',
            'properties',
            'attributes',
            'interfaces',
            'copy'))


@has_fields
@implements_specification('3.7.5', 'tosca-simple-1.0')
class GroupTemplate(ExtensiblePresentation):
    """
    A group definition defines a logical grouping of node templates, typically for management
    purposes, but is separate from the application's topology template.

    See the `TOSCA Simple Profile v1.0 cos01 specification <http://docs.oasis-open.org/tosca
    /TOSCA-Simple-Profile-YAML/v1.0/cos01/TOSCA-Simple-Profile-YAML-v1.0-cos01.html
    #DEFN_ELEMENT_GROUP_DEF>`__
    """

    @field_validator(type_validator('group type', convert_name_to_full_type_name,
                                    'group_types'))
    @primitive_field(str, required=True)
    def type(self):
        """
        The required name of the group type the group definition is based upon.

        :type: :obj:`basestring`
        """

    @object_field(Description)
    def description(self):
        """
        The optional description for the group definition.

        :type: :class:`Description`
        """

    @object_dict_field(PropertyAssignment)
    def properties(self):
        """
        An optional list of property value assignments for the group definition.

        :type: {:obj:`basestring`: :class:`PropertyAssignment`}
        """

    @field_validator(list_type_validator('node template', 'topology_template', 'node_templates'))
    @primitive_list_field(str)
    def members(self):
        """
        The optional list of one or more node template names that are members of this group
        definition.

        :type: [:obj:`basestring`]
        """

    @object_dict_field(InterfaceAssignment)
    def interfaces(self):
        """
        An optional list of named interface definitions for the group definition.

        :type: {:obj:`basestring`: :class:`InterfaceDefinition`}
        """

    @cachedmethod
    def _get_type(self, context):
        return get_type_by_name(context, self.type, 'group_types')

    @cachedmethod
    def _get_property_values(self, context):
        return FrozenDict(get_assigned_and_defined_parameter_values(context, self, 'property'))

    @cachedmethod
    def _get_interfaces(self, context):
        return FrozenDict(get_template_interfaces(context, self, 'group definition'))

    def _validate(self, context):
        super(GroupTemplate, self)._validate(context)
        self._get_property_values(context)
        self._get_interfaces(context)


@has_fields
@implements_specification('3.7.6', 'tosca-simple-1.0')
class PolicyTemplate(ExtensiblePresentation):
    """
    A policy definition defines a policy that can be associated with a TOSCA topology or top-level
    entity definition (e.g., group definition, node template, etc.).

    See the `TOSCA Simple Profile v1.0 cos01 specification <http://docs.oasis-open.org/tosca
    /TOSCA-Simple-Profile-YAML/v1.0/cos01/TOSCA-Simple-Profile-YAML-v1.0-cos01.html
    #DEFN_ELEMENT_POLICY_DEF>`__
    """

    @field_validator(type_validator('policy type', convert_name_to_full_type_name, 'policy_types'))
    @primitive_field(str, required=True)
    def type(self):
        """
        The required name of the policy type the policy definition is based upon.

        :type: :obj:`basestring`
        """

    @object_field(Description)
    def description(self):
        """
        The optional description for the policy definition.

        :type: :class:`Description`
        """

    @object_dict_field(PropertyAssignment)
    def properties(self):
        """
        An optional list of property value assignments for the policy definition.

        :type: {:obj:`basestring`: :class:`PropertyAssignment`
        """

    @field_validator(policy_targets_validator)
    @primitive_list_field(str)
    def targets(self):
        """
        An optional list of valid Node Templates or Groups the Policy can be applied to.

        :type: [:obj:`basestring`]
        """

    @cachedmethod
    def _get_type(self, context):
        return get_type_by_name(context, self.type, 'policy_types')

    @cachedmethod
    def _get_property_values(self, context):
        return FrozenDict(get_assigned_and_defined_parameter_values(context, self, 'property'))

    @cachedmethod
    def _get_targets(self, context):
        node_templates, groups = get_policy_targets(context, self)
        return FrozenList(node_templates), FrozenList(groups)

    def _validate(self, context):
        super(PolicyTemplate, self)._validate(context)
        self._get_property_values(context)


@has_fields
@implements_specification('3.8', 'tosca-simple-1.0')
class TopologyTemplate(ExtensiblePresentation):
    """
    This section defines the topology template of a cloud application. The main ingredients of the
    topology template are node templates representing components of the application and relationship
    templates representing links between the components. These elements are defined in the nested
    ``node_templates`` section and the nested relationship_templates sections, respectively.
    Furthermore, a topology template allows for defining input parameters, output parameters as well
    as grouping of node templates.

    See the `TOSCA Simple Profile v1.0 cos01 specification <http://docs.oasis-open.org/tosca
    /TOSCA-Simple-Profile-YAML/v1.0/cos01/TOSCA-Simple-Profile-YAML-v1.0-cos01.html
    #DEFN_ENTITY_TOPOLOGY_TEMPLATE>`__
    """

    @object_field(Description)
    def description(self):
        """
        The optional description for the Topology Template.

        :type: :class:`Description`
        """

    @object_dict_field(ParameterDefinition)
    def inputs(self):
        """
        An optional list of input parameters (i.e., as parameter definitions) for the Topology
        Template.

        :type: {:obj:`basestring`: :class:`ParameterDefinition`}
        """

    @object_dict_field(NodeTemplate)
    def node_templates(self):
        """
        An optional list of node template definitions for the Topology Template.

        :type: {:obj:`basestring`: :class:`NodeTemplate`}
        """

    @object_dict_field(RelationshipTemplate)
    def relationship_templates(self):
        """
        An optional list of relationship templates for the Topology Template.

        :type: {:obj:`basestring`: :class:`RelationshipTemplate`}
        """

    @object_dict_field(GroupTemplate)
    def groups(self):
        """
        An optional list of Group definitions whose members are node templates defined within this
        same Topology Template.

        :class:`GroupTemplate`
        """

    @object_dict_field(PolicyTemplate)
    def policies(self):
        """
        An optional list of Policy definitions for the Topology Template.

        :type: {:obj:`basestring`: :class:`PolicyTemplate`}
        """

    @object_dict_field(ParameterDefinition)
    def outputs(self):
        """
        An optional list of output parameters (i.e., as parameter definitions) for the Topology
        Template.

        :type: {:obj:`basestring`: :class:`ParameterDefinition`}
        """

    @object_field(SubstitutionMappings)
    def substitution_mappings(self):
        """
        An optional declaration that exports the topology template as an implementation of a Node
        type.

        This also includes the mappings between the external Node Types named capabilities and
        requirements to existing implementations of those capabilities and requirements on Node
        templates declared within the topology template.
        """

    @cachedmethod
    def _get_input_values(self, context):
        return FrozenDict(get_parameter_values(context, self, 'inputs'))

    @cachedmethod
    def _get_output_values(self, context):
        return FrozenDict(get_parameter_values(context, self, 'outputs'))

    def _validate(self, context):
        super(TopologyTemplate, self)._validate(context)
        self._get_input_values(context)
        self._get_output_values(context)

    def _dump(self, context):
        self._dump_content(context, (
            'description',
            'inputs',
            'node_templates',
            'relationship_templates',
            'groups',
            'policies',
            'outputs',
            'substitution_mappings'))


@has_fields
@implements_specification('3.9', 'tosca-simple-1.0')
class ServiceTemplate(ExtensiblePresentation):
    """
    Servicate template.

    See the `TOSCA Simple Profile v1.0 cos01 specification <http://docs.oasis-open.org/tosca
    /TOSCA-Simple-Profile-YAML/v1.0/cos01/TOSCA-Simple-Profile-YAML-v1.0-cos01.html
    #DEFN_ELEMENT_SERVICE_TEMPLATE>`__.
    """

    @primitive_field(str)
    @implements_specification('3.9.3.1', 'tosca-simple-1.0')
    def tosca_definitions_version(self):
        """
        Defines the version of the TOSCA Simple Profile specification the template (grammar)
        complies with.

        See the `TOSCA Simple Profile v1.0 cos01 specification <http://docs.oasis-open.org/tosca
        /TOSCA-Simple-Profile-YAML/v1.0/cos01/TOSCA-Simple-Profile-YAML-v1.0-cos01.html
        #_Toc379455047>`__

        :type: :obj:`basestring`
        """

    @object_field(MetaData)
    def metadata(self):
        """
        Defines a section used to declare additional metadata information. Domain-specific TOSCA
        profile specifications may define keynames that are required for their implementations.

        See the `TOSCA Simple Profile v1.0 cos01 specification <http://docs.oasis-open.org/tosca
        /TOSCA-Simple-Profile-YAML/v1.0/cos01/TOSCA-Simple-Profile-YAML-v1.0-cos01.html
        #_Toc379455048>`__

        :type: :class:`MetaData`
        """

    @object_field(Description)
    @implements_specification('3.9.3.6', 'tosca-simple-1.0')
    def description(self):
        """
        Declares a description for this Service Template and its contents.

        :type: :class:`Description`
        """

    @primitive_field()
    @implements_specification('3.9.3.7', 'tosca-simple-1.0')
    def dsl_definitions(self):
        """
        Declares optional DSL-specific definitions and conventions. For example, in YAML, this
        allows defining reusable YAML macros (i.e., YAML alias anchors) for use throughout the TOSCA
        Service Template.

        See the `TOSCA Simple Profile v1.0 cos01 specification <http://docs.oasis-open.org/tosca
        /TOSCA-Simple-Profile-YAML/v1.0/cos01/TOSCA-Simple-Profile-YAML-v1.0-cos01.html
        #_Toc397688790>`__
        """

    @object_dict_field(Repository)
    @implements_specification('3.9.3.8', 'tosca-simple-1.0')
    def repositories(self):
        """
        Declares the list of external repositories which contain artifacts that are referenced in
        the service template along with their addresses and necessary credential information used to
        connect to them in order to retrieve the artifacts.

        :type: {:obj:`basestring`: :class:`Repository`}
        """

    @object_list_field(Import)
    @implements_specification('3.9.3.9', 'tosca-simple-1.0')
    def imports(self):
        """
        Declares import statements external TOSCA Definitions documents. For example, these may be
        file location or URIs relative to the service template file within the same TOSCA CSAR file.

        :type: list of :class:`Import`
        """

    @object_dict_field(ArtifactType)
    @implements_specification('3.9.3.10', 'tosca-simple-1.0')
    def artifact_types(self):
        """
        This section contains an optional list of artifact type definitions for use in the service
        template.

        :type: {:obj:`basestring`: :class:`ArtifactType`}
        """

    @object_dict_field(DataType)
    @implements_specification('3.9.3.11', 'tosca-simple-1.0')
    def data_types(self):
        """
        Declares a list of optional TOSCA Data Type definitions.

        :type: {:obj:`basestring`: :class:`DataType`}
        """

    @object_dict_field(CapabilityType)
    @implements_specification('3.9.3.12', 'tosca-simple-1.0')
    def capability_types(self):
        """
        This section contains an optional list of capability type definitions for use in the service
        template.

        :type: {:obj:`basestring`: :class:`CapabilityType`}
        """

    @object_dict_field(InterfaceType)
    @implements_specification('3.9.3.13', 'tosca-simple-1.0')
    def interface_types(self):
        """
        This section contains an optional list of interface type definitions for use in the service
        template.

        :type: {:obj:`basestring`: :class:`InterfaceType`}
        """

    @object_dict_field(RelationshipType)
    @implements_specification('3.9.3.14', 'tosca-simple-1.0')
    def relationship_types(self):
        """
        This section contains a set of relationship type definitions for use in the service
        template.

        :type: {:obj:`basestring`: :class:`RelationshipType`}
        """

    @object_dict_field(NodeType)
    @implements_specification('3.9.3.15', 'tosca-simple-1.0')
    def node_types(self):
        """
        This section contains a set of node type definitions for use in the service template.

        :type: {:obj:`basestring`: :class:`NodeType`}
        """

    @object_dict_field(GroupType)
    @implements_specification('3.9.3.16', 'tosca-simple-1.0')
    def group_types(self):
        """
        This section contains a list of group type definitions for use in the service template.

        :type: {:obj:`basestring`: :class:`GroupType`}
        """

    @object_dict_field(PolicyType)
    @implements_specification('3.9.3.17', 'tosca-simple-1.0')
    def policy_types(self):
        """
        This section contains a list of policy type definitions for use in the service template.

        :type: {:obj:`basestring`: :class:`PolicyType`}
        """

    @object_field(TopologyTemplate)
    def topology_template(self):
        """
        Defines the topology template of an application or service, consisting of node templates
        that represent the application's or service's components, as well as relationship templates
        representing relations between the components.

        :type: :class:`TopologyTemplate`
        """

    def _dump(self, context):
        self._dump_content(context, (
            'description',
            'tosca_definitions_version',
            'metadata',
            'repositories',
            'imports',
            'artifact_types',
            'data_types',
            'capability_types',
            'interface_types',
            'relationship_types',
            'node_types',
            'group_types',
            'policy_types',
            'topology_template'))