Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARG Query Generation API in 2023-09-01-preview #25699

Merged
merged 7 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"parameters": {
"api-version": "2023-09-01-preview"
},
"responses": {
"200": {
"body": {
"value": [
{
"name": "Microsoft.ResourceGraph/operations/read",
"display": {
"provider": "Microsoft Resource Graph",
"resource": "Operation",
"operation": "Get Operations",
"description": "Gets the list of supported operations"
}
},
{
"name": "Microsoft.ResourceGraph/resources/read",
"display": {
"provider": "Microsoft Resource Graph",
"resource": "Resources",
"operation": "Query resources",
"description": "Submits a query on resources within specified subscriptions, the specified management groups, or against all access granted in the tenant."
}
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"title": "Basic Query",
"description": "A simple resources query.",
"parameters": {
"api-version": "2023-09-01-preview",
"query": {
"subscriptions": [
"cfbbd179-59d2-4052-aa06-9270a38aa9d6"
],
"query": "Resources | project id, name, type, location, tags | limit 3"
}
},
"responses": {
"200": {
"body": {
"totalRecords": 3,
"count": 3,
"resultTruncated": "false",
"facets": [],
"data": [
{
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Network/networkInterfaces/myNetworkInterface",
"name": "myNetworkInterface",
"type": "microsoft.network/networkinterfaces",
"location": "centralus",
"tags": {
"tag1": "Value1"
}
},
{
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Network/virtualNetworks/myVnet",
"name": "myVnet",
"type": "microsoft.network/virtualnetworks",
"location": "westus",
"tags": {}
},
{
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Network/publicIPAddresses/myPublicIp",
"name": "myPublicIp",
"type": "microsoft.network/publicipaddresses",
"location": "westus",
"tags": {}
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"title": "Complex Query",
"description": "A complex query on resources featuring multiple operations.",
"parameters": {
"api-version": "2023-09-01-preview",
"query": {
"subscriptions": [
"cfbbd179-59d2-4052-aa06-9270a38aa9d6"
],
"query": "Resources | 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",
"facets": [],
"data": [
{
"location": "centralus",
"count_": 11
},
{
"location": "eastus",
"count_": 11
},
{
"location": "southcentralus",
"count_": 3
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
{
"title": "Facet Query",
"description": "A query on resources requesting extra facets.",
"parameters": {
"api-version": "2023-09-01-preview",
"query": {
"subscriptions": [
"cfbbd179-59d2-4052-aa06-9270a38aa9d6"
],
"query": "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | project id, name, location, resourceGroup, 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
}
},
{
"expression": "resourceGroup",
"options": {
"sortBy": "tolower(resourceGroup)",
"sortOrder": "asc",
"$top": 3
}
},
{
"expression": "resourceGroup",
"options": {
"filter": "resourceGroup contains 'test'",
"$top": 3
}
}
]
}
},
"responses": {
"200": {
"body": {
"totalRecords": 5,
"count": 5,
"resultTruncated": "false",
"data": [
{
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/B-TEST-RG/providers/Microsoft.Compute/virtualMachines/myTestVm",
"name": "myTestVm",
"location": "eastus",
"resourceGroup": "B-TEST-RG",
"properties_storageProfile_osDisk_osType": "Windows"
},
{
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/c-rg/providers/Microsoft.Compute/virtualMachines/myTestAccountVm",
"name": "myTestAccountVm",
"location": "westcentralus",
"resourceGroup": "c-rg",
"properties_storageProfile_osDisk_osType": "Windows"
},
{
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/I-RG/providers/Microsoft.Compute/virtualMachines/yetanothertest",
"name": "yetanothertest",
"location": "eastus",
"resourceGroup": "I-RG",
"properties_storageProfile_osDisk_osType": "Linux"
},
{
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/x-test-rg/providers/Microsoft.Compute/virtualMachines/drafttest1bux4cv7a7q3aw",
"name": "drafttest1bux4cv7a7q3aw",
"location": "southcentralus",
"resourceGroup": "x-test-rg",
"properties_storageProfile_osDisk_osType": "Linux"
},
{
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/y-rg/providers/Microsoft.Compute/virtualMachines/testvmntp25370",
"name": "testvmntp25370",
"location": "eastus",
"resourceGroup": "y-rg",
"properties_storageProfile_osDisk_osType": "Windows"
}
],
"facets": [
{
"expression": "location",
"resultType": "FacetResult",
"totalRecords": 3,
"count": 3,
"data": [
{
"location": "eastus",
"count": 3
},
{
"location": "southcentralus",
"count": 1
},
{
"location": "westcentralus",
"count": 1
}
]
},
{
"expression": "properties.storageProfile.osDisk.osType",
"resultType": "FacetResult",
"totalRecords": 2,
"count": 2,
"data": [
{
"properties_storageProfile_osDisk_osType": "Linux",
"count": 2
},
{
"properties_storageProfile_osDisk_osType": "Windows",
"count": 3
}
]
},
{
"expression": "nonExistingColumn",
"resultType": "FacetError",
"errors": [
{
"code": "NoValidColumns",
"message": "No valid columns in facet expression."
},
{
"code": "InvalidColumnNames",
"message": "Invalid column names: [nonExistingColumn]."
}
]
},
{
"expression": "resourceGroup",
"resultType": "FacetResult",
"totalRecords": 5,
"count": 3,
"data": [
{
"resourceGroup": "B-TEST-RG",
"count": 1
},
{
"resourceGroup": "c-rg",
"count": 1
},
{
"resourceGroup": "I-RG",
"count": 1
}
]
},
{
"expression": "resourceGroup",
"resultType": "FacetResult",
"totalRecords": 2,
"count": 2,
"data": [
{
"resourceGroup": "B-TEST-RG",
"count": 1
},
{
"resourceGroup": "x-test-rg",
"count": 1
}
]
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"title": "Filter query",
"description": "A filtering query on resources.",
"parameters": {
"api-version": "2023-09-01-preview",
"query": {
"subscriptions": [
"cfbbd179-59d2-4052-aa06-9270a38aa9d6"
],
"query": "Resources | project id, name, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | limit 3"
}
},
"responses": {
"200": {
"body": {
"totalRecords": 3,
"count": 3,
"resultTruncated": "false",
"facets": [],
"data": [
{
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Compute/virtualMachines/myVm1",
"name": "myVm1",
"type": "microsoft.compute/virtualmachines",
"location": "centralus"
},
{
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Compute/virtualMachines/myVirtualMachine",
"name": "myVirtualMachine",
"type": "microsoft.compute/virtualmachines",
"location": "eastus"
},
{
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG3/providers/Microsoft.Compute/virtualMachines/testVm",
"name": "testVm",
"type": "microsoft.compute/virtualmachines",
"location": "eastus"
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"title": "First page query",
"description": "A query requesting a first page with of results. Please note id field is required in the response to return the pages in stable sorted fashion.",
"parameters": {
"api-version": "2023-09-01-preview",
"query": {
"subscriptions": [
"cfbbd179-59d2-4052-aa06-9270a38aa9d6"
],
"query": "Resources | where name contains 'test' | project id, name, type, location",
"options": {
"$top": 3,
"$skip": 0
}
}
},
"responses": {
"200": {
"body": {
"totalRecords": 386,
"count": 3,
"resultTruncated": "false",
"facets": [],
"$skipToken": "eyAibm8iOiAibHVjayIsICJidXQiOiAibmljZSIsICJ0cnkiOiAiISIgfQ==",
"data": [
{
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Compute/disks/yetanothertest_OsDisk_1_f396cbcb625a457bb69fe2abf5975820",
"name": "yetanothertest_OsDisk_1_f396cbcb625a457bb69fe2abf5975820",
"type": "microsoft.compute/disks",
"location": "eastus"
},
{
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Automation/automationAccounts/TestAA",
"name": "TestAA",
"type": "microsoft.automation/automationaccounts",
"location": "westcentralus"
},
{
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Automation/automationAccounts/TestAA/runbooks/TestRB",
"name": "TestRB",
"type": "microsoft.automation/automationaccounts/runbooks",
"location": "westcentralus"
}
]
}
}
}
}
Loading