(payload)
Validate the payload includes all required keys.

  Will automatically add the following keys if they do not already exist:
    PayloadUUID, PayloadEnabled, PayloadVersion

  Args:
    payload: dict, the payload to validate.

  Raises:
    PayloadValidationError: the payload is missing a required key.
Validate the payload includes all required keys.
Validate the payload includes all required keys .
def ValidatePayload(payload):
  """Validate the payload includes all required keys.

  Will automatically add the following keys if they do not already exist:
    PayloadUUID, PayloadEnabled, PayloadVersion

  Args:
    payload: dict, the payload to validate.

  Raises:
    PayloadValidationError: the payload is missing a required key.
  """
  required_keys = [PAYLOADKEYS_IDENTIFIER,
                   PAYLOADKEYS_DISPLAYNAME,
                   PAYLOADKEYS_TYPE]

  for key in required_keys:
    if key not in payload:
      raise PayloadValidationError('Required key (%s) missing.' % key)

  if PAYLOADKEYS_UUID not in payload:
    payload[PAYLOADKEYS_UUID] = GenerateUUID(payload[PAYLOADKEYS_IDENTIFIER])

  if PAYLOADKEYS_ENABLED not in payload:
    payload[PAYLOADKEYS_ENABLED] = True

  if PAYLOADKEYS_VERSION not in payload:
    payload[PAYLOADKEYS_VERSION] = 1
def ValidatePayload ( payload ) : required_keys = [ PAYLOADKEYS_IDENTIFIER , PAYLOADKEYS_DISPLAYNAME , PAYLOADKEYS_TYPE ] for key in required_keys : if key not in payload : raise PayloadValidationError ( 'Required key (%s) missing.' % key ) if PAYLOADKEYS_UUID not in payload : payload [ PAYLOADKEYS_UUID ] = GenerateUUID ( payload [ PAYLOADKEYS_IDENTIFIER ] ) if PAYLOADKEYS_ENABLED not in payload : payload [ PAYLOADKEYS_ENABLED ] = True if PAYLOADKEYS_VERSION not in payload : payload [ PAYLOADKEYS_VERSION ] = 1