use of com.amazonaws.services.identitymanagement.model.AmazonIdentityManagementException in project intellij-idea-plugin-connector-for-aws-lambda by satr.
the class RoleConnectorModel method populateRoleListAndMap.
private void populateRoleListAndMap(AmazonIdentityManagement identityManagementClient) {
roleEntities = new ArrayList<>();
roleEntityMap = new LinkedHashMap<>();
try {
ListRolesRequest listRolesRequest = new ListRolesRequest().withMaxItems(MAX_FETCHED_ROLE_COUNT);
ListRolesResult listRolesResult = identityManagementClient.listRoles(listRolesRequest);
List<Role> roles = listRolesResult.getRoles();
for (Role role : roles) {
addRoleToListAndMap(role);
}
} catch (AmazonIdentityManagementException e) {
if ("AccessDenied".equals(e.getErrorCode())) {
// "User has not access to a list of roles - skip the error.
}
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations