--- title: "Edit a change set" canonical: "https://admiral.io/docs/api/projects/ChangeSetAPI_EditChangeSet" --- # Edit a change set `POST https://api.admiral.io/v1/projects/{project}/environments/{environment}/changesets/{changeset}/edit` - FAILED_PRECONDITION when `if_revision` is not the head (the message names the head), when the change set is not open or its apply is running or holding the environment, when a version is revoked (the message carries the recorded reason), and when a component would land on no agent assignment that may run it and serves its providers (the message names an agent that would, and its owner). - ALREADY_EXISTS when a component name is live or held by another open change set (the message names which). Scope: `changeset:write` ### Path parameters - `project` (string, required): The project id. - `environment` (string, required): The environment id. - `changeset` (string, required): The changeset id. ### Request body - `if_revision` (integer (int32)): When set, refused unless the head is this revision. Value at least 0. - `edits` (array of Edit): Items 1 to 100. - Exactly one of `add_component`, `set_value`, `unset_value`, `set_version`, `replace_values`, `remove_component`, `set_settings`, `set_depends_on`, `orphan_component` is set. - `add_component` (AddComponent): AddComponent creates a component instance from the registry. The name is reserved in the environment until the change set closes or the component is removed from it. - `name` (string, required): Pattern `^[a-z]([a-z0-9-]{0,51}[a-z0-9])?$`. Length 1 to 53. - `version` (RegistryRef, required): The registry component and the tag or digest to run. - `resource_name` (string, required): The registry component's resource name, `components/{component}`, such as `components/cloud-sql`. The component may be named by its uid. Pattern `^components/[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`. Length 1 to 74. - `reference` (string, required): A tag or a `sha256:` digest. Pattern `^(sha256:[0-9a-f]{64}|[A-Za-z0-9][A-Za-z0-9._+-]{0,127})$`. Length 1 to 128. - `values_json` (string): A JSON object. Empty means no values. Length at most 1048576. - `orphan_component` (OrphanComponent): OrphanComponent stops managing a live component without tearing it down. - `component` (string, required): Pattern `^[a-z]([a-z0-9-]{0,51}[a-z0-9])?$`. Length 1 to 53. - `remove_component` (RemoveComponent): RemoveComponent drops a component this change set adds, or destroys a live one. A live Terraform component is refused, since destroying it needs the code it was last applied from. - `component` (string, required): Pattern `^[a-z]([a-z0-9-]{0,51}[a-z0-9])?$`. Length 1 to 53. - `replace_values` (ReplaceValues): ReplaceValues makes a component's values exactly this tree: an upload. The request must carry `if_revision`, the head the tree was downloaded at. - `component` (string, required): Pattern `^[a-z]([a-z0-9-]{0,51}[a-z0-9])?$`. Length 1 to 53. - `tree_json` (string, required): A JSON object. Length 2 to 1048576. - `set_depends_on` (SetDependsOn): SetDependsOn replaces the components a component applies after. Empty clears it. A cycle is refused. - `component` (string, required): Pattern `^[a-z]([a-z0-9-]{0,51}[a-z0-9])?$`. - `dependencies` (array of string): Items at most 32. - `set_settings` (SetSettings): SetSettings replaces how a component is deployed. FAILED_PRECONDITION when the settings are for another kind than the component's. - `component` (string, required): Pattern `^[a-z]([a-z0-9-]{0,51}[a-z0-9])?$`. Length 1 to 53. - `settings` (ComponentSettings, required): ComponentSettings is how Admiral deploys one component in an environment, as opposed to its values, which are what the component receives. Only the block for the component's kind is accepted. - At most one of `kubernetes`, `terraform` is set. - `assignment_id` (string): The environment's agent assignment it runs on. Empty means the one assignment left after the agent's grants and allowed components rule the others out; required on a tie. A placement nothing covers is refused, naming an agent that would. Pattern `^asg-[0-9a-z]+$`. - `kubernetes` (KubernetesComponentSettings): KubernetesComponentSettings is where a Kubernetes component's objects go. - `namespace` (string): Empty means the environment's default namespace. Pattern `^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)?$`. Length at most 63. - `extra_namespaces` (array of string): Namespaces the component may also write to, such as `kube-system` for a chart's leader-election Role. The plan refuses an object in any other. Items at most 16. - `terraform` (TerraformComponentSettings): TerraformComponentSettings is where a Terraform component's state lives. The engine and version are the environment's, gated by the component's own `required_version`. - `backend` (InfraBackend): Replaces the environment's backend for this component, location included: for adopting state that already exists somewhere else. Empty uses the environment's, at a location Admiral derives. Fixed at the component's first apply. - `type` (string): The backend type as Terraform names it: `gcs`, `s3`, `azurerm`, `http`. Never `local`, which would leave state on the agent's disk. Not `local`. Pattern `^[a-z][a-z0-9_]*$`. Length at most 32. - `config` (map of string to Value): The backend's arguments, as the backend block takes them. On an environment, the bucket and its settings, without the key or prefix; Admiral derives the location per component. Admiral refuses credential arguments. - `set_value` (SetValue): SetValue writes a value at a path, creating maps on the way, as `helm --set` does. A map value replaces what was there. - `component` (string, required): Pattern `^[a-z]([a-z0-9-]{0,51}[a-z0-9])?$`. Length 1 to 53. - `path_segments` (array of PathSegment): Items 1 to 32. - `key` (string, required): Length 1 to 256. - `value_json` (string, required): JSON text. `null` clears a chart default, as a values file's `key: null` does; UnsetValue makes the key absent so the default applies. Length 1 to 1048576. - `set_version` (SetVersion): SetVersion moves a component to another version of the same registry component. The reference resolves to a digest when the edit is made. - `component` (string, required): Pattern `^[a-z]([a-z0-9-]{0,51}[a-z0-9])?$`. Length 1 to 53. - `reference` (string, required): A tag or a `sha256:` digest. Pattern `^(sha256:[0-9a-f]{64}|[A-Za-z0-9][A-Za-z0-9._+-]{0,127})$`. Length 1 to 128. - `unset_value` (UnsetValue): UnsetValue removes a path, so the default applies. - `component` (string, required): Pattern `^[a-z]([a-z0-9-]{0,51}[a-z0-9])?$`. Length 1 to 53. - `path_segments` (array of PathSegment): Items 1 to 32. - `key` (string, required): Length 1 to 256. ### Response 200 Success - `change_set` (ChangeSet): ChangeSet is a proposal against the components of one environment. - `uid` (string): `cs-` and twelve base36 characters, the last segment of `resource_name`. Never changes and is never reused. Pattern `^cs-[0-9a-z]+$`. Read-only. - `resource_name` (string): (IDENTIFIER) The change set's resource name, such as `projects/payments-api/environments/prod/changesets/cs-01jg7m3k2x9q`. Identifies the change set on update. Pattern `^projects/([a-z]([a-z0-9-]{0,61}[a-z0-9])?|-)/environments/([a-z]([a-z0-9-]{0,61}[a-z0-9])?|-)/changesets/cs-[0-9a-z]+$`. - `description` (string): Length at most 4096. - `project_id` (string): The uid of the project the change set's environment is in. Read-only. - `environment_id` (string): The uid of the environment the change set proposes against. It never changes. Read-only. - `title` (string): Length at most 256. - `reverts_change_set_id` (string): Set on a change set made by RevertChangeSet: the change set it reverts. It may apply while that change set's partial apply holds the environment. Read-only. - `reverted_by_change_set_id` (string): Set when another change set reverted this one: the change set that did. Empty for a revert in place. Read-only. - `latest_run_id` (string): The change set's newest run; empty before its first. Its status is the change set's progress: planning, awaiting approval, applying, failed. Read-only. - `status` (Status): One of `STATUS_UNSPECIFIED`, `OPEN`, `APPLIED`, `CLOSED`, `REVERTED`. Read-only. - `behind` (boolean): The environment moved since the head revision's base. It cannot apply until RebaseChangeSet brings it up to date. Read-only. - `head_revision` (integer (int32)): 0 until the first edit. Read-only. - `etag` (string): Changes whenever the change set does. Send it back on update to refuse the change if someone else changed the change set first. Read-only. - `created_by` (ActorRef): ActorRef is a lightweight reference to the user or agent that performed an action. Server-populated on all resource responses. Clients should never send this. Read-only. - `id` (string): The actor's typed id: a `usr-` user id or an `sa-` service account id. - `display_name` (string): Human-readable name (e.g., "John Smith", "deploy-bot"). - `email` (string): Email address (empty for non-human actors). - `created_at` (Timestamp): A point in time in RFC 3339 format, with up to nanosecond precision. Output uses UTC (`Z`); input may use an offset from UTC. Read-only. - `updated_at` (Timestamp): A point in time in RFC 3339 format, with up to nanosecond precision. Output uses UTC (`Z`); input may use an offset from UTC. Read-only. - `revision` (Revision): Revision is one immutable cut of a change set. - `uid` (string): `rev-` and twelve base36 characters. Pattern `^rev-[0-9a-z]+$`. Read-only. - `resource_name` (string): (IDENTIFIER) The revision's resource name, ending in its number, such as `projects/payments-api/environments/prod/changesets/cs-01jg7m3k2x9q/revisions/2`. The `uid` in place of the number names the same revision. - `change_set_id` (string): The uid of the change set the revision belongs to. Read-only. - `number` (integer (int32)): The revision's ordinal within its change set, from 1. - `cause` (Cause): Cause is why a revision was cut: an edit, or a rebase onto the environment as it now is. One of `CAUSE_UNSPECIFIED`, `EDIT`, `REBASE`. - `base_generation` (string (int64)): The environment's generation when the base was taken. - `entries` (array of Entry): Empty in a listing. - `component` (string) - `action` (EntryAction): EntryAction is what a change set does to one component. One of `ENTRY_ACTION_UNSPECIFIED`, `CREATE`, `UPDATE`, `DESTROY`, `ORPHAN`. - `version` (VersionRef): The version the component runs after this change set: set on CREATE and when the version changes. - `component_id` (string): The registry component. Pattern `^cmp-[0-9a-z]+$`. - `version_id` (string): The registry version. Pattern `^ver-[0-9a-z]+$`. - `digest` (string): `sha256:` of the bundle. - `reference` (string): The tag or `sha256:` digest as given, such as `5.5.0` or `latest`. - `base_digest` (string): Empty on CREATE. - `result_digest` (string): Empty on DESTROY. - `ops` (array of ValueOp) - `path_segments` (array of PathSegment) - `key` (string, required): Length 1 to 256. - `op` (Kind): One of `KIND_UNSPECIFIED`, `SET`, `UNSET`. - `value_json` (string): JSON text; empty unless op is SET. - `from_present` (boolean): Whether the base had the key; a null there is present. - `from_value_json` (string): JSON text; empty when from_present is false. - `settings` (ComponentSettings): How Admiral deploys the component after this change set. Empty on DESTROY. - At most one of `kubernetes`, `terraform` is set. - `assignment_id` (string): The environment's agent assignment it runs on. Empty means the one assignment left after the agent's grants and allowed components rule the others out; required on a tie. A placement nothing covers is refused, naming an agent that would. Pattern `^asg-[0-9a-z]+$`. - `kubernetes` (KubernetesComponentSettings): KubernetesComponentSettings is where a Kubernetes component's objects go. - `namespace` (string): Empty means the environment's default namespace. Pattern `^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)?$`. Length at most 63. - `extra_namespaces` (array of string): Namespaces the component may also write to, such as `kube-system` for a chart's leader-election Role. The plan refuses an object in any other. Items at most 16. - `terraform` (TerraformComponentSettings): TerraformComponentSettings is where a Terraform component's state lives. The engine and version are the environment's, gated by the component's own `required_version`. - `backend` (InfraBackend): Replaces the environment's backend for this component, location included: for adopting state that already exists somewhere else. Empty uses the environment's, at a location Admiral derives. Fixed at the component's first apply. - `type` (string): The backend type as Terraform names it: `gcs`, `s3`, `azurerm`, `http`. Never `local`, which would leave state on the agent's disk. Not `local`. Pattern `^[a-z][a-z0-9_]*$`. Length at most 32. - `config` (map of string to Value): The backend's arguments, as the backend block takes them. On an environment, the bucket and its settings, without the key or prefix; Admiral derives the location per component. Admiral refuses credential arguments. - `dependencies` (array of string): Components this one applies after, after this change set. A component whose outputs this one's values reference is always among them. - `consumes` (array of string): Components whose outputs this one's values reference. An entry with no ops whose `consumes` names a changed component is planned because that component changes. Read-only. - `violations` (array of Violation) - `component` (string) - `path` (string): Display form: `image.tag`, `ingress."a.b"`. - `message` (string) - `created_by` (ActorRef): ActorRef is a lightweight reference to the user or agent that performed an action. Server-populated on all resource responses. Clients should never send this. - `id` (string): The actor's typed id: a `usr-` user id or an `sa-` service account id. - `display_name` (string): Human-readable name (e.g., "John Smith", "deploy-bot"). - `email` (string): Email address (empty for non-human actors). - `created_at` (Timestamp): A point in time in RFC 3339 format, with up to nanosecond precision. Output uses UTC (`Z`); input may use an offset from UTC. - `warnings` (array of string)