func GetRoleDetails(verbose bool, svc *iam.Client) []IAMRole {
	result := []IAMRole{}
	resp, err := svc.ListRoles(context.TODO(), &iam.ListRolesInput{})
	if err != nil {
		log.Fatal(err.Error())
	}
	for _, role := range resp.Roles {
		policydocument := IAMPolicyDocument{Type: IAMPolicyTypeAssumeRole}
		decodeddocument, err := url.QueryUnescape(*role.AssumeRolePolicyDocument)
		if err != nil {
			panic(err)
		}
		err = json.Unmarshal([]byte(decodeddocument), &policydocument)
		if err != nil {
			panic(err)
		}
		inlinepolicies := getInlinePoliciesForRole(*role.RoleName, verbose, svc)
		attachedpolicies := getAttachedPoliciesForRole(*role.RoleName, verbose, svc)
		rolestruct := IAMRole{
			Name:             *role.RoleName,
			ID:               *role.RoleId,
			AssumeRolePolicy: policydocument,
			Path:             *role.Path,
			Role:             &role,
			InlinePolicies:   inlinepolicies,
			AttachedPolicies: attachedpolicies,
			Type:             getRoleType(role),
			Verbose:          verbose,
		}
		for _, policy := range rolestruct.InlinePolicies {
			policy.AddRole(&rolestruct)
		}
		for _, policy := range rolestruct.AttachedPolicies {
			policy.AddRole(&rolestruct)
		}
		result = append(result, rolestruct)
	}
	return result
}
// GetRoleDetails returns the list of roles in the account
GetRoleDetails returns the list of roles in the account
// GetRoleDetails returns the list of roles in the account
func GetRoleDetails(verbose bool, svc *iam.Client) []IAMRole {
	result := []IAMRole{}
	resp, err := svc.ListRoles(context.TODO(), &iam.ListRolesInput{})
	if err != nil {
		log.Fatal(err.Error())
	}
	for _, role := range resp.Roles {
		policydocument := IAMPolicyDocument{Type: IAMPolicyTypeAssumeRole}
		decodeddocument, err := url.QueryUnescape(*role.AssumeRolePolicyDocument)
		if err != nil {
			panic(err)
		}
		err = json.Unmarshal([]byte(decodeddocument), &policydocument)
		if err != nil {
			panic(err)
		}
		inlinepolicies := getInlinePoliciesForRole(*role.RoleName, verbose, svc)
		attachedpolicies := getAttachedPoliciesForRole(*role.RoleName, verbose, svc)
		rolestruct := IAMRole{
			Name:             *role.RoleName,
			ID:               *role.RoleId,
			AssumeRolePolicy: policydocument,
			Path:             *role.Path,
			Role:             &role,
			InlinePolicies:   inlinepolicies,
			AttachedPolicies: attachedpolicies,
			Type:             getRoleType(role),
			Verbose:          verbose,
		}
		for _, policy := range rolestruct.InlinePolicies {
			policy.AddRole(&rolestruct)
		}
		for _, policy := range rolestruct.AttachedPolicies {
			policy.AddRole(&rolestruct)
		}
		result = append(result, rolestruct)
	}
	return result
}
func GetRoleDetails ( verbose bool , svc * iam . Client ) [ ] IAMRole { result := [ ] IAMRole { } resp , err := svc . ListRoles ( context . TODO ( ) , & iam . ListRolesInput { } ) if err != nil { log . Fatal ( err . Error ( ) ) } for _ , role := range resp . Roles { policydocument := IAMPolicyDocument { Type : IAMPolicyTypeAssumeRole } decodeddocument , err := url . QueryUnescape ( * role . AssumeRolePolicyDocument ) if err != nil { panic ( err ) } err = json . Unmarshal ( [ ] byte ( decodeddocument ) , & policydocument ) if err != nil { panic ( err ) } inlinepolicies := getInlinePoliciesForRole ( * role . RoleName , verbose , svc ) attachedpolicies := getAttachedPoliciesForRole ( * role . RoleName , verbose , svc ) rolestruct := IAMRole { Name : * role . RoleName , ID : * role . RoleId , AssumeRolePolicy : policydocument , Path : * role . Path , Role : & role , InlinePolicies : inlinepolicies , AttachedPolicies : attachedpolicies , Type : getRoleType ( role ) , Verbose : verbose , } for _ , policy := range rolestruct . InlinePolicies { policy . AddRole ( & rolestruct ) } for _ , policy := range rolestruct . AttachedPolicies { policy . AddRole ( & rolestruct ) } result = append ( result , rolestruct ) } return result }
GetRoleDetails returns the list of roles in the account
GetRoleDetails returns the list of roles in the account