Description
Replaces the machine's environments with exactly the ones you send. Environments the machine currently has that are not in the list are unassigned, and any in the list that it does not have are added.
Send an empty environmentIds array to clear every assignment, which takes the machine out of service for new deployments without deleting it.
This is the endpoint to use when your pipeline owns the whole picture and wants the machine to end up in a known state. To change one assignment while leaving the rest alone, use Assign an environment or Unassign an environment instead.
Every ID must name an environment in the same workspace as the machine. If any one of them does not, the whole call is refused and nothing is changed - the replacement is all or nothing. Duplicate IDs are collapsed rather than rejected.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
machineId |
body | string | yes | ID of the machine, from List machines. |
environmentIds |
body | string[] | yes | The complete set of environment IDs the machine should be assigned to. Send [] to clear all assignments. |
Errors
| Status | Meaning |
|---|---|
400 |
Invalid machineId. A machine that belongs to another organization is reported the same way as one that does not exist. |
400 |
One or more environment IDs are invalid for this workspace. Nothing is changed. |
401 |
Missing or invalid Basic auth credentials, or the service account lacks permission to manage machines in this workspace. |