Added SQL MI tile and sub resource types to resource deployment (#14043)

* Made azure arc as resourcesubtype
Added new azure arc resource type
Added support for different eula statement for different subtypes
Consolidated getSelectedOption

* Fixed some PR based comments

* Fixed more pr comments

* Fixed the error in unit test by deep copying extension resourceTypes (to keep the original one intact)

* Fixed property name 'agreement' to 'agreements'

* Cloning subresourceTypes
This commit is contained in:
Aasim Khan
2021-01-27 22:06:53 -08:00
committed by GitHub
parent 8651db1e7e
commit 14cf6add73
9 changed files with 1160 additions and 943 deletions

View File

@@ -292,11 +292,13 @@
"target": "AZDATA_NB_VAR_ARC_DATA_CONTROLLER_CONNECTIVITY_MODE",
"value": "direct"
},
"validations" : [{
"type": "regex_match",
"regex": "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$",
"description": "%arc.data.controller.spclientid.validation.description%"
}]
"validations": [
{
"type": "regex_match",
"regex": "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$",
"description": "%arc.data.controller.spclientid.validation.description%"
}
]
},
{
"label": "%arc.data.controller.spclientsecret%",
@@ -322,11 +324,13 @@
"providerId": "subscription-id-to-tenant-id",
"triggerField": "AZDATA_NB_VAR_ARC_SUBSCRIPTION"
},
"validations" : [{
"type": "regex_match",
"regex": "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$",
"description": "%arc.data.controller.sptenantid.validation.description%"
}]
"validations": [
{
"type": "regex_match",
"regex": "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$",
"description": "%arc.data.controller.sptenantid.validation.description%"
}
]
}
]
}
@@ -346,11 +350,13 @@
{
"type": "text",
"label": "%arc.data.controller.namespace%",
"validations" : [{
"type": "regex_match",
"regex": "^[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?$",
"description": "%arc.data.controller.namespace.validation.description%"
}],
"validations": [
{
"type": "regex_match",
"regex": "^[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?$",
"description": "%arc.data.controller.namespace.validation.description%"
}
],
"defaultValue": "arc",
"required": true,
"variableName": "AZDATA_NB_VAR_ARC_DATA_CONTROLLER_NAMESPACE"
@@ -358,11 +364,13 @@
{
"type": "text",
"label": "%arc.data.controller.name%",
"validations" : [{
"type": "regex_match",
"regex": "^[a-z0-9]([-.a-z0-9]{0,251}[a-z0-9])?$",
"description": "%arc.data.controller.name.validation.description%"
}],
"validations": [
{
"type": "regex_match",
"regex": "^[a-z0-9]([-.a-z0-9]{0,251}[a-z0-9])?$",
"description": "%arc.data.controller.name.validation.description%"
}
],
"defaultValue": "arc-dc",
"required": true,
"variableName": "AZDATA_NB_VAR_ARC_DATA_CONTROLLER_NAME"
@@ -617,200 +625,6 @@
}
]
},
{
"name": "arc.sql",
"displayName": "%resource.type.arc.sql.display.name%",
"description": "%resource.type.arc.sql.description%",
"platforms": "*",
"icon": "./images/miaa.svg",
"tags": [
"Hybrid",
"SQL Server"
],
"providers": [
{
"notebookWizard": {
"notebook": "./notebooks/arcDeployment/deploy.sql.existing.arc.ipynb",
"doneAction": {
"label": "%deploy.done.action%"
},
"scriptAction": {
"label": "%deploy.script.action%"
},
"codeCellInsertionPosition": 5,
"title": "%arc.sql.wizard.title%",
"name": "arc.sql.wizard",
"labelPosition": "left",
"generateSummaryPage": false,
"pages": [
{
"title": "%arc.sql.wizard.page1.title%",
"labelWidth": "175px",
"inputWidth": "280px",
"sections": [
{
"title": "%arc.sql.connection.settings.section.title%",
"fields": [
{
"label": "%arc.controller%",
"variableName": "",
"type": "options",
"editable": false,
"required": true,
"options": {
"source": {
"providerId": "arc.controllers",
"variableNames": {
"endpoint": "AZDATA_NB_VAR_CONTROLLER_ENDPOINT",
"username": "AZDATA_NB_VAR_CONTROLLER_USERNAME",
"kubeConfig": "AZDATA_NB_VAR_CONTROLLER_KUBECONFIG",
"clusterContext": "AZDATA_NB_VAR_CONTROLLER_KUBECTL_CONTEXT",
"password": "AZDATA_NB_VAR_CONTROLLER_PASSWORD"
}
},
"optionsType": "dropdown"
}
},
{
"label": "%arc.sql.instance.name%",
"variableName": "AZDATA_NB_VAR_SQL_INSTANCE_NAME",
"type": "text",
"defaultValue": "sqlinstance1",
"required": true,
"validations" : [{
"type": "regex_match",
"regex": "^[a-z]([-a-z0-9]{0,11}[a-z0-9])?$",
"description": "%arc.sql.invalid.instance.name%"
}]
},
{
"label": "%arc.sql.username%",
"variableName": "AZDATA_NB_VAR_SQL_USERNAME",
"type": "text",
"required": true,
"validations" : [{
"type": "regex_match",
"regex": "^(?!sa$)",
"description": "%arc.sql.invalid.username%"
}]
},
{
"label": "%arc.password%",
"variableName": "AZDATA_NB_VAR_SQL_PASSWORD",
"type": "sql_password",
"userName": "sa",
"confirmationRequired": true,
"confirmationLabel": "%arc.confirm.password%",
"defaultValue": "",
"required": true
}
]
},
{
"title": "%arc.sql.instance.settings.section.title%",
"fields": [
{
"label": "%arc.storage-class.data.label%",
"description": "%arc.sql.storage-class.data.description%",
"variableName": "AZDATA_NB_VAR_SQL_STORAGE_CLASS_DATA",
"type": "kube_storage_class",
"required": true
},
{
"label": "%arc.storage-class.logs.label%",
"description": "%arc.sql.storage-class.logs.description%",
"variableName": "AZDATA_NB_VAR_SQL_STORAGE_CLASS_LOGS",
"type": "kube_storage_class",
"required": true
},
{
"label": "%arc.cores-request.label%",
"description": "%arc.sql.cores-request.description%",
"variableName": "AZDATA_NB_VAR_SQL_CORES_REQUEST",
"type": "number",
"min": 1,
"required": false,
"validations": [
{
"type": "<=",
"target": "AZDATA_NB_VAR_SQL_CORES_LIMIT",
"description": "%requested.cores.less.than.or.equal.to.cores.limit%"
}
]
},
{
"label": "%arc.cores-limit.label%",
"description": "%arc.sql.cores-limit.description%",
"variableName": "AZDATA_NB_VAR_SQL_CORES_LIMIT",
"type": "number",
"min": 1,
"required": false,
"validations": [
{
"type": ">=",
"target": "AZDATA_NB_VAR_SQL_CORES_REQUEST",
"description": "%cores.limit.greater.than.or.equal.to.requested.cores%"
}
]
},
{
"label": "%arc.memory-request.label%",
"description": "%arc.sql.memory-request.description%",
"variableName": "AZDATA_NB_VAR_SQL_MEMORY_REQUEST",
"type": "number",
"min": 2,
"required": false,
"validations": [{
"type": "<=",
"target": "AZDATA_NB_VAR_SQL_MEMORY_LIMIT",
"description": "%requested.memory.less.than.or.equal.to.memory.limit%"
}]
},
{
"label": "%arc.memory-limit.label%",
"description": "%arc.sql.memory-limit.description%",
"variableName": "AZDATA_NB_VAR_SQL_MEMORY_LIMIT",
"type": "number",
"min": 2,
"required": false,
"validations": [{
"type": ">=",
"target": "AZDATA_NB_VAR_SQL_MEMORY_REQUEST",
"description": "%memory.limit.greater.than.or.equal.to.requested.memory%"
}]
}
]
}
]
}
]
},
"requiredTools": [
{
"name": "kubectl"
},
{
"name": "azdata",
"version": "20.2.6"
}
],
"when": "true"
}
],
"agreement": {
"template": "%arc.agreement%",
"links": [
{
"text": "%microsoft.agreement.privacy.statement%",
"url": "https://go.microsoft.com/fwlink/?LinkId=853010"
},
{
"text": "%arc.agreement.sql.terms.conditions%",
"url": "https://go.microsoft.com/fwlink/?linkid=2045708"
}
]
}
},
{
"name": "arc.postgres",
"displayName": "%resource.type.arc.postgres.display.name%",
@@ -870,11 +684,13 @@
"variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_NAME",
"type": "text",
"description": "%arc.postgres.server.group.name.validation.description%",
"validations" : [{
"type": "regex_match",
"regex": "^[a-z]([-a-z0-9]{0,9}[a-z0-9])?$",
"description": "%arc.postgres.server.group.name.validation.description%"
}],
"validations": [
{
"type": "regex_match",
"regex": "^[a-z]([-a-z0-9]{0,9}[a-z0-9])?$",
"description": "%arc.postgres.server.group.name.validation.description%"
}
],
"required": true
},
{
@@ -891,10 +707,12 @@
"description": "%arc.postgres.server.group.workers.description%",
"variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_WORKERS",
"type": "number",
"validations": [{
"type": "is_integer",
"description": "%should.be.integer%"
}],
"validations": [
{
"type": "is_integer",
"description": "%should.be.integer%"
}
],
"defaultValue": "0",
"min": 0
},
@@ -902,10 +720,12 @@
"label": "%arc.postgres.server.group.port%",
"variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_PORT",
"type": "number",
"validations": [{
"type": "is_integer",
"description": "%should.be.integer%"
}],
"validations": [
{
"type": "is_integer",
"description": "%should.be.integer%"
}
],
"defaultValue": "5432",
"min": 1,
"max": 65535
@@ -987,11 +807,13 @@
"variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_CORES_REQUEST",
"type": "number",
"min": 1,
"validations": [{
"type": "<=",
"target": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_CORES_LIMIT",
"description": "%requested.cores.less.than.or.equal.to.cores.limit%"
}]
"validations": [
{
"type": "<=",
"target": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_CORES_LIMIT",
"description": "%requested.cores.less.than.or.equal.to.cores.limit%"
}
]
},
{
"label": "%arc.postgres.server.group.cores.limit.label%",
@@ -999,11 +821,13 @@
"variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_CORES_LIMIT",
"type": "number",
"min": 1,
"validations": [{
"type": ">=",
"target": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_CORES_REQUEST",
"description": "%cores.limit.greater.than.or.equal.to.requested.cores%"
}]
"validations": [
{
"type": ">=",
"target": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_CORES_REQUEST",
"description": "%cores.limit.greater.than.or.equal.to.requested.cores%"
}
]
},
{
"label": "%arc.postgres.server.group.memory.request.label%",
@@ -1011,11 +835,13 @@
"variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_MEMORY_REQUEST",
"type": "number",
"min": 0.25,
"validations": [{
"type": "<=",
"target": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_MEMORY_LIMIT",
"description": "%requested.memory.less.than.or.equal.to.memory.limit%"
}]
"validations": [
{
"type": "<=",
"target": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_MEMORY_LIMIT",
"description": "%requested.memory.less.than.or.equal.to.memory.limit%"
}
]
},
{
"label": "%arc.postgres.server.group.memory.limit.label%",
@@ -1023,11 +849,13 @@
"variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_MEMORY_LIMIT",
"type": "number",
"min": 0.25,
"validations": [{
"type": ">=",
"target": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_MEMORY_REQUEST",
"description": "%memory.limit.greater.than.or.equal.to.requested.memory%"
}]
"validations": [
{
"type": ">=",
"target": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_MEMORY_REQUEST",
"description": "%memory.limit.greater.than.or.equal.to.requested.memory%"
}
]
}
]
}
@@ -1047,6 +875,218 @@
"when": "true"
}
],
"agreements": [
{
"template": "%arc.agreement%",
"links": [
{
"text": "%microsoft.agreement.privacy.statement%",
"url": "https://go.microsoft.com/fwlink/?LinkId=853010"
},
{
"text": "%arc.agreement.postgres.terms.conditions%",
"url": "https://go.microsoft.com/fwlink/?linkid=2045708"
}
],
"when": "true"
}
]
}
],
"resourceDeploymentSubTypes": [
{
"name": "azure-sql-mi",
"options": [
{
"name": "mi-type",
"values": [
{
"name": "arc-mi",
"displayName": "%resource.type.arc.sql.display.name%"
}
]
}
],
"tags": [
"Hybrid",
"SQL Server"
],
"provider": {
"notebookWizard": {
"notebook": "./notebooks/arcDeployment/deploy.sql.existing.arc.ipynb",
"doneAction": {
"label": "%deploy.done.action%"
},
"scriptAction": {
"label": "%deploy.script.action%"
},
"codeCellInsertionPosition": 5,
"title": "%arc.sql.wizard.title%",
"name": "arc.sql.wizard",
"labelPosition": "left",
"generateSummaryPage": false,
"pages": [
{
"title": "%arc.sql.wizard.page1.title%",
"labelWidth": "175px",
"inputWidth": "280px",
"sections": [
{
"title": "%arc.sql.connection.settings.section.title%",
"fields": [
{
"label": "%arc.controller%",
"variableName": "",
"type": "options",
"editable": false,
"required": true,
"options": {
"source": {
"providerId": "arc.controllers",
"variableNames": {
"endpoint": "AZDATA_NB_VAR_CONTROLLER_ENDPOINT",
"username": "AZDATA_NB_VAR_CONTROLLER_USERNAME",
"kubeConfig": "AZDATA_NB_VAR_CONTROLLER_KUBECONFIG",
"clusterContext": "AZDATA_NB_VAR_CONTROLLER_KUBECTL_CONTEXT",
"password": "AZDATA_NB_VAR_CONTROLLER_PASSWORD"
}
},
"optionsType": "dropdown"
}
},
{
"label": "%arc.sql.instance.name%",
"variableName": "AZDATA_NB_VAR_SQL_INSTANCE_NAME",
"type": "text",
"defaultValue": "sqlinstance1",
"required": true,
"validations": [
{
"type": "regex_match",
"regex": "^[a-z]([-a-z0-9]{0,11}[a-z0-9])?$",
"description": "%arc.sql.invalid.instance.name%"
}
]
},
{
"label": "%arc.sql.username%",
"variableName": "AZDATA_NB_VAR_SQL_USERNAME",
"type": "text",
"required": true,
"validations": [
{
"type": "regex_match",
"regex": "^(?!sa$)",
"description": "%arc.sql.invalid.username%"
}
]
},
{
"label": "%arc.password%",
"variableName": "AZDATA_NB_VAR_SQL_PASSWORD",
"type": "sql_password",
"userName": "sa",
"confirmationRequired": true,
"confirmationLabel": "%arc.confirm.password%",
"defaultValue": "",
"required": true
}
]
},
{
"title": "%arc.sql.instance.settings.section.title%",
"fields": [
{
"label": "%arc.storage-class.data.label%",
"description": "%arc.sql.storage-class.data.description%",
"variableName": "AZDATA_NB_VAR_SQL_STORAGE_CLASS_DATA",
"type": "kube_storage_class",
"required": true
},
{
"label": "%arc.storage-class.logs.label%",
"description": "%arc.sql.storage-class.logs.description%",
"variableName": "AZDATA_NB_VAR_SQL_STORAGE_CLASS_LOGS",
"type": "kube_storage_class",
"required": true
},
{
"label": "%arc.cores-request.label%",
"description": "%arc.sql.cores-request.description%",
"variableName": "AZDATA_NB_VAR_SQL_CORES_REQUEST",
"type": "number",
"min": 1,
"required": false,
"validations": [
{
"type": "<=",
"target": "AZDATA_NB_VAR_SQL_CORES_LIMIT",
"description": "%requested.cores.less.than.or.equal.to.cores.limit%"
}
]
},
{
"label": "%arc.cores-limit.label%",
"description": "%arc.sql.cores-limit.description%",
"variableName": "AZDATA_NB_VAR_SQL_CORES_LIMIT",
"type": "number",
"min": 1,
"required": false,
"validations": [
{
"type": ">=",
"target": "AZDATA_NB_VAR_SQL_CORES_REQUEST",
"description": "%cores.limit.greater.than.or.equal.to.requested.cores%"
}
]
},
{
"label": "%arc.memory-request.label%",
"description": "%arc.sql.memory-request.description%",
"variableName": "AZDATA_NB_VAR_SQL_MEMORY_REQUEST",
"type": "number",
"min": 2,
"required": false,
"validations": [
{
"type": "<=",
"target": "AZDATA_NB_VAR_SQL_MEMORY_LIMIT",
"description": "%requested.memory.less.than.or.equal.to.memory.limit%"
}
]
},
{
"label": "%arc.memory-limit.label%",
"description": "%arc.sql.memory-limit.description%",
"variableName": "AZDATA_NB_VAR_SQL_MEMORY_LIMIT",
"type": "number",
"min": 2,
"required": false,
"validations": [
{
"type": ">=",
"target": "AZDATA_NB_VAR_SQL_MEMORY_REQUEST",
"description": "%memory.limit.greater.than.or.equal.to.requested.memory%"
}
]
}
]
}
]
}
]
},
"requiredTools": [
{
"name": "kubectl"
},
{
"name": "azdata",
"version": "20.2.6"
}
],
"when": "mi-type=arc-mi"
},
"agreement": {
"template": "%arc.agreement%",
"links": [
@@ -1055,10 +1095,11 @@
"url": "https://go.microsoft.com/fwlink/?LinkId=853010"
},
{
"text": "%arc.agreement.postgres.terms.conditions%",
"text": "%arc.agreement.sql.terms.conditions%",
"url": "https://go.microsoft.com/fwlink/?linkid=2045708"
}
]
],
"when": "mi-type=arc-mi"
}
}
]

