use of com.sequenceiq.cloudbreak.core.flow2.stack.provision.action.AbstractStackCreationAction in project cloudbreak by hortonworks.
the class ClusterCreationActions method clusterProxyRegistrationAction.
@Bean(name = "CLUSTER_PROXY_REGISTRATION_STATE")
public Action<?, ?> clusterProxyRegistrationAction() {
return new AbstractStackCreationAction<>(ProvisionEvent.class) {
@Inject
private ClusterProxyEnablementService clusterProxyEnablementService;
@Override
protected void prepareExecution(ProvisionEvent payload, Map<Object, Object> variables) {
super.prepareExecution(payload, variables);
variables.put(PROVISION_TYPE, payload.getProvisionType());
}
@Override
protected void doExecute(StackCreationContext context, ProvisionEvent payload, Map<Object, Object> variables) {
if (clusterProxyEnablementService.isClusterProxyApplicable(context.getStack().cloudPlatform())) {
clusterCreationService.registeringToClusterProxy(context.getStack());
sendEvent(context);
} else {
ClusterProxyRegistrationSuccess clusterProxyRegistrationSuccess = new ClusterProxyRegistrationSuccess(payload.getResourceId());
sendEvent(context, clusterProxyRegistrationSuccess);
}
}
@Override
protected Selectable createRequest(StackCreationContext context) {
return new ClusterProxyRegistrationRequest(context.getStack().getId(), context.getStack().cloudPlatform());
}
};
}
use of com.sequenceiq.cloudbreak.core.flow2.stack.provision.action.AbstractStackCreationAction in project cloudbreak by hortonworks.
the class StackCreationActions method tlsSetupAction.
@Bean(name = "TLS_SETUP_STATE")
public Action<?, ?> tlsSetupAction() {
return new AbstractStackCreationAction<>(GetSSHFingerprintsResult.class) {
@Override
protected void doExecute(StackCreationContext context, GetSSHFingerprintsResult payload, Map<Object, Object> variables) throws Exception {
if (!context.getStack().getTunnel().useCcm()) {
stackCreationService.setupTls(context);
}
StackWithFingerprintsEvent fingerprintsEvent = new StackWithFingerprintsEvent(payload.getResourceId(), payload.getSshFingerprints());
sendEvent(context, StackCreationEvent.TLS_SETUP_FINISHED_EVENT.event(), fingerprintsEvent);
}
};
}
use of com.sequenceiq.cloudbreak.core.flow2.stack.provision.action.AbstractStackCreationAction in project cloudbreak by hortonworks.
the class StackCreationActions method prepareImageAction.
@Bean(name = "IMAGESETUP_STATE")
public Action<?, ?> prepareImageAction() {
return new AbstractStackCreationAction<>(SetupResult.class) {
@Override
protected void doExecute(StackCreationContext context, SetupResult payload, Map<Object, Object> variables) {
stackCreationService.prepareImage(context.getStack(), variables);
sendEvent(context);
}
@Override
protected Selectable createRequest(StackCreationContext context) {
try {
CloudStack cloudStack = cloudStackConverter.convert(context.getStack());
Image image = imageService.getImage(context.getCloudContext().getId());
return new PrepareImageRequest<>(context.getCloudContext(), context.getCloudCredential(), cloudStack, image);
} catch (CloudbreakImageNotFoundException e) {
throw new CloudbreakServiceException(e);
}
}
};
}
use of com.sequenceiq.cloudbreak.core.flow2.stack.provision.action.AbstractStackCreationAction in project cloudbreak by hortonworks.
the class StackCreationActions method getTlsInfoAction.
@Bean(name = "GET_TLS_INFO_STATE")
public Action<?, ?> getTlsInfoAction() {
return new AbstractStackCreationAction<>(GetTlsInfoResult.class) {
@Override
protected void doExecute(StackCreationContext context, GetTlsInfoResult payload, Map<Object, Object> variables) {
Stack stack = stackCreationService.saveTlsInfo(context, payload.getTlsInfo());
StackCreationContext newContext = new StackCreationContext(context.getFlowParameters(), stack, context.getCloudContext(), context.getCloudCredential(), context.getCloudStack());
sendEvent(newContext);
}
@Override
protected Selectable createRequest(StackCreationContext context) {
Stack stack = context.getStack();
InstanceMetaData gatewayMetaData = stack.getPrimaryGatewayInstance();
DetailedEnvironmentResponse environment = environmentClientService.getByCrnAsInternal(stack.getEnvironmentCrn());
CloudInstance gatewayInstance = metadataConverter.convert(gatewayMetaData, environment, stack.getStackAuthentication());
return new GetSSHFingerprintsRequest<GetSSHFingerprintsResult>(context.getCloudContext(), context.getCloudCredential(), gatewayInstance);
}
};
}
use of com.sequenceiq.cloudbreak.core.flow2.stack.provision.action.AbstractStackCreationAction in project cloudbreak by hortonworks.
the class KerberosConfigValidationActions method pollBindUserCreationAction.
@Bean(name = "POLL_BIND_USER_CREATION_STATE")
public Action<?, ?> pollBindUserCreationAction() {
return new AbstractStackCreationAction<>(PollBindUserCreationEvent.class) {
@Override
protected void doExecute(StackCreationContext context, PollBindUserCreationEvent payload, Map<Object, Object> variables) {
PollBindUserCreationEvent event = new PollBindUserCreationEvent(payload.getResourceId(), payload.getOperationId(), Crn.safeFromString(context.getStack().getResourceCrn()).getAccountId());
sendEvent(context, event);
}
@Override
protected Object getFailurePayload(PollBindUserCreationEvent payload, Optional<StackCreationContext> flowContext, Exception ex) {
return new StackFailureEvent(KerberosConfigValidationEvent.VALIDATE_KERBEROS_CONFIG_FAILED_EVENT.selector(), payload.getResourceId(), ex);
}
};
}
Aggregations