Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_measurement_for_host(self, granularity: AtlasGranularities = AtlasGranularities.HOUR,
period: AtlasPeriods = AtlasPeriods.WEEKS_1,
measurement: AtlasMeasurementTypes = AtlasMeasurementTypes.Cache.dirty,
pageNum: int = Settings.pageNum,
itemsPerPage: int = Settings.itemsPerPage,
iterable: bool = True) -> Union[dict, Iterable[AtlasMeasurement]]:
"""Get measurement(s) for a host
Returns measurements for the Host object.
url: https://docs.atlas.mongodb.com/reference/api/process-measurements/
Accepts either a single measurement, but will retrieve more than one measurement
if the measurement (using the AtlasMeasurementTypes class)
/api/atlas/v1.0/groups/{GROUP-ID}/processes/{HOST}:{PORT}/measurements
Keyword Args:
host_obj (Host): the host
granularity (AtlasGranularities): the desired granularity
def _get_all_hosts(self, pageNum=Settings.pageNum,
itemsPerPage=Settings.itemsPerPage,
iterable=False):
"""Get All Hosts (actually processes)
Internal use only, actual data retrieval comes from properties host_list and host_names
url: https://docs.atlas.mongodb.com/reference/api/alerts-get-all-alerts/
Keyword Args:
pageNum (int): Page number
itemsPerPage (int): Number of Users per Page
iterable (bool): To return an iterable high level object instead of a low level API response
Returns:
ListOfHosts or dict: Iterable object representing this function OR Response payload
Raises:
ErrPaginationLimits: Out of limits
def _get_measurement_for_host(self, host_obj: Host, granularity: AtlasGranularities = AtlasGranularities.HOUR,
period: AtlasPeriods = AtlasPeriods.WEEKS_1,
measurement: AtlasMeasurementTypes = AtlasMeasurementTypes.Cache.dirty,
pageNum: int = Settings.pageNum,
itemsPerPage: int = Settings.itemsPerPage,
iterable: bool = True) -> Union[dict, Iterable[AtlasMeasurement]]:
"""Get measurement(s) for a host
Internal use only, should come from the host obj itself.
Returns measurements for the passed Host object.
url: https://docs.atlas.mongodb.com/reference/api/process-measurements/
Accepts either a single measurement, but will retrieve more than one measurement
if the measurement (using the AtlasMeasurementTypes class)
/api/atlas/v1.0/groups/{GROUP-ID}/processes/{HOST}:{PORT}/measurements
Keyword Args:
def get_all_database_users(self, pageNum: int = Settings.pageNum, itemsPerPage: int = Settings.itemsPerPage,
iterable: bool = False):
"""Get All Database Users
url: https://docs.atlas.mongodb.com/reference/api/database-users-get-all-users/
Keyword Args:
pageNum (int): Page number
itemsPerPage (int): Number of Users per Page
iterable (bool): To return an iterable high level object instead of a low level API response
Returns:
AtlasPagination or dict: Iterable object representing this function OR Response payload
Raises:
ErrPaginationLimits: Out of limits
"""