use of alien4cloud.orchestrators.locations.events.AfterLocationCreated in project alien4cloud by alien4cloud.
the class LocationService method create.
/**
* Add a new locations for a given orchestrator.
*/
public String create(String orchestratorId, String locationName, String infrastructureType) {
Orchestrator orchestrator = orchestratorService.getOrFail(orchestratorId);
if (!OrchestratorState.CONNECTED.equals(orchestrator.getState())) {
// we cannot configure locations for orchestrator that are not connected.
// TODO throw exception
}
ensureMultipleLocations(orchestratorId);
Location location = new Location();
location.setId(UUID.randomUUID().toString());
location.setName(locationName);
location.setOrchestratorId(orchestratorId);
createLocation(orchestrator, location, infrastructureType);
publisher.publishEvent(new AfterLocationCreated(this, location));
return location.getId();
}
Aggregations