# Path: dftimewolf/lib/state.py
# T = TypeVar("T", bound="interface.AttributeContainer")  # pylint: disable=invalid-name,line-too-long
# NEW_ISSUE_URL = 'https://github.com/log2timeline/dftimewolf/issues/new'
# class DFTimewolfState(object):
#   def __init__(self, config: Type[Config]) -> None:
#   def _InvokeModulesInThreads(self, callback: Callable[[Any], Any]) -> None:
#   def ImportRecipeModules(self, module_locations: Dict[str, str]) -> None:
#   def LoadRecipe(self,
#                  recipe: Dict[str, Any],
#                  module_locations: Dict[str, str]) -> None:
#   def FormatExecutionPlan(self) -> str:
#   def LogExecutionPlan(self) -> None:
#   def AddToCache(self, name: str, value: Any) -> None:
#   def GetFromCache(self, name: str, default_value: Any=None) -> Any:
#   def StoreContainer(self, container: "interface.AttributeContainer") -> None:
#   def GetContainers(self,
#                     container_class: Type[T],
#                     pop: bool=False) -> Sequence[T]:
#   def DedupeContainers(self, container_class: Type[T]) -> None:
#   def _SetupModuleThread(self, module_definition: Dict[str, str]) -> None:
#   def SetupModules(self) -> None:
#   def _RunModuleThread(self, module_definition: Dict[str, str]) -> None:
#   def RunPreflights(self) -> None:
#   def CleanUpPreflights(self) -> None:
#   def InstantiateModule(self, module_name: str) -> "dftw_module.BaseModule":
#   def RunModules(self) -> None:
#   def RegisterStreamingCallback(
#       self,
#       target: Callable[["interface.AttributeContainer"], Any],
#       container_type: Type["interface.AttributeContainer"]) -> None:
#   def StreamContainer(self, container: "interface.AttributeContainer") -> None:
#   def AddError(self, error: DFTimewolfError) -> None:
#   def CleanUp(self) -> None:
#   def CheckErrors(self, is_global: bool=False) -> None:
# 
# Path: dftimewolf/lib/processors/gcp_logging_timesketch.py
# class GCPLoggingTimesketch(BaseModule):
#   DATA_TYPE = 'gcp:log:json'
#   def __init__(self,
#                state: "state.DFTimewolfState",
#                name: Optional[str]=None,
#                critical: bool=False) -> None:
#   def SetUp(self, *args, **kwargs):  # type: ignore
#   def _ProcessLogLine(self,
#                       log_line: str,
#                       query: str,
#                       project_name: str) -> str:
#   def _parse_proto_payload(
#       self,
#       proto_payload: Dict[str, Any],
#       timesketch_record: Dict[str, str]) -> None:
#   def _ParseProtoPayloadRequest(
#       self,
#       request: Dict[str, Any],
#       timesketch_record: Dict[str, Any]) -> None:
#   def _ParseJSONPayload(self,
#       json_payload: Dict[str, Any],
#       timesketch_record: Dict[str, Any]) -> None:
#   def _BuildMessageString(self, timesketch_record: Dict[str, Any]) -> None:
#   def _ProcessLogContainer(self, logs_container: containers.GCPLogs) -> None:
#   def Process(self) -> None:
# 
# Path: dftimewolf/config.py
# class Config(object):
#   def GetExtra(cls, name: str='') -> Dict[str, Any]:
#   def LoadExtra(cls, filename: str) -> bool:
#   def LoadExtraData(cls, json_string: bytes) -> None:
#   def ClearExtra(cls) -> None:


import json
import unittest
from dftimewolf.lib import state
from dftimewolf.lib.processors import gcp_logging_timesketch
from dftimewolf import config
            'storage.googleapis.com',
        'methodName':
            'storage.buckets.create',
        'resourceName':
            'projects/_/buckets/test_bucket_1',
        'resource_label_bucket_name':
            'test_bucket_1',
        'policyDelta':
            'ADD projectEditor:ketchup-research with role '
            'roles/storage.legacyBucketOwner, ADD '
            'projectOwner:ketchup-research with role '
            'roles/storage.legacyBucketOwner, ADD '
            'projectViewer:ketchup-research with role '
            'roles/storage.legacyBucketReader',
        'message':
            'User heinz-57@ketchup-research.iam.gserviceaccount.com '
            'performed storage.buckets.create on '
            'projects/_/buckets/test_bucket_1',
        'severity': 'NOTICE'
    }

    # pylint: disable=protected-access
    actual_timesketch_record = processor._ProcessLogLine(
        gcs_creation, 'test_query', 'test_project')
    actual_timesketch_record = json.loads(actual_timesketch_record)
    self.assertDictEqual(expected_timesketch_record, actual_timesketch_record)

  def testDataProcYarn(self):
    """Tests that a Yarn dataproc log is transformed correctly."""
    test_state = state.DFTimewolfState(config.Config)

