curl --request POST \
--url https://{region}.api.plerion.com/v1/tenant/custom-checks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"slug": "<string>",
"title": "<string>",
"target": {
"assetType": "AWS::S3::Bucket"
},
"defaults": {
"message": "<string>",
"informational": true,
"remediation": "<string>",
"meta": {}
},
"type": "rego",
"body": "<string>",
"description": "<string>",
"additionalAssets": [
{
"assetType": "<string>"
}
]
}
'import requests
url = "https://{region}.api.plerion.com/v1/tenant/custom-checks"
payload = {
"slug": "<string>",
"title": "<string>",
"target": { "assetType": "AWS::S3::Bucket" },
"defaults": {
"message": "<string>",
"informational": True,
"remediation": "<string>",
"meta": {}
},
"type": "rego",
"body": "<string>",
"description": "<string>",
"additionalAssets": [{ "assetType": "<string>" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
slug: '<string>',
title: '<string>',
target: {assetType: 'AWS::S3::Bucket'},
defaults: {message: '<string>', informational: true, remediation: '<string>', meta: {}},
type: 'rego',
body: JSON.stringify('<string>'),
description: '<string>',
additionalAssets: [{assetType: '<string>'}]
})
};
fetch('https://{region}.api.plerion.com/v1/tenant/custom-checks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{region}.api.plerion.com/v1/tenant/custom-checks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'slug' => '<string>',
'title' => '<string>',
'target' => [
'assetType' => 'AWS::S3::Bucket'
],
'defaults' => [
'message' => '<string>',
'informational' => true,
'remediation' => '<string>',
'meta' => [
]
],
'type' => 'rego',
'body' => '<string>',
'description' => '<string>',
'additionalAssets' => [
[
'assetType' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{region}.api.plerion.com/v1/tenant/custom-checks"
payload := strings.NewReader("{\n \"slug\": \"<string>\",\n \"title\": \"<string>\",\n \"target\": {\n \"assetType\": \"AWS::S3::Bucket\"\n },\n \"defaults\": {\n \"message\": \"<string>\",\n \"informational\": true,\n \"remediation\": \"<string>\",\n \"meta\": {}\n },\n \"type\": \"rego\",\n \"body\": \"<string>\",\n \"description\": \"<string>\",\n \"additionalAssets\": [\n {\n \"assetType\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{region}.api.plerion.com/v1/tenant/custom-checks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"slug\": \"<string>\",\n \"title\": \"<string>\",\n \"target\": {\n \"assetType\": \"AWS::S3::Bucket\"\n },\n \"defaults\": {\n \"message\": \"<string>\",\n \"informational\": true,\n \"remediation\": \"<string>\",\n \"meta\": {}\n },\n \"type\": \"rego\",\n \"body\": \"<string>\",\n \"description\": \"<string>\",\n \"additionalAssets\": [\n {\n \"assetType\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{region}.api.plerion.com/v1/tenant/custom-checks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"slug\": \"<string>\",\n \"title\": \"<string>\",\n \"target\": {\n \"assetType\": \"AWS::S3::Bucket\"\n },\n \"defaults\": {\n \"message\": \"<string>\",\n \"informational\": true,\n \"remediation\": \"<string>\",\n \"meta\": {}\n },\n \"type\": \"rego\",\n \"body\": \"<string>\",\n \"description\": \"<string>\",\n \"additionalAssets\": [\n {\n \"assetType\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"customCheckId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"organizationId": "<string>",
"tenantId": "<string>",
"title": "<string>",
"target": {
"assetType": "AWS::S3::Bucket"
},
"defaults": {
"message": "<string>",
"informational": true,
"remediation": "<string>",
"meta": {}
},
"type": "rego",
"body": "<string>",
"version": 2,
"createdBy": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedBy": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"description": "<string>",
"additionalAssets": [
{
"assetType": "<string>"
}
]
}{
"errors": [
{
"field": "<string>",
"code": "<string>",
"message": "<string>"
}
]
}{
"message": "Internal server error"
}Create a custom check in a tenant
Create a new custom (rego) check. The created check is returned, including its generated customCheckId and initial version.
curl --request POST \
--url https://{region}.api.plerion.com/v1/tenant/custom-checks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"slug": "<string>",
"title": "<string>",
"target": {
"assetType": "AWS::S3::Bucket"
},
"defaults": {
"message": "<string>",
"informational": true,
"remediation": "<string>",
"meta": {}
},
"type": "rego",
"body": "<string>",
"description": "<string>",
"additionalAssets": [
{
"assetType": "<string>"
}
]
}
'import requests
url = "https://{region}.api.plerion.com/v1/tenant/custom-checks"
payload = {
"slug": "<string>",
"title": "<string>",
"target": { "assetType": "AWS::S3::Bucket" },
"defaults": {
"message": "<string>",
"informational": True,
"remediation": "<string>",
"meta": {}
},
"type": "rego",
"body": "<string>",
"description": "<string>",
"additionalAssets": [{ "assetType": "<string>" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
slug: '<string>',
title: '<string>',
target: {assetType: 'AWS::S3::Bucket'},
defaults: {message: '<string>', informational: true, remediation: '<string>', meta: {}},
type: 'rego',
body: JSON.stringify('<string>'),
description: '<string>',
additionalAssets: [{assetType: '<string>'}]
})
};
fetch('https://{region}.api.plerion.com/v1/tenant/custom-checks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{region}.api.plerion.com/v1/tenant/custom-checks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'slug' => '<string>',
'title' => '<string>',
'target' => [
'assetType' => 'AWS::S3::Bucket'
],
'defaults' => [
'message' => '<string>',
'informational' => true,
'remediation' => '<string>',
'meta' => [
]
],
'type' => 'rego',
'body' => '<string>',
'description' => '<string>',
'additionalAssets' => [
[
'assetType' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{region}.api.plerion.com/v1/tenant/custom-checks"
payload := strings.NewReader("{\n \"slug\": \"<string>\",\n \"title\": \"<string>\",\n \"target\": {\n \"assetType\": \"AWS::S3::Bucket\"\n },\n \"defaults\": {\n \"message\": \"<string>\",\n \"informational\": true,\n \"remediation\": \"<string>\",\n \"meta\": {}\n },\n \"type\": \"rego\",\n \"body\": \"<string>\",\n \"description\": \"<string>\",\n \"additionalAssets\": [\n {\n \"assetType\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{region}.api.plerion.com/v1/tenant/custom-checks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"slug\": \"<string>\",\n \"title\": \"<string>\",\n \"target\": {\n \"assetType\": \"AWS::S3::Bucket\"\n },\n \"defaults\": {\n \"message\": \"<string>\",\n \"informational\": true,\n \"remediation\": \"<string>\",\n \"meta\": {}\n },\n \"type\": \"rego\",\n \"body\": \"<string>\",\n \"description\": \"<string>\",\n \"additionalAssets\": [\n {\n \"assetType\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{region}.api.plerion.com/v1/tenant/custom-checks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"slug\": \"<string>\",\n \"title\": \"<string>\",\n \"target\": {\n \"assetType\": \"AWS::S3::Bucket\"\n },\n \"defaults\": {\n \"message\": \"<string>\",\n \"informational\": true,\n \"remediation\": \"<string>\",\n \"meta\": {}\n },\n \"type\": \"rego\",\n \"body\": \"<string>\",\n \"description\": \"<string>\",\n \"additionalAssets\": [\n {\n \"assetType\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"customCheckId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"organizationId": "<string>",
"tenantId": "<string>",
"title": "<string>",
"target": {
"assetType": "AWS::S3::Bucket"
},
"defaults": {
"message": "<string>",
"informational": true,
"remediation": "<string>",
"meta": {}
},
"type": "rego",
"body": "<string>",
"version": 2,
"createdBy": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedBy": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"description": "<string>",
"additionalAssets": [
{
"assetType": "<string>"
}
]
}{
"errors": [
{
"field": "<string>",
"code": "<string>",
"message": "<string>"
}
]
}{
"message": "Internal server error"
}Authorizations
Bearer API Key. For example, "Bearer {Tenant API Key}"
Headers
Bearer API Key. For example, "Bearer {Tenant API Key}"
application/json
Body
Fields for creating or replacing a custom check.
1 - 128^[a-z0-9-]+$1 - 256The primary asset type a check evaluates and how it is batched.
Show child attributes
Show child attributes
Default verdict values applied to findings the check produces.
Show child attributes
Show child attributes
rego 14096Show child attributes
Show child attributes
Response
The created custom check
A stored custom check.
URL-safe identifier, unique within the tenant.
1 - 128^[a-z0-9-]+$1 - 256The primary asset type a check evaluates and how it is batched.
Show child attributes
Show child attributes
Default verdict values applied to findings the check produces.
Show child attributes
Show child attributes
rego The rego policy source.
1x >= 14096Additional asset types loaded in full and made available to the policy.
Show child attributes
Show child attributes
Was this page helpful?