Example #1
0
 def delete_dataset(key=None) -> DeleteDatasetResponse:
     """
     Delete the dataset with key=<key>
     """
     config = ThreatExchangeConfig.getx(str(key))
     hmaconfig.delete_config(config)
     return DeleteDatasetResponse(response="The privacy group is deleted")
Example #2
0
    def update_dataset(request: UpdateDatasetRequest) -> Dataset:
        """
        Update dataset values: fetcher_active, write_back, and matcher_active.
        """
        config = ThreatExchangeConfig.getx(str(request.privacy_group_id))
        config.fetcher_active = request.fetcher_active
        config.write_back = request.write_back
        config.matcher_active = request.matcher_active
        updated_config = hmaconfig.update_config(config).__dict__
        updated_config["privacy_group_id"] = updated_config["name"]

        additional_config = AdditionalMatchSettingsConfig.get(
            str(request.privacy_group_id))
        if request.pdq_match_threshold:
            if additional_config:
                additional_config.pdq_match_threshold = int(
                    request.pdq_match_threshold)
                hmaconfig.update_config(additional_config)
            else:
                additional_config = AdditionalMatchSettingsConfig(
                    str(request.privacy_group_id),
                    int(request.pdq_match_threshold))
                hmaconfig.create_config(additional_config)
        elif additional_config:  # pdq_match_threshold was set and now should be removed
            hmaconfig.delete_config(additional_config)

        return Dataset.from_dict(updated_config)
Example #3
0
 def update_dataset(request: UpdateDatasetRequest) -> Dataset:
     """
     Update dataset values: fetcher_active, write_back, and matcher_active.
     """
     config = ThreatExchangeConfig.getx(str(request.privacy_group_id))
     config.fetcher_active = request.fetcher_active
     config.write_back = request.write_back
     config.matcher_active = request.matcher_active
     updated_config = hmaconfig.update_config(config).__dict__
     updated_config["privacy_group_id"] = updated_config["name"]
     return Dataset.from_dict(updated_config)
def update_privacy_group_description(privacy_group_id: str,
                                     description: str) -> None:
    config = ThreatExchangeConfig.getx(privacy_group_id)
    config.description = description
    hmaconfig.update_config(config)