// awsGetIamRolesHandler returns the list of IAM roles.
awsGetIamRolesHandler returns the list of IAM roles.
// awsGetIamRolesHandler returns the list of IAM roles .
func awsGetIamRolesHandler(w http.ResponseWriter, req *http.Request, _ *Context) error {
	awsSession, err := awsSessionFromRequest(req)
	if err != nil {
		return fromAWSErr(err)
	}
	iamSvc := iam.New(awsSession)
	resp, err := iamSvc.ListRoles(&iam.ListRolesInput{})
	if err != nil {
		return fromAWSErr(err)
	}
	roles := make([]string, len(resp.Roles))
	for i, role := range resp.Roles {
		roles[i] = aws.StringValue(role.RoleName)
	}
	sort.Strings(roles)
	return writeJSONResponse(w, req, http.StatusOK, roles)
}
func awsGetIamRolesHandler ( w http . ResponseWriter , req * http . Request , _ * Context ) error { awsSession , err := awsSessionFromRequest ( req ) if err != nil { return fromAWSErr ( err ) } iamSvc := iam . New ( awsSession ) resp , err := iamSvc . ListRoles ( & iam . ListRolesInput { } ) if err != nil { return fromAWSErr ( err ) } roles := make ( [ ] string , len ( resp . Roles ) ) for i , role := range resp . Roles { roles [ i ] = aws . StringValue ( role . RoleName ) } sort . Strings ( roles ) return writeJSONResponse ( w , req , http . StatusOK , roles ) }
awsGetIamRolesHandler returns the list of IAM roles.
awsGetIamRolesHandler returns the list of IAM roles .