use of com.sequenceiq.flow.api.model.FlowIdentifier in project cloudbreak by hortonworks.
the class SdxDeleteInternalAction method action.
@Override
public SdxInternalTestDto action(TestContext testContext, SdxInternalTestDto testDto, SdxClient client) throws Exception {
Log.when(LOGGER, " SDX endpoint: %s" + client.getDefaultClient().sdxEndpoint() + ", SDX's environment: " + testDto.getRequest().getEnvironment());
Log.whenJson(LOGGER, " SDX Internal delete request: ", testDto.getRequest());
FlowIdentifier flowIdentifier = client.getDefaultClient().sdxEndpoint().delete(testDto.getName(), false);
testDto.setFlow("SDX delete", flowIdentifier);
SdxClusterDetailResponse detailedResponse = client.getDefaultClient().sdxEndpoint().getDetail(testDto.getName(), Collections.emptySet());
testDto.setResponse(detailedResponse);
Log.whenJson(LOGGER, " SDX Internal delete response: ", detailedResponse);
return testDto;
}
use of com.sequenceiq.flow.api.model.FlowIdentifier in project cloudbreak by hortonworks.
the class SdxForceDeleteAction method action.
@Override
public SdxTestDto action(TestContext testContext, SdxTestDto testDto, SdxClient client) throws Exception {
Log.when(LOGGER, " SDX endpoint: %s" + client.getDefaultClient().sdxEndpoint() + ", SDX's environment: " + testDto.getRequest().getEnvironment());
Log.whenJson(LOGGER, " SDX force delete request: ", testDto.getRequest());
FlowIdentifier flowIdentifier = client.getDefaultClient().sdxEndpoint().delete(testDto.getName(), true);
testDto.setFlow("SDX force delete", flowIdentifier);
SdxClusterDetailResponse detailedResponse = client.getDefaultClient().sdxEndpoint().getDetail(testDto.getName(), Collections.emptySet());
testDto.setResponse(detailedResponse);
Log.whenJson(LOGGER, " SDX force delete response: ", detailedResponse);
return testDto;
}
use of com.sequenceiq.flow.api.model.FlowIdentifier in project cloudbreak by hortonworks.
the class SdxForceDeleteInternalAction method action.
@Override
public SdxInternalTestDto action(TestContext testContext, SdxInternalTestDto testDto, SdxClient client) throws Exception {
Log.when(LOGGER, " SDX endpoint: %s" + client.getDefaultClient().sdxEndpoint() + ", SDX's environment: " + testDto.getRequest().getEnvironment());
FlowIdentifier flowIdentifier = client.getDefaultClient().sdxEndpoint().delete(testDto.getName(), true);
testDto.setFlow("SDX Internal force delete", flowIdentifier);
SdxClusterDetailResponse detailedResponse = client.getDefaultClient().sdxEndpoint().getDetail(testDto.getName(), Collections.emptySet());
testDto.setResponse(detailedResponse);
Log.whenJson(LOGGER, " SDX Internal force delete response: ", detailedResponse);
return testDto;
}
use of com.sequenceiq.flow.api.model.FlowIdentifier in project cloudbreak by hortonworks.
the class LoadBalancerPollerService method updateStackWithLoadBalancer.
public void updateStackWithLoadBalancer(Long environmentId, String environmentCrn, String environmentName, PublicEndpointAccessGateway endpointAccessGateway) {
Set<String> stackNames;
if (PublicEndpointAccessGateway.ENABLED.equals(endpointAccessGateway)) {
LOGGER.debug("Updating load balancers for endpoint gateway on Data Lake and Data Hubs.");
stackNames = getDataLakeAndDataHubNames(environmentCrn, environmentName);
LOGGER.debug("Found {} Data Lake and Data Hub clusters to update for environment {}.", stackNames.size(), environmentName);
} else {
LOGGER.debug("Updating load balancer for Data Lake cluster.");
stackNames = getAttachedDatalakeClusters(environmentName);
}
if (stackNames.isEmpty()) {
LOGGER.debug("No Data Lake or Data Hub clusters found for environment.");
} else {
try {
List<FlowIdentifier> failedFlows = waitStackLoadBalancerUpdate(getPollingConfig(), stackNames, environmentName);
LOGGER.debug("Data Lake and Data Hub load balancer update finished.");
if (!failedFlows.isEmpty()) {
LOGGER.error("Found failed flows for Data Lake or Data Hub load balancer updates: " + failedFlows);
throw new UpdateFailedException("Data Lake or Data Hub update flows failed: " + failedFlows);
}
} catch (PollerStoppedException e) {
throw new UpdateFailedException("Stack update poller reached timeout.", e);
}
}
}
use of com.sequenceiq.flow.api.model.FlowIdentifier in project cloudbreak by hortonworks.
the class StackService method updateLoadBalancer.
public List<FlowIdentifier> updateLoadBalancer(Set<String> names) {
String initiatorUserCrn = ThreadBasedUserCrnProvider.getUserCrn();
List<FlowIdentifier> flowIdentifiers = new ArrayList<>();
for (String name : names) {
try {
ThreadBasedUserCrnProvider.doAsInternalActor(regionAwareInternalCrnGeneratorFactory.iam().getInternalCrnForServiceAsString(), () -> {
FlowIdentifier flowidentifier = stackV4Endpoint.updateLoadBalancersInternal(0L, name, initiatorUserCrn);
flowIdentifiers.add(flowidentifier);
});
} catch (WebApplicationException e) {
String errorMessage = messageExtractor.getErrorMessage(e);
LOGGER.error(String.format("Failed update load balancer for stack %s due to: '%s'.", name, errorMessage), e);
throw e;
}
}
return flowIdentifiers;
}
Aggregations