List of usage examples for com.amazonaws.services.identitymanagement AmazonIdentityManagement listRoles
ListRolesResult listRoles(ListRolesRequest listRolesRequest);
Lists the IAM roles that have the specified path prefix.
From source file:com.netflix.spinnaker.clouddriver.ecs.provider.agent.IamRoleCachingAgent.java
License:Apache License
Set<IamRole> fetchIamRoles(AmazonIdentityManagement iam, String accountName) { Set<IamRole> cacheableRoles = new HashSet<>(); String marker = null;//from ww w .j a va 2 s .co m do { ListRolesRequest request = new ListRolesRequest(); if (marker != null) { request.setMarker(marker); } ListRolesResult listRolesResult = iam.listRoles(request); List<Role> roles = listRolesResult.getRoles(); for (Role role : roles) { cacheableRoles.add(new IamRole(role.getArn(), role.getRoleName(), accountName, iamPolicyReader.getTrustedEntities(role.getAssumeRolePolicyDocument()))); } if (listRolesResult.isTruncated()) { marker = listRolesResult.getMarker(); } else { marker = null; } } while (marker != null && marker.length() != 0); return cacheableRoles; }
From source file:com.netflix.spinnaker.clouddriver.lambda.provider.agent.IamRoleCachingAgent.java
License:Apache License
private Set<IamRole> fetchIamRoles(AmazonIdentityManagement iam, String accountName) { Set<IamRole> cacheableRoles = new HashSet<>(); String marker = null;//w ww . j a v a 2 s . c om do { ListRolesRequest request = new ListRolesRequest(); if (marker != null) { request.setMarker(marker); } ListRolesResult listRolesResult = iam.listRoles(request); List<Role> roles = listRolesResult.getRoles(); for (Role role : roles) { cacheableRoles.add(new IamRole(role.getArn(), role.getRoleName(), accountName, getTrustedEntities(role.getAssumeRolePolicyDocument()))); } if (listRolesResult.isTruncated()) { marker = listRolesResult.getMarker(); } else { marker = null; } } while (marker != null && marker.length() != 0); return cacheableRoles; }