use of alien4cloud.model.orchestrators.locations.Location in project alien4cloud by alien4cloud.
the class LocationController method deleteSecretConfiguration.
@ApiOperation(value = "Delete the secret configuration for the given location.", authorizations = { @Authorization("ADMIN") })
@RequestMapping(value = "/{id}/secret-conf", method = RequestMethod.DELETE)
@PreAuthorize("hasAuthority('ADMIN')")
@Audit
public RestResponse<Void> deleteSecretConfiguration(@ApiParam(value = "Id of the orchestrator for which the location is defined.") @PathVariable String orchestratorId, @ApiParam(value = "Id of the location to update", required = true) @PathVariable String id) {
Location location = locationService.getOrFail(id);
location.setSecretProviderConfiguration(null);
locationService.save(location);
return RestResponseBuilder.<Void>builder().build();
}
use of alien4cloud.model.orchestrators.locations.Location in project alien4cloud by alien4cloud.
the class LocationController method update.
@ApiOperation(value = "Update the name of an existing location.", authorizations = { @Authorization("ADMIN") })
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasAuthority('ADMIN')")
@Audit
public RestResponse<Void> update(@ApiParam(value = "Id of the orchestrator for which the location is defined.") @PathVariable String orchestratorId, @ApiParam(value = "Id of the location to update", required = true) @PathVariable String id, @ApiParam(value = "Location update request, representing the fields to updates and their new values.", required = true) @Valid @NotEmpty @RequestBody UpdateLocationRequest updateRequest) {
Location location = locationService.getOrFail(id);
String currentName = location.getName();
ReflectionUtil.mergeObject(updateRequest, location);
locationService.ensureNameUnicityAndSave(location, currentName);
return RestResponseBuilder.<Void>builder().build();
}
use of alien4cloud.model.orchestrators.locations.Location in project alien4cloud by alien4cloud.
the class LocationModifiersController method delete.
@ApiOperation(value = "Delete a location modifier at the given index.", authorizations = { @Authorization("ADMIN") })
@RequestMapping(value = "/{index}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public RestResponse<Void> delete(@ApiParam(value = "Id of the location", required = true) @PathVariable String locationId, @ApiParam(value = "Index of the location modifier to delete", required = true) @PathVariable int index) {
Location location = locationService.getOrFail(locationId);
locationModifierService.remove(location, index);
return RestResponseBuilder.<Void>builder().build();
}
use of alien4cloud.model.orchestrators.locations.Location in project alien4cloud by alien4cloud.
the class LocationModifiersController method move.
@ApiOperation(value = "Update the order of a modifier.", authorizations = { @Authorization("ADMIN") })
@RequestMapping(value = "/from/{from}/to/{to}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
public RestResponse<Void> move(@ApiParam(value = "Id of the location", required = true) @PathVariable String locationId, @ApiParam(value = "From index", required = true) @PathVariable int from, @ApiParam(value = "To index", required = true) @PathVariable int to) {
Location location = locationService.getOrFail(locationId);
locationModifierService.move(location, from, to);
return RestResponseBuilder.<Void>builder().build();
}
use of alien4cloud.model.orchestrators.locations.Location in project alien4cloud by alien4cloud.
the class LocationModifiersController method getAllModifiers.
@ApiOperation(value = "Get all modifiers for a given location.")
@RequestMapping(method = RequestMethod.GET)
public RestResponse<List<LocationModifierReference>> getAllModifiers(@ApiParam(value = "Id of the location for which to get all modifiers.") @PathVariable String locationId) {
Location location = locationService.getOrFail(locationId);
List<LocationModifierReference> modifiers = location.getModifiers();
if (modifiers == null) {
modifiers = Lists.newArrayList();
}
return RestResponseBuilder.<List<LocationModifierReference>>builder().data(modifiers).build();
}
Aggregations