def persist_content(manager, collection_name, service_id, timestamp=None, binding=CB_STIX_XML_111, subtypes=[]): timestamp = timestamp or get_utc_now() content_binding = entities.ContentBindingEntity(binding=binding, subtypes=subtypes) content = entities.ContentBlockEntity(content=CONTENT, timestamp_label=timestamp, message=MESSAGE, content_binding=content_binding) collection = manager.get_collection(collection_name, service_id) if not collection: raise ValueError('No collection with name {}'.format(collection_name)) content = manager.create_content(content, collections=[collection]) return content
def persist_content(manager, collection_name, service_id, timestamp=None, binding=CB_STIX_XML_111, subtypes=[]): timestamp = timestamp or get_utc_now() content_binding = entities.ContentBindingEntity( binding=binding, subtypes=subtypes ) content = entities.ContentBlockEntity( content=CONTENT, timestamp_label=timestamp, message=MESSAGE, content_binding=content_binding) collection = manager.get_collection(collection_name, service_id) if not collection: raise ValueError('No collection with name {}'.format(collection_name)) content = manager.create_content(content, collections=[collection]) return content