Skip to content

Commit

Permalink
Merge pull request #1184 from yves-chan/oychan/myworkbooks
Browse files Browse the repository at this point in the history
add myworkbooks, update workbooks schema
  • Loading branch information
anthony-c-martin authored Sep 15, 2020
2 parents cf636b1 + 6f68c52 commit 443fa3a
Show file tree
Hide file tree
Showing 7 changed files with 201 additions and 6 deletions.
1 change: 1 addition & 0 deletions schemas/2014-04-01-preview/deploymentTemplate.json
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@
{ "$ref": "https://schema.management.azure.com/schemas/2014-04-01/Microsoft.Sql.json#/resourceDefinitions/servers_elasticPools" },
{ "$ref": "https://schema.management.azure.com/schemas/2014-04-01/Microsoft.Sql.json#/resourceDefinitions/servers_firewallRules" },
{ "$ref": "https://schema.management.azure.com/schemas/2015-05-01/Microsoft.Insights.json#/resourceDefinitions/components" },
{ "$ref": "https://schema.management.azure.com/schemas/2015-05-01/Microsoft.Insights.json#/resourceDefinitions/myWorkbooks" },
{ "$ref": "https://schema.management.azure.com/schemas/2015-05-01/Microsoft.Insights.json#/resourceDefinitions/workbooks" },
{ "$ref": "https://schema.management.azure.com/schemas/2018-06-17-preview/microsoft.insights.json#/resourceDefinitions/workbooks" },
{ "$ref": "https://schema.management.azure.com/schemas/2019-10-17-preview/microsoft.insights.json#/resourceDefinitions/privateLinkScopes" },
Expand Down
1 change: 1 addition & 0 deletions schemas/2015-01-01/deploymentTemplate.json
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@
{ "$ref": "https://schema.management.azure.com/schemas/2014-04-01/Microsoft.Sql.json#/resourceDefinitions/servers_firewallRules" },
{ "$ref": "https://schema.management.azure.com/schemas/2015-05-01/Microsoft.Insights.json#/resourceDefinitions/components" },
{ "$ref": "https://schema.management.azure.com/schemas/2015-05-01/Microsoft.Insights.json#/resourceDefinitions/workbooks" },
{ "$ref": "https://schema.management.azure.com/schemas/2015-05-01/Microsoft.Insights.json#/resourceDefinitions/myWorkbooks" },
{ "$ref": "https://schema.management.azure.com/schemas/2018-06-17-preview/microsoft.insights.json#/resourceDefinitions/workbooks" },
{ "$ref": "https://schema.management.azure.com/schemas/2019-10-17-preview/microsoft.insights.json#/resourceDefinitions/privateLinkScopes" },
{ "$ref": "https://schema.management.azure.com/schemas/2019-10-17-preview/microsoft.insights.json#/resourceDefinitions/privateLinkScopes_privateEndpointConnections" },
Expand Down
123 changes: 123 additions & 0 deletions schemas/2015-05-01/Microsoft.Insights.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,83 @@
],
"description": "Microsoft.Insights/components"
},
"myWorkbooks": {
"type": "object",
"properties": {
"apiVersion": {
"type": "string",
"enum": [
"2015-05-01"
]
},
"id": {
"type": "string",
"description": "Azure resource Id"
},
"kind": {
"oneOf": [
{
"type": "string",
"enum": [
"user",
"shared"
]
},
{
"$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression"
}
],
"description": "The kind of workbook. Choices are user and shared."
},
"location": {
"type": "string",
"description": "Resource location"
},
"name": {
"type": "string",
"description": "The name of the Application Insights component resource."
},
"properties": {
"oneOf": [
{
"$ref": "#/definitions/MyWorkbookProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression"
}
],
"description": "Properties that contain a private workbook."
},
"tags": {
"oneOf": [
{
"type": "object",
"additionalProperties": {
"type": "string"
},
"properties": {}
},
{
"$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression"
}
],
"description": "Resource tags"
},
"type": {
"type": "string",
"enum": [
"Microsoft.Insights/myWorkbooks"
]
}
},
"required": [
"apiVersion",
"name",
"properties",
"type"
],
"description": "Microsoft.Insights/myWorkbooks"
},
"webtests": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -282,6 +359,52 @@
],
"description": "Properties that define an Application Insights component resource."
},
"MyWorkbookProperties": {
"type": "object",
"properties": {
"category": {
"type": "string",
"description": "Workbook category, as defined by the user at creation time."
},
"displayName": {
"type": "string",
"description": "The user-defined name of the private workbook."
},
"serializedData": {
"type": "string",
"description": "Configuration of this particular private workbook. Configuration data is a string containing valid JSON"
},
"sourceId": {
"type": "string",
"description": "resourceId for a source resource or 'Azure Monitor'."
},
"tags": {
"oneOf": [
{
"type": "array",
"items": {
"type": "string"
}
},
{
"$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression"
}
],
"description": "A list of 0 or more tags that are associated with this private workbook definition"
},
"version": {
"type": "string",
"description": "This instance's version of the data model. This can change as new features are added that can be marked private workbook."
}
},
"required": [
"category",
"displayName",
"serializedData",
"sourceId"
],
"description": "Properties that contain a private workbook."
},
"WebTestGeolocation": {
"type": "object",
"properties": {
Expand Down
6 changes: 3 additions & 3 deletions schemas/2018-06-17-preview/microsoft.insights.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@
],
"description": "A list of 0 or more tags that are associated with this workbook definition"
},
"userId": {
"sourceId": {
"type": "string",
"description": "Unique user id of the specific user that owns this workbook."
"description": "resourceId for a source resource or 'Azure Monitor'."
},
"version": {
"type": "string",
Expand All @@ -122,7 +122,7 @@
"category",
"displayName",
"serializedData",
"userId"
"sourceId"
],
"description": "Properties that contain a workbook."
}
Expand Down
1 change: 1 addition & 0 deletions schemas/2019-04-01/deploymentTemplate.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@
{ "$ref": "https://schema.management.azure.com/schemas/2017-04-01/Microsoft.Insights.json#/resourceDefinitions/actionGroups" },
{ "$ref": "https://schema.management.azure.com/schemas/2017-04-01/Microsoft.Insights.json#/resourceDefinitions/activityLogAlerts" },
{ "$ref": "https://schema.management.azure.com/schemas/2015-05-01/Microsoft.Insights.json#/resourceDefinitions/components" },
{ "$ref": "https://schema.management.azure.com/schemas/2015-05-01/Microsoft.Insights.json#/resourceDefinitions/myWorkbooks" },
{ "$ref": "https://schema.management.azure.com/schemas/2015-05-01/Microsoft.Insights.json#/resourceDefinitions/workbooks" },
{ "$ref": "https://schema.management.azure.com/schemas/2015-05-01/Microsoft.Insights.json#/resourceDefinitions/webtests" },
{ "$ref": "https://schema.management.azure.com/schemas/2017-08-01/Microsoft.Network.json#/resourceDefinitions/publicIPAddresses" },
Expand Down
69 changes: 69 additions & 0 deletions tests/2015-05-01/microsoft.insights.tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,75 @@
"category": "workbook"
}
}
},
{
"name": "myWorkbooks - empty",
"definition": "https://schema.management.azure.com/schemas/2015-05-01/Microsoft.Insights.json#/resourceDefinitions/myWorkbooks",
"json": {
"apiVersion": "2015-05-01",
"properties": {}
},
"expectedErrors": [
{
"message": "Missing required property: name",
"dataPath": "/",
"schemaPath": "/required/1",
"subErrors": []
},
{
"message": "Missing required property: type",
"dataPath": "/",
"schemaPath": "/required/3",
"subErrors": []
},
{
"message": "Data does not match any schemas from \"oneOf\"",
"dataPath": "/properties",
"schemaPath": "/properties/properties/oneOf",
"subErrors": [
{
"message": "Missing required property: category",
"dataPath": "/properties",
"schemaPath": "/properties/properties/oneOf/0/required/0",
"subErrors": []
},
{
"message": "Missing required property: displayName",
"dataPath": "/properties",
"schemaPath": "/properties/properties/oneOf/0/required/1",
"subErrors": []
},
{
"message": "Missing required property: serializedData",
"dataPath": "/properties",
"schemaPath": "/properties/properties/oneOf/0/required/2",
"subErrors": []
},
{
"message": "Invalid type: object (expected string)",
"dataPath": "/properties",
"schemaPath": "/properties/properties/oneOf/1/type",
"subErrors": []
}
]
}
]
},
{
"name": "myWorkbooks - basic test",
"definition": "https://schema.management.azure.com/schemas/2015-05-01/Microsoft.Insights.json#/resourceDefinitions/myWorkbooks",
"json": {
"apiVersion": "2015-05-01",
"name": "deadb33f-8bee-4d3b-a059-9be8dac93960",
"type": "Microsoft.Insights/myWorkbooks",
"location": "west us",
"properties": {
"displayName": "Blah Blah Blah",
"serializedData": "{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}",
"category": "workbook",
"sourceId": "Azure Monitor"
}
}
}
]
}
6 changes: 3 additions & 3 deletions tests/2018-06-17-preview/microsoft.insights.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{
"message": "Missing required property: type",
"dataPath": "/",
"schemaPath": "/required/4",
"schemaPath": "/required/3",
"subErrors": []
},
{
Expand All @@ -50,7 +50,7 @@
"subErrors": []
},
{
"message": "Missing required property: userId",
"message": "Missing required property: sourceId",
"dataPath": "/properties",
"schemaPath": "/properties/properties/oneOf/0/required/3",
"subErrors": []
Expand All @@ -75,7 +75,7 @@
"location": "west us",
"properties": {
"displayName": "Blah Blah Blah",
"userId": "userId",
"sourceId": "Azure Monitor",
"serializedData": "{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}",
"category": "workbook"
}
Expand Down

0 comments on commit 443fa3a

Please sign in to comment.