Skip to content

upsert_target

Add or update a Deployment Target · write tool

Adds a Deployment Target, or updates the fields of an existing one (name, kind, description, owner, tags, links); comments and formatting are kept. A new Target nests under parent in the parent’s file. A new top-level one goes into file (relative to the Project’s folder), else model.yaml. kind is free text printed as written in the Target’s header, so keep it short: region, az, vnet, snet, vm, aks, ns, asp, not availability-zone or subnet.

Field Type Required Notes
project string yes The Project to edit, by id.
id string yes An id in this Project (bare), or project:id.
fields map of id → any Fields to set, as in YAML; null removes a field. Fields not given are left as they are. Default: {}.
parent string The Target to nest a new one under.
file string For a new top-level Target: a .yaml file relative to the Project’s folder.
dry_run boolean Check the write and return its diff without changing any file. Default: false.
Field Type Required Notes
action "created" or "updated" or "removed" or "unchanged" yes
id string or null yes The qualified id written (bare for a Team, Environment or Project); null for a Deployment, or a Relationship without one.
from string
to string
service string
environment string
target string
files list of string yes
diff string yes
dryRun boolean yes

Called over the Kitchen sink example Workspace.

Arguments:

{
"project": "sink",
"id": "edge-cdn",
"fields": {
"name": "Edge CDN",
"kind": "cdn"
},
"dry_run": true
}

Result:

{
"action": "created",
"id": "sink:edge-cdn",
"files": [
"examples/kitchen-sink/archidocs/sink/model.yaml"
],
"dryRun": true,
"diff": "(the patch below)"
}

The diff, as a patch:

--- a/examples/kitchen-sink/archidocs/sink/model.yaml
+++ b/examples/kitchen-sink/archidocs/sink/model.yaml
@@ -101,4 +101,9 @@
external: true
technology: Stripe API
owner: edge
+targets:
+ edge-cdn:
+ name: Edge CDN
+ kind: cdn
+
#endregion

A call that fails returns isError: true, with {code, message, suggestions?} as structuredContent. This tool returns:

  • invalid_input when the arguments don’t fit the input above.
  • not_found when the Project, or an id it names, matches nothing.
  • validation_failed when the write would add a check error. Nothing is written.
  • read_only when the server reads a published Workspace Bundle, or serves HTTP without --allow-writes.
  • source_unavailable when the server can’t read the Workspace.

Error codes says what to do about each.

Documents Archidocs v1.4.0, the latest release.