From 65f757a75131d3d28a88205ea8d1d4ca51774cee Mon Sep 17 00:00:00 2001 From: Levi Blackstone Date: Mon, 19 Aug 2024 14:31:24 -0600 Subject: [PATCH] Document org policy violations REST API --- .../pulumi-cloud/cloud-rest-api/_index.md | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/content/docs/pulumi-cloud/cloud-rest-api/_index.md b/content/docs/pulumi-cloud/cloud-rest-api/_index.md index 2c8dc382ed551..0fb0f933c1ce2 100644 --- a/content/docs/pulumi-cloud/cloud-rest-api/_index.md +++ b/content/docs/pulumi-cloud/cloud-rest-api/_index.md @@ -3193,6 +3193,59 @@ Status: 200 OK ``` +### List Policy Violations + +``` +GET /api/orgs/{organization}/policyresults/violations +``` + +#### Parameters + +| Parameter | Type | In | Description | +|---------------------|--------|-------|--------------------------------------------------------------------------------------------------------------| +| `organization` | string | path | organization name | + +#### Example + +```bash +curl \ + -H "Accept: application/vnd.pulumi+8" \ + -H "Content-Type: application/json" \ + -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ + https://api.pulumi.com/api/orgs/{organization}/policyresults/violations +``` + +#### Default response + +``` +Status: 200 OK +``` + +``` +{ + "continuationToken": "", + "policyViolations": [ + { + "level": "advisory", + "message": "Checks that Kubernetes Pods are not being used directly. +Kubernetes Pods should not be used directly. Instead, you may want to use a Deployment, ReplicaSet or Job. +", + "observedAt": "2024-08-19T20:28:46Z", + "policyName": "pods-are-prohibited", + "policyPack": "kubernetes", + "policyPackTag": "0.0.2", + "projectName": "pulumi-k8s-test", + "resourceName": "pod-test", + "resourceType": "kubernetes:core/v1:Pod", + "stackName": "dev", + "updateVersion": 4 + } + ] +} +``` + + + ## Environments {{< notes >}}