/**
   * Register a new required actions
   *
   * @param data JSON containing 'providerId', and 'name' attributes.
   */
  @Path("register-required-action")
  @POST
  @Consumes(MediaType.APPLICATION_JSON)
  @NoCache
  public void registerRequiredAction(Map<String, String> data) {
    auth.requireManage();

    String providerId = data.get("providerId");
    String name = data.get("name");
    RequiredActionProviderModel requiredAction = new RequiredActionProviderModel();
    requiredAction.setAlias(providerId);
    requiredAction.setName(name);
    requiredAction.setProviderId(providerId);
    requiredAction.setDefaultAction(false);
    requiredAction.setEnabled(true);
    requiredAction = realm.addRequiredActionProvider(requiredAction);

    data.put("id", requiredAction.getId());
    adminEvent.operation(OperationType.CREATE).resourcePath(uriInfo).representation(data).success();
  }
  /**
   * Update required action
   *
   * @param alias Alias of required action
   * @param rep JSON describing new state of required action
   */
  @Path("required-actions/{alias}")
  @PUT
  @Consumes(MediaType.APPLICATION_JSON)
  public void updateRequiredAction(
      @PathParam("alias") String alias, RequiredActionProviderRepresentation rep) {
    auth.requireManage();

    RequiredActionProviderModel model = realm.getRequiredActionProviderByAlias(alias);
    if (model == null) {
      throw new NotFoundException("Failed to find required action");
    }
    RequiredActionProviderModel update = new RequiredActionProviderModel();
    update.setId(model.getId());
    update.setName(rep.getName());
    update.setAlias(rep.getAlias());
    update.setProviderId(model.getProviderId());
    update.setDefaultAction(rep.isDefaultAction());
    update.setEnabled(rep.isEnabled());
    update.setConfig(rep.getConfig());
    realm.updateRequiredActionProvider(update);

    adminEvent.operation(OperationType.UPDATE).resourcePath(uriInfo).representation(rep).success();
  }