private void validateCommandParams(Map<String, String> commandParams) {

    LOGGER.info("Validating command parameters ...");

    if (!commandParams.containsKey(UserHookParams.PAYLOAD.param())) {
      LOGGER.error("Missing command parameter: {}; Failing the server action.", UserHookParams.PAYLOAD.param());
      throw new IllegalArgumentException("Missing command parameter: [" + UserHookParams.PAYLOAD.param() + "]");
    }

    if (!commandParams.containsKey(UserHookParams.SCRIPT.param())) {
      LOGGER.error("Missing command parameter: {}; Failing the server action.", UserHookParams.SCRIPT.param());
      throw new IllegalArgumentException("Missing command parameter: [" + UserHookParams.SCRIPT.param() + "]");
    }

    if (!commandParams.containsKey(UserHookParams.CMD_INPUT_FILE.param())) {
      LOGGER.error("Missing command parameter: {}; Failing the server action.", UserHookParams.CMD_INPUT_FILE.param());
      throw new IllegalArgumentException("Missing command parameter: [" + UserHookParams.CMD_INPUT_FILE.param() + "]");
    }

    if (!commandParams.containsKey(UserHookParams.CLUSTER_SECURITY_TYPE.param())) {
      LOGGER.error("Missing command parameter: {}; Failing the server action.", UserHookParams.CLUSTER_SECURITY_TYPE.param());
      throw new IllegalArgumentException("Missing command parameter: [" + UserHookParams.CLUSTER_SECURITY_TYPE.param() + "]");
    }

    if (!commandParams.containsKey(UserHookParams.CMD_HDFS_USER.param())) {
      LOGGER.error("Missing command parameter: {}; Failing the server action.", UserHookParams.CMD_HDFS_USER.param());
      throw new IllegalArgumentException("Missing command parameter: [" + UserHookParams.CMD_HDFS_USER.param() + "]");
    }

    LOGGER.info("Command parameter validation passed.");
  }
Validates command parameters, throws exception in case required parameters are missing
ambari-server/src/main/java/org/apache/ambari/server/serveraction/users/PostUserCreationHookServerAction.java