def fetch_user_data_for_campaigns(self, campaign_id):
        """Get mimecast phishing user data from given campaign.

        Args:
            campaign (dict): campaign for which user data to be fetched.
        """
        __method_name = inspect.currentframe().f_code.co_name
        try:
            request_body = {
                "data": [{"id": campaign_id}],
                "meta": {"pagination": {"pageSize": consts.MAX_PAGE_SIZE}},
            }
            applogger.info(
                self.log_format.format(
                    consts.LOGS_STARTS_WITH,
                    __method_name,
                    self.azure_function_name,
                    "Fetching user data for campaign : {}.".format(campaign_id),
                )
            )
            next_page = True
            total_user_count = 0
            while next_page:
                if (
                    int(time.time())
                    >= self.function_start_time + consts.FUNCTION_APP_TIMEOUT_SECONDS
                ):
                    raise MimecastTimeoutException()
                user_data_response = self.make_rest_call(
                    method="POST", url=self.get_user_url, json=request_body
                )
                user_data = user_data_response.get("data", [])
                if len(user_data) > 0 and len(user_data[0].get("items", [])) > 0:
                    total_user_count += len(user_data[0]["items"])
                    user_data_items = user_data[0]["items"]
                    applogger.info(
                        self.log_format.format(
                            consts.LOGS_STARTS_WITH,
                            __method_name,
                            self.azure_function_name,
                            "Posting data to azure Sentinel log analytics, data count : {}.".format(
                                len(user_data_items)
                            ),
                        )
                    )
                    post_data(
                        json.dumps(user_data_items),
                        log_type=consts.TABLE_NAME["USER_DATA"],
                    )
                    next_page_token = user_data_response["meta"]["pagination"].get(
                        "next", ""
                    )
                    if next_page_token:
                        request_body["meta"]["pagination"][
                            "pageToken"
                        ] = next_page_token
                        applogger.info(
                            self.log_format.format(
                                consts.LOGS_STARTS_WITH,
                                __method_name,
                                self.azure_function_name,
                                "Found next in response : {}.".format(next_page_token),
                            )
                        )
                    else:
                        next_page = False
                        applogger.debug(
                            self.log_format.format(
                                consts.LOGS_STARTS_WITH,
                                __method_name,
                                self.azure_function_name,
                                "End of user data for campaign id : {}.".format(
                                    campaign_id
                                ),
                            )
                        )
                else:
                    next_page = False
                    applogger.info(
                        self.log_format.format(
                            consts.LOGS_STARTS_WITH,
                            __method_name,
                            self.azure_function_name,
                            "No user data found for campaign : {}.".format(campaign_id),
                        )
                    )
            applogger.info(
                self.log_format.format(
                    consts.LOGS_STARTS_WITH,
                    __method_name,
                    self.azure_function_name,
                    "Total user count : {} for campaign : {}.".format(
                        total_user_count, campaign_id
                    ),
                )
            )
        except KeyError as key_error:
            applogger.error(
                self.log_format.format(
                    consts.LOGS_STARTS_WITH,
                    __method_name,
                    self.azure_function_name,
                    consts.KEY_ERROR_MSG.format(key_error),
                )
            )
            raise MimecastException()
        except MimecastTimeoutException:
            raise MimecastTimeoutException()
        except RetryError as error:
            applogger.error(
                self.log_format.format(
                    consts.LOGS_STARTS_WITH,
                    __method_name,
                    self.azure_function_name,
                    consts.MAX_RETRY_ERROR_MSG.format(
                        error, error.last_attempt.exception()
                    ),
                )
            )
            raise MimecastException()
        except MimecastException:
            raise MimecastException()
        except Exception as err:
            applogger.error(
                self.log_format.format(
                    consts.LOGS_STARTS_WITH,
                    __method_name,
                    self.azure_function_name,
                    consts.UNEXPECTED_ERROR_MSG.format(err),
                )
            )
            raise MimecastException()
Get mimecast phishing user data from given campaign.

        Args:
            campaign (dict): campaign for which user data to be fetched.
        
Solutions/Mimecast/Data Connectors/MimecastAT/UserData/mimecast_user_data_to_sentinel.py