Skip to content

Commit

Permalink
Microsoft.ResourceGraph public preview spec (#3716)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilidemi authored and sarangan12 committed Aug 27, 2018
1 parent 21d580e commit b85c2ca
Show file tree
Hide file tree
Showing 14 changed files with 1,343 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"parameters": {
"api-version": "2018-09-01-preview"
},
"responses": {
"200": {
"body": {
"value": [
{
"name": "Microsoft.ResourceGraph/resources/action",
"display": {
"provider": "Microsoft Resource Graph",
"resource": "Resources",
"operation": "Query resources",
"description": "Submits a query on resources within specified subscriptions"
}
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"title": "Alias Query",
"description": "A query accessing one of the resource properties through [alias](https://docs.microsoft.com/en-us/azure/azure-policy/policy-definition#aliases).",
"parameters": {
"api-version": "2018-09-01-preview",
"query": {
"subscriptions": [
"cfbbd179-59d2-4052-aa06-9270a38aa9d6"
],
"query": "where type =~ 'Microsoft.Web/serverFarms' | extend skuName = tostring(aliases['Microsoft.Web/serverfarms/sku.name']) | summarize count() by skuName"
}
},
"responses": {
"200": {
"body": {
"totalRecords": 3,
"count": 3,
"resultTruncated": "false",
"data": {
"columns": [
{
"name": "skuName",
"type": "string"
},
{
"name": "count_",
"type": "integer"
}
],
"rows": [
[
"S2",
1
],
[
"Y1",
3
],
[
"S1",
1
]
]
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"title": "Basic Query",
"description": "A simple resources query.",
"parameters": {
"api-version": "2018-09-01-preview",
"query": {
"subscriptions": [
"cfbbd179-59d2-4052-aa06-9270a38aa9d6"
],
"query": "project id, name, type, location, tags | limit 3"
}
},
"responses": {
"200": {
"body": {
"totalRecords": 3,
"count": 3,
"resultTruncated": "false",
"data": {
"columns": [
{
"name": "id",
"type": "string"
},
{
"name": "name",
"type": "string"
},
{
"name": "type",
"type": "string"
},
{
"name": "location",
"type": "string"
},
{
"name": "tags",
"type": "object"
}
],
"rows": [
[
"/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Network/networkInterfaces/myNetworkInterface",
"myNetworkInterface",
"microsoft.network/networkinterfaces",
"centralus",
{
"tag1": "Value1"
}
],
[
"/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Network/virtualNetworks/myVnet",
"myVnet",
"microsoft.network/virtualnetworks",
"westus",
{}
],
[
"/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Network/publicIPAddresses/myPublicIp",
"myPublicIp",
"microsoft.network/publicipaddresses",
"westus",
{}
]
]
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"title": "Complex Query",
"description": "A complex query on resources featuring multiple operations.",
"parameters": {
"api-version": "2018-09-01-preview",
"query": {
"subscriptions": [
"cfbbd179-59d2-4052-aa06-9270a38aa9d6"
],
"query": "project id, name, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by location | top 3 by count_"
}
},
"responses": {
"200": {
"body": {
"totalRecords": 3,
"count": 3,
"resultTruncated": "false",
"data": {
"columns": [
{
"name": "location",
"type": "string"
},
{
"name": "count_",
"type": "integer"
}
],
"rows": [
[
"centralus",
11
],
[
"eastus",
11
],
[
"southcentralus",
3
]
]
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
{
"title": "Facet Query",
"description": "A query on resources requesting extra facets.",
"parameters": {
"api-version": "2018-09-01-preview",
"query": {
"subscriptions": [
"cfbbd179-59d2-4052-aa06-9270a38aa9d6"
],
"query": "where type =~ 'Microsoft.Compute/virtualMachines' | project id, name, location, properties.storageProfile.osDisk.osType | limit 5",
"facets": [
{
"expression": "location",
"options": {
"sortOrder": "desc",
"$top": 3
}
},
{
"expression": "properties.storageProfile.osDisk.osType",
"options": {
"sortOrder": "desc",
"$top": 3
}
},
{
"expression": "nonExistingColumn",
"options": {
"sortOrder": "desc",
"$top": 3
}
}
]
}
},
"responses": {
"200": {
"body": {
"totalRecords": 5,
"count": 5,
"resultTruncated": "false",
"data": {
"columns": [
{
"name": "id",
"type": "string"
},
{
"name": "name",
"type": "string"
},
{
"name": "location",
"type": "string"
},
{
"name": "properties_storageProfile_osDisk_osType",
"type": "object"
}
],
"rows": [
[
"/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Compute/virtualMachines/myTestVm",
"myTestVm",
"eastus",
"Windows"
],
[
"/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Compute/virtualMachines/myTestAccountVm",
"myTestAccountVm",
"westcentralus",
"Windows"
],
[
"/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Compute/virtualMachines/yetanothertest",
"yetanothertest",
"eastus",
"Linux"
],
[
"/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Compute/virtualMachines/drafttest1bux4cv7a7q3aw",
"drafttest1bux4cv7a7q3aw",
"southcentralus",
"Linux"
],
[
"/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Compute/virtualMachines/testvmntp25370",
"testvmntp25370",
"eastus",
"Windows"
]
]
},
"facets": [
{
"expression": "location",
"resultType": "FacetResult",
"totalRecords": 3,
"count": 3,
"data": {
"columns": [
{
"name": "location",
"type": "string"
},
{
"name": "count",
"type": "integer"
}
],
"rows": [
[
"eastus",
3
],
[
"southcentralus",
1
],
[
"westcentralus",
1
]
]
}
},
{
"expression": "properties.storageProfile.osDisk.osType",
"resultType": "FacetResult",
"totalRecords": 2,
"count": 2,
"data": {
"columns": [
{
"name": "properties_storageProfile_osDisk_osType",
"type": "string"
},
{
"name": "count",
"type": "integer"
}
],
"rows": [
[
"Linux",
2
],
[
"Windows",
3
]
]
}
},
{
"expression": "nonExistingColumn",
"resultType": "FacetError",
"errors": [
{
"code": "NoValidColumns",
"message": "No valid columns in facet expression."
},
{
"code": "InvalidColumnNames",
"message": "Invalid column names: [nonExistingColumn]."
}
]
}
]
}
}
}
}
Loading

0 comments on commit b85c2ca

Please sign in to comment.