@Inject
NetworkService networkService;
@Override
public void run() throws CloudException, IOException {
Auth unscoped = authService.authenticate(null, username, password);
if (unscoped == null) {
throw new IllegalArgumentException("Cannot authenticate");
}
List<Long> projectIds = authService.resolveProjectName(unscoped, project);
if (projectIds.size() == 0) {
throw new IllegalArgumentException("Cannot find project");
}
if (projectIds.size() != 1) {
throw new IllegalArgumentException("The project name is ambiguous");
}
Long projectId = projectIds.get(0);
Auth auth = authService.authenticate(projectId, username, password);
if (auth == null) {
throw new IllegalArgumentException("Cannot authenticate to project");
}
NetworkData.Builder b = NetworkData.newBuilder();