@Override public void execute() throws ResourceUnavailableException { CallContext.current().setEventDetails("Network ACL item ID: " + id); boolean result = _networkACLService.revokeNetworkACLItem(id); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network ACL item"); } }
@Override public void execute() throws ResourceUnavailableException { boolean success = false; NetworkACLItem rule = _networkACLService.getNetworkACLItem(getEntityId()); try { CallContext.current().setEventDetails("Rule ID: " + getEntityId()); success = _networkACLService.applyNetworkACL(rule.getAclId()); // State is different after the rule is applied, so get new object here rule = _networkACLService.getNetworkACLItem(getEntityId()); NetworkACLItemResponse aclResponse = new NetworkACLItemResponse(); if (rule != null) { aclResponse = _responseGenerator.createNetworkACLItemResponse(rule); setResponseObject(aclResponse); } aclResponse.setResponseName(getCommandName()); } finally { if (!success || rule == null) { _networkACLService.revokeNetworkACLItem(getEntityId()); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network ACL Item"); } } } }
@Override public void execute() throws ResourceUnavailableException { CallContext.current().setEventDetails("Network ACL item ID: " + id); final boolean result = _networkACLService.revokeNetworkACLItem(id); if (result) { final SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network ACL item"); } }
@Override public void execute() throws ResourceUnavailableException { boolean success = false; NetworkACLItem rule = _networkACLService.getNetworkACLItem(getEntityId()); try { CallContext.current().setEventDetails("Rule ID: " + getEntityId()); success = _networkACLService.applyNetworkACL(rule.getAclId()); // State is different after the rule is applied, so get new object here rule = _networkACLService.getNetworkACLItem(getEntityId()); NetworkACLItemResponse aclResponse = new NetworkACLItemResponse(); if (rule != null) { aclResponse = _responseGenerator.createNetworkACLItemResponse(rule); setResponseObject(aclResponse); } aclResponse.setResponseName(getCommandName()); } finally { if (!success || rule == null) { _networkACLService.revokeNetworkACLItem(getEntityId()); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network ACL Item"); } } }