Version: 1.2.0
ramrod.cybox
Module¶
-
ramrod.cybox.
get_version
(doc)¶ Returns the version number for input CybOX document.
-
ramrod.cybox.
register_updater
(cls)¶ Registers a CybOX updater class.
-
ramrod.cybox.
update
(doc, from_=None, to_=None, options=None, force=False)¶ Updates a CybOX document to align with a given version of the CybOX Language.
Parameters: - doc – A CybOX document filename, file-like object,
etree._Element
, oretree._ElementTree
. - from (optional, string) – The base version for the update process. If
None
, an attempt will be made to extract the version number from doc. - to (optional, string) – The version to update to. If
None
, the latest version of CybOX is assumed. - options (optional) – A
ramrod.UpdateOptions
instance. IfNone
,ramrod.DEFAULT_UPDATE_OPTIONS
will be used. - force (boolean) – Forces the update process. This may result in content being removed during the update process and could result in schema-invalid content. Use at your own risk!
Returns: An instance of
ramrod.UpdateResults
.Raises: UpdateError
– If any of the following conditions are encountered:- The from_ or to_ versions are invalid.
- An untranslatable field is encountered and force is
False
. - A non-unique ID is encountered and force is
False
.
InvalidVersionError
– If the source document version and the from_ value do not match and force isFalse
.UnknownVersionError
– If the source document does not contain version information and force isFalse
.
- doc – A CybOX document filename, file-like object,