class_docstr: StreamAlert payload object for incoming records
  
  Attributes:
      resource (str): The name of the resource from which this log originated.
          Can be a kinesis stream name, SNS topic, or S3 bucket name.
      raw_record: The record from the AWS Lambda Records dictionary.
      fully_classified (bool): Whether the payload has been successfully
          and completely classified.
class_docstr_tok: ["StreamAlert","payload","object","for","incoming","records","Attributes",":","resource","(","str",")",":","The","name","of","the","resource","from","which","this","log","originated",".","Can","be","a","kinesis","stream","name",",","SNS","topic",",","or","S3","bucket","name",".","raw_record",":","The","record","from","the","AWS","Lambda","Records","dictionary",".","fully_classified","(","bool",")",":","Whether","the","payload","has","been","successfully","and","completely","classified","."]
docstr: Extract the originating AWS service and resource from a raw record
  
  Each raw record contains a set of keys that represent its source.
  A Kinesis record will contain a 'kinesis' key, while a S3 record
  contains 's3', and an SNS record contains an 'Sns' key, and so on
  
  This method also supports loading an S3 event notification that is received via SNS.
  
  Args:
      raw_record (dict): A raw record as a dictionary
  
  Returns:
      StreamPayload: Loaded subclass of StreamPayload for the proper payload type
docstr_tok: ["Extract","the","originating","AWS","service","and","resource","from","a","raw","record","Each","raw","record","contains","a","set","of","keys","that","represent","its","source",".","A","Kinesis","record","will","contain","a","'kinesis","'","key",",","while","a","S3","record","contains","'s3","'",",","and","an","SNS","record","contains","an","'Sns","'","key",",","and","so","on","This","method","also","supports","loading","an","S3","event","notification","that","is","received","via","SNS",".","Args",":","raw_record","(","dict",")",":","A","raw","record","as","a","dictionary","Returns",":","StreamPayload",":","Loaded","subclass","of","StreamPayload","for","the","proper","payload","type"]
code: def load_from_raw_record(cls, raw_record):
      """Extract the originating AWS service and resource from a raw record
  
      Each raw record contains a set of keys that represent its source.
      A Kinesis record will contain a 'kinesis' key, while a S3 record
      contains 's3', and an SNS record contains an 'Sns' key, and so on
  
      This method also supports loading an S3 event notification that is received via SNS.
  
      Args:
          raw_record (dict): A raw record as a dictionary
  
      Returns:
          StreamPayload: Loaded subclass of StreamPayload for the proper payload type
      """
      # Sns is capitalized below because this is how AWS stores it within the Record
      # Other services above, like s3, are not stored like this. Do not alter it!
      resource_mapper = {
          "kinesis": lambda r: r["eventSourceARN"].split("/")[-1],
          "s3": lambda r: r["s3"]["bucket"]["name"],
          "Sns": lambda r: r["Sns"]["TopicArn"].split(":")[-1],
          "streamalert_app": lambda r: r["streamalert_app"],
      }
  
      service, resource = None, None
      # check raw record for either kinesis, s3, or apps keys
      for svc, map_function in resource_mapper.items():
          if svc in raw_record:
              # map the resource name from a record
              resource = map_function(raw_record)
              service = svc
              break
  
      # If this is an s3 event notification via SNS, extract the bucket from the record
      if (
          "Sns" in raw_record
          and raw_record["Sns"].get("Type") == "Notification"
          and raw_record["Sns"].get("Subject")
          == "Amazon S3 Notification"
      ):
          service = "s3"
  
          # Assign the s3 event notification data to the raw_record and extract the resource
          raw_record = json.loads(raw_record["Sns"]["Message"])[
              "Records"
          ][0]
          resource = resource_mapper[service](raw_record)
  
      if not (service and resource):
          LOGGER.error(
              "No valid service (%s) or resource (%s) found in payload's raw "
              "record, skipping: %s",
              service,
              resource,
              raw_record,
          )
          return False
  
      return RegisterInput.load_for_service(
          service.lower(), resource, raw_record
      )
  
imports: from abc import ABCMeta, abstractmethod, abstractproperty
  import json
  import logging
  import os
  from streamalert.shared.logger import get_logger
label_desc: Use image node_id 4 for calling the StreamPayload obj's underlying member method code with example usage: obj.load_from_raw_record(cls, raw_record) and returns: RegisterInput, False