func removeUsersFromGroup(conn *iam.IAM, users []*string, group string) error { for _, u := range users { _, err := conn.RemoveUserFromGroup(&iam.RemoveUserFromGroupInput{ UserName: u, GroupName: aws.String(group), }) if err != nil { return err } } return nil }
func (u *User) RemoveUserFromGroup(svc *iam.IAM) error { params := &iam.RemoveUserFromGroupInput{ GroupName: aws.String(u.GroupName), // Required UserName: aws.String(u.UserName), // Required } _, err := svc.RemoveUserFromGroup(params) if err != nil { return err } return nil }
func removeUsersFromGroup(conn *iam.IAM, users []*string, group string) error { for _, u := range users { _, err := conn.RemoveUserFromGroup(&iam.RemoveUserFromGroupInput{ UserName: u, GroupName: aws.String(group), }) if err != nil { if iamerr, ok := err.(awserr.Error); ok && iamerr.Code() == "NoSuchEntity" { return nil } return err } } return nil }