Search in sources :

Example 1 with AfterLocationCreated

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();
}
Also used : AfterLocationCreated(alien4cloud.orchestrators.locations.events.AfterLocationCreated) Orchestrator(alien4cloud.model.orchestrators.Orchestrator) Location(alien4cloud.model.orchestrators.locations.Location)

Aggregations

Orchestrator (alien4cloud.model.orchestrators.Orchestrator)1 Location (alien4cloud.model.orchestrators.locations.Location)1 AfterLocationCreated (alien4cloud.orchestrators.locations.events.AfterLocationCreated)1