Search in sources :

Example 6 with InternalOnly

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;
}
Also used : Images(com.sequenceiq.cloudbreak.cloud.model.catalog.Images) ImageCatalogV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageCatalogV4Response) ImageCatalog(com.sequenceiq.cloudbreak.domain.ImageCatalog) InternalOnly(com.sequenceiq.authorization.annotation.InternalOnly)

Example 7 with InternalOnly

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);
}
Also used : Recipe(com.sequenceiq.cloudbreak.domain.Recipe) InternalOnly(com.sequenceiq.authorization.annotation.InternalOnly)

Example 8 with InternalOnly

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;
}
Also used : AuthorizeForAutoscaleV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.autoscales.response.AuthorizeForAutoscaleV4Response) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) InternalOnly(com.sequenceiq.authorization.annotation.InternalOnly)

Example 9 with InternalOnly

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);
}
Also used : HashSet(java.util.HashSet) InternalOnly(com.sequenceiq.authorization.annotation.InternalOnly)

Example 10 with InternalOnly

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);
}
Also used : Consumption(com.sequenceiq.consumption.domain.Consumption) InternalOnly(com.sequenceiq.authorization.annotation.InternalOnly)

Aggregations

InternalOnly (com.sequenceiq.authorization.annotation.InternalOnly)11 NameOrCrn (com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn)2 InternalUpgradeSettings (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.InternalUpgradeSettings)2 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)2 AuthorizeForAutoscaleV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.autoscales.response.AuthorizeForAutoscaleV4Response)1 ImageCatalogV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageCatalogV4Response)1 AutoscaleRecommendation (com.sequenceiq.cloudbreak.cloud.model.AutoscaleRecommendation)1 Images (com.sequenceiq.cloudbreak.cloud.model.catalog.Images)1 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)1 ImageCatalog (com.sequenceiq.cloudbreak.domain.ImageCatalog)1 Recipe (com.sequenceiq.cloudbreak.domain.Recipe)1 Consumption (com.sequenceiq.consumption.domain.Consumption)1 ConsumptionCreationDto (com.sequenceiq.consumption.dto.ConsumptionCreationDto)1 DatabaseServerConfig (com.sequenceiq.redbeams.domain.DatabaseServerConfig)1 NotFoundException (com.sequenceiq.redbeams.exception.NotFoundException)1 HashSet (java.util.HashSet)1