pycti.entities.opencti_vocabulary
Classes
Main Vocabulary class for OpenCTI |
Module Contents
- class pycti.entities.opencti_vocabulary.Vocabulary(opencti)[source]
Main Vocabulary class for OpenCTI
Manages vocabularies and controlled vocabularies in the OpenCTI platform.
- Parameters:
opencti (OpenCTIApiClient) – instance of
OpenCTIApiClient
Initialize the Vocabulary instance.
- Parameters:
opencti (OpenCTIApiClient) – OpenCTI API client instance
- static generate_id(name, category)[source]
Generate a STIX ID for a Vocabulary.
- Parameters:
name (str) – the name of the Vocabulary
category (str) – the category of the Vocabulary
- Returns:
STIX ID for the Vocabulary
- Return type:
str
- static generate_id_from_data(data)[source]
Generate a STIX ID from Vocabulary data.
- Parameters:
data (dict) – Dictionary containing ‘name’ and ‘category’ keys
- Returns:
STIX ID for the Vocabulary
- Return type:
str
- list(**kwargs)[source]
List Vocabulary objects.
- Parameters:
filters (dict) – the filters to apply
- Returns:
List of Vocabulary objects
- Return type:
list
- read(**kwargs)[source]
Read a Vocabulary object.
- Parameters:
id (str) – the id of the Vocabulary
filters (dict) – the filters to apply if no id provided
- Returns:
Vocabulary object
- Return type:
dict or None
- read_or_create_unchecked_with_cache(vocab, cache, field)[source]
Read or create a Vocabulary using a cache for optimization.
- Parameters:
vocab (str) – the vocabulary name
cache (dict) – the cache dictionary
field (dict) – the field configuration containing ‘required’ and ‘key’
- Returns:
Vocabulary object or None
- Return type:
dict or None
- create(**kwargs)[source]
Create a Vocabulary object.
- Parameters:
stix_id (str) – (optional) the STIX ID
name (str) – the name of the Vocabulary (required)
category (str) – the category of the Vocabulary (required)
description (str) – (optional) description
created (str) – (optional) creation date
modified (str) – (optional) modification date
aliases (list) – (optional) list of aliases
x_opencti_stix_ids (list) – (optional) list of additional STIX IDs
update (bool) – (optional) whether to update if exists (default: False)
- Returns:
Vocabulary object
- Return type:
dict or None
- read_or_create_unchecked(**kwargs)[source]
Read or create a Vocabulary.
If the user has no rights to create the vocabulary, return None.
- Parameters:
name (str) – the vocabulary name
required (bool) – whether the vocabulary is required
category (str) – the category of the vocabulary
- Returns:
The available or created Vocabulary object
- Return type:
dict or None