@Test void getTest() throws NoSuchFieldException { SdxCluster sdxCluster = getValidSdxCluster(); when(sdxService.getByNameInAccount(anyString(), anyString())).thenReturn(sdxCluster); SdxStatusEntity sdxStatusEntity = new SdxStatusEntity(); sdxStatusEntity.setStatus(DatalakeStatusEnum.REQUESTED); sdxStatusEntity.setStatusReason("statusreason"); sdxStatusEntity.setCreated(1L); when(sdxStatusService.getActualStatusForSdx(sdxCluster)).thenReturn(sdxStatusEntity); FieldSetter.setField(sdxClusterConverter, SdxClusterConverter.class.getDeclaredField("sdxStatusService"), sdxStatusService); SdxClusterResponse sdxClusterResponse = ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> sdxController.get("test-sdx-cluster")); assertEquals("test-sdx-cluster", sdxClusterResponse.getName()); assertEquals("test-env", sdxClusterResponse.getEnvironmentName()); assertEquals("crn:sdxcluster", sdxClusterResponse.getCrn()); assertEquals(SdxClusterStatusResponse.REQUESTED, sdxClusterResponse.getStatus()); assertEquals("statusreason", sdxClusterResponse.getStatusReason()); }
@Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_DATALAKE) public SdxClusterResponse get(@ResourceName String name) { String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); SdxCluster sdxCluster = sdxService.getByNameInAccount(userCrn, name); return sdxClusterConverter.sdxClusterToResponse(sdxCluster); }
SdxController implements SdxEndpoint { @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_DATALAKE) public SdxClusterResponse get(@ResourceName String name) { String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); SdxCluster sdxCluster = sdxService.getByNameInAccount(userCrn, name); return sdxClusterConverter.sdxClusterToResponse(sdxCluster); } }
SdxController implements SdxEndpoint { @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_DATALAKE) public SdxClusterResponse get(@ResourceName String name) { String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); SdxCluster sdxCluster = sdxService.getByNameInAccount(userCrn, name); return sdxClusterConverter.sdxClusterToResponse(sdxCluster); }  }
SdxController implements SdxEndpoint { @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_DATALAKE) public SdxClusterResponse get(@ResourceName String name) { String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); SdxCluster sdxCluster = sdxService.getByNameInAccount(userCrn, name); return sdxClusterConverter.sdxClusterToResponse(sdxCluster); }  @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_DATALAKE) SdxClusterResponse create(@ValidStackNameFormat @ValidStackNameLength String name,
            @Valid SdxClusterRequest createSdxClusterRequest); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.DELETE_DATALAKE) FlowIdentifier delete(@ResourceName String name, Boolean forced); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DELETE_DATALAKE) FlowIdentifier deleteByCrn(@ResourceCrn String clusterCrn, Boolean forced); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_DATALAKE) SdxClusterResponse get(@ResourceName String name); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_DATALAKE) SdxClusterResponse getByCrn(@TenantAwareParam @ResourceCrn String clusterCrn); @Override @DisableCheckPermissions List<SdxClusterResponse> list(String envName); @Override @DisableCheckPermissions List<SdxClusterResponse> getByEnvCrn(@ValidCrn String envCrn); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_DETAILED_DATALAKE) SdxClusterDetailResponse getDetail(@ResourceName String name, Set<String> entries); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_DETAILED_DATALAKE) SdxClusterDetailResponse getDetailByCrn(@TenantAwareParam @ResourceCrn String clusterCrn, Set<String> entries); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.REPAIR_DATALAKE) FlowIdentifier repairCluster(@ResourceName String clusterName, SdxRepairRequest clusterRepairRequest); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.REPAIR_DATALAKE) FlowIdentifier repairClusterByCrn(@ResourceCrn String clusterCrn, SdxRepairRequest clusterRepairRequest); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.SYNC_DATALAKE) void sync(@ResourceName String name); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.SYNC_DATALAKE) void syncByCrn(@ResourceCrn String crn); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.RETRY_DATALAKE_OPERATION) FlowIdentifier retry(@ResourceName String name); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.RETRY_DATALAKE_OPERATION) FlowIdentifier retryByCrn(@ResourceCrn String crn); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.START_DATALAKE) FlowIdentifier startByName(@ResourceName String name); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.START_DATALAKE) FlowIdentifier startByCrn(@ResourceCrn String crn); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.STOP_DATALAKE) FlowIdentifier stopByName(@ResourceName String name); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.STOP_DATALAKE) FlowIdentifier stopByCrn(@ResourceCrn String crn); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_DATALAKE) List<String> versions(); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_DATALAKE) List<AdvertisedRuntime> advertisedRuntimes(); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.BACKUP_DATALAKE) SdxDatabaseBackupResponse backupDatabaseByName(@ResourceName String name, String backupId, String backupLocation); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.RESTORE_DATALAKE) SdxDatabaseRestoreResponse restoreDatabaseByName(@ResourceName String name, String backupId, String backupLocation); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.BACKUP_DATALAKE) SdxDatabaseBackupStatusResponse getBackupDatabaseStatusByName(@ResourceName String name, String operationId); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.RESTORE_DATALAKE) SdxDatabaseRestoreStatusResponse getRestoreDatabaseStatusByName(@ResourceName String name, String operationId); @Override @InternalOnly RangerCloudIdentitySyncStatus setRangerCloudIdentityMapping(String envCrn, SetRangerCloudIdentityMappingRequest request); @Override @InternalOnly RangerCloudIdentitySyncStatus getRangerCloudIdentitySyncStatus(String envCrn, long commandId); }
