Porting security_group_api code