MCPcopy Create free account
hub / github.com/STIXProject/python-stix / SuggestedCOAs

Class SuggestedCOAs

stix/indicator/indicator.py:30–90  ·  view source on GitHub ↗

The ``SuggestedCOAs`` class provides functionality for adding :class:`stix.common.related.RelatedCOA` instances to an :class:`Indicator` instance. The ``SuggestedCOAs`` class implements methods found on ``collections.MutableSequence`` and as such can be interacted with as a ``li

Source from the content-addressed store, hash-verified

28from .valid_time import ValidTime
29
30class SuggestedCOAs(GenericRelationshipList):
31 """The ``SuggestedCOAs`` class provides functionality for adding
32 :class:`stix.common.related.RelatedCOA` instances to an :class:`Indicator`
33 instance.
34
35 The ``SuggestedCOAs`` class implements methods found on
36 ``collections.MutableSequence`` and as such can be interacted with as a
37 ``list`` (e.g., ``append()``).
38
39 The ``append()`` method can accept instances of
40 :class:`stix.common.related.RelatedCOA` or :class:`stix.coa.CourseOfAction`
41 as an argument.
42
43 Note:
44 Calling ``append()`` with an instance of
45 :class:`stix.coa.CourseOfAction` will wrap that instance in a
46 :class:`stix.common.related.RelatedCOA` layer, with the ``item`` set to
47 the :class:`stix.coa.CourseOfAction` instance.
48
49 Examples:
50 Append an instance of :class:`stix.coa.CourseOfAction` to the
51 ``Indicator.suggested_coas`` property. The instance of
52 :class:`stix.coa.CourseOfAction` will be wrapped in an instance of
53 :class:`stix.common.related.RelatedCOA`.
54
55 >>> coa = CourseOfAction()
56 >>> indicator = Indicator()
57 >>> indicator.suggested_coas.append(coa)
58 >>> print(type(indicator.suggested_coas[0]))
59 <class 'stix.common.related.RelatedCOA'>
60
61 Iterate over the ``suggested_coas`` property of an :class:`Indicator`
62 instance and print the ids of each underlying
63 :class:`stix.coa.CourseOfAction` instance.
64
65 >>> for related_coa in indicator.suggested_coas:
66 >>> print(related_coa.item.id_)
67
68 Args:
69 suggested_coas(list): A list of :class:`stix.coa.CourseOfAction`
70 or :class:`stix.common.related.RelatedCOA` instances.
71 scope (str): The scope of the items. Can be set to ``"inclusive"``
72 or ``"exclusive"``. See
73 :class:`stix.common.related.GenericRelationshipList` documentation
74 for more information.
75
76 Attributes:
77 scope (str): The scope of the items. Can be set to ``"inclusive"``
78 or ``"exclusive"``. See
79 :class:`stix.common.related.GenericRelationshipList` documentation
80 for more information.
81 """
82
83 _namespace = "http://docs.oasis-open.org/cti/ns/stix/indicator-1"
84 _binding = indicator_binding
85 _binding_class = indicator_binding.SuggestedCOAsType
86
87 suggested_coa = fields.TypedField("Suggested_COA", RelatedCOA, multiple=True, key_name="suggested_coas")

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected