Search in sources :

Example 6 with PaaSTopologyDeploymentContext

use of alien4cloud.paas.model.PaaSTopologyDeploymentContext in project alien4cloud by alien4cloud.

the class DeploymentRuntimeService method triggerOperationExecution.

/**
 * Trigger the execution of an operation on a node.
 *
 * @param request the operation's execution description ( see {@link alien4cloud.paas.model.OperationExecRequest})
 * @param callback the callback when execution finishes
 * @throws alien4cloud.paas.exception.OperationExecutionException runtime exception during an operation
 */
public void triggerOperationExecution(OperationExecRequest request, IPaaSCallback<Map<String, String>> callback) throws OperationExecutionException {
    PaaSTopologyDeploymentContext context = buildPaaSTopologyDeploymentContext(request);
    IOrchestratorPlugin orchestratorPlugin = orchestratorPluginService.getOrFail(context.getDeployment().getOrchestratorId());
    orchestratorPlugin.executeOperation(context, request, callback);
}
Also used : PaaSTopologyDeploymentContext(alien4cloud.paas.model.PaaSTopologyDeploymentContext) IOrchestratorPlugin(alien4cloud.orchestrators.plugin.IOrchestratorPlugin)

Example 7 with PaaSTopologyDeploymentContext

use of alien4cloud.paas.model.PaaSTopologyDeploymentContext in project alien4cloud by alien4cloud.

the class ArtifactProcessorService method processDeploymentArtifacts.

private void processDeploymentArtifacts(PaaSTopologyDeploymentContext deploymentContext) {
    if (deploymentContext.getDeploymentTopology().getNodeTemplates() != null) {
        // Artifact which comes from the archive or from internal repository
        getDeploymentArtifactStream(deploymentContext).filter(deploymentArtifact -> !isArtifactFromTopologyEditor(deploymentArtifact)).forEach(this::processArtifact);
        // Artifact which does not come from the archive, which comes from topology's edition
        getDeploymentArtifactStream(deploymentContext).filter(this::isArtifactFromTopologyEditor).forEach(deploymentArtifact -> {
            Path artifactPath = editorRepositoryService.resolveArtifact(deploymentContext.getDeploymentTopology().getInitialTopologyId(), deploymentArtifact.getArtifactRef());
            deploymentArtifact.setArtifactPath(artifactPath.toString());
        });
    }
}
Also used : URL(java.net.URL) PaaSTopologyDeploymentContext(alien4cloud.paas.model.PaaSTopologyDeploymentContext) PaaSRelationshipTemplate(alien4cloud.paas.model.PaaSRelationshipTemplate) PaaSNodeTemplate(alien4cloud.paas.model.PaaSNodeTemplate) AlienUtils.safe(alien4cloud.utils.AlienUtils.safe) StandardCopyOption(java.nio.file.StandardCopyOption) Value(org.springframework.beans.factory.annotation.Value) IFileRepository(alien4cloud.component.repository.IFileRepository) Map(java.util.Map) Interface(org.alien4cloud.tosca.model.definitions.Interface) FileUtil(alien4cloud.utils.FileUtil) Path(java.nio.file.Path) ArtifactRepositoryConstants(alien4cloud.component.repository.ArtifactRepositoryConstants) DeploymentArtifact(org.alien4cloud.tosca.model.definitions.DeploymentArtifact) EditorRepositoryService(org.alien4cloud.tosca.editor.EditorRepositoryService) MalformedURLException(java.net.MalformedURLException) Files(java.nio.file.Files) UnresolvableArtifactException(alien4cloud.deployment.exceptions.UnresolvableArtifactException) Resource(javax.annotation.Resource) IOException(java.io.IOException) CsarFileRepository(org.alien4cloud.tosca.catalog.repository.CsarFileRepository) AbstractArtifact(org.alien4cloud.tosca.model.definitions.AbstractArtifact) NotFoundException(alien4cloud.exception.NotFoundException) RepositoryService(alien4cloud.repository.services.RepositoryService) Component(org.springframework.stereotype.Component) Slf4j(lombok.extern.slf4j.Slf4j) Stream(java.util.stream.Stream) FilenameUtils(org.apache.commons.io.FilenameUtils) InputStream(java.io.InputStream) Path(java.nio.file.Path)

Example 8 with PaaSTopologyDeploymentContext

use of alien4cloud.paas.model.PaaSTopologyDeploymentContext in project alien4cloud by alien4cloud.

the class DeploymentService method getCloudActiveDeploymentContexts.

public Map<String, PaaSTopologyDeploymentContext> getCloudActiveDeploymentContexts(String orchestratorId) {
    Deployment[] deployments = getOrchestratorActiveDeployments(orchestratorId);
    Map<String, PaaSTopologyDeploymentContext> activeDeploymentContexts = Maps.newHashMap();
    for (Deployment deployment : deployments) {
        DeploymentTopology topology = deploymentRuntimeStateService.getRuntimeTopology(deployment.getId());
        activeDeploymentContexts.put(deployment.getOrchestratorDeploymentId(), deploymentContextService.buildTopologyDeploymentContext(null, deployment, deploymentTopologyService.getLocations(topology), topology));
    }
    return activeDeploymentContexts;
}
Also used : PaaSTopologyDeploymentContext(alien4cloud.paas.model.PaaSTopologyDeploymentContext) DeploymentTopology(alien4cloud.model.deployment.DeploymentTopology) Deployment(alien4cloud.model.deployment.Deployment)

Aggregations

PaaSTopologyDeploymentContext (alien4cloud.paas.model.PaaSTopologyDeploymentContext)8 IOrchestratorPlugin (alien4cloud.orchestrators.plugin.IOrchestratorPlugin)3 Deployment (alien4cloud.model.deployment.Deployment)2 DeploymentTopology (alien4cloud.model.deployment.DeploymentTopology)2 Location (alien4cloud.model.orchestrators.locations.Location)2 Map (java.util.Map)2 ArtifactRepositoryConstants (alien4cloud.component.repository.ArtifactRepositoryConstants)1 IFileRepository (alien4cloud.component.repository.IFileRepository)1 UnresolvableArtifactException (alien4cloud.deployment.exceptions.UnresolvableArtifactException)1 SecretProviderConfigurationAndCredentials (alien4cloud.deployment.model.SecretProviderConfigurationAndCredentials)1 DeploymentCreatedEvent (alien4cloud.events.DeploymentCreatedEvent)1 NotFoundException (alien4cloud.exception.NotFoundException)1 IPaaSCallback (alien4cloud.paas.IPaaSCallback)1 PaaSNodeTemplate (alien4cloud.paas.model.PaaSNodeTemplate)1 PaaSRelationshipTemplate (alien4cloud.paas.model.PaaSRelationshipTemplate)1 PaaSTopology (alien4cloud.paas.model.PaaSTopology)1 RepositoryService (alien4cloud.repository.services.RepositoryService)1 AlienUtils.safe (alien4cloud.utils.AlienUtils.safe)1 FileUtil (alien4cloud.utils.FileUtil)1 IOException (java.io.IOException)1