# Path: dftimewolf/lib/state.py
# T = TypeVar("T", bound="interface.AttributeContainer")  # pylint: disable=invalid-name,line-too-long
# NEW_ISSUE_URL = 'https://github.com/log2timeline/dftimewolf/issues/new'
# class DFTimewolfState(object):
#   def __init__(self, config: Type[Config]) -> None:
#   def _InvokeModulesInThreads(self, callback: Callable[[Any], Any]) -> None:
#   def ImportRecipeModules(self, module_locations: Dict[str, str]) -> None:
#   def LoadRecipe(self,
#                  recipe: Dict[str, Any],
#                  module_locations: Dict[str, str]) -> None:
#   def FormatExecutionPlan(self) -> str:
#   def LogExecutionPlan(self) -> None:
#   def AddToCache(self, name: str, value: Any) -> None:
#   def GetFromCache(self, name: str, default_value: Any=None) -> Any:
#   def StoreContainer(self, container: "interface.AttributeContainer") -> None:
#   def GetContainers(self,
#                     container_class: Type[T],
#                     pop: bool=False) -> Sequence[T]:
#   def DedupeContainers(self, container_class: Type[T]) -> None:
#   def _SetupModuleThread(self, module_definition: Dict[str, str]) -> None:
#   def SetupModules(self) -> None:
#   def _RunModuleThread(self, module_definition: Dict[str, str]) -> None:
#   def RunPreflights(self) -> None:
#   def CleanUpPreflights(self) -> None:
#   def InstantiateModule(self, module_name: str) -> "dftw_module.BaseModule":
#   def RunModules(self) -> None:
#   def RegisterStreamingCallback(
#       self,
#       target: Callable[["interface.AttributeContainer"], Any],
#       container_type: Type["interface.AttributeContainer"]) -> None:
#   def StreamContainer(self, container: "interface.AttributeContainer") -> None:
#   def AddError(self, error: DFTimewolfError) -> None:
#   def CleanUp(self) -> None:
#   def CheckErrors(self, is_global: bool=False) -> None:
# 
# Path: dftimewolf/lib/processors/gcp_logging_timesketch.py
# class GCPLoggingTimesketch(BaseModule):
#   DATA_TYPE = 'gcp:log:json'
#   def __init__(self,
#                state: "state.DFTimewolfState",
#                name: Optional[str]=None,
#                critical: bool=False) -> None:
#   def SetUp(self, *args, **kwargs):  # type: ignore
#   def _ProcessLogLine(self,
#                       log_line: str,
#                       query: str,
#                       project_name: str) -> str:
#   def _parse_proto_payload(
#       self,
#       proto_payload: Dict[str, Any],
#       timesketch_record: Dict[str, str]) -> None:
#   def _ParseProtoPayloadRequest(
#       self,
#       request: Dict[str, Any],
#       timesketch_record: Dict[str, Any]) -> None:
#   def _ParseJSONPayload(self,
#       json_payload: Dict[str, Any],
#       timesketch_record: Dict[str, Any]) -> None:
#   def _BuildMessageString(self, timesketch_record: Dict[str, Any]) -> None:
#   def _ProcessLogContainer(self, logs_container: containers.GCPLogs) -> None:
#   def Process(self) -> None:
# 
# Path: dftimewolf/config.py
# class Config(object):
#   def GetExtra(cls, name: str='') -> Dict[str, Any]:
#   def LoadExtra(cls, filename: str) -> bool:
#   def LoadExtraData(cls, json_string: bytes) -> None:
#   def ClearExtra(cls) -> None:


# Path: tests/lib/processors/gcp_logging_timesketch.py
import json
import unittest
from dftimewolf.lib import state
from dftimewolf.lib.processors import gcp_logging_timesketch
from dftimewolf import config

            'storage.googleapis.com',
        'methodName':
            'storage.buckets.create',
        'resourceName':
            'projects/_/buckets/test_bucket_1',
        'resource_label_bucket_name':
            'test_bucket_1',
        'policyDelta':
            'ADD projectEditor:ketchup-research with role '
            'roles/storage.legacyBucketOwner, ADD '
            'projectOwner:ketchup-research with role '
            'roles/storage.legacyBucketOwner, ADD '
            'projectViewer:ketchup-research with role '
            'roles/storage.legacyBucketReader',
        'message':
            'User heinz-57@ketchup-research.iam.gserviceaccount.com '
            'performed storage.buckets.create on '
            'projects/_/buckets/test_bucket_1',
        'severity': 'NOTICE'
    }

    # pylint: disable=protected-access
    actual_timesketch_record = processor._ProcessLogLine(
        gcs_creation, 'test_query', 'test_project')
    actual_timesketch_record = json.loads(actual_timesketch_record)
    self.assertDictEqual(expected_timesketch_record, actual_timesketch_record)

  def testDataProcYarn(self):
    """Tests that a Yarn dataproc log is transformed correctly."""
    test_state = state.DFTimewolfState(config.Config)

    processor = gcp_logging_timesketch.GCPLoggingTimesketch(test_state)