Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# noinspection PyProtectedMember
class HostsGetAll(AtlasPagination):
"""Pagination for Processes : Get All"""
def __init__(self, atlas: Atlas, pageNum: int, itemsPerPage: int):
super().__init__(atlas, atlas.Hosts._get_all_hosts, pageNum, itemsPerPage)
# noinspection PyProtectedMember
class EventsGetForProject(AtlasPagination):
def __init__(self, atlas: Atlas, pageNum: int, itemsPerPage: int):
super().__init__(atlas, atlas.Events._get_all_project_events, pageNum, itemsPerPage)
class DatabaseUsersGetAll(AtlasPagination):
"""Pagination for Database User : Get All"""
def __init__(self, atlas, pageNum, itemsPerPage):
super().__init__(atlas, atlas.DatabaseUsers.get_all_database_users, pageNum, itemsPerPage)
class AlertsGetAll(AtlasPagination):
"""Pagination for Alerts : Get All"""
def __init__(self, atlas, status, pageNum, itemsPerPage):
super().__init__(atlas, self.fetch, pageNum, itemsPerPage)
self.get_all_alerts = atlas.Alerts.get_all_alerts
self.status = status
def fetch(self, pageNum, itemsPerPage):
"""Intermediate fetching
except Exception:
raise ErrPagination()
# set the real total
total = details["totalCount"]
# while into the page results
results = details["results"]
results_count = len(results)
index = 0
while index < results_count:
result = results[index]
index += 1
yield result
class DatabaseUsersGetAll(AtlasPagination):
"""Pagination for Database User : Get All"""
def __init__(self, atlas, pageNum, itemsPerPage):
super().__init__(atlas, atlas.DatabaseUsers.get_all_database_users, pageNum, itemsPerPage)
# next page
pageNum += 1
# noinspection PyProtectedMember
class EventsGetForProject(AtlasPagination):
def __init__(self, atlas: Atlas, pageNum: int, itemsPerPage: int):
super().__init__(atlas, atlas.Events._get_all_project_events, pageNum, itemsPerPage)
class DatabaseUsersGetAll(AtlasPagination):
"""Pagination for Database User : Get All"""
def __init__(self, atlas, pageNum, itemsPerPage):
super().__init__(atlas, atlas.DatabaseUsers.get_all_database_users, pageNum, itemsPerPage)
class AlertsGetAll(AtlasPagination):
"""Pagination for Alerts : Get All"""
def __init__(self, atlas, status, pageNum, itemsPerPage):
super().__init__(atlas, self.fetch, pageNum, itemsPerPage)
self.get_all_alerts = atlas.Alerts.get_all_alerts
self.status = status
def fetch(self, pageNum, itemsPerPage):
"""Intermediate fetching
Args:
pageNum (int): Page number
itemsPerPage (int): Number of Users per Page
Returns:
dict: Response payload
while index < results_count:
result = results[index]
index += 1
yield result
class DatabaseUsersGetAll(AtlasPagination):
"""Pagination for Database User : Get All"""
def __init__(self, atlas, pageNum, itemsPerPage):
super().__init__(atlas, atlas.DatabaseUsers.get_all_database_users, pageNum, itemsPerPage)
# next page
pageNum += 1
class ClustersGetAll(AtlasPagination):
"""Pagination for Clusters : Get All"""
def __init__(self, atlas, pageNum, itemsPerPage):
super().__init__(atlas, atlas.Clusters.get_all_clusters, pageNum, itemsPerPage)
# noinspection PyProtectedMember
class HostsGetAll(AtlasPagination):
"""Pagination for Processes : Get All"""
def __init__(self, atlas: Atlas, pageNum: int, itemsPerPage: int):
super().__init__(atlas, atlas.Hosts._get_all_hosts, pageNum, itemsPerPage)
# noinspection PyProtectedMember
class EventsGetForProject(AtlasPagination):
def __init__(self, atlas, pageNum, itemsPerPage):
super().__init__(atlas, atlas.DatabaseUsers.get_all_database_users, pageNum, itemsPerPage)
# next page
pageNum += 1
class ClustersGetAll(AtlasPagination):
"""Pagination for Clusters : Get All"""
def __init__(self, atlas, pageNum, itemsPerPage):
super().__init__(atlas, atlas.Clusters.get_all_clusters, pageNum, itemsPerPage)
# noinspection PyProtectedMember
class HostsGetAll(AtlasPagination):
"""Pagination for Processes : Get All"""
def __init__(self, atlas: Atlas, pageNum: int, itemsPerPage: int):
super().__init__(atlas, atlas.Hosts._get_all_hosts, pageNum, itemsPerPage)
# noinspection PyProtectedMember
class EventsGetForProject(AtlasPagination):
def __init__(self, atlas: Atlas, pageNum: int, itemsPerPage: int):
super().__init__(atlas, atlas.Events._get_all_project_events, pageNum, itemsPerPage)
class DatabaseUsersGetAll(AtlasPagination):
"""Pagination for Database User : Get All"""
self.status = status
def fetch(self, pageNum, itemsPerPage):
"""Intermediate fetching
Args:
pageNum (int): Page number
itemsPerPage (int): Number of Users per Page
Returns:
dict: Response payload
"""
return self.get_all_alerts(self.status, pageNum, itemsPerPage)
class WhitelistGetAll(AtlasPagination):
"""Pagination for Database User : Get All"""
def __init__(self, atlas, pageNum, itemsPerPage):
super().__init__(atlas, atlas.Whitelist.get_all_whitelist_entries, pageNum, itemsPerPage)
"""Pagination for Clusters : Get All"""
def __init__(self, atlas, pageNum, itemsPerPage):
super().__init__(atlas, atlas.Clusters.get_all_clusters, pageNum, itemsPerPage)
# noinspection PyProtectedMember
class HostsGetAll(AtlasPagination):
"""Pagination for Processes : Get All"""
def __init__(self, atlas: Atlas, pageNum: int, itemsPerPage: int):
super().__init__(atlas, atlas.Hosts._get_all_hosts, pageNum, itemsPerPage)
# noinspection PyProtectedMember
class EventsGetForProject(AtlasPagination):
def __init__(self, atlas: Atlas, pageNum: int, itemsPerPage: int):
super().__init__(atlas, atlas.Events._get_all_project_events, pageNum, itemsPerPage)
class DatabaseUsersGetAll(AtlasPagination):
"""Pagination for Database User : Get All"""
def __init__(self, atlas, pageNum, itemsPerPage):
super().__init__(atlas, atlas.DatabaseUsers.get_all_database_users, pageNum, itemsPerPage)
class AlertsGetAll(AtlasPagination):
"""Pagination for Alerts : Get All"""
def __init__(self, atlas, status, pageNum, itemsPerPage):