The important thing to understand is that you cannot modify a data group directly from an iRule. There are ways around this if course, but for the sake of complexity and supportability I won't get into that. It's also not considered a safe thing to do (touching the control plane from the data plane) unless you can absolutely guarantee the security and throughput of that "bridge". That said, there are a few options you may want to consider.
1. Access the data group via out-of-band process. Use iControl or SSH and TMSH commands to the management shell to modify the data group.
2. Move your data group information to a global table. On initialization, consume the static data group (default) data into a table and read and write to that instead.
3. Use syslog to fire an action (TMSH call) in the shell on a log event. This is one of those "bridge" methods I mentioned earlier and would not be my first choice for all of the reasons already given, but just throwing it out there as an example of flexibility.
If these I think option 2 is my favorite, but still comes with the caveat that you must guarantee the security of the function. You don't want anyone to be able to turn on maintenance mode.