def pull_and_push_the_data(
        self,
        endpoint,
        checkpoint_field,
        checkpoint_value,
        table_name,
        fields=None,
        query_params=dict(),
    ):
        """To pull the data from vectra and push into sentinel."""
        __method_name = inspect.currentframe().f_code.co_name
        posted_event_count = 0
        iter_next = True
        query_params.update({"limit": consts.PAGE_SIZE, checkpoint_field: checkpoint_value})
        while iter_next:
            res = self.pull_data(endpoint, params=query_params)
            next_checkpoint = res.get("next_checkpoint", None)
            if endpoint == consts.DETECTIONS_ENDPOINT and len(res.get("events")):
                self.applogger.debug(
                    "{}(method={}) : {} : Trying to collect the additional information from"
                    " /detections endpoint for type=host and type=account.".format(
                        consts.LOGS_STARTS_WITH, __method_name, self.function_name
                    )
                )
                detection_ids_list = []
                for event in res.get("events"):
                    if event.get("type") == "host" or event.get("type") == "account":
                        detection_ids_list.append(str(event.get("detection_id")))

                detection_id_set = set(detection_ids_list)
                detections_ids = ",".join(detection_id_set)
                next = True
                page = 1
                merge_json = {}

                if detections_ids:
                    while next:
                        detection_endpoint = "/api/v3.3/detections"
                        self.applogger.debug(
                            "{}(method={}) : {} : GET call to /detections endpoint with URL = {}".format(
                                consts.LOGS_STARTS_WITH,
                                __method_name,
                                self.function_name,
                                self.base_url + detection_endpoint,
                            )
                        )
                        host_details = self.pull_data(detection_endpoint, params={"id": detections_ids, "page": page})
                        if host_details.get("results"):
                            for each in host_details.get("results"):
                                merge_json[each.get("id")] = each
                        if not host_details.get("next"):
                            break
                        page += 1

                for event in res.get("events"):
                    if event.get("type") == "host" and merge_json.get(event.get("detection_id"), {}):
                        temp_host = merge_json.get(event.get("detection_id"), {})
                        event["d_detection_details"] = [temp_host]
                        event["is_targeting_key_asset"] = str(temp_host.get("is_targeting_key_asset", ""))
                        event["src_host"] = [temp_host.get("src_host", {})]
                        event["normal_domains"] = temp_host.get("normal_domains", [])
                        event["src_ip"] = temp_host.get("src_ip", "")
                        event["summary"] = [temp_host.get("summary", {})]
                        event["grouped_details"] = temp_host.get("grouped_details", [])
                        event["tags"] = temp_host.get("tags", [])
                    elif event.get("type") == "account":
                        if event.get("detail", {}):
                            event["d_detection_details"] = [event.get("detail", {})]
                        if merge_json.get(event.get("detection_id"), {}):
                            account_data = merge_json.get(event.get("detection_id"), {})
                            event["tags"] = account_data.get("tags", [])
                    else:
                        event["d_detection_details"] = []
                    self.applogger.debug(
                        "{}(method={}) : {} :  Successfully modified events/detections"
                        " response for id={}.".format(
                            consts.LOGS_STARTS_WITH,
                            __method_name,
                            self.function_name,
                            event.get("id"),
                        )
                    )

            if res and len(res.get("events")):
                self._create_chunks_and_post_to_sentinel(res.get("events"), table_name, fields)
                posted_event_count += len(res.get("events"))
                iter_next = True if int(res.get("remaining_count")) > 0 else False
                query_params.update({"limit": consts.PAGE_SIZE, "from": next_checkpoint})
            else:
                iter_next = False
            if endpoint == consts.ENTITY_SCORING_ENDPOINT and (next_checkpoint is None or next_checkpoint == "null"):
                break
            else:
                self.save_checkpoint(data=next_checkpoint)

        self.applogger.info(
            "{}(method={}) : {} : Posted total {} event(s) into MS Sentinel. No more events."
            " Stopping the collection.".format(
                consts.LOGS_STARTS_WITH,
                __method_name,
                self.function_name,
                posted_event_count,
            )
        )
To pull the data from vectra and push into sentinel.
Solutions/Vectra XDR/Data Connectors/VectraDataConnector/SharedCode/collector.py