def delete_batch_anomaly_score(self, batch_anomaly_score): """Deletes a batch anomaly score. """ check_resource_type(batch_anomaly_score, BATCH_ANOMALY_SCORE_PATH, message="A batch anomaly score id is needed.") batch_anomaly_score_id = get_batch_anomaly_score_id( batch_anomaly_score) if batch_anomaly_score_id: return self._delete("%s%s" % (self.url, batch_anomaly_score_id))
def delete_batch_anomaly_score(self, batch_anomaly_score): """Deletes a batch anomaly score. """ check_resource_type(batch_anomaly_score, BATCH_ANOMALY_SCORE_PATH, message="A batch anomaly score id is needed.") batch_anomaly_score_id = get_batch_anomaly_score_id( batch_anomaly_score) if batch_anomaly_score_id: return self._delete("%s%s" % (self.url, batch_anomaly_score_id))
def update_batch_anomaly_score(self, batch_anomaly_score, changes): """Updates a batch anomaly scores. """ check_resource_type(batch_anomaly_score, BATCH_ANOMALY_SCORE_PATH, message="A batch anomaly score id is needed.") batch_anomaly_score_id = get_batch_anomaly_score_id( batch_anomaly_score) if batch_anomaly_score_id: body = json.dumps(changes) return self._update("%s%s" % (self.url, batch_anomaly_score_id), body)
def update_batch_anomaly_score(self, batch_anomaly_score, changes): """Updates a batch anomaly scores. """ check_resource_type(batch_anomaly_score, BATCH_ANOMALY_SCORE_PATH, message="A batch anomaly score id is needed.") batch_anomaly_score_id = get_batch_anomaly_score_id( batch_anomaly_score) if batch_anomaly_score_id: body = json.dumps(changes) return self._update("%s%s" % (self.url, batch_anomaly_score_id), body)
def download_batch_anomaly_score(self, batch_anomaly_score, filename=None): """Retrieves the batch anomaly score file. Downloads anomaly scores, that are stored in a remote CSV file. If a path is given in filename, the contents of the file are downloaded and saved locally. A file-like object is returned otherwise. """ check_resource_type(batch_anomaly_score, BATCH_ANOMALY_SCORE_PATH, message="A batch anomaly score id is needed.") batch_anomaly_score_id = get_batch_anomaly_score_id( batch_anomaly_score) if batch_anomaly_score_id: return self._download("%s%s%s" % (self.url, batch_anomaly_score_id, DOWNLOAD_DIR), filename=filename)
def download_batch_anomaly_score(self, batch_anomaly_score, filename=None): """Retrieves the batch anomaly score file. Downloads anomaly scores, that are stored in a remote CSV file. If a path is given in filename, the contents of the file are downloaded and saved locally. A file-like object is returned otherwise. """ check_resource_type(batch_anomaly_score, BATCH_ANOMALY_SCORE_PATH, message="A batch anomaly score id is needed.") batch_anomaly_score_id = get_batch_anomaly_score_id( batch_anomaly_score) if batch_anomaly_score_id: return self._download("%s%s%s" % (self.url, batch_anomaly_score_id, DOWNLOAD_DIR), filename=filename)
def get_batch_anomaly_score(self, batch_anomaly_score): """Retrieves a batch anomaly score. The batch_anomaly_score parameter should be a string containing the batch_anomaly_score id or the dict returned by create_batch_anomaly_score. As batch_anomaly_score is an evolving object that is processed until it reaches the FINISHED or FAULTY state, the function will return a dict that encloses the batch_anomaly_score values and state info available at the time it is called. """ check_resource_type(batch_anomaly_score, BATCH_ANOMALY_SCORE_PATH, message="A batch anomaly score id is needed.") batch_anomaly_score_id = get_batch_anomaly_score_id( batch_anomaly_score) if batch_anomaly_score_id: return self._get("%s%s" % (self.url, batch_anomaly_score_id))