Search in sources :

Example 1 with EnvironmentViewDto

use of com.sequenceiq.environment.environment.dto.EnvironmentViewDto in project cloudbreak by hortonworks.

the class EnvironmentDeletionServiceTest method setup.

@BeforeEach
public void setup() {
    environmentView = new EnvironmentView();
    environmentViewDto = new EnvironmentViewDto();
    when(environmentService.findNameWithAccountIdAndParentEnvIdAndArchivedIsFalse(any(), any())).thenReturn(emptyList());
}
Also used : EnvironmentViewDto(com.sequenceiq.environment.environment.dto.EnvironmentViewDto) EnvironmentView(com.sequenceiq.environment.environment.domain.EnvironmentView) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with EnvironmentViewDto

use of com.sequenceiq.environment.environment.dto.EnvironmentViewDto in project cloudbreak by hortonworks.

the class EnvironmentController method deleteByCrn.

@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DELETE_ENVIRONMENT)
public SimpleEnvironmentResponse deleteByCrn(@ValidCrn(resource = CrnResourceDescriptor.ENVIRONMENT) @ResourceCrn @TenantAwareParam String crn, boolean cascading, boolean forced) {
    String accountId = ThreadBasedUserCrnProvider.getAccountId();
    String actualUserCrn = ThreadBasedUserCrnProvider.getUserCrn();
    EnvironmentViewDto environmentDto = environmentDeletionService.deleteByCrnAndAccountId(crn, accountId, actualUserCrn, cascading, forced);
    return environmentResponseConverter.dtoToSimpleResponse(environmentDto);
}
Also used : EnvironmentViewDto(com.sequenceiq.environment.environment.dto.EnvironmentViewDto) CheckPermissionByResourceCrn(com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn)

Example 3 with EnvironmentViewDto

use of com.sequenceiq.environment.environment.dto.EnvironmentViewDto in project cloudbreak by hortonworks.

the class EnvironmentController method deleteByName.

@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.DELETE_ENVIRONMENT)
public SimpleEnvironmentResponse deleteByName(@ResourceName String environmentName, boolean cascading, boolean forced) {
    String accountId = ThreadBasedUserCrnProvider.getAccountId();
    String actualUserCrn = ThreadBasedUserCrnProvider.getUserCrn();
    EnvironmentViewDto environmentDto = environmentDeletionService.deleteByNameAndAccountId(environmentName, accountId, actualUserCrn, cascading, forced);
    return environmentResponseConverter.dtoToSimpleResponse(environmentDto);
}
Also used : EnvironmentViewDto(com.sequenceiq.environment.environment.dto.EnvironmentViewDto) CheckPermissionByResourceName(com.sequenceiq.authorization.annotation.CheckPermissionByResourceName)

Aggregations

EnvironmentViewDto (com.sequenceiq.environment.environment.dto.EnvironmentViewDto)3 CheckPermissionByResourceCrn (com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn)1 CheckPermissionByResourceName (com.sequenceiq.authorization.annotation.CheckPermissionByResourceName)1 EnvironmentView (com.sequenceiq.environment.environment.domain.EnvironmentView)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1