acstore.helpers package

Submodules

acstore.helpers.json_serializer module

Attribute container JSON serializer.

class acstore.helpers.json_serializer.AttributeContainerJSONSerializer[source]

Bases: object

Attribute container JSON serializer.

classmethod ConvertAttributeContainerToJSON(attribute_container)[source]

Converts an attribute container object into a JSON dictioary.

The resulting dictionary of the JSON serialized objects consists of: {

‘__type__’: ‘AttributeContainer’ ‘__container_type__’: … …

}

Here ‘__type__’ indicates the object base type. In this case ‘AttributeContainer’.

‘__container_type__’ indicates the container type and rest of the elements of the dictionary that make up the attributes of the container.

Parameters:

attribute_container (AttributeContainer) – attribute container.

Returns:

JSON serialized objects.

Return type:

dict[str, object]

classmethod ConvertJSONToAttributeContainer(json_dict)[source]

Converts a JSON dictionary into an attribute container object.

The dictionary of the JSON serialized objects consists of: {

‘__type__’: ‘AttributeContainer’ ‘__container_type__’: … …

}

Here ‘__type__’ indicates the object base type. In this case ‘AttributeContainer’.

‘__container_type__’ indicates the container type and rest of the elements of the dictionary that make up the attributes of the container.

Parameters:

json_dict (dict[str, object]) – JSON serialized objects.

Returns:

attribute container.

Return type:

AttributeContainer

acstore.helpers.schema module

Schema helper.

class acstore.helpers.schema.SchemaHelper[source]

Bases: object

Schema helper.

classmethod DeregisterDataType(data_type)[source]

Deregisters a data type.

Parameters:

data_type (str) – data type.

Raises:

KeyError – if the data type is not set.

classmethod GetAttributeSerializer(data_type, serialization_method)[source]

Retrieves a specific attribute serializer.

Parameters:
  • data_type (str) – data type.

  • serialization_method (str) – serialization method.

Returns:

attribute serializer or None if not available.

Return type:

AttributeSerializer

classmethod HasDataType(data_type)[source]

Determines is a specific data type is supported by the schema.

Parameters:

data_type (str) – data type.

Returns:

True if the data type is supported, or False otherwise.

Return type:

bool

classmethod RegisterDataType(data_type, serializers)[source]

Registers a data type.

Parameters:
  • data_type (str) – data type.

  • serializers (dict[str, AttributeSerializer]) – attribute serializers per method.

Raises:

KeyError – if the data type is already set.

classmethod RegisterDataTypes(data_types)[source]

Registers data types.

Parameters:

(dict[str (data_types) – dict[str, AttributeSerializer]]): attribute serializers with method per data types.

Raises:

KeyError – if the data type is already set.

acstore.helpers.yaml_definitions_file module

YAML-based attribute container definitions file.

class acstore.helpers.yaml_definitions_file.AttributeContainerWithSchema[source]

Bases: AttributeContainer

Attribute container with schema.

SCHEMA = {}
class acstore.helpers.yaml_definitions_file.YAMLAttributeContainerDefinitionsFile[source]

Bases: object

YAML-based attribute container definitions file.

A YAML-based attribute container definitions file contains one or more attribute container definitions. An attribute container definition consists of:

name: windows_eventlog_message_file attributes: - name: path

type: str

  • name: windows_path type: str

Where: * name, unique identifier of the attribute container; * attributes, defines the attributes of the container.

ReadFromFile(path)[source]

Reads the definitions from a YAML file.

Parameters:

path (str) – path to a definitions file.

Yields:

AttributeContainer – an attribute container.

Module contents