use of com.sequenceiq.cloudbreak.core.flow2.stack.start.StackCreationContext 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);
}
};
}
use of com.sequenceiq.cloudbreak.core.flow2.stack.start.StackCreationContext 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.start.StackCreationContext 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.start.StackCreationContext 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.start.StackCreationContext 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);
}
};
}
Aggregations