Search in sources :

Example 1 with SdxRestoreResponse

use of com.sequenceiq.sdx.api.model.SdxRestoreResponse in project cloudbreak by hortonworks.

the class SdxRestoreAction method action.

@Override
public SdxTestDto action(TestContext testContext, SdxTestDto testDto, SdxClient client) throws Exception {
    String sdxName = testDto.getName();
    Log.when(LOGGER, format(" SDX '%s' restore has been started to '%s' ", sdxName, backupLocation));
    Log.whenJson(LOGGER, " SDX restore request: ", testDto.getRequest());
    LOGGER.info(format(" SDX '%s' restore has been started to '%s'... ", sdxName, backupLocation));
    SdxRestoreResponse sdxRestoreResponse = client.getDefaultClient().sdxRestoreEndpoint().restoreDatalakeByName(sdxName, backupId, backupLocation);
    testDto.setFlow("SDX restore", sdxRestoreResponse.getFlowIdentifier());
    SdxClusterDetailResponse detailedResponse = client.getDefaultClient().sdxEndpoint().getDetail(sdxName, Collections.emptySet());
    testDto.setResponse(detailedResponse);
    Log.whenJson(LOGGER, " SDX response after restore: ", client.getDefaultClient().sdxEndpoint().get(sdxName));
    return testDto;
}
Also used : SdxRestoreResponse(com.sequenceiq.sdx.api.model.SdxRestoreResponse) SdxClusterDetailResponse(com.sequenceiq.sdx.api.model.SdxClusterDetailResponse)

Example 2 with SdxRestoreResponse

use of com.sequenceiq.sdx.api.model.SdxRestoreResponse in project cloudbreak by hortonworks.

the class SdxBackupRestoreService method triggerDatalakeRestoreFlow.

private SdxRestoreResponse triggerDatalakeRestoreFlow(SdxCluster cluster, String backupId, String backupLocation, String backupLocationOverride) {
    String selector = DATALAKE_TRIGGER_RESTORE_EVENT.event();
    String userId = ThreadBasedUserCrnProvider.getUserCrn();
    DatalakeTriggerRestoreEvent startEvent = new DatalakeTriggerRestoreEvent(selector, cluster.getId(), null, userId, backupId, backupLocation, backupLocationOverride, DatalakeRestoreFailureReason.USER_TRIGGERED);
    FlowIdentifier flowIdentifier = sdxReactorFlowManager.triggerDatalakeRestoreFlow(startEvent, cluster.getClusterName());
    return new SdxRestoreResponse(startEvent.getDrStatus().getOperationId(), flowIdentifier);
}
Also used : SdxRestoreResponse(com.sequenceiq.sdx.api.model.SdxRestoreResponse) DatalakeTriggerRestoreEvent(com.sequenceiq.datalake.flow.dr.restore.event.DatalakeTriggerRestoreEvent) FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier)

Example 3 with SdxRestoreResponse

use of com.sequenceiq.sdx.api.model.SdxRestoreResponse in project cloudbreak by hortonworks.

the class SdxRestoreInternalAction method action.

@Override
public SdxInternalTestDto action(TestContext testContext, SdxInternalTestDto testDto, SdxClient client) throws Exception {
    String sdxName = testDto.getName();
    testContext.waitingFor(Duration.ofMinutes(2), "Waiting for CM services to be synchronized has been interrupted");
    Log.when(LOGGER, format(" Internal SDX '%s' restore has been started to '%s' ", sdxName, backupLocation));
    Log.whenJson(LOGGER, " Internal SDX restore request: ", testDto.getRequest());
    LOGGER.info(format(" Internal SDX '%s' restore has been started to '%s'... ", sdxName, backupLocation));
    SdxRestoreResponse sdxRestoreResponse = client.getDefaultClient().sdxRestoreEndpoint().restoreDatalakeByName(sdxName, backupId, backupLocation);
    testDto.setFlow("SDX restore", sdxRestoreResponse.getFlowIdentifier());
    SdxClusterDetailResponse detailedResponse = client.getDefaultClient().sdxEndpoint().getDetail(sdxName, Collections.emptySet());
    testDto.setResponse(detailedResponse);
    Log.whenJson(LOGGER, " Internal SDX response after restore: ", client.getDefaultClient().sdxEndpoint().get(sdxName));
    return testDto;
}
Also used : SdxRestoreResponse(com.sequenceiq.sdx.api.model.SdxRestoreResponse) SdxClusterDetailResponse(com.sequenceiq.sdx.api.model.SdxClusterDetailResponse)

Example 4 with SdxRestoreResponse

use of com.sequenceiq.sdx.api.model.SdxRestoreResponse in project cloudbreak by hortonworks.

the class SdxBackupRestoreService method triggerDatalakeRestoreFlow.

private SdxRestoreResponse triggerDatalakeRestoreFlow(Long clusterId, String backupId, String backupLocation, String backupLocationOverride) {
    String selector = DATALAKE_TRIGGER_RESTORE_EVENT.event();
    String userId = ThreadBasedUserCrnProvider.getUserCrn();
    DatalakeTriggerRestoreEvent startEvent = new DatalakeTriggerRestoreEvent(selector, clusterId, null, userId, backupId, backupLocation, backupLocationOverride, DatalakeRestoreFailureReason.USER_TRIGGERED);
    FlowIdentifier flowIdentifier = sdxReactorFlowManager.triggerDatalakeRestoreFlow(startEvent);
    return new SdxRestoreResponse(startEvent.getDrStatus().getOperationId(), flowIdentifier);
}
Also used : SdxRestoreResponse(com.sequenceiq.sdx.api.model.SdxRestoreResponse) DatalakeTriggerRestoreEvent(com.sequenceiq.datalake.flow.dr.restore.event.DatalakeTriggerRestoreEvent) FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier)

Aggregations

SdxRestoreResponse (com.sequenceiq.sdx.api.model.SdxRestoreResponse)4 DatalakeTriggerRestoreEvent (com.sequenceiq.datalake.flow.dr.restore.event.DatalakeTriggerRestoreEvent)2 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)2 SdxClusterDetailResponse (com.sequenceiq.sdx.api.model.SdxClusterDetailResponse)2