func addUsersToGroup(conn *iam.IAM, users []*string, group string) error {
	for _, u := range users {
		_, err := conn.AddUserToGroup(&iam.AddUserToGroupInput{
			UserName:  u,
			GroupName: aws.String(group),
		})

		if err != nil {
			return err
		}
	}
	return nil
}
Example #2
0
func (u *User) AddUserToGroup(svc *iam.IAM) error {
	params := &iam.AddUserToGroupInput{
		GroupName: aws.String(u.GroupName), // Required
		UserName:  aws.String(u.UserName),  // Required
	}
	_, err := svc.AddUserToGroup(params)

	if err != nil {
		return err
	}

	return nil
}