Skip to main content
POST
/
v1
/
tenant
/
asset-groups
Create
curl --request POST \
  --url https://{region}.api.plerion.com/v1/tenant/asset-groups \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "string",
  "rules": [
    [
      {
        "type": "integration",
        "value": [
          "8f3be88c-0f3d-4ec0-a4ab-2699c993fbff"
        ]
      },
      {
        "type": "region",
        "value": [
          "ap-south-1",
          "us-east-1"
        ]
      },
      {
        "type": "AWSResourceGroup",
        "value": [
          "f4e967fd-1475-4d11-901c-89e1df5e5784"
        ]
      },
      {
        "type": "resourceType",
        "value": [
          "AWS::Lambda::Function",
          "AWS::S3::Bucket"
        ]
      },
      {
        "type": "tag",
        "key": "stage",
        "operator": "equals",
        "value": "dev"
      },
      {
        "type": "tag",
        "key": "stage",
        "operator": "contains",
        "value": "qa"
      },
      {
        "type": "resourceName",
        "value": "foundation",
        "operator": "endsWith"
      },
      {
        "type": "resourceName",
        "value": "dev",
        "operator": "startsWith"
      }
    ]
  ]
}
'
import requests

url = "https://{region}.api.plerion.com/v1/tenant/asset-groups"

payload = {
    "name": "string",
    "rules": [[
            {
                "type": "integration",
                "value": ["8f3be88c-0f3d-4ec0-a4ab-2699c993fbff"]
            },
            {
                "type": "region",
                "value": ["ap-south-1", "us-east-1"]
            },
            {
                "type": "AWSResourceGroup",
                "value": ["f4e967fd-1475-4d11-901c-89e1df5e5784"]
            },
            {
                "type": "resourceType",
                "value": ["AWS::Lambda::Function", "AWS::S3::Bucket"]
            },
            {
                "type": "tag",
                "key": "stage",
                "operator": "equals",
                "value": "dev"
            },
            {
                "type": "tag",
                "key": "stage",
                "operator": "contains",
                "value": "qa"
            },
            {
                "type": "resourceName",
                "value": "foundation",
                "operator": "endsWith"
            },
            {
                "type": "resourceName",
                "value": "dev",
                "operator": "startsWith"
            }
        ]]
}
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({
    name: 'string',
    rules: [
      [
        {type: 'integration', value: ['8f3be88c-0f3d-4ec0-a4ab-2699c993fbff']},
        {type: 'region', value: ['ap-south-1', 'us-east-1']},
        {type: 'AWSResourceGroup', value: ['f4e967fd-1475-4d11-901c-89e1df5e5784']},
        {type: 'resourceType', value: ['AWS::Lambda::Function', 'AWS::S3::Bucket']},
        {type: 'tag', key: 'stage', operator: 'equals', value: 'dev'},
        {type: 'tag', key: 'stage', operator: 'contains', value: 'qa'},
        {type: 'resourceName', value: 'foundation', operator: 'endsWith'},
        {type: 'resourceName', value: 'dev', operator: 'startsWith'}
      ]
    ]
  })
};

