Search in sources :

Example 16 with Location

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();
}
Also used : Location(alien4cloud.model.orchestrators.locations.Location) Audit(alien4cloud.audit.annotation.Audit) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 17 with Location

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();
}
Also used : Location(alien4cloud.model.orchestrators.locations.Location) Audit(alien4cloud.audit.annotation.Audit) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 18 with Location

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();
}
Also used : Location(alien4cloud.model.orchestrators.locations.Location) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 19 with Location

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();
}
Also used : Location(alien4cloud.model.orchestrators.locations.Location) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 20 with Location

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();
}
Also used : LocationModifierReference(alien4cloud.model.orchestrators.locations.LocationModifierReference) List(java.util.List) Location(alien4cloud.model.orchestrators.locations.Location) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Location (alien4cloud.model.orchestrators.locations.Location)80 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)31 ApiOperation (io.swagger.annotations.ApiOperation)30 List (java.util.List)28 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)28 Audit (alien4cloud.audit.annotation.Audit)21 ApplicationEnvironment (alien4cloud.model.application.ApplicationEnvironment)15 LocationService (alien4cloud.orchestrators.locations.services.LocationService)13 Set (java.util.Set)13 Collectors (java.util.stream.Collectors)13 Application (alien4cloud.model.application.Application)12 AbstractLocationResourceTemplate (alien4cloud.model.orchestrators.locations.AbstractLocationResourceTemplate)12 RestResponse (alien4cloud.rest.model.RestResponse)12 RestResponseBuilder (alien4cloud.rest.model.RestResponseBuilder)12 GroupDTO (alien4cloud.rest.orchestrator.model.GroupDTO)12 UserDTO (alien4cloud.rest.orchestrator.model.UserDTO)12 Resource (javax.annotation.Resource)12 ApplicationEnvironmentService (alien4cloud.application.ApplicationEnvironmentService)11 ResourcePermissionService (alien4cloud.authorization.ResourcePermissionService)11 ApplicationEnvironmentAuthorizationUpdateRequest (alien4cloud.rest.orchestrator.model.ApplicationEnvironmentAuthorizationUpdateRequest)11