Search in sources :

Example 6 with StackContext

use of com.sequenceiq.cloudbreak.core.flow2.stack.StackContext in project cloudbreak by hortonworks.

the class StackCreationActions method collectMetadataAction.

@Bean(name = "COLLECTMETADATA_STATE")
public Action<?, ?> collectMetadataAction() {
    return new AbstractStackCreationAction<CollectMetadataResult>(CollectMetadataResult.class) {

        @Override
        protected void doExecute(StackContext context, CollectMetadataResult payload, Map<Object, Object> variables) {
            Stack stack = stackCreationService.setupMetadata(context, payload);
            StackContext newContext = new StackContext(context.getFlowId(), stack, context.getCloudContext(), context.getCloudCredential(), context.getCloudStack());
            sendEvent(newContext);
        }

        @Override
        protected Selectable createRequest(StackContext context) {
            CloudStack cloudStack = cloudStackConverter.convert(context.getStack());
            return new GetTlsInfoRequest<GetTlsInfoResult>(context.getCloudContext(), context.getCloudCredential(), cloudStack);
        }
    };
}
Also used : StackContext(com.sequenceiq.cloudbreak.core.flow2.stack.StackContext) CollectMetadataResult(com.sequenceiq.cloudbreak.cloud.event.instance.CollectMetadataResult) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) Map(java.util.Map) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) Stack(com.sequenceiq.cloudbreak.domain.Stack) GetTlsInfoRequest(com.sequenceiq.cloudbreak.cloud.event.instance.GetTlsInfoRequest) Bean(org.springframework.context.annotation.Bean)

Example 7 with StackContext

use of com.sequenceiq.cloudbreak.core.flow2.stack.StackContext in project cloudbreak by hortonworks.

the class StackCreationActions method provisioningFinishedAction.

@Bean(name = "PROVISIONING_FINISHED_STATE")
public Action<?, ?> provisioningFinishedAction() {
    return new AbstractStackCreationAction<LaunchStackResult>(LaunchStackResult.class) {

        @Override
        protected void doExecute(StackContext context, LaunchStackResult payload, Map<Object, Object> variables) {
            Stack stack = stackCreationService.provisioningFinished(context, payload, variables);
            StackContext newContext = new StackContext(context.getFlowId(), stack, context.getCloudContext(), context.getCloudCredential(), context.getCloudStack());
            sendEvent(newContext);
        }

        @Override
        protected Selectable createRequest(StackContext context) {
            List<CloudInstance> cloudInstances = cloudStackConverter.buildInstances(context.getStack());
            List<CloudResource> cloudResources = cloudResourceConverter.convert(context.getStack().getResources());
            return new CollectMetadataRequest(context.getCloudContext(), context.getCloudCredential(), cloudResources, cloudInstances);
        }
    };
}
Also used : CollectMetadataRequest(com.sequenceiq.cloudbreak.cloud.event.instance.CollectMetadataRequest) StackContext(com.sequenceiq.cloudbreak.core.flow2.stack.StackContext) LaunchStackResult(com.sequenceiq.cloudbreak.cloud.event.resource.LaunchStackResult) CloudInstance(com.sequenceiq.cloudbreak.cloud.model.CloudInstance) CloudResource(com.sequenceiq.cloudbreak.cloud.model.CloudResource) Map(java.util.Map) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) Stack(com.sequenceiq.cloudbreak.domain.Stack) Bean(org.springframework.context.annotation.Bean)

Aggregations

StackContext (com.sequenceiq.cloudbreak.core.flow2.stack.StackContext)7 Map (java.util.Map)6 Bean (org.springframework.context.annotation.Bean)6 CloudStack (com.sequenceiq.cloudbreak.cloud.model.CloudStack)5 Stack (com.sequenceiq.cloudbreak.domain.Stack)4 CloudInstance (com.sequenceiq.cloudbreak.cloud.model.CloudInstance)2 CloudContext (com.sequenceiq.cloudbreak.cloud.context.CloudContext)1 CollectMetadataRequest (com.sequenceiq.cloudbreak.cloud.event.instance.CollectMetadataRequest)1 CollectMetadataResult (com.sequenceiq.cloudbreak.cloud.event.instance.CollectMetadataResult)1 GetSSHFingerprintsRequest (com.sequenceiq.cloudbreak.cloud.event.instance.GetSSHFingerprintsRequest)1 GetSSHFingerprintsResult (com.sequenceiq.cloudbreak.cloud.event.instance.GetSSHFingerprintsResult)1 GetTlsInfoRequest (com.sequenceiq.cloudbreak.cloud.event.instance.GetTlsInfoRequest)1 GetTlsInfoResult (com.sequenceiq.cloudbreak.cloud.event.instance.GetTlsInfoResult)1 CreateCredentialRequest (com.sequenceiq.cloudbreak.cloud.event.resource.CreateCredentialRequest)1 LaunchStackResult (com.sequenceiq.cloudbreak.cloud.event.resource.LaunchStackResult)1 PrepareImageRequest (com.sequenceiq.cloudbreak.cloud.event.setup.PrepareImageRequest)1 SetupResult (com.sequenceiq.cloudbreak.cloud.event.setup.SetupResult)1 CloudCredential (com.sequenceiq.cloudbreak.cloud.model.CloudCredential)1 CloudResource (com.sequenceiq.cloudbreak.cloud.model.CloudResource)1 Image (com.sequenceiq.cloudbreak.cloud.model.Image)1