use of com.sequenceiq.authorization.annotation.InternalOnly in project cloudbreak by hortonworks.
the class ImageCatalogV4Controller method getByNameInternal.
@Override
@InternalOnly
public ImageCatalogV4Response getByNameInternal(Long workspaceId, @ResourceName String name, Boolean withImages, @InitiatorUserCrn String initiatorUserCrn) {
ImageCatalog catalog = imageCatalogService.getImageCatalogByName(NameOrCrn.ofName(name), restRequestThreadLocalService.getRequestedWorkspaceId());
ImageCatalogV4Response imageCatalogResponse = imageCatalogToImageCatalogV4ResponseConverter.convert(catalog);
Images images = imageCatalogService.propagateImagesIfRequested(restRequestThreadLocalService.getRequestedWorkspaceId(), name, withImages);
if (images != null) {
imageCatalogResponse.setImages(imagesToImagesV4ResponseConverter.convert(images));
}
return imageCatalogResponse;
}
use of com.sequenceiq.authorization.annotation.InternalOnly in project cloudbreak by hortonworks.
the class RecipesV4Controller method postInternal.
@Override
@InternalOnly
public RecipeV4Response postInternal(@AccountId String accountId, Long workspaceId, @Valid RecipeV4Request request) {
Recipe recipeToSave = recipeV4RequestToRecipeConverter.convert(request);
Recipe recipe = recipeService.createWithInternalUser(recipeToSave, restRequestThreadLocalService.getRequestedWorkspaceId(), accountId);
notify(ResourceEvent.RECIPE_CREATED);
return recipeToRecipeV4ResponseConverter.convert(recipe);
}
use of com.sequenceiq.authorization.annotation.InternalOnly in project cloudbreak by hortonworks.
the class AutoscaleV4Controller method authorizeForAutoscale.
@Override
@InternalOnly
public AuthorizeForAutoscaleV4Response authorizeForAutoscale(@TenantAwareParam String crn, String userId, String tenant, String permission) {
AuthorizeForAutoscaleV4Response response = new AuthorizeForAutoscaleV4Response();
try {
restRequestThreadLocalService.setCloudbreakUserByUsernameAndTenant(userId, tenant);
// TODO check permission explicitly
Stack stack = stackService.getByCrn(crn);
response.setSuccess(true);
} catch (RuntimeException ignore) {
response.setSuccess(false);
}
return response;
}
use of com.sequenceiq.authorization.annotation.InternalOnly in project cloudbreak by hortonworks.
the class AutoscaleV4Controller method decommissionInternalInstancesForClusterCrn.
@Override
@InternalOnly
public void decommissionInternalInstancesForClusterCrn(@TenantAwareParam @ResourceCrn String clusterCrn, List<String> instanceIds, Boolean forced) {
LOGGER.info("decommissionInternalInstancesForClusterCrn. forced={}, clusterCrn={}, instanceIds=[{}]", forced, clusterCrn, instanceIds);
stackCommonService.deleteMultipleInstancesInWorkspace(NameOrCrn.ofCrn(clusterCrn), restRequestThreadLocalService.getRequestedWorkspaceId(), new HashSet(instanceIds), forced);
}
use of com.sequenceiq.authorization.annotation.InternalOnly in project cloudbreak by hortonworks.
the class ConsumptionInternalV1Controller method unscheduleStorageConsumptionCollection.
@Override
@InternalOnly
public void unscheduleStorageConsumptionCollection(@AccountId String accountId, @NotNull @ValidCrn(resource = { CrnResourceDescriptor.ENVIRONMENT, CrnResourceDescriptor.DATALAKE }) String monitoredResourceCrn, @NotEmpty String storageLocation) {
Consumption consumption = consumptionService.findStorageConsumptionByMonitoredResourceCrnAndLocation(monitoredResourceCrn, storageLocation);
consumptionService.delete(consumption);
}
Aggregations