Preview rules
curl --request POST \
--url https://{region}.api.plerion.com/v1/tenant/ownership/rules/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rules": [
{
"type": "tag",
"enabled": true,
"config": {
"key": "Team",
"from": "asset",
"newOwnersAre": "team"
}
}
]
}
'import requests
url = "https://{region}.api.plerion.com/v1/tenant/ownership/rules/preview"
payload = { "rules": [
{
"type": "tag",
"enabled": True,
"config": {
"key": "Team",
"from": "asset",
"newOwnersAre": "team"
}
}
] }
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({
rules: [
{
type: 'tag',
enabled: true,
config: {key: 'Team', from: 'asset', newOwnersAre: 'team'}
}
]
})
};
fetch('https://{region}.api.plerion.com/v1/tenant/ownership/rules/preview', 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/ownership/rules/preview",
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([
'rules' => [
[
'type' => 'tag',
'enabled' => true,
'config' => [
'key' => 'Team',
'from' => 'asset',
'newOwnersAre' => 'team'
]
]
]
]),
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/ownership/rules/preview"
payload := strings.NewReader("{\n \"rules\": [\n {\n \"type\": \"tag\",\n \"enabled\": true,\n \"config\": {\n \"key\": \"Team\",\n \"from\": \"asset\",\n \"newOwnersAre\": \"team\"\n }\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/ownership/rules/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rules\": [\n {\n \"type\": \"tag\",\n \"enabled\": true,\n \"config\": {\n \"key\": \"Team\",\n \"from\": \"asset\",\n \"newOwnersAre\": \"team\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{region}.api.plerion.com/v1/tenant/ownership/rules/preview")
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 \"rules\": [\n {\n \"type\": \"tag\",\n \"enabled\": true,\n \"config\": {\n \"key\": \"Team\",\n \"from\": \"asset\",\n \"newOwnersAre\": \"team\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"scanned": 5024,
"partial": false,
"tooManyValues": [
{
"key": "Name",
"values": 4210
}
],
"noOwnerBefore": 5024,
"noOwnerAfter": 120,
"owners": [
{
"id": "<string>",
"name": "payments",
"kind": "team",
"guessed": true,
"isNew": true,
"tool": "<string>",
"assets": 2410,
"key": "Team",
"from": "asset"
}
],
"coverage": {
"byRule": [
{
"ruleId": "<string>",
"type": "tag",
"key": "Team",
"from": "asset",
"assets": 123,
"values": 123,
"sample": [
{
"id": "<string>",
"name": "<string>",
"resourceType": "AWS::S3::Bucket",
"integrationId": "<string>",
"region": "<string>"
}
]
}
],
"noOwner": {
"untagged": 40,
"otherTags": 60,
"unusableValues": 20
}
},
"person": {
"gained": 123,
"lost": 123,
"changed": 123
},
"team": {
"gained": 123,
"lost": 123,
"changed": 123
},
"newOwners": [
{
"key": "Owner",
"from": "asset",
"kind": "team",
"count": 14,
"sampleValues": [
"payments"
]
}
],
"looksOther": [
{
"key": "Owner",
"from": "asset",
"kind": "team",
"count": 14,
"sampleValues": [
"payments"
]
}
]
}
}{
"errors": [
{
"code": "NameTaken",
"message": "Payments already goes by \"payments\". Use that one instead."
}
]
}{
"message": "Forbidden"
}{
"message": "Internal server error"
}Preview ownership rules
A dry run of Set ownership rules. Returns the owners these rules would find, how many assets each rule would give an owner, why the rest would have none, and how owners would change. Saves nothing. Reads up to 100,000 assets; past that partial is true. Needs a key with access to every integration in the tenant (403 ScopeTooNarrow otherwise). Requires OwnershipRule:Modify.
POST
/
v1
/
tenant
/
ownership
/
rules
/
preview
Preview rules
curl --request POST \
--url https://{region}.api.plerion.com/v1/tenant/ownership/rules/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rules": [
{
"type": "tag",
"enabled": true,
"config": {
"key": "Team",
"from": "asset",
"newOwnersAre": "team"
}
}
]
}
'import requests
url = "https://{region}.api.plerion.com/v1/tenant/ownership/rules/preview"
payload = { "rules": [
{
"type": "tag",
"enabled": True,
"config": {
"key": "Team",
"from": "asset",
"newOwnersAre": "team"
}
}
] }
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({
rules: [
{
type: 'tag',
enabled: true,
config: {key: 'Team', from: 'asset', newOwnersAre: 'team'}
}
]
})
};
fetch('https://{region}.api.plerion.com/v1/tenant/ownership/rules/preview', 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/ownership/rules/preview",
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([
'rules' => [
[
'type' => 'tag',
'enabled' => true,
'config' => [
'key' => 'Team',
'from' => 'asset',
'newOwnersAre' => 'team'
]
]
]
]),
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/ownership/rules/preview"
payload := strings.NewReader("{\n \"rules\": [\n {\n \"type\": \"tag\",\n \"enabled\": true,\n \"config\": {\n \"key\": \"Team\",\n \"from\": \"asset\",\n \"newOwnersAre\": \"team\"\n }\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/ownership/rules/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rules\": [\n {\n \"type\": \"tag\",\n \"enabled\": true,\n \"config\": {\n \"key\": \"Team\",\n \"from\": \"asset\",\n \"newOwnersAre\": \"team\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{region}.api.plerion.com/v1/tenant/ownership/rules/preview")
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 \"rules\": [\n {\n \"type\": \"tag\",\n \"enabled\": true,\n \"config\": {\n \"key\": \"Team\",\n \"from\": \"asset\",\n \"newOwnersAre\": \"team\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"scanned": 5024,
"partial": false,
"tooManyValues": [
{
"key": "Name",
"values": 4210
}
],
"noOwnerBefore": 5024,
"noOwnerAfter": 120,
"owners": [
{
"id": "<string>",
"name": "payments",
"kind": "team",
"guessed": true,
"isNew": true,
"tool": "<string>",
"assets": 2410,
"key": "Team",
"from": "asset"
}
],
"coverage": {
"byRule": [
{
"ruleId": "<string>",
"type": "tag",
"key": "Team",
"from": "asset",
"assets": 123,
"values": 123,
"sample": [
{
"id": "<string>",
"name": "<string>",
"resourceType": "AWS::S3::Bucket",
"integrationId": "<string>",
"region": "<string>"
}
]
}
],
"noOwner": {
"untagged": 40,
"otherTags": 60,
"unusableValues": 20
}
},
"person": {
"gained": 123,
"lost": 123,
"changed": 123
},
"team": {
"gained": 123,
"lost": 123,
"changed": 123
},
"newOwners": [
{
"key": "Owner",
"from": "asset",
"kind": "team",
"count": 14,
"sampleValues": [
"payments"
]
}
],
"looksOther": [
{
"key": "Owner",
"from": "asset",
"kind": "team",
"count": 14,
"sampleValues": [
"payments"
]
}
]
}
}{
"errors": [
{
"code": "NameTaken",
"message": "Payments already goes by \"payments\". Use that one instead."
}
]
}{
"message": "Forbidden"
}{
"message": "Internal server error"
}Authorizations
Headers
Was this page helpful?