From b85c2cab0908643f3bba1955409847c93083ac9a Mon Sep 17 00:00:00 2001 From: Ilia Demianenko Date: Mon, 27 Aug 2018 14:51:35 -0700 Subject: [PATCH] Microsoft.ResourceGraph public preview spec (#3716) --- .../examples/OperationsList.json | 22 + .../examples/ResourcesAliasQuery.json | 48 ++ .../examples/ResourcesBasicQuery.json | 71 +++ .../examples/ResourcesComplexQuery.json | 48 ++ .../examples/ResourcesFacetQuery.json | 173 ++++++ .../examples/ResourcesFilterQuery.json | 62 +++ .../examples/ResourcesFirstPageQuery.json | 67 +++ .../examples/ResourcesNextPageQuery.json | 64 +++ .../examples/ResourcesPropertiesQuery.json | 44 ++ .../examples/ResourcesQueryOptions.json | 67 +++ .../examples/ResourcesRandomPageQuery.json | 62 +++ .../examples/ResourcesSummarizeQuery.json | 41 ++ .../2018-09-01-preview/resourcegraph.json | 524 ++++++++++++++++++ .../resourcegraph/resource-manager/readme.md | 50 ++ 14 files changed, 1343 insertions(+) create mode 100644 specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/OperationsList.json create mode 100644 specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesAliasQuery.json create mode 100644 specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesBasicQuery.json create mode 100644 specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesComplexQuery.json create mode 100644 specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesFacetQuery.json create mode 100644 specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesFilterQuery.json create mode 100644 specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesFirstPageQuery.json create mode 100644 specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesNextPageQuery.json create mode 100644 specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesPropertiesQuery.json create mode 100644 specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesQueryOptions.json create mode 100644 specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesRandomPageQuery.json create mode 100644 specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesSummarizeQuery.json create mode 100644 specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/resourcegraph.json create mode 100644 specification/resourcegraph/resource-manager/readme.md diff --git a/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/OperationsList.json b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/OperationsList.json new file mode 100644 index 000000000000..8e2165b092e8 --- /dev/null +++ b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/OperationsList.json @@ -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" + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesAliasQuery.json b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesAliasQuery.json new file mode 100644 index 000000000000..445ca5440e1d --- /dev/null +++ b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesAliasQuery.json @@ -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 + ] + ] + } + } + } + } +} \ No newline at end of file diff --git a/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesBasicQuery.json b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesBasicQuery.json new file mode 100644 index 000000000000..904d96b34a02 --- /dev/null +++ b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesBasicQuery.json @@ -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", + {} + ] + ] + } + } + } + } +} \ No newline at end of file diff --git a/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesComplexQuery.json b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesComplexQuery.json new file mode 100644 index 000000000000..32b567768ff8 --- /dev/null +++ b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesComplexQuery.json @@ -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 + ] + ] + } + } + } + } +} \ No newline at end of file diff --git a/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesFacetQuery.json b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesFacetQuery.json new file mode 100644 index 000000000000..b3e83ee11a0f --- /dev/null +++ b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesFacetQuery.json @@ -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]." + } + ] + } + ] + } + } + } +} \ No newline at end of file diff --git a/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesFilterQuery.json b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesFilterQuery.json new file mode 100644 index 000000000000..83e0e399a19f --- /dev/null +++ b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesFilterQuery.json @@ -0,0 +1,62 @@ +{ + "title": "Filter query", + "description": "A filtering query on resources.", + "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' | 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" + } + ], + "rows": [ + [ + "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Compute/virtualMachines/myVm1", + "myVm1", + "microsoft.compute/virtualmachines", + "centralus" + ], + [ + "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Compute/virtualMachines/myVirtualMachine", + "myVirtualMachine", + "microsoft.compute/virtualmachines", + "eastus" + ], + [ + "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG3/providers/Microsoft.Compute/virtualMachines/testVm", + "testVm", + "microsoft.compute/virtualmachines", + "eastus" + ] + ] + } + } + } + } +} \ No newline at end of file diff --git a/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesFirstPageQuery.json b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesFirstPageQuery.json new file mode 100644 index 000000000000..e64a1acaff21 --- /dev/null +++ b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesFirstPageQuery.json @@ -0,0 +1,67 @@ +{ + "title": "First page query", + "description": "A query requesting a first page with of results", + "parameters": { + "api-version": "2018-09-01-preview", + "query": { + "subscriptions": [ + "cfbbd179-59d2-4052-aa06-9270a38aa9d6" + ], + "query": "where name contains 'test' | project id, name, type, location", + "options": { + "$top": 3, + "$skip": 0 + } + } + }, + "responses": { + "200": { + "body": { + "totalRecords": 386, + "count": 3, + "resultTruncated": "false", + "$skipToken": "eyAibm8iOiAibHVjayIsICJidXQiOiAibmljZSIsICJ0cnkiOiAiISIgfQ==", + "data": { + "columns": [ + { + "name": "id", + "type": "string" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "type", + "type": "string" + }, + { + "name": "location", + "type": "string" + } + ], + "rows": [ + [ + "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Compute/disks/yetanothertest_OsDisk_1_f396cbcb625a457bb69fe2abf5975820", + "yetanothertest_OsDisk_1_f396cbcb625a457bb69fe2abf5975820", + "microsoft.compute/disks", + "eastus" + ], + [ + "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Automation/automationAccounts/TestAA", + "TestAA", + "microsoft.automation/automationaccounts", + "westcentralus" + ], + [ + "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Automation/automationAccounts/TestAA/runbooks/TestRB", + "TestRB", + "microsoft.automation/automationaccounts/runbooks", + "westcentralus" + ] + ] + } + } + } + } +} \ No newline at end of file diff --git a/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesNextPageQuery.json b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesNextPageQuery.json new file mode 100644 index 000000000000..47c1ec14f3e6 --- /dev/null +++ b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesNextPageQuery.json @@ -0,0 +1,64 @@ +{ + "title": "Next page query", + "description": "A query on resources requesting the next page using skip token", + "parameters": { + "api-version": "2018-09-01-preview", + "query": { + "subscriptions": [ + "cfbbd179-59d2-4052-aa06-9270a38aa9d6" + ], + "query": "where name contains 'test' | project id, name, type, location", + "$skipToken": "eyAibm8iOiAibHVjayIsICJidXQiOiAibmljZSIsICJ0cnkiOiAiISIgfQ==" + } + }, + "responses": { + "200": { + "body": { + "totalRecords": 386, + "count": 3, + "resultTruncated": "false", + "$skipToken": "eyAibm8yIjogImx1Y2syIiwgImJ1dDIiOiAibmljZTIiLCAidHJ5MiI6ICIhIiB9", + "data": { + "columns": [ + { + "name": "id", + "type": "string" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "type", + "type": "string" + }, + { + "name": "location", + "type": "string" + } + ], + "rows": [ + [ + "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Compute/disks/second_OsDisk_dddddbcb625a457bb69fe2abf5975820", + "second_OsDisk_dddddbcb625a457bb69fe2abf5975820", + "microsoft.compute/disks", + "eastus" + ], + [ + "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Automation/automationAccounts/AATest", + "AATest", + "microsoft.automation/automationaccounts", + "westcentralus" + ], + [ + "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Automation/automationAccounts/TestAA/runbooks/RBTest", + "RBTest", + "microsoft.automation/automationaccounts/runbooks", + "westcentralus" + ] + ] + } + } + } + } +} \ No newline at end of file diff --git a/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesPropertiesQuery.json b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesPropertiesQuery.json new file mode 100644 index 000000000000..851e8ce0de3e --- /dev/null +++ b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesPropertiesQuery.json @@ -0,0 +1,44 @@ +{ + "title": "Properties Query", + "description": "A query accessing one of the resource properties.", + "parameters": { + "api-version": "2018-09-01-preview", + "query": { + "subscriptions": [ + "cfbbd179-59d2-4052-aa06-9270a38aa9d6" + ], + "query": "where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by tostring(properties.storageProfile.osDisk.osType)" + } + }, + "responses": { + "200": { + "body": { + "totalRecords": 2, + "count": 2, + "resultTruncated": "false", + "data": { + "columns": [ + { + "name": "properties_storageProfile_osDisk_osType", + "type": "string" + }, + { + "name": "count_", + "type": "integer" + } + ], + "rows": [ + [ + "Linux", + 7 + ], + [ + "Windows", + 23 + ] + ] + } + } + } + } +} \ No newline at end of file diff --git a/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesQueryOptions.json b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesQueryOptions.json new file mode 100644 index 000000000000..721822db8cfa --- /dev/null +++ b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesQueryOptions.json @@ -0,0 +1,67 @@ +{ + "title": "Query options", + "description": "A query on resources specifying paging and max rows through query options", + "parameters": { + "api-version": "2018-09-01-preview", + "query": { + "subscriptions": [ + "cfbbd179-59d2-4052-aa06-9270a38aa9d6" + ], + "query": "where name contains 'test' | project id, name, type, location", + "options": { + "$top": 3, + "$skip": 10 + } + } + }, + "responses": { + "200": { + "body": { + "totalRecords": 386, + "count": 3, + "resultTruncated": "false", + "$skipToken": "eyAibm8yIjogImx1Y2syIiwgImJ1dDIiOiAibmljZTIiLCAidHJ5MiI6ICIhIiB9", + "data": { + "columns": [ + { + "name": "id", + "type": "string" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "type", + "type": "string" + }, + { + "name": "location", + "type": "string" + } + ], + "rows": [ + [ + "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG4/providers/Microsoft.Compute/disks/yetanothertest_OsDisk_1_f396cbcb625a457bb69fe2abf5975820", + "yetanothertest_OsDisk_1_f396cbcb625a457bb69fe2abf5975820", + "microsoft.compute/disks", + "eastus" + ], + [ + "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG5/providers/Microsoft.Automation/automationAccounts/TestAA", + "TestAA", + "microsoft.automation/automationaccounts", + "westcentralus" + ], + [ + "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG5/providers/Microsoft.Automation/automationAccounts/TestAA/runbooks/TestRB", + "TestRB", + "microsoft.automation/automationaccounts/runbooks", + "westcentralus" + ] + ] + } + } + } + } +} \ No newline at end of file diff --git a/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesRandomPageQuery.json b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesRandomPageQuery.json new file mode 100644 index 000000000000..6f5b3dfc7b5f --- /dev/null +++ b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesRandomPageQuery.json @@ -0,0 +1,62 @@ +{ + "title": "Random page query", + "description": "A query on resources requesting the random page using skip token, top and skip overrides", + "parameters": { + "api-version": "2018-09-01-preview", + "query": { + "subscriptions": [ + "cfbbd179-59d2-4052-aa06-9270a38aa9d6" + ], + "query": "where name contains 'test' | project id, name, type, location", + "$skipToken": "eyAibm8iOiAibHVjayIsICJidXQiOiAibmljZSIsICJ0cnkiOiAiISIgfQ==", + "options": { + "$top": 2, + "$skip": 10 + } + } + }, + "responses": { + "200": { + "body": { + "totalRecords": 386, + "count": 2, + "resultTruncated": "false", + "$skipToken": "eyAibm8yIjogImx1Y2syIiwgImJ1dDIiOiAibmljZTIiLCAidHJ5MiI6ICIhIiB9", + "data": { + "columns": [ + { + "name": "id", + "type": "string" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "type", + "type": "string" + }, + { + "name": "location", + "type": "string" + } + ], + "rows": [ + [ + "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Compute/disks/third_OsDisk_dddddbcb625a457bb69fe2abf5975820", + "third_OsDisk_dddddbcb625a457bb69fe2abf5975820", + "microsoft.compute/disks", + "eastus" + ], + [ + "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Automation/automationAccounts/CCTest", + "CCTest", + "microsoft.automation/automationaccounts", + "westcentralus" + ] + ] + } + } + } + } +} \ No newline at end of file diff --git a/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesSummarizeQuery.json b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesSummarizeQuery.json new file mode 100644 index 000000000000..452bb7c4c67a --- /dev/null +++ b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/examples/ResourcesSummarizeQuery.json @@ -0,0 +1,41 @@ +{ + "title": "Summarize Query", + "description": "A summarizing query on resources.", + "parameters": { + "api-version": "2018-09-01-preview", + "query": { + "subscriptions": [ + "cfbbd179-59d2-4052-aa06-9270a38aa9d6" + ], + "query": "project id, name, type, location | summarize by location" + } + }, + "responses": { + "200": { + "body": { + "totalRecords": 3, + "count": 3, + "resultTruncated": "false", + "data": { + "columns": [ + { + "name": "location", + "type": "string" + } + ], + "rows": [ + [ + "centralus" + ], + [ + "eastus" + ], + [ + "westus" + ] + ] + } + } + } + } +} \ No newline at end of file diff --git a/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/resourcegraph.json b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/resourcegraph.json new file mode 100644 index 000000000000..8f21aa299301 --- /dev/null +++ b/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/resourcegraph.json @@ -0,0 +1,524 @@ +{ + "swagger": "2.0", + "info": { + "title": "Azure Resource Graph", + "description": "Azure Resource Graph API Reference", + "version": "2018-09-01-preview" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/providers/Microsoft.ResourceGraph/resources": { + "post": { + "tags": [ + "Resources" + ], + "operationId": "Resources", + "description": "Queries the resources managed by Azure Resource Manager for all subscriptions specified in the request.", + "externalDocs": { + "description": "Learn more about the query syntax here", + "url": "https://aka.ms/resource-graph/learntoquery" + }, + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "name": "query", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/QueryRequest" + }, + "description": "Request specifying query and its options." + } + ], + "responses": { + "200": { + "description": "Result of the query operation", + "schema": { + "$ref": "#/definitions/QueryResponse" + } + }, + "default": { + "description": "An error occurred while processing the request. See the error.code parameter to identify the specific error.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Basic query": { "$ref": "./examples/ResourcesBasicQuery.json" }, + "Filter resources": { "$ref": "./examples/ResourcesFilterQuery.json" }, + "Summarize resources by location": { "$ref": "./examples/ResourcesSummarizeQuery.json" }, + "Complex query": { "$ref": "./examples/ResourcesComplexQuery.json" }, + "Access a properties field": { "$ref": "./examples/ResourcesPropertiesQuery.json" }, + "Access a properties field through alias": { "$ref": "./examples/ResourcesAliasQuery.json" }, + "Query with a facet request": { "$ref": "./examples/ResourcesFacetQuery.json" }, + "Query options": { "$ref": "./examples/ResourcesQueryOptions.json" }, + "First page query": { "$ref": "./examples/ResourcesFirstPageQuery.json" }, + "Next page query": { "$ref": "./examples/ResourcesNextPageQuery.json" }, + "Random page query": { "$ref": "./examples/ResourcesRandomPageQuery.json" } + } + } + }, + "/providers/Microsoft.ResourceGraph/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "Lists all of the available REST API operations.", + "operationId": "Operations_List", + "x-ms-examples": { + "OperationsList": { "$ref": "./examples/OperationsList.json" } + }, + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "OK. The request has succeeded.", + "schema": { + "$ref": "#/definitions/OperationListResult" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + } + } + } + }, + "definitions": { + "QueryRequest": { + "description": "Describes a query to be executed.", + "type": "object", + "properties": { + "subscriptions": { + "description": "Azure subscriptions against which to execute the query.", + "type": "array", + "items": { + "type": "string", + "description": "Subscription Id." + } + }, + "query": { + "description": "The resources query.", + "type": "string" + }, + "options": { + "description": "The query evaluation options", + "$ref": "#/definitions/QueryRequestOptions" + }, + "facets": { + "description": "An array of facet requests to be computed against the query result.", + "type": "array", + "items": { + "$ref": "#/definitions/FacetRequest" + } + } + }, + "required": [ + "subscriptions", + "query" + ] + }, + "QueryRequestOptions": { + "description": "The options for query evaluation", + "properties": { + "$skipToken": { + "description": "Continuation token for pagination, capturing the next page size and offset, as well as the context of the query.", + "type": "string" + }, + "$top": { + "description": "The maximum number of rows that the query should return. Overrides the page size when ```$skipToken``` property is present.", + "type": "integer", + "format": "int32", + "minimum": 1, + "maximum": 1000 + }, + "$skip": { + "description": "The number of rows to skip from the beginning of the results. Overrides the next page offset when ```$skipToken``` property is present.", + "type": "integer", + "format": "int32", + "minimum": 0 + } + } + }, + "FacetRequest": { + "description": "A request to compute additional statistics (facets) over the query results.", + "type": "object", + "properties": { + "expression": { + "description": "The column or list of columns to summarize by", + "type": "string" + }, + "options": { + "description": "The options for facet evaluation", + "$ref": "#/definitions/FacetRequestOptions" + } + }, + "required": [ + "expression" + ] + }, + "FacetRequestOptions": { + "description": "The options for facet evaluation", + "properties": { + "sortOrder": { + "description": "The sorting order by the hit count", + "type": "string", + "default": "desc", + "enum": [ + "asc", + "desc" + ], + "x-ms-enum": { + "name": "FacetSortOrder", + "modelAsString": false + } + }, + "$top": { + "description": "The maximum number of facet rows that should be returned.", + "type": "integer", + "format": "int32", + "minimum": 1, + "maximum": 1000 + } + } + }, + "QueryResponse": { + "description": "Query result.", + "type": "object", + "properties": { + "totalRecords": { + "description": "Number of total records matching the query.", + "type": "integer", + "format": "int64" + }, + "count": { + "description": "Number of records returned in the current response. In the case of paging, this is the number of records in the current page.", + "type": "integer", + "format": "int64" + }, + "resultTruncated": { + "description": "Indicates whether the query results are truncated.", + "type": "string", + "enum": [ + "true", + "false" + ], + "x-ms-enum": { + "name": "ResultTruncated", + "modelAsString": false + } + }, + "$skipToken": { + "description": "When present, the value can be passed to a subsequent query call (together with the same query and subscriptions used in the current request) to retrieve the next page of data.", + "type": "string" + }, + "data": { + "description": "Query output in tabular format.", + "$ref": "#/definitions/Table" + }, + "facets": { + "description": "Query facets.", + "type": "array", + "items": { + "$ref": "#/definitions/Facet" + } + } + }, + "required": [ + "totalRecords", + "count", + "resultTruncated", + "data" + ] + }, + "Table": { + "description": "Query output in tabular format.", + "type": "object", + "properties": { + "columns": { + "description": "Query result column descriptors.", + "type": "array", + "items": { + "$ref": "#/definitions/Column", + "description": "Column descriptor." + } + }, + "rows": { + "description": "Query result rows.", + "type": "array", + "items": { + "$ref": "#/definitions/Row", + "description": "Query result row." + } + } + }, + "required": [ + "columns", + "rows" + ] + }, + "Column": { + "description": "Query result column descriptor.", + "type": "object", + "properties": { + "name": { + "description": "Column name.", + "type": "string" + }, + "type": { + "description": "Column data type.", + "$ref": "#/definitions/ColumnDataType" + } + }, + "required": [ + "name", + "type" + ] + }, + "ColumnDataType": { + "description": "Data type of a column in a table.", + "type": "string", + "enum": [ + "string", + "integer", + "number", + "boolean", + "object" + ], + "x-ms-enum": { + "name": "ColumnDataType", + "modelAsString": false + } + }, + "Row": { + "description": "Query result row.", + "type": "array", + "items": { + "type": "object", + "description": "Cell value." + } + }, + "Facet": { + "description": "A facet containing additional statistics on the response of a query. Can be either FacetResult or FacetError.", + "type": "object", + "properties": { + "expression": { + "description": "Facet expression, same as in the corresponding facet request.", + "type": "string" + }, + "resultType": { + "description": "Result type", + "type": "string" + } + }, + "required": [ + "expression", + "resultType" + ], + "discriminator": "resultType" + }, + "FacetResult" : { + "x-ms-discriminator-value": "FacetResult", + "description": "Successfully executed facet containing additional statistics on the response of a query.", + "type": "object", + "properties": { + "totalRecords": { + "description": "Number of total records in the facet results.", + "type": "integer", + "format": "int64" + }, + "count": { + "description": "Number of records returned in the facet response.", + "type": "integer", + "format": "int32" + }, + "data": { + "description": "A table containing the desired facets. Only present if the facet is valid.", + "$ref": "#/definitions/Table" + } + }, + "required": [ + "totalRecords", + "count", + "data" + ], + "allOf": [ + { + "$ref": "#/definitions/Facet" + } + ] + }, + "FacetError" : { + "x-ms-discriminator-value": "FacetError", + "description": "A facet whose execution resulted in an error.", + "type": "object", + "properties": { + "errors": { + "description": "An array containing detected facet errors with details.", + "type": "array", + "items": { + "$ref": "#/definitions/ErrorDetails" + } + } + }, + "required": [ + "errors" + ], + "allOf": [ + { + "$ref": "#/definitions/Facet" + } + ] + }, + "ErrorResponse": { + "title": "Error response.", + "type": "object", + "description": "An error response from the API.", + "properties": { + "error": { + "$ref": "#/definitions/Error", + "description": "Error information." + } + }, + "required": [ + "error" + ] + }, + "Error": { + "title": "Error info.", + "type": "object", + "description": "Error details.", + "properties": { + "code": { + "type": "string", + "description": "Error code identifying the specific error." + }, + "message": { + "type": "string", + "description": "A human readable error message." + }, + "details": { + "type": "array", + "description": "Error details", + "items": { + "$ref": "#/definitions/ErrorDetails" + } + } + }, + "required": [ + "code", + "message" + ] + }, + "ErrorDetails": { + "title": "Error details.", + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Error code identifying the specific error." + }, + "message": { + "type": "string", + "description": "A human readable error message." + }, + "additionalProperties": { + "type": "object", + "description": "Additional custom properties." + } + }, + "required": [ + "code", + "message" + ] + }, + "OperationListResult": { + "description": "Result of the request to list Resource Graph operations. It contains a list of operations and a URL link to get the next set of results.", + "properties": { + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "description": "List of Resource Graph operations supported by the Resource Graph resource provider." + } + } + }, + "Operation": { + "description": "Resource Graph REST API operation definition.", + "properties": { + "name": { + "description": "Operation name: {provider}/{resource}/{operation}", + "type": "string" + }, + "display": { + "description": "Display metadata associated with the operation.", + "properties": { + "provider": { + "description": "Service provider: Microsoft Resource Graph.", + "type": "string" + }, + "resource": { + "description": "Resource on which the operation is performed etc.", + "type": "string" + }, + "operation": { + "description": "Type of operation: get, read, delete, etc.", + "type": "string" + }, + "description": { + "description": "Description for the operation.", + "type": "string" + } + } + }, + "origin": { + "type" : "string", + "description": "The origin of operations." + } + } + } + }, + "parameters": { + "ApiVersionParameter": { + "name": "api-version", + "in": "query", + "required": true, + "type": "string", + "description": "API version." + } + } +} diff --git a/specification/resourcegraph/resource-manager/readme.md b/specification/resourcegraph/resource-manager/readme.md new file mode 100644 index 000000000000..10fca5396f81 --- /dev/null +++ b/specification/resourcegraph/resource-manager/readme.md @@ -0,0 +1,50 @@ +# ResourceGraph + +> see https://aka.ms/autorest + +This is the AutoRest configuration file for ResourceGraph. + + + +--- +## Getting Started +To build the SDK for ResourceGraph, simply [Install AutoRest](https://aka.ms/autorest/install) and in this folder, run: + +> `autorest` + +To see additional help and options, run: + +> `autorest --help` +--- + +## Configuration + + +### Basic Information +These are the global settings for the ResourceGraph API. + +``` yaml +title: ResourceGraphClient +openapi-type: arm +tag: package-2018-09-preview +``` + +### Validations +Run validations when `--validate` is specified on command line + +``` yaml $(validate) +azure-validator: true +semantic-validator: true +model-validator: true +message-format: json +``` + + +### Tag: package-2018-09-preview + +These settings apply only when `--tag=package-2018-09-preview` is specified on the command line. + +``` yaml $(tag) == 'package-2018-09-preview' +input-file: +- Microsoft.ResourceGraph/preview/2018-09-01-preview/resourcegraph.json +``` \ No newline at end of file