How to undeploy an application using the XL Deploy REST API

Apart from adding, modifying, and removing items from XL Deploy repository, you will want to undeploy Deployed Applications. Undeploying an Deployed Application is a task that is composed  of 4 steps , Prepare an undeployment,Create the Deployment task, Start the task and Archive the Executed task

Here, we'll give some examples of how to use XL Deploy's REST API to:

  • Prepare an undeployment
  • Create the deployment task
  • Start a task
  • Archive an executed task

Prepare an undeployment

Use  GET /deployment/prepare/undeploy to prepare an undeployment. Here, we'll prepare an undeployment for a  Deployed Application with ID Environments/myEnv/my-App.

INPUT:

curl -u<username>:<password> -X GET -H "content-type:application/xml" http://<xl-deploy-server>:<xl-deploy-port>/deployit/deployment/prepare/undeploy?deployedApplication=Environments/myEnv/my-App

OUTPUT:

<deployment id="deployment-0aa49c10-03fe-4ee4-8015-222abac3ba55" type="UNDEPLOYMENT">

  <application>

    <udm.DeployedApplication id="Environments/myEnv/my-App" token="384d1559-4aa9-4ae6-9c3e-fd6ab491b866">

      <version ref="Applications/my-App/1.0"/>

      <environment ref="Environments/myEnv/"/>

      <deployeds>

        <ci ref="Infrastructure/localhost/file"/>

      </deployeds>

      <orchestrator>default</orchestrator>

    </udm.DeployedApplication>

  </application>

  <deployeds/>

  <deployables>

    <ci ref="Applications/my-App/1.0/file" type="file.File"/>

  </deployables>

  <containers>

    <ci ref="Infrastructure/localhost" type="overthere.LocalHost"/>

  </containers>

</deployment>

A new Deployment object which contains no deployeds is returned. We need the response to be saved for the next step. Save it in a undeploy.xml file for the need of this example

Create the deployment task

Use  POST /deployment/ to create a deployment task. Here, we'll create an deployment task using the the response of the previous step. .

INPUT:

curl -u<username>:<password> -X POST -H "content-type:application/xml" http://<xl-deploy-server>:<xl-deploy-port>/deployit/deployment/ -d@/tmp/undeploy.xml

OUTPUT:

1327d3b8-40b9-4909-8080-b21e2c32f9a5

A reference to a Task ID that can be executed by the TaskService .

Start a task

Use  POST /task/{taskid}/start to start a task. Here, we'll start a task by using the Task ID from the response in the previous step .

INPUT:

curl -u<username>:<password> -X POST -H "content-type:application/xml" http://<xl-deploy-server>:<xl-deploy-port>/deployit/task/1327d3b8-40b9-4909-8080-b21e2c32f9a5/start

OUTPUT:

none

 

Archive an executed task

And finally, once the previous call,in the previous step has returned, use POST /task/{taskid}/archive to archive the task. Use the same Task ID as in the previous step

INPUT:

curl -u<username>:<password> -X POST -H "content-type:application/xml" http://<xl-deploy-server>:<xl-deploy-port>/deployit/task/1327d3b8-40b9-4909-8080-b21e2c32f9a5/archive/

OUTPUT:

none

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.