View File

@@ -338,11 +338,13 @@
"confirmationRequired": true,
"confirmationLabel": "%vm_password_confirm%",
"required": true,
"validations" : [{
"type": "regex_match",
"regex": "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[\\W_])[A-Za-z\\d\\W_]{12,123}$",
"description": "%vm_password_validation_error_message%"
}]
"validations": [
{
"type": "regex_match",
"regex": "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[\\W_])[A-Za-z\\d\\W_]{12,123}$",
"description": "%vm_password_validation_error_message%"
}
]
}
]
},
@@ -580,19 +582,22 @@
"when": "type=azure-multi-device"
}
],
"agreement": {
"template": "%edge-agreement%",
"links": [
{
"text": "%microsoft-privacy-statement%",
"url": "https://go.microsoft.com/fwlink/?LinkId=853010"
},
{
"text": "%edge-eula%",
"url": "https://go.microsoft.com/fwlink/?linkid=2128283"
}
]
}
"agreements": [
{
"template": "%edge-agreement%",
"links": [
{
"text": "%microsoft-privacy-statement%",
"url": "https://go.microsoft.com/fwlink/?LinkId=853010"
},
{
"text": "%edge-eula%",
"url": "https://go.microsoft.com/fwlink/?linkid=2128283"
}
],
"when": "true"
}
]
}
]
},

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -71,7 +71,10 @@
"description": "%resource-type-sql-image-description%",
"platforms": "*",
"icon": "./images/sql_server_container.svg",
"tags": ["On-premises", "SQL Server"],
"tags": [
"On-premises",
"SQL Server"
],
"options": [
{
"name": "version",
@@ -200,7 +203,11 @@
"description": "%resource-type-sql-bdc-description%",
"platforms": "*",
"icon": "./images/sql_bdc.svg",
"tags": ["On-premises", "SQL Server", "Cloud"],
"tags": [
"On-premises",
"SQL Server",
"Cloud"
],
"options": [
{
"name": "version",
@@ -329,23 +336,26 @@
"when": "target=existing-openshift&&version=bdc2019"
}
],
"agreement": {
"template": "%bdc-agreement%",
"links": [
{
"text": "%microsoft-privacy-statement%",
"url": "https://go.microsoft.com/fwlink/?LinkId=853010"
},
{
"text": "%bdc-agreement-bdc-eula%",
"url": "https://go.microsoft.com/fwlink/?LinkId=2002534"
},
{
"text": "%bdc-agreement-azdata-eula%",
"url": "https://aka.ms/eula-azdata-en"
}
]
}
"agreements": [
{
"template": "%bdc-agreement%",
"links": [
{
"text": "%microsoft-privacy-statement%",
"url": "https://go.microsoft.com/fwlink/?LinkId=853010"
},
{
"text": "%bdc-agreement-bdc-eula%",
"url": "https://go.microsoft.com/fwlink/?LinkId=2002534"
},
{
"text": "%bdc-agreement-azdata-eula%",
"url": "https://aka.ms/eula-azdata-en"
}
],
"when": "true"
}
]
},
{
"name": "sql-windows-setup",
@@ -359,7 +369,10 @@
"light": "./images/sql_server_on_windows.svg",
"dark": "./images/sql_server_on_windows_inverse.svg"
},
"tags": ["On-premises", "SQL Server"],
"tags": [
"On-premises",
"SQL Server"
],
"options": [
{
"name": "version",
@@ -391,11 +404,15 @@
},
{
"name": "sql-azure-setup",
"displayIndex": 4,
"displayName": "%azure-sqldb-display-name%",
"description": "%azure-sqldb-description%",
"platforms": "*",
"icon": "./images/azure-sql-db.svg",
"tags": ["SQL Server", "Cloud"],
"tags": [
"SQL Server",
"Cloud"
],
"okButtonText": [
{
"value": "%azure-sqldb-notebook-ok-button-text%",
@@ -432,7 +449,7 @@
],
"providers": [
{
"azureSQLDBWizard":{
"azureSQLDBWizard": {
"notebook": "./notebooks/azuredb/create-sqldb.ipynb"
},
"requiredTools": [
@@ -453,31 +470,38 @@
"when": "resource-type=database-server"
}
],
"agreement": {
"template": "%azure-sqldb-agreement%",
"links": [
{
"text": "%microsoft-privacy-statement%",
"url": "https://go.microsoft.com/fwlink/?LinkId=853010"
},
{
"text": "%azure-sqldb-agreement-sqldb-eula%",
"url": "https://azure.microsoft.com/support/legal/"
},
{
"text": "%azure-sqldb-agreement-azdata-eula%",
"url": "https://aka.ms/eula-azdata-en"
}
]
}
"agreements": [
{
"template": "%azure-sqldb-agreement%",
"links": [
{
"text": "%microsoft-privacy-statement%",
"url": "https://go.microsoft.com/fwlink/?LinkId=853010"
},
{
"text": "%azure-sqldb-agreement-sqldb-eula%",
"url": "https://azure.microsoft.com/support/legal/"
},
{
"text": "%azure-sqldb-agreement-azdata-eula%",
"url": "https://aka.ms/eula-azdata-en"
}
],
"when": "true"
}
]
},
{
"name": "azure-sql-vm",
"displayIndex": 5,
"displayName": "%azure-sqlvm-display-name%",
"description": "%azure-sqlvm-description%",
"platforms": "*",
"icon": "./images/azure-sql-vm.svg",
"tags": ["SQL Server", "Cloud"],
"tags": [
"SQL Server",
"Cloud"
],
"providers": [
{
"azureSQLVMWizard": {
@@ -491,23 +515,79 @@
"when": true
}
],
"agreement": {
"template": "%azure-sqlvm-agreement%",
"links": [
{
"text": "%microsoft-privacy-statement%",
"url": "https://go.microsoft.com/fwlink/?LinkId=853010"
},
{
"text": "%azure-sqlvm-agreement-sqlvm-eula%",
"url": "https://azure.microsoft.com/support/legal/"
},
{
"text": "%azure-sqlvm-agreement-azdata-eula%",
"url": "https://aka.ms/eula-azdata-en"
}
]
}
"agreements": [
{
"template": "%azure-sqlvm-agreement%",
"links": [
{
"text": "%microsoft-privacy-statement%",
"url": "https://go.microsoft.com/fwlink/?LinkId=853010"
},
{
"text": "%azure-sqlvm-agreement-sqlvm-eula%",
"url": "https://azure.microsoft.com/support/legal/"
},
{
"text": "%azure-sqlvm-agreement-azdata-eula%",
"url": "https://aka.ms/eula-azdata-en"
}
],
"when": "true"
}
]
},
{
"name": "azure-sql-mi",
"displayIndex": 6,
"displayName": "%azure-sql-mi-display-name%",
"description": "%azure-sql-mi-display-description%",
"platforms": "*",
"icon": "./images/managed-instance.svg",
"tags": [
"SQL Server",
"Cloud"
],
"providers": [
{
"webPageUrl": "https://portal.azure.com/#create/Microsoft.SQLManagedInstance",
"requiredTools": [],
"when": "mi-type=azure-sql-mi"
}
],
"okButtonText": [
{
"value": "%azure-sql-mi-okButton-text%",
"when": "mi-type=azure-sql-mi"
}
],
"options": [
{
"name": "mi-type",
"displayName": "%azure-sql-mi-resource-type-option-label%",
"values": [
{
"name": "azure-sql-mi",
"displayName": "%azure-sql-mi-display-name%"
}
]
}
],
"agreements": [
{
"template": "%azure-sql-mi-agreement%",
"links": [
{
"text": "%microsoft-privacy-statement%",
"url": "https://go.microsoft.com/fwlink/?LinkId=853010"
},
{
"text": "%azure-sql-mi-agreement-eula%",
"url": "https://azure.microsoft.com/support/legal/"
}
],
"when": "mi-type=azure-sql-mi"
}
]
}
]
},

View File

@@ -54,7 +54,7 @@
"azure-sqlvm-agreement": "I accept {0}, {1} and {2}.",
"azure-sqlvm-agreement-sqlvm-eula": "Azure SQL VM License Terms",
"azure-sqlvm-agreement-azdata-eula": "azdata License Terms",
"azure-sqlvm-azure-account-page-label":"Azure information",
"azure-sqlvm-azure-account-page-label": "Azure information",
"azure-sqlvm-azure-location-label": "Azure locations",
"azure-sqlvm-vm-information-page-label": "VM information",
"azure-sqlvm-image-label": "Image",
@@ -80,5 +80,11 @@
"sql-azure-database-server-display-name": "Database Server",
"azure-sqldb-agreement": "I accept {0}, {1} and {2}.",
"azure-sqldb-agreement-sqldb-eula": "Azure SQL DB License Terms",
"azure-sqldb-agreement-azdata-eula": "azdata License Terms"
"azure-sqldb-agreement-azdata-eula": "azdata License Terms",
"azure-sql-mi-display-name": "Azure SQL managed instance",
"azure-sql-mi-display-description": "Create a SQL Managed Instance. Best for most migrations to the cloud.",
"azure-sql-mi-okButton-text": "Open in Portal",
"azure-sql-mi-resource-type-option-label": "Resource Type",
"azure-sql-mi-agreement": "I accept {0} and {1}.",
"azure-sql-mi-agreement-eula": "Azure SQL MI License Terms"
}

View File

@@ -18,17 +18,35 @@ export interface ResourceType {
icon: { light: string; dark: string } | string;
options: ResourceTypeOption[];
providers: DeploymentProvider[];
agreement?: AgreementInfo;
agreements?: AgreementInfo[];
displayIndex?: number;
okButtonText?: OkButtonTextValue[];
getOkButtonText(selectedOptions: { option: string, value: string }[]): string | undefined;
getProvider(selectedOptions: { option: string, value: string }[]): DeploymentProvider | undefined;
getAgreementInfo(selectedOptions: { option: string, value: string }[]): AgreementInfo | undefined;
getHelpText(selectedOption: { option: string, value: string }[]): string | undefined;
tags?: string[];
}
export interface ResourceSubType {
/**
* The name should match the name in Resource Type
*/
name: string;
/**
* The option name should have a matching name in ResourceType.options
*/
options: ResourceTypeOption[];
tags?: string[];
provider: DeploymentProvider;
okButtonText?: OkButtonTextValue;
agreement?: AgreementInfo;
}
export interface AgreementInfo {
template: string;
links: azdata.LinkArea[];
when: string;
}
export interface ResourceTypeOption {

View File

@@ -9,7 +9,7 @@ import * as os from 'os';
import * as path from 'path';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { DeploymentProvider, instanceOfAzureSQLVMDeploymentProvider, instanceOfAzureSQLDBDeploymentProvider, instanceOfCommandDeploymentProvider, instanceOfDialogDeploymentProvider, instanceOfDownloadDeploymentProvider, instanceOfNotebookBasedDialogInfo, instanceOfNotebookDeploymentProvider, instanceOfNotebookWizardDeploymentProvider, instanceOfWebPageDeploymentProvider, instanceOfWizardDeploymentProvider, NotebookInfo, NotebookPathInfo, ResourceType, ResourceTypeOption } from '../interfaces';
import { DeploymentProvider, instanceOfAzureSQLVMDeploymentProvider, instanceOfAzureSQLDBDeploymentProvider, instanceOfCommandDeploymentProvider, instanceOfDialogDeploymentProvider, instanceOfDownloadDeploymentProvider, instanceOfNotebookBasedDialogInfo, instanceOfNotebookDeploymentProvider, instanceOfNotebookWizardDeploymentProvider, instanceOfWebPageDeploymentProvider, instanceOfWizardDeploymentProvider, NotebookInfo, NotebookPathInfo, ResourceType, ResourceTypeOption, ResourceSubType, AgreementInfo } from '../interfaces';
import { AzdataService } from './azdataService';
import { KubeService } from './kubeService';
import { INotebookService } from './notebookService';
@@ -39,19 +39,20 @@ export class ResourceTypeService implements IResourceTypeService {
getResourceTypes(filterByPlatform: boolean = true): ResourceType[] {
if (this._resourceTypes.length === 0) {
vscode.extensions.all.forEach((extension) => {
const extensionResourceTypes = extension.packageJSON.contributes && extension.packageJSON.contributes.resourceDeploymentTypes as ResourceType[];
if (extensionResourceTypes) {
extensionResourceTypes.forEach((extensionResourceType: ResourceType) => {
// Clone the object - we modify it by adding complex types and so if we modify the original contribution then
// we can break VS Code functionality since it will sometimes pass this object over the RPC layer which requires
// stringifying it - which can break with some of the complex types we add.
const resourceType = deepClone(extensionResourceType);
this.updatePathProperties(resourceType, extension.extensionPath);
resourceType.getProvider = (selectedOptions) => { return this.getProvider(resourceType, selectedOptions); };
resourceType.getOkButtonText = (selectedOptions) => { return this.getOkButtonText(resourceType, selectedOptions); };
this._resourceTypes.push(resourceType);
});
}
const extensionResourceTypes = extension.packageJSON.contributes?.resourceDeploymentTypes as ResourceType[];
extensionResourceTypes?.forEach((extensionResourceType: ResourceType) => {
// Clone the object - we modify it by adding complex types and so if we modify the original contribution then
// we can break VS Code functionality since it will sometimes pass this object over the RPC layer which requires
// stringifying it - which can break with some of the complex types we add.
const resourceType = deepClone(extensionResourceType);
this.updatePathProperties(resourceType, extension.extensionPath);
resourceType.getProvider = (selectedOptions) => { return this.getProvider(resourceType, selectedOptions); };
resourceType.getOkButtonText = (selectedOptions) => { return this.getOkButtonText(resourceType, selectedOptions); };
resourceType.getAgreementInfo = (selectedOptions) => { return this.getAgreementInfo(resourceType, selectedOptions); };
this.getResourceSubTypes(filterByPlatform, resourceType);
this._resourceTypes.push(resourceType);
});
});
}
@@ -71,26 +72,30 @@ export class ResourceTypeService implements IResourceTypeService {
resourceType.icon.light = path.join(extensionPath, resourceType.icon.light);
}
resourceType.providers.forEach((provider) => {
if (instanceOfNotebookDeploymentProvider(provider)) {
this.updateNotebookPath(provider, extensionPath);
} else if (instanceOfDialogDeploymentProvider(provider) && instanceOfNotebookBasedDialogInfo(provider.dialog)) {
this.updateNotebookPath(provider.dialog, extensionPath);
}
else if ('bdcWizard' in provider) {
this.updateNotebookPath(provider.bdcWizard, extensionPath);
}
else if ('notebookWizard' in provider) {
this.updateNotebookPath(provider.notebookWizard, extensionPath);
}
else if ('azureSQLVMWizard' in provider) {
this.updateNotebookPath(provider.azureSQLVMWizard, extensionPath);
}
else if ('azureSQLDBWizard' in provider) {
this.updateNotebookPath(provider.azureSQLDBWizard, extensionPath);
}
this.updateProviderPathProperties(provider, extensionPath);
});
}
private updateProviderPathProperties(provider: DeploymentProvider, extensionPath: string): void {
if (instanceOfNotebookDeploymentProvider(provider)) {
this.updateNotebookPath(provider, extensionPath);
} else if (instanceOfDialogDeploymentProvider(provider) && instanceOfNotebookBasedDialogInfo(provider.dialog)) {
this.updateNotebookPath(provider.dialog, extensionPath);
}
else if ('bdcWizard' in provider) {
this.updateNotebookPath(provider.bdcWizard, extensionPath);
}
else if ('notebookWizard' in provider) {
this.updateNotebookPath(provider.notebookWizard, extensionPath);
}
else if ('azureSQLVMWizard' in provider) {
this.updateNotebookPath(provider.azureSQLVMWizard, extensionPath);
}
else if ('azureSQLDBWizard' in provider) {
this.updateNotebookPath(provider.azureSQLDBWizard, extensionPath);
}
}
private updateNotebookPath(objWithNotebookProperty: { notebook: string | NotebookPathInfo | NotebookInfo[] } | undefined, extensionPath: string): void {
if (objWithNotebookProperty && objWithNotebookProperty.notebook) {
if (typeof objWithNotebookProperty.notebook === 'string') {
@@ -113,6 +118,40 @@ export class ResourceTypeService implements IResourceTypeService {
}
}
private getResourceSubTypes(filterByPlatform: boolean = true, resourceType: ResourceType): void {
const resourceSubTypes: ResourceSubType[] = [];
vscode.extensions.all.forEach((extension) => {
const extensionResourceSubTypes = extension.packageJSON.contributes?.resourceDeploymentSubTypes as ResourceSubType[];
extensionResourceSubTypes?.forEach((extensionResourceSubType: ResourceSubType) => {
const resourceSubType = deepClone(extensionResourceSubType);
if (resourceSubType.name === resourceType.name) {
this.updateProviderPathProperties(resourceSubType.provider, extension.extensionPath);
resourceSubTypes.push(resourceSubType);
const tagSet = new Set(resourceType.tags);
resourceSubType.tags?.forEach(tag => tagSet.add(tag));
resourceType.tags = Array.from(tagSet);
resourceType.providers.push(resourceSubType.provider);
if (resourceSubType.okButtonText) {
resourceType.okButtonText?.push(resourceSubType.okButtonText!);
}
if (resourceSubType.options) {
resourceType.options.forEach((roption) => {
resourceSubType.options.forEach((soption) => {
if (roption.name === soption.name) {
roption.values = roption.values.concat(soption.values);
}
});
});
}
if (resourceSubType.agreement) {
resourceType.agreements?.push(resourceSubType.agreement!);
}
}
});
});
}
/**
* Validate the resource types and returns validation error messages if any.
* @param resourceTypes resource types to be validated
@@ -177,6 +216,7 @@ export class ResourceTypeService implements IResourceTypeService {
if (dupePositions.length !== 0) {
errorMessages.push(`Option values with same name or display name are found at the following positions: ${i + 1}, ${dupePositions.join(',')}.${positionInfo} `);
errorMessages.push(JSON.stringify(option));
}
}
}
@@ -250,6 +290,16 @@ export class ResourceTypeService implements IResourceTypeService {
return loc.select;
}
private getAgreementInfo(resourceType: ResourceType, selectedOptions: { option: string, value: string }[]): AgreementInfo | undefined {
if (resourceType.agreements) {
for (const possibleOption of resourceType.agreements) {
if (processWhenClause(possibleOption.when, selectedOptions)) {
return possibleOption;
}
}
}
return undefined;
}
public startDeployment(resourceType: ResourceType): void {
const wizard = new ResourceTypeWizard(resourceType, new KubeService(), new AzdataService(this.platformService), this.notebookService, this.toolsService, this.platformService, this);

View File

@@ -164,7 +164,7 @@ export class ToolsAndEulaPage extends ResourceTypePage {
);
return view.initializeModel(this.form!.withLayout({ width: '100%' }).component()).then(() => {
this._agreementContainer.clearItems();
if (this._resourceType.agreement) {
if (this._resourceType.agreements) {
const agreementTitle = this.view.modelBuilder.text().withProps({
value: localize('resourceDeployment.AgreementTitle', "Accept terms of use"),
CSSStyles: {
@@ -173,7 +173,6 @@ export class ToolsAndEulaPage extends ResourceTypePage {
}
}).component();
this._agreementContainer.addItem(agreementTitle);
this._agreementContainer.addItem(this.createAgreementCheckbox(this._resourceType.agreement));
} else {
this.form.removeFormItem({
component: this._agreementContainer
@@ -227,6 +226,9 @@ export class ToolsAndEulaPage extends ResourceTypePage {
});
}
if (this._agreementContainer) {
this._agreementContainer.addItem(this.createAgreementCheckbox());
}
this.updateOkButtonText();
this.updateToolsDisplayTable();
});
@@ -235,7 +237,8 @@ export class ToolsAndEulaPage extends ResourceTypePage {
}
private createAgreementCheckbox(agreementInfo: AgreementInfo): azdata.FlexContainer {
private createAgreementCheckbox(): azdata.FlexContainer {
const agreementInfo = this._resourceType.getAgreementInfo(this.getSelectedOptions())!;
this._agreementCheckBox = this.view.modelBuilder.checkBox().withProperties<azdata.CheckBoxProperties>({
ariaLabel: this.getAgreementDisplayText(agreementInfo),
required: true
@@ -275,26 +278,24 @@ export class ToolsAndEulaPage extends ResourceTypePage {
}
private getCurrentProvider(): DeploymentProvider {
const options: { option: string, value: string }[] = [];
this._optionDropDownMap.forEach((selectBox, option) => {
let selectedValue: azdata.CategoryValue = selectBox.value as azdata.CategoryValue;
options.push({ option: option, value: selectedValue.name });
});
const options = this.getSelectedOptions();
this.resourceProvider = this._resourceType.getProvider(options)!;
return this._resourceType.getProvider(options)!;
}
private getCurrentOkText(): string {
const options: { option: string, value: string }[] = [];
return this._resourceType.getOkButtonText(this.getSelectedOptions())!;
}
private getSelectedOptions(): { option: string, value: string }[] {
const options: { option: string, value: string }[] = [];
this._optionDropDownMap.forEach((selectBox, option) => {
let selectedValue: azdata.CategoryValue = selectBox.value as azdata.CategoryValue;
options.push({ option: option, value: selectedValue.name });
});
return this._resourceType.getOkButtonText(options)!;
return options;
}
private updateOkButtonText(): void {

File diff suppressed because it is too large Load Diff