use of com.sequenceiq.cloudbreak.core.flow2.stack.provision.action.AbstractStackCreationAction in project cloudbreak by hortonworks.
the class KerberosConfigValidationActions method createBindUserAction.
@Bean(name = "CREATE_BIND_USER_STATE")
public Action<?, ?> createBindUserAction() {
return new AbstractStackCreationAction<>(StackEvent.class) {
@Override
protected void doExecute(StackCreationContext context, StackEvent payload, Map<Object, Object> variables) {
StartBindUserCreationEvent event = new StartBindUserCreationEvent(payload.getResourceId());
sendEvent(context, event);
}
@Override
protected Object getFailurePayload(StackEvent payload, Optional<StackCreationContext> flowContext, Exception ex) {
return new StackFailureEvent(KerberosConfigValidationEvent.VALIDATE_KERBEROS_CONFIG_FAILED_EVENT.selector(), payload.getResourceId(), ex);
}
};
}
use of com.sequenceiq.cloudbreak.core.flow2.stack.provision.action.AbstractStackCreationAction in project cloudbreak by hortonworks.
the class StackCreationActions method collectMetadataAction.
@Bean(name = "COLLECTMETADATA_STATE")
public Action<?, ?> collectMetadataAction() {
return new AbstractStackCreationAction<>(CollectMetadataResult.class) {
@Override
protected void doExecute(StackCreationContext context, CollectMetadataResult payload, Map<Object, Object> variables) {
Stack stack = stackCreationService.setupMetadata(context, payload);
StackCreationContext newContext = new StackCreationContext(context.getFlowParameters(), stack, context.getCloudContext(), context.getCloudCredential(), context.getCloudStack());
sendEvent(newContext);
}
@Override
protected Selectable createRequest(StackCreationContext context) {
List<LoadBalancerType> loadBalancerTypes = loadBalancerPersistenceService.findByStackId(context.getStack().getId()).stream().map(LoadBalancer::getType).collect(Collectors.toList());
List<CloudResource> cloudResources = context.getStack().getResources().stream().map(r -> cloudResourceConverter.convert(r)).collect(Collectors.toList());
return new CollectLoadBalancerMetadataRequest(context.getCloudContext(), context.getCloudCredential(), loadBalancerTypes, cloudResources);
}
};
}
use of com.sequenceiq.cloudbreak.core.flow2.stack.provision.action.AbstractStackCreationAction in project cloudbreak by hortonworks.
the class StackCreationActions method createCredentialAction.
@Bean(name = "CREATE_CREDENTIAL_STATE")
public Action<?, ?> createCredentialAction() {
return new AbstractStackCreationAction<>(StackEvent.class) {
@Override
protected void doExecute(StackCreationContext context, StackEvent payload, Map<Object, Object> variables) {
variables.put(START_DATE, new Date());
stackCreationService.startProvisioning(context, variables);
sendEvent(context);
}
@Override
protected Selectable createRequest(StackCreationContext context) {
return new CreateCredentialRequest(context.getCloudContext(), context.getCloudCredential(), context.getCloudStack());
}
};
}
use of com.sequenceiq.cloudbreak.core.flow2.stack.provision.action.AbstractStackCreationAction in project cloudbreak by hortonworks.
the class StackCreationActions method provisioningFinishedAction.
@Bean(name = "PROVISIONING_FINISHED_STATE")
public Action<?, ?> provisioningFinishedAction() {
return new AbstractStackCreationAction<>(LaunchLoadBalancerResult.class) {
@Override
protected void doExecute(StackCreationContext context, LaunchLoadBalancerResult payload, Map<Object, Object> variables) {
Stack stack = stackCreationService.loadBalancerProvisioningFinished(context, payload, variables);
StackCreationContext newContext = new StackCreationContext(context.getFlowParameters(), stack, context.getCloudContext(), context.getCloudCredential(), context.getCloudStack());
sendEvent(newContext);
}
@Override
protected Selectable createRequest(StackCreationContext context) {
List<CloudInstance> cloudInstances = cloudStackConverter.buildInstances(context.getStack());
List<CloudResource> cloudResources = context.getStack().getResources().stream().map(r -> cloudResourceConverter.convert(r)).collect(Collectors.toList());
return new CollectMetadataRequest(context.getCloudContext(), context.getCloudCredential(), cloudResources, cloudInstances, cloudInstances);
}
};
}
use of com.sequenceiq.cloudbreak.core.flow2.stack.provision.action.AbstractStackCreationAction in project cloudbreak by hortonworks.
the class StackCreationActions method collectLoadBalancerMetadataAction.
@Bean(name = "COLLECTMETADATA_LOADBALANCER_STATE")
public Action<?, ?> collectLoadBalancerMetadataAction() {
return new AbstractStackCreationAction<>(CollectLoadBalancerMetadataResult.class) {
@Override
protected void doExecute(StackCreationContext context, CollectLoadBalancerMetadataResult payload, Map<Object, Object> variables) {
Stack stack = stackCreationService.setupLoadBalancerMetadata(context, payload);
StackCreationContext newContext = new StackCreationContext(context.getFlowParameters(), stack, context.getCloudContext(), context.getCloudCredential(), context.getCloudStack());
if (newContext.getStack().getTunnel().useCcm()) {
GetTlsInfoResult getTlsInfoResult = new GetTlsInfoResult(context.getCloudContext().getId(), new TlsInfo(true));
sendEvent(newContext, getTlsInfoResult.selector(), getTlsInfoResult);
} else {
sendEvent(newContext);
}
}
@Override
protected Selectable createRequest(StackCreationContext context) {
CloudStack cloudStack = cloudStackConverter.convert(context.getStack());
return new GetTlsInfoRequest<GetTlsInfoResult>(context.getCloudContext(), context.getCloudCredential(), cloudStack);
}
};
}
Aggregations