cloudfoundry/cloud_controller_ng

View on GitHub
docs/v3/source/includes/resources/deployments/_create.md.erb

Summary

Maintainability
Test Coverage
### Create a deployment

```
Example Request with Droplet
```

```shell
curl "https://api.example.org/v3/deployments" \
-X POST \
-H "Authorization: bearer [token]" \
-H "Content-type: application/json" \
-d '{
  "droplet": {
    "guid": "[droplet-guid]"
  },
  "strategy": "rolling",
  "relationships": {
    "app": {
      "data": {
        "guid": "[app-guid]"
      }
    }
  }
}'
```

```
Example Request with Revision
```

```shell
curl "https://api.example.org/v3/deployments" \
-X POST \
-H "Authorization: bearer [token]" \
-H "Content-type: application/json" \
-d '{
  "revision": {
    "guid": "[revision-guid]"
  },
  "strategy": "rolling",
  "relationships": {
    "app": {
      "data": {
        "guid": "[app-guid]"
      }
    }
  }
}'
```

```
Example Response
```

```http
HTTP/1.1 201 OK
Content-Type: application/json

<%= yield_content :single_deployment %>
```

When you create a new deployment you can either provide a specific droplet or revision to deploy. If no revision or droplet is provided, the droplet associated with the [app](#apps) is deployed.

#### Definition
`POST /v3/deployments`

#### Required parameters

Name | Type | Description
---- | ---- | -----------
**relationships.app** | [_to-one relationship_](#to-one-relationships) | The app to deploy a droplet for

#### Optional parameters

Name | Type | Description | Default
---- | ---- | ----------- | -------
**droplet**<sup>[1]</sup> | _object_ | The droplet to deploy for the app; this will update the app's [current droplet](#get-current-droplet-association-for-an-app) to this droplet | The app's [current droplet](#get-current-droplet-association-for-an-app)
**revision**<sup>[1]</sup> | _object_ | The [revision](#revisions) whose droplet to deploy for the app; this will update the app's [current droplet](#get-current-droplet-association-for-an-app) to this droplet |
**strategy** | _string_ | The strategy to use for the deployment | `rolling`
**metadata.labels** | [_label object_](#labels) | Labels applied to the deployment
**metadata.annotations**  | [_annotation object_](#annotations) | Annotations applied to the deployment


<sup>1 Only a droplet _or_ a revision may be provided, not both.</sup>

#### Permitted roles
 |
--- |
Admin |
Space Developer |
Space Supporter |