2017-02-10 22:35:02 +01:00
|
|
|
"""STIX 2 Bundle object"""
|
|
|
|
|
|
|
|
from .base import _STIXBase
|
2017-04-25 00:29:56 +02:00
|
|
|
from .properties import IDProperty, Property, TypeProperty
|
2017-02-10 22:35:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Bundle(_STIXBase):
|
|
|
|
|
|
|
|
_type = 'bundle'
|
|
|
|
_properties = {
|
2017-02-24 17:46:21 +01:00
|
|
|
'type': TypeProperty(_type),
|
2017-02-24 17:20:24 +01:00
|
|
|
'id': IDProperty(_type),
|
2017-02-24 17:50:43 +01:00
|
|
|
'spec_version': Property(fixed="2.0"),
|
2017-02-24 20:07:54 +01:00
|
|
|
'objects': Property(),
|
2017-02-10 22:35:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
# Add any positional arguments to the 'objects' kwarg.
|
|
|
|
if args:
|
2017-07-05 17:31:56 +02:00
|
|
|
if isinstance(args[0], list):
|
|
|
|
kwargs['objects'] = args[0] + list(args[1:]) + kwargs.get('objects', [])
|
|
|
|
else:
|
|
|
|
kwargs['objects'] = list(args) + kwargs.get('objects', [])
|
2017-02-10 22:35:02 +01:00
|
|
|
|
|
|
|
super(Bundle, self).__init__(**kwargs)
|