# DeploymentService

Deployment management

POST | /deployment/ | Creates the deployment task.
GET | /deployment/exists | Returns whether or not a udm.Version of the udm.Application that is passed in is already deployed to the udm.Environment .
POST | /deployment/generate/all | Generates all deployeds for the given deployment.
POST | /deployment/generate/selected | Generates only the deployeds for the given deployables in the deployment.
POST | /deployment/generate/single | Generates a deployed for the given deployable to the given container in the deployment.
POST | /deployment/prepare/deployeds | Prepares all the deployeds for the given deployment.
GET | /deployment/prepare/initial | Prepares an initial deployment.
GET | /deployment/prepare/undeploy | Prepares an undeployment.
GET | /deployment/prepare/update | Prepares an update deployment.
POST | /deployment/preview | Calculate the steps that Deployit will execute for the given deployment.
POST | /deployment/preview/{stepNr} |
POST | /deployment/rollback/{taskid} | Rollback a `STOPPED` or `EXECUTED` task.
POST | /deployment/validate | Validates the generated deployment.

## POST /deployment/

Creates the deployment task.

Permissions
  `deploy#initial` - for initial deployments
  `deploy#upgrade` - for upgrades
  `deploy#remove` - for undeployments

Parameters

  Request body | application/xml | Deployment | The fully prepared Deployment parameter object.

Response body
  String - a reference to a Task ID that can be executed by the TaskService .
  Content type: application/xml

## GET /deployment/exists

Returns whether or not a udm.Version of the udm.Application that is passed in is already deployed to the udm.Environment .

Parameters

  Query | application | String | The ID of the udm.Application .
  Query | environment | String | The ID of the udm.Environment .

Response body
  boolean - `true` if there exists a deployed version of the application on the environment, `false` otherwise.
  Content type: application/xml

## POST /deployment/generate/all

Generates all deployeds for the given deployment.

Permissions
  `deploy#initial`

Parameters

  Request body | application/xml | Deployment | The prepared Deployment parameter object.

Response body
  Deployment - An updated Deployment parameter object.
  Content type: application/xml

## POST /deployment/generate/selected

Generates only the deployeds for the given deployables in the deployment.

Try to generate deployeds from each of the deployables to all the matching Containers in the Environment of the Deployment parameter object.

Permissions
  `deploy#initial`

Parameters

  Query | deployables | List of String | The list of IDs of deployables to generate the deployeds for.
  Request body | application/xml | Deployment | The prepared Deployment parameter object

Response body
  Deployment - An updated Deployment parameter object.
  Content type: application/xml

## POST /deployment/generate/single

Generates a deployed for the given deployable to the given container in the deployment.

The deployed should be of the given type (which is optional)

Permissions
  `deploy#initial`

Parameters

  Query | deployable | String | The ID of the deployable to generate a deployed for
  Query | container | String | The ID of the container to generate a deployed to
  Query | deployedtype | Type | (Optional) The type of the deployed to generate
  Request body | application/xml | Deployment | The prepared Deployment parameter object

Response body
  Deployment - An updated Deployment parameter object.
  Content type: application/xml

## POST /deployment/prepare/deployeds

Prepares all the deployeds for the given deployment. This will keep any previous deployeds present in the deployment object that are already present, unless they cannot be deployed with regards to their tags. It will add all the deployeds that are still missing.

Also filters out the deployeds that do not have any source attached anymore (deployables that were previously present).

Permissions
  `deploy#initial`

Parameters

  Request body | application/xml | Deployment | The prepared Deployment parameter object

Response body
  Deployment - An updated Deployment parameter object.
  Content type: application/xml

## GET /deployment/prepare/initial

Prepares an initial deployment.

Permissions
  `deploy#initial`

Parameters

  Query | version | String | The ID of the udm.Version that is the source of the deployment.
  Query | environment | String | The ID of the udm.Environment that is the target of the deployment.

Response body
  Deployment - A new `Deployment` object to which you can add deployeds.
  Content type: application/xml

## GET /deployment/prepare/undeploy

Prepares an undeployment.

Permissions
  `deploy#undeploy`

Parameters

  Query | deployedApplication | String | The ID of the udm.DeployedApplication that is to be undeployed.

Response body
  Deployment - A new `Deployment` object which contains no deployeds (ie. all deployeds of the previous deployment will be deleted).
  Content type: application/xml

## GET /deployment/prepare/update

Prepares an update deployment.

Permissions
  `deploy#upgrade`

Parameters

  Query | version | String | The ID of the new udm.Version that is the source of the deployment.
  Query | deployedApplication | String | The ID of the udm.DeployedApplication that is to be updated.

Response body
  Deployment - A new `Deployment` object which contains the updated deployeds.
  Content type: application/xml

## POST /deployment/preview

Calculate the steps that Deployit will execute for the given deployment. Note: The steps returned here are not a task yet, and as such can not be skipped or re-ordered.

Permissions
  `deploy#initial` - for initial deployments
  `deploy#upgrade` - for upgrades
  `deploy#remove` - for undeployments

Parameters

  Request body | application/xml | Deployment | The deployment to generate the steps for.

Response body
  TaskPreview - A List of generated steps.
  Content type: application/xml

## POST /deployment/preview/{stepNr}

Response body
  StepState
  Content type: application/xml

## POST /deployment/rollback/{taskid}

Rollback a `STOPPED` or `EXECUTED` task. Reverting the deployment to the previous state. The task will be set to `CANCELLED` when it was `STOPPED` , and `DONE` when it was `EXECUTED` .

Parameters

  Path | taskid | String | the ID of the task

Response body
  String - the ID of the new task.
  Content type: application/xml

## POST /deployment/validate

Validates the generated deployment. Checks whether all the deployeds that are in the deployment are valid.

Parameters

  Request body | application/xml | Deployment | The deployment to validate.

Response body
  Deployment - The validated deployment.
  Content type: application/xml