Implement state change API

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>