use of com.sequenceiq.freeipa.flow.stack.StackContext in project cloudbreak by hortonworks.
the class FreeIpaDownscaleActions method downscaleFinsihedAction.
@Bean(name = "DOWNSCALE_FINISHED_STATE")
public Action<?, ?> downscaleFinsihedAction() {
return new AbstractDownscaleAction<>(StackEvent.class) {
@Inject
private OperationService operationService;
@Override
protected void doExecute(StackContext context, StackEvent payload, Map<Object, Object> variables) {
Stack stack = context.getStack();
stackUpdater.updateStackStatus(stack.getId(), getDownscaleCompleteStatus(variables), "Downscale complete");
if (shouldCompleteOperation(variables)) {
SuccessDetails successDetails = new SuccessDetails(stack.getEnvironmentCrn());
successDetails.getAdditionalDetails().put("Hosts", getDownscaleHosts(variables));
operationService.completeOperation(stack.getAccountId(), getOperationId(variables), List.of(successDetails), Collections.emptyList());
}
sendEvent(context, DOWNSCALE_FINISHED_EVENT.selector(), new StackEvent(stack.getId()));
}
};
}
use of com.sequenceiq.freeipa.flow.stack.StackContext in project cloudbreak by hortonworks.
the class FreeIpaDownscaleActions method downscaleClusterProxyRegistrationAction.
@Bean(name = "DOWNSCALE_CLUSTERPROXY_REGISTRATION_STATE")
public Action<?, ?> downscaleClusterProxyRegistrationAction() {
return new AbstractDownscaleAction<>(StackEvent.class) {
@Override
protected void doExecute(StackContext context, StackEvent payload, Map<Object, Object> variables) throws Exception {
Stack stack = context.getStack();
stackUpdater.updateStackStatus(stack.getId(), getInProgressStatus(variables), "Updating cluster proxy registration.");
List<String> repairInstanceIds = getInstanceIds(variables);
List<String> instanceIdsToRegister = stack.getNotDeletedInstanceMetaDataList().stream().map(InstanceMetaData::getInstanceId).filter(instanceId -> !repairInstanceIds.contains(instanceId)).collect(Collectors.toList());
ClusterProxyUpdateRegistrationRequest request = new ClusterProxyUpdateRegistrationRequest(stack.getId(), instanceIdsToRegister);
sendEvent(context, request.selector(), request);
}
};
}
use of com.sequenceiq.freeipa.flow.stack.StackContext in project cloudbreak by hortonworks.
the class StackProvisionActions method getTlsInfoAction.
@Bean(name = "GET_TLS_INFO_STATE")
public Action<?, ?> getTlsInfoAction() {
return new AbstractStackProvisionAction<>(GetTlsInfoResult.class) {
@Override
protected void doExecute(StackContext context, GetTlsInfoResult payload, Map<Object, Object> variables) {
stackProvisionService.saveTlsInfo(context, payload.getTlsInfo());
sendEvent(context, new StackEvent(StackProvisionEvent.SETUP_TLS_EVENT.event(), context.getStack().getId()));
}
};
}
use of com.sequenceiq.freeipa.flow.stack.StackContext in project cloudbreak by hortonworks.
the class StackProvisionActions method createCredentialAction.
@Bean(name = "CREATE_CREDENTIAL_STATE")
public Action<?, ?> createCredentialAction() {
return new AbstractStackProvisionAction<>(StackEvent.class) {
@Override
protected void doExecute(StackContext context, StackEvent payload, Map<Object, Object> variables) {
variables.put(START_DATE, new Date());
stackProvisionService.startProvisioning(context);
sendEvent(context);
}
@Override
protected Selectable createRequest(StackContext context) {
return new CreateCredentialRequest(context.getCloudContext(), context.getCloudCredential(), context.getCloudStack());
}
};
}
use of com.sequenceiq.freeipa.flow.stack.StackContext in project cloudbreak by hortonworks.
the class StackProvisionActions method provisioningFinishedAction.
@Bean(name = "PROVISIONING_FINISHED_STATE")
public Action<?, ?> provisioningFinishedAction() {
return new AbstractStackProvisionAction<>(LaunchStackResult.class) {
@Override
protected void doExecute(StackContext context, LaunchStackResult payload, Map<Object, Object> variables) {
Stack stack = stackProvisionService.provisioningFinished(context, payload, variables);
StackContext newContext = new StackContext(context.getFlowParameters(), stack, context.getCloudContext(), context.getCloudCredential(), context.getCloudStack());
sendEvent(newContext);
}
@Override
protected Selectable createRequest(StackContext context) {
List<CloudInstance> cloudInstances = cloudStackConverter.buildInstances(context.getStack());
List<Resource> resources = resourceService.findAllByStackId(context.getStack().getId());
List<CloudResource> cloudResources = resources.stream().map(r -> resourceConverter.convert(r)).collect(Collectors.toList());
return new CollectMetadataRequest(context.getCloudContext(), context.getCloudCredential(), cloudResources, cloudInstances, cloudInstances);
}
};
}
Aggregations