Skip to content

Commit 35c7876

Browse files
authored
ARG Query Generation API in 2023-09-01-preview (#25699)
* Adds base for updating Microsoft.ResourceGraph from version stable/2022-10-01 to version 2023-09-01-preview * Updates readme * Updates API version in new specs and examples * Updated ARG Swagger Specs by Adding Copilot Swagger. * Updated ARG Copilot Swagger Spec with Linter Fix. * Updated ARG Swagger Spec ReadMe with Avocado Fix. * Updated ARG Swagger Specs to Handle Linter Issue.
1 parent 79e0974 commit 35c7876

18 files changed

+1631
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"parameters": {
3+
"api-version": "2023-09-01-preview"
4+
},
5+
"responses": {
6+
"200": {
7+
"body": {
8+
"value": [
9+
{
10+
"name": "Microsoft.ResourceGraph/operations/read",
11+
"display": {
12+
"provider": "Microsoft Resource Graph",
13+
"resource": "Operation",
14+
"operation": "Get Operations",
15+
"description": "Gets the list of supported operations"
16+
}
17+
},
18+
{
19+
"name": "Microsoft.ResourceGraph/resources/read",
20+
"display": {
21+
"provider": "Microsoft Resource Graph",
22+
"resource": "Resources",
23+
"operation": "Query resources",
24+
"description": "Submits a query on resources within specified subscriptions, the specified management groups, or against all access granted in the tenant."
25+
}
26+
}
27+
]
28+
}
29+
}
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"title": "Basic Query",
3+
"description": "A simple resources query.",
4+
"parameters": {
5+
"api-version": "2023-09-01-preview",
6+
"query": {
7+
"subscriptions": [
8+
"cfbbd179-59d2-4052-aa06-9270a38aa9d6"
9+
],
10+
"query": "Resources | project id, name, type, location, tags | limit 3"
11+
}
12+
},
13+
"responses": {
14+
"200": {
15+
"body": {
16+
"totalRecords": 3,
17+
"count": 3,
18+
"resultTruncated": "false",
19+
"facets": [],
20+
"data": [
21+
{
22+
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Network/networkInterfaces/myNetworkInterface",
23+
"name": "myNetworkInterface",
24+
"type": "microsoft.network/networkinterfaces",
25+
"location": "centralus",
26+
"tags": {
27+
"tag1": "Value1"
28+
}
29+
},
30+
{
31+
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Network/virtualNetworks/myVnet",
32+
"name": "myVnet",
33+
"type": "microsoft.network/virtualnetworks",
34+
"location": "westus",
35+
"tags": {}
36+
},
37+
{
38+
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Network/publicIPAddresses/myPublicIp",
39+
"name": "myPublicIp",
40+
"type": "microsoft.network/publicipaddresses",
41+
"location": "westus",
42+
"tags": {}
43+
}
44+
]
45+
}
46+
}
47+
}
48+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"title": "Complex Query",
3+
"description": "A complex query on resources featuring multiple operations.",
4+
"parameters": {
5+
"api-version": "2023-09-01-preview",
6+
"query": {
7+
"subscriptions": [
8+
"cfbbd179-59d2-4052-aa06-9270a38aa9d6"
9+
],
10+
"query": "Resources | project id, name, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by location | top 3 by count_"
11+
}
12+
},
13+
"responses": {
14+
"200": {
15+
"body": {
16+
"totalRecords": 3,
17+
"count": 3,
18+
"resultTruncated": "false",
19+
"facets": [],
20+
"data": [
21+
{
22+
"location": "centralus",
23+
"count_": 11
24+
},
25+
{
26+
"location": "eastus",
27+
"count_": 11
28+
},
29+
{
30+
"location": "southcentralus",
31+
"count_": 3
32+
}
33+
]
34+
}
35+
}
36+
}
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
{
2+
"title": "Facet Query",
3+
"description": "A query on resources requesting extra facets.",
4+
"parameters": {
5+
"api-version": "2023-09-01-preview",
6+
"query": {
7+
"subscriptions": [
8+
"cfbbd179-59d2-4052-aa06-9270a38aa9d6"
9+
],
10+
"query": "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | project id, name, location, resourceGroup, properties.storageProfile.osDisk.osType | limit 5",
11+
"facets": [
12+
{
13+
"expression": "location",
14+
"options": {
15+
"sortOrder": "desc",
16+
"$top": 3
17+
}
18+
},
19+
{
20+
"expression": "properties.storageProfile.osDisk.osType",
21+
"options": {
22+
"sortOrder": "desc",
23+
"$top": 3
24+
}
25+
},
26+
{
27+
"expression": "nonExistingColumn",
28+
"options": {
29+
"sortOrder": "desc",
30+
"$top": 3
31+
}
32+
},
33+
{
34+
"expression": "resourceGroup",
35+
"options": {
36+
"sortBy": "tolower(resourceGroup)",
37+
"sortOrder": "asc",
38+
"$top": 3
39+
}
40+
},
41+
{
42+
"expression": "resourceGroup",
43+
"options": {
44+
"filter": "resourceGroup contains 'test'",
45+
"$top": 3
46+
}
47+
}
48+
]
49+
}
50+
},
51+
"responses": {
52+
"200": {
53+
"body": {
54+
"totalRecords": 5,
55+
"count": 5,
56+
"resultTruncated": "false",
57+
"data": [
58+
{
59+
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/B-TEST-RG/providers/Microsoft.Compute/virtualMachines/myTestVm",
60+
"name": "myTestVm",
61+
"location": "eastus",
62+
"resourceGroup": "B-TEST-RG",
63+
"properties_storageProfile_osDisk_osType": "Windows"
64+
},
65+
{
66+
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/c-rg/providers/Microsoft.Compute/virtualMachines/myTestAccountVm",
67+
"name": "myTestAccountVm",
68+
"location": "westcentralus",
69+
"resourceGroup": "c-rg",
70+
"properties_storageProfile_osDisk_osType": "Windows"
71+
},
72+
{
73+
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/I-RG/providers/Microsoft.Compute/virtualMachines/yetanothertest",
74+
"name": "yetanothertest",
75+
"location": "eastus",
76+
"resourceGroup": "I-RG",
77+
"properties_storageProfile_osDisk_osType": "Linux"
78+
},
79+
{
80+
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/x-test-rg/providers/Microsoft.Compute/virtualMachines/drafttest1bux4cv7a7q3aw",
81+
"name": "drafttest1bux4cv7a7q3aw",
82+
"location": "southcentralus",
83+
"resourceGroup": "x-test-rg",
84+
"properties_storageProfile_osDisk_osType": "Linux"
85+
},
86+
{
87+
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/y-rg/providers/Microsoft.Compute/virtualMachines/testvmntp25370",
88+
"name": "testvmntp25370",
89+
"location": "eastus",
90+
"resourceGroup": "y-rg",
91+
"properties_storageProfile_osDisk_osType": "Windows"
92+
}
93+
],
94+
"facets": [
95+
{
96+
"expression": "location",
97+
"resultType": "FacetResult",
98+
"totalRecords": 3,
99+
"count": 3,
100+
"data": [
101+
{
102+
"location": "eastus",
103+
"count": 3
104+
},
105+
{
106+
"location": "southcentralus",
107+
"count": 1
108+
},
109+
{
110+
"location": "westcentralus",
111+
"count": 1
112+
}
113+
]
114+
},
115+
{
116+
"expression": "properties.storageProfile.osDisk.osType",
117+
"resultType": "FacetResult",
118+
"totalRecords": 2,
119+
"count": 2,
120+
"data": [
121+
{
122+
"properties_storageProfile_osDisk_osType": "Linux",
123+
"count": 2
124+
},
125+
{
126+
"properties_storageProfile_osDisk_osType": "Windows",
127+
"count": 3
128+
}
129+
]
130+
},
131+
{
132+
"expression": "nonExistingColumn",
133+
"resultType": "FacetError",
134+
"errors": [
135+
{
136+
"code": "NoValidColumns",
137+
"message": "No valid columns in facet expression."
138+
},
139+
{
140+
"code": "InvalidColumnNames",
141+
"message": "Invalid column names: [nonExistingColumn]."
142+
}
143+
]
144+
},
145+
{
146+
"expression": "resourceGroup",
147+
"resultType": "FacetResult",
148+
"totalRecords": 5,
149+
"count": 3,
150+
"data": [
151+
{
152+
"resourceGroup": "B-TEST-RG",
153+
"count": 1
154+
},
155+
{
156+
"resourceGroup": "c-rg",
157+
"count": 1
158+
},
159+
{
160+
"resourceGroup": "I-RG",
161+
"count": 1
162+
}
163+
]
164+
},
165+
{
166+
"expression": "resourceGroup",
167+
"resultType": "FacetResult",
168+
"totalRecords": 2,
169+
"count": 2,
170+
"data": [
171+
{
172+
"resourceGroup": "B-TEST-RG",
173+
"count": 1
174+
},
175+
{
176+
"resourceGroup": "x-test-rg",
177+
"count": 1
178+
}
179+
]
180+
}
181+
]
182+
}
183+
}
184+
}
185+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"title": "Filter query",
3+
"description": "A filtering query on resources.",
4+
"parameters": {
5+
"api-version": "2023-09-01-preview",
6+
"query": {
7+
"subscriptions": [
8+
"cfbbd179-59d2-4052-aa06-9270a38aa9d6"
9+
],
10+
"query": "Resources | project id, name, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | limit 3"
11+
}
12+
},
13+
"responses": {
14+
"200": {
15+
"body": {
16+
"totalRecords": 3,
17+
"count": 3,
18+
"resultTruncated": "false",
19+
"facets": [],
20+
"data": [
21+
{
22+
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Compute/virtualMachines/myVm1",
23+
"name": "myVm1",
24+
"type": "microsoft.compute/virtualmachines",
25+
"location": "centralus"
26+
},
27+
{
28+
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Compute/virtualMachines/myVirtualMachine",
29+
"name": "myVirtualMachine",
30+
"type": "microsoft.compute/virtualmachines",
31+
"location": "eastus"
32+
},
33+
{
34+
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG3/providers/Microsoft.Compute/virtualMachines/testVm",
35+
"name": "testVm",
36+
"type": "microsoft.compute/virtualmachines",
37+
"location": "eastus"
38+
}
39+
]
40+
}
41+
}
42+
}
43+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"title": "First page query",
3+
"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.",
4+
"parameters": {
5+
"api-version": "2023-09-01-preview",
6+
"query": {
7+
"subscriptions": [
8+
"cfbbd179-59d2-4052-aa06-9270a38aa9d6"
9+
],
10+
"query": "Resources | where name contains 'test' | project id, name, type, location",
11+
"options": {
12+
"$top": 3,
13+
"$skip": 0
14+
}
15+
}
16+
},
17+
"responses": {
18+
"200": {
19+
"body": {
20+
"totalRecords": 386,
21+
"count": 3,
22+
"resultTruncated": "false",
23+
"facets": [],
24+
"$skipToken": "eyAibm8iOiAibHVjayIsICJidXQiOiAibmljZSIsICJ0cnkiOiAiISIgfQ==",
25+
"data": [
26+
{
27+
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Compute/disks/yetanothertest_OsDisk_1_f396cbcb625a457bb69fe2abf5975820",
28+
"name": "yetanothertest_OsDisk_1_f396cbcb625a457bb69fe2abf5975820",
29+
"type": "microsoft.compute/disks",
30+
"location": "eastus"
31+
},
32+
{
33+
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Automation/automationAccounts/TestAA",
34+
"name": "TestAA",
35+
"type": "microsoft.automation/automationaccounts",
36+
"location": "westcentralus"
37+
},
38+
{
39+
"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Automation/automationAccounts/TestAA/runbooks/TestRB",
40+
"name": "TestRB",
41+
"type": "microsoft.automation/automationaccounts/runbooks",
42+
"location": "westcentralus"
43+
}
44+
]
45+
}
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)