Query Entities by Type

This query takes a single argument entityType to return entities filtered by the entityType. The query requests the entityId and the name and id of any namespaces that entity is part of.

Query

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
query QueryEntityByType($entityType: [String!]) {
  entityQuery {
    queryEntities(entityType: $entityType) {
      entities {
        entityId
        namespaces {
          name
          id
        }
      }
    }
  }
}

Variables

1
2
3
{
  "entityType": "AWS.EC2.Instance"
}

Example response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
  "data": {
    "entityQuery": {
      "queryEntities": {
        "entities": [

          {
            "entityId": "AWS.EC2.825279116158.af-south-1.Instance.i-050046434c9192ff1",
            "entityType": "AWS.EC2.Instance",
            "namespaces": [
              {
                "name": "VROPS",
                "id": "vrn/org:2acf4023-1778-4e6a-a892-7635b8c7f4fb/provider:VROPS/EC2Instance:3a8252a6-a0d9-44e6-beef-63ee5c73d85c"
              },
              {
                "name": "Tanzu",
                "id": null
              }
            ]
          },
          {
            "entityId": "AWS.EC2.825279116158.ap-northeast-2.Instance.i-043ad3d1553894402",
            "entityType": "AWS.EC2.Instance",
            "namespaces": [
              {
                "name": "Tanzu",
                "id": null
              },
              {
                "name": "VROPS",
                "id": "vrn/org:2acf4023-1778-4e6a-a892-7635b8c7f4fb/provider:VROPS/EC2Instance:23254a50-c003-400f-8354-64ee7fc96ccf"
              }
            ]
          }
        ]
      }
    }
  }
}
Share this post