SdxController implements SdxEndpoint { @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_DATALAKE) public SdxClusterResponse get(@ResourceName String name) { String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); SdxCluster sdxCluster = sdxService.getByNameInAccount(userCrn, name); return sdxClusterConverter.sdxClusterToResponse(sdxCluster); }  @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_DATALAKE) SdxClusterResponse create(@ValidStackNameFormat @ValidStackNameLength String name,
            @Valid SdxClusterRequest createSdxClusterRequest); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.DELETE_DATALAKE) FlowIdentifier delete(@ResourceName String name, Boolean forced); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DELETE_DATALAKE) FlowIdentifier deleteByCrn(@ResourceCrn String clusterCrn, Boolean forced); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_DATALAKE) SdxClusterResponse get(@ResourceName String name); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_DATALAKE) SdxClusterResponse getByCrn(@TenantAwareParam @ResourceCrn String clusterCrn); @Override @DisableCheckPermissions List<SdxClusterResponse> list(String envName); @Override @DisableCheckPermissions List<SdxClusterResponse> getByEnvCrn(@ValidCrn String envCrn); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_DETAILED_DATALAKE) SdxClusterDetailResponse getDetail(@ResourceName String name, Set<String> entries); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_DETAILED_DATALAKE) SdxClusterDetailResponse getDetailByCrn(@TenantAwareParam @ResourceCrn String clusterCrn, Set<String> entries); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.REPAIR_DATALAKE) FlowIdentifier repairCluster(@ResourceName String clusterName, SdxRepairRequest clusterRepairRequest); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.REPAIR_DATALAKE) FlowIdentifier repairClusterByCrn(@ResourceCrn String clusterCrn, SdxRepairRequest clusterRepairRequest); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.SYNC_DATALAKE) void sync(@ResourceName String name); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.SYNC_DATALAKE) void syncByCrn(@ResourceCrn String crn); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.RETRY_DATALAKE_OPERATION) FlowIdentifier retry(@ResourceName String name); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.RETRY_DATALAKE_OPERATION) FlowIdentifier retryByCrn(@ResourceCrn String crn); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.START_DATALAKE) FlowIdentifier startByName(@ResourceName String name); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.START_DATALAKE) FlowIdentifier startByCrn(@ResourceCrn String crn); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.STOP_DATALAKE) FlowIdentifier stopByName(@ResourceName String name); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.STOP_DATALAKE) FlowIdentifier stopByCrn(@ResourceCrn String crn); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_DATALAKE) List<String> versions(); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_DATALAKE) List<AdvertisedRuntime> advertisedRuntimes(); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.BACKUP_DATALAKE) SdxDatabaseBackupResponse backupDatabaseByName(@ResourceName String name, String backupId, String backupLocation); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.RESTORE_DATALAKE) SdxDatabaseRestoreResponse restoreDatabaseByName(@ResourceName String name, String backupId, String backupLocation); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.BACKUP_DATALAKE) SdxDatabaseBackupStatusResponse getBackupDatabaseStatusByName(@ResourceName String name, String operationId); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.RESTORE_DATALAKE) SdxDatabaseRestoreStatusResponse getRestoreDatabaseStatusByName(@ResourceName String name, String operationId); @Override @InternalOnly RangerCloudIdentitySyncStatus setRangerCloudIdentityMapping(String envCrn, SetRangerCloudIdentityMappingRequest request); @Override @InternalOnly RangerCloudIdentitySyncStatus getRangerCloudIdentitySyncStatus(String envCrn, long commandId);  }