Aller au contenu

Passer une politique en Enforce sur la foi d’une anomalie

POST/api/public/v1/policies/{public_id}/promote

Sets mode: enforce and writes a policy_history row promoted_from_anomaly whose evidence_ref is the anomaly cited — the audit answer to why was this enforced. Evidence is resolved through I-6's tenant-scoped stored-anomaly reader; accepting an id unchecked would write an evidence_ref pointing at nothing and read, forever after, as a decision somebody backed with data. The checks that ARE live run first and in this order: submitting from a descendant layer is 409 INHERITED_HERE (you change a policy where it was authored), a policy that is not ratified is 409 NOT_RATIFIED carrying its actual status (a draft composes into nothing, so Enforce on one would enforce nothing), and a policy with no enforceable intent is 409 NOT_ACTIVATABLE with no_enforceable_atoms in details[]. Unknown, cross-tenant and archived evidence, and evidence raised by a different policy, are each 422. An agent (OAuth) caller must send the version of the policy it read: missing answers 428 POLICY_VERSION_REQUIRED, one that is no longer current 409 POLICY_VERSION_STALE.

Fenêtre de terminal
curl --fail-with-body -X POST 'https://app.openlatch.ai/api/public/v1/policies/<policy_public_id>/promote' \
-H "Authorization: Bearer $OPENLATCH_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"evidence_anomaly_id":"<evidence_anomaly_id>","zone_id":"<zone_id>"}'
Rôle dans l’organisationCe point de terminaison
ownerAutorisé
adminAutorisé
editorAutorisé
viewerNon autorisé

Une clé porte le rôle que son propriétaire détient dans l’organisation. Voir Authentification.

Portée de clé d’API : policies:write

ParamètreTypeDescription
public_idstringObligatoire.
ParamètreTypeDescription
Idempotency-Keystring or nullOptional. Makes the request safe to retry: the same key and the same request, within 24 hours, returns the stored response with Idempotent-Replayed: true and runs once.
ChampTypeDescription
evidence_anomaly_idstringObligatoire.
versioninteger or nullThe version of the policy the caller read. Required of an agent (OAuth) caller: missing answers 428 POLICY_VERSION_REQUIRED, a version that is no longer current 409 POLICY_VERSION_STALE.
zone_idstring (uuid) or null
ChampTypeDescription
dataobjectObligatoire. One policy as a zone's list serves it.
data.anomalies_7dinteger
data.attached_herebooleanWhether the viewed zone holds its own attachment.
data.attachment_modestring — one of disabled, monitor, enforce or nullThe viewed zone's own attachment mode; null when it only inherits the AIP.
data.coverageobjectObligatoire. D-66 — installs counted from stamped negotiation, never from mode + recent poll.
data.coverage.compatibility_unavailable_installsintegerObligatoire.
data.coverage.enforced_installsintegerObligatoire.
data.dimensionsarray of stringObligatoire.
data.display_titlestringThe AIP's name: its title, else its generated_title, else its statement.
data.effective_layerobject or nullThe zone whose attachment sets effective_mode when it is not layer; null otherwise.
data.effective_layer.inheritedbooleanObligatoire.
data.effective_layer.labelstringObligatoire.
data.effective_layer.unit_idstringObligatoire.
data.effective_layer.zone_idstringObligatoire.
data.effective_modestring — one of disabled, monitor, enforce or nullThe mode the AIP runs in at the viewed zone: the strictest attachment on its path.
data.idstringObligatoire.
data.intentsobjectObligatoire. How many of the policy's atoms are actually enforceable.
data.intents.enforceableintegerObligatoire.
data.intents.monitor_onlyintegerObligatoire.
data.intents.totalintegerObligatoire.
data.layerobjectObligatoire. The layer a policy row is labelled with: the zone being viewed when it holds the AIP, else the zone whose attachment sets its mode there. `inherited` is true when the viewed zone holds no attachment of it.
data.layer.inheritedbooleanObligatoire.
data.layer.labelstringObligatoire.
data.layer.unit_idstringObligatoire.
data.layer.zone_idstringObligatoire.
data.modestringObligatoire. Deprecated: attachment_mode when the viewed zone holds it, else effective_mode.
data.presetobject or null
data.preset.application_idstringObligatoire.
data.preset.preset_idstringObligatoire.
data.preset.preset_namestringObligatoire.
data.preset.preset_policy_keystringObligatoire.
data.preset.preset_versionintegerObligatoire.
data.public_idstringObligatoire.
data.statementstringObligatoire.
data.statusstringObligatoire.
data.versionintegerObligatoire.
{
"data": {
"anomalies_7d": 0,
"attached_here": false,
"attachment_mode": "disabled",
"coverage": {
"compatibility_unavailable_installs": 3,
"enforced_installs": 3
},
"dimensions": [
"string"
],
"display_title": "",
"effective_layer": {
"inherited": false,
"label": "string",
"unit_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10",
"zone_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10"
},
"effective_mode": "disabled",
"id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10",
"intents": {
"enforceable": 3,
"monitor_only": 3,
"total": 3
},
"layer": {
"inherited": false,
"label": "string",
"unit_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10",
"zone_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10"
},
"mode": "string",
"preset": {
"application_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10",
"preset_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10",
"preset_name": "release-bot",
"preset_policy_key": "string",
"preset_version": 3
},
"public_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10",
"statement": "string",
"status": "string",
"version": 3
}
}