fetch('https://{region}.api.plerion.com/v1/tenant/asset-groups', 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/asset-groups",
  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([
    'name' => 'string',
    'rules' => [
        [
                [
                                'type' => 'integration',
                                'value' => [
                                                                '8f3be88c-0f3d-4ec0-a4ab-2699c993fbff'
                                ]
                ],
                [
                                'type' => 'region',
                                'value' => [
                                                                'ap-south-1',
                                                                'us-east-1'
                                ]
                ],
                [
                                'type' => 'AWSResourceGroup',
                                'value' => [
                                                                'f4e967fd-1475-4d11-901c-89e1df5e5784'
                                ]
                ],
                [
                                'type' => 'resourceType',
                                'value' => [
                                                                'AWS::Lambda::Function',
                                                                'AWS::S3::Bucket'
                                ]
                ],
                [
                                'type' => 'tag',
                                'key' => 'stage',
                                'operator' => 'equals',
                                'value' => 'dev'
                ],
                [
                                'type' => 'tag',
                                'key' => 'stage',
                                'operator' => 'contains',
                                'value' => 'qa'
                ],
                [
                                'type' => 'resourceName',
                                'value' => 'foundation',
                                'operator' => 'endsWith'
                ],
                [
                                'type' => 'resourceName',
                                'value' => 'dev',
                                'operator' => 'startsWith'
                ]
        ]
    ]
  ]),
  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/asset-groups"

	payload := strings.NewReader("{\n  \"name\": \"string\",\n  \"rules\": [\n    [\n      {\n        \"type\": \"integration\",\n        \"value\": [\n          \"8f3be88c-0f3d-4ec0-a4ab-2699c993fbff\"\n        ]\n      },\n      {\n        \"type\": \"region\",\n        \"value\": [\n          \"ap-south-1\",\n          \"us-east-1\"\n        ]\n      },\n      {\n        \"type\": \"AWSResourceGroup\",\n        \"value\": [\n          \"f4e967fd-1475-4d11-901c-89e1df5e5784\"\n        ]\n      },\n      {\n        \"type\": \"resourceType\",\n        \"value\": [\n          \"AWS::Lambda::Function\",\n          \"AWS::S3::Bucket\"\n        ]\n      },\n      {\n        \"type\": \"tag\",\n        \"key\": \"stage\",\n        \"operator\": \"equals\",\n        \"value\": \"dev\"\n      },\n      {\n        \"type\": \"tag\",\n        \"key\": \"stage\",\n        \"operator\": \"contains\",\n        \"value\": \"qa\"\n      },\n      {\n        \"type\": \"resourceName\",\n        \"value\": \"foundation\",\n        \"operator\": \"endsWith\"\n      },\n      {\n        \"type\": \"resourceName\",\n        \"value\": \"dev\",\n        \"operator\": \"startsWith\"\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/asset-groups")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"string\",\n  \"rules\": [\n    [\n      {\n        \"type\": \"integration\",\n        \"value\": [\n          \"8f3be88c-0f3d-4ec0-a4ab-2699c993fbff\"\n        ]\n      },\n      {\n        \"type\": \"region\",\n        \"value\": [\n          \"ap-south-1\",\n          \"us-east-1\"\n        ]\n      },\n      {\n        \"type\": \"AWSResourceGroup\",\n        \"value\": [\n          \"f4e967fd-1475-4d11-901c-89e1df5e5784\"\n        ]\n      },\n      {\n        \"type\": \"resourceType\",\n        \"value\": [\n          \"AWS::Lambda::Function\",\n          \"AWS::S3::Bucket\"\n        ]\n      },\n      {\n        \"type\": \"tag\",\n        \"key\": \"stage\",\n        \"operator\": \"equals\",\n        \"value\": \"dev\"\n      },\n      {\n        \"type\": \"tag\",\n        \"key\": \"stage\",\n        \"operator\": \"contains\",\n        \"value\": \"qa\"\n      },\n      {\n        \"type\": \"resourceName\",\n        \"value\": \"foundation\",\n        \"operator\": \"endsWith\"\n      },\n      {\n        \"type\": \"resourceName\",\n        \"value\": \"dev\",\n        \"operator\": \"startsWith\"\n      }\n    ]\n  ]\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://{region}.api.plerion.com/v1/tenant/asset-groups")

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  \"name\": \"string\",\n  \"rules\": [\n    [\n      {\n        \"type\": \"integration\",\n        \"value\": [\n          \"8f3be88c-0f3d-4ec0-a4ab-2699c993fbff\"\n        ]\n      },\n      {\n        \"type\": \"region\",\n        \"value\": [\n          \"ap-south-1\",\n          \"us-east-1\"\n        ]\n      },\n      {\n        \"type\": \"AWSResourceGroup\",\n        \"value\": [\n          \"f4e967fd-1475-4d11-901c-89e1df5e5784\"\n        ]\n      },\n      {\n        \"type\": \"resourceType\",\n        \"value\": [\n          \"AWS::Lambda::Function\",\n          \"AWS::S3::Bucket\"\n        ]\n      },\n      {\n        \"type\": \"tag\",\n        \"key\": \"stage\",\n        \"operator\": \"equals\",\n        \"value\": \"dev\"\n      },\n      {\n        \"type\": \"tag\",\n        \"key\": \"stage\",\n        \"operator\": \"contains\",\n        \"value\": \"qa\"\n      },\n      {\n        \"type\": \"resourceName\",\n        \"value\": \"foundation\",\n        \"operator\": \"endsWith\"\n      },\n      {\n        \"type\": \"resourceName\",\n        \"value\": \"dev\",\n        \"operator\": \"startsWith\"\n      }\n    ]\n  ]\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "id": "k3d83a9b-k3dk-5lkd-2ldk-9kd77c1beb6"
  }
}
{
  "errors": [
    {
      "field": "<string>",
      "code": "<string>",
      "message": "<string>"
    }
  ]
}
{
  "message": "Internal server error"
}

Authorizations

Authorization
string
header
required

Bearer API Key. For example, "Bearer {Tenant API Key}"

Headers

Authorization
string
required

Bearer API Key. For example, "Bearer {Tenant API Key}"

Content-Type
string

application/json

Body

application/json
name
string
required
Minimum string length: 1
rules
object[][]
required

Response

Success

data
object