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", "target": "AZDATA_NB_VAR_ARC_DATA_CONTROLLER_CONNECTIVITY_MODE",
"value": "direct" "value": "direct"
}, },
"validations" : [{ "validations": [
"type": "regex_match", {
"regex": "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$", "type": "regex_match",
"description": "%arc.data.controller.spclientid.validation.description%" "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%", "label": "%arc.data.controller.spclientsecret%",
@@ -322,11 +324,13 @@
"providerId": "subscription-id-to-tenant-id", "providerId": "subscription-id-to-tenant-id",
"triggerField": "AZDATA_NB_VAR_ARC_SUBSCRIPTION" "triggerField": "AZDATA_NB_VAR_ARC_SUBSCRIPTION"
}, },
"validations" : [{ "validations": [
"type": "regex_match", {
"regex": "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$", "type": "regex_match",
"description": "%arc.data.controller.sptenantid.validation.description%" "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", "type": "text",
"label": "%arc.data.controller.namespace%", "label": "%arc.data.controller.namespace%",
"validations" : [{ "validations": [
"type": "regex_match", {
"regex": "^[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?$", "type": "regex_match",
"description": "%arc.data.controller.namespace.validation.description%" "regex": "^[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?$",
}], "description": "%arc.data.controller.namespace.validation.description%"
}
],
"defaultValue": "arc", "defaultValue": "arc",
"required": true, "required": true,
"variableName": "AZDATA_NB_VAR_ARC_DATA_CONTROLLER_NAMESPACE" "variableName": "AZDATA_NB_VAR_ARC_DATA_CONTROLLER_NAMESPACE"
@@ -358,11 +364,13 @@
{ {
"type": "text", "type": "text",
"label": "%arc.data.controller.name%", "label": "%arc.data.controller.name%",
"validations" : [{ "validations": [
"type": "regex_match", {
"regex": "^[a-z0-9]([-.a-z0-9]{0,251}[a-z0-9])?$", "type": "regex_match",
"description": "%arc.data.controller.name.validation.description%" "regex": "^[a-z0-9]([-.a-z0-9]{0,251}[a-z0-9])?$",
}], "description": "%arc.data.controller.name.validation.description%"
}
],
"defaultValue": "arc-dc", "defaultValue": "arc-dc",
"required": true, "required": true,
"variableName": "AZDATA_NB_VAR_ARC_DATA_CONTROLLER_NAME" "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", "name": "arc.postgres",
"displayName": "%resource.type.arc.postgres.display.name%", "displayName": "%resource.type.arc.postgres.display.name%",
@@ -870,11 +684,13 @@
"variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_NAME", "variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_NAME",
"type": "text", "type": "text",
"description": "%arc.postgres.server.group.name.validation.description%", "description": "%arc.postgres.server.group.name.validation.description%",
"validations" : [{ "validations": [
"type": "regex_match", {
"regex": "^[a-z]([-a-z0-9]{0,9}[a-z0-9])?$", "type": "regex_match",
"description": "%arc.postgres.server.group.name.validation.description%" "regex": "^[a-z]([-a-z0-9]{0,9}[a-z0-9])?$",
}], "description": "%arc.postgres.server.group.name.validation.description%"
}
],
"required": true "required": true
}, },
{ {
@@ -891,10 +707,12 @@
"description": "%arc.postgres.server.group.workers.description%", "description": "%arc.postgres.server.group.workers.description%",
"variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_WORKERS", "variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_WORKERS",
"type": "number", "type": "number",
"validations": [{ "validations": [
"type": "is_integer", {
"description": "%should.be.integer%" "type": "is_integer",
}], "description": "%should.be.integer%"
}
],
"defaultValue": "0", "defaultValue": "0",
"min": 0 "min": 0
}, },
@@ -902,10 +720,12 @@
"label": "%arc.postgres.server.group.port%", "label": "%arc.postgres.server.group.port%",
"variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_PORT", "variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_PORT",
"type": "number", "type": "number",
"validations": [{ "validations": [
"type": "is_integer", {
"description": "%should.be.integer%" "type": "is_integer",
}], "description": "%should.be.integer%"
}
],
"defaultValue": "5432", "defaultValue": "5432",
"min": 1, "min": 1,
"max": 65535 "max": 65535
@@ -987,11 +807,13 @@
"variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_CORES_REQUEST", "variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_CORES_REQUEST",
"type": "number", "type": "number",
"min": 1, "min": 1,
"validations": [{ "validations": [
"type": "<=", {
"target": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_CORES_LIMIT", "type": "<=",
"description": "%requested.cores.less.than.or.equal.to.cores.limit%" "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%", "label": "%arc.postgres.server.group.cores.limit.label%",
@@ -999,11 +821,13 @@
"variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_CORES_LIMIT", "variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_CORES_LIMIT",
"type": "number", "type": "number",
"min": 1, "min": 1,
"validations": [{ "validations": [
"type": ">=", {
"target": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_CORES_REQUEST", "type": ">=",
"description": "%cores.limit.greater.than.or.equal.to.requested.cores%" "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%", "label": "%arc.postgres.server.group.memory.request.label%",
@@ -1011,11 +835,13 @@
"variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_MEMORY_REQUEST", "variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_MEMORY_REQUEST",
"type": "number", "type": "number",
"min": 0.25, "min": 0.25,
"validations": [{ "validations": [
"type": "<=", {
"target": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_MEMORY_LIMIT", "type": "<=",
"description": "%requested.memory.less.than.or.equal.to.memory.limit%" "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%", "label": "%arc.postgres.server.group.memory.limit.label%",
@@ -1023,11 +849,13 @@
"variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_MEMORY_LIMIT", "variableName": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_MEMORY_LIMIT",
"type": "number", "type": "number",
"min": 0.25, "min": 0.25,
"validations": [{ "validations": [
"type": ">=", {
"target": "AZDATA_NB_VAR_POSTGRES_SERVER_GROUP_MEMORY_REQUEST", "type": ">=",
"description": "%memory.limit.greater.than.or.equal.to.requested.memory%" "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" "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": { "agreement": {
"template": "%arc.agreement%", "template": "%arc.agreement%",
"links": [ "links": [
@@ -1055,10 +1095,11 @@
"url": "https://go.microsoft.com/fwlink/?LinkId=853010" "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" "url": "https://go.microsoft.com/fwlink/?linkid=2045708"
} }
] ],
"when": "mi-type=arc-mi"
} }
} }
] ]

View File

@@ -338,11 +338,13 @@
"confirmationRequired": true, "confirmationRequired": true,
"confirmationLabel": "%vm_password_confirm%", "confirmationLabel": "%vm_password_confirm%",
"required": true, "required": true,
"validations" : [{ "validations": [
"type": "regex_match", {
"regex": "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[\\W_])[A-Za-z\\d\\W_]{12,123}$", "type": "regex_match",
"description": "%vm_password_validation_error_message%" "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" "when": "type=azure-multi-device"
} }
], ],
"agreement": { "agreements": [
"template": "%edge-agreement%", {
"links": [ "template": "%edge-agreement%",
{ "links": [
"text": "%microsoft-privacy-statement%", {
"url": "https://go.microsoft.com/fwlink/?LinkId=853010" "text": "%microsoft-privacy-statement%",
}, "url": "https://go.microsoft.com/fwlink/?LinkId=853010"
{ },
"text": "%edge-eula%", {
"url": "https://go.microsoft.com/fwlink/?linkid=2128283" "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%", "description": "%resource-type-sql-image-description%",
"platforms": "*", "platforms": "*",
"icon": "./images/sql_server_container.svg", "icon": "./images/sql_server_container.svg",
"tags": ["On-premises", "SQL Server"], "tags": [
"On-premises",
"SQL Server"
],
"options": [ "options": [
{ {
"name": "version", "name": "version",
@@ -200,7 +203,11 @@
"description": "%resource-type-sql-bdc-description%", "description": "%resource-type-sql-bdc-description%",
"platforms": "*", "platforms": "*",
"icon": "./images/sql_bdc.svg", "icon": "./images/sql_bdc.svg",
"tags": ["On-premises", "SQL Server", "Cloud"], "tags": [
"On-premises",
"SQL Server",
"Cloud"
],
"options": [ "options": [
{ {
"name": "version", "name": "version",
@@ -329,23 +336,26 @@
"when": "target=existing-openshift&&version=bdc2019" "when": "target=existing-openshift&&version=bdc2019"
} }
], ],
"agreement": { "agreements": [
"template": "%bdc-agreement%", {
"links": [ "template": "%bdc-agreement%",
{ "links": [
"text": "%microsoft-privacy-statement%", {
"url": "https://go.microsoft.com/fwlink/?LinkId=853010" "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-bdc-eula%",
}, "url": "https://go.microsoft.com/fwlink/?LinkId=2002534"
{ },
"text": "%bdc-agreement-azdata-eula%", {
"url": "https://aka.ms/eula-azdata-en" "text": "%bdc-agreement-azdata-eula%",
} "url": "https://aka.ms/eula-azdata-en"
] }
} ],
"when": "true"
}
]
}, },
{ {
"name": "sql-windows-setup", "name": "sql-windows-setup",
@@ -359,7 +369,10 @@
"light": "./images/sql_server_on_windows.svg", "light": "./images/sql_server_on_windows.svg",
"dark": "./images/sql_server_on_windows_inverse.svg" "dark": "./images/sql_server_on_windows_inverse.svg"
}, },
"tags": ["On-premises", "SQL Server"], "tags": [
"On-premises",
"SQL Server"
],
"options": [ "options": [
{ {
"name": "version", "name": "version",
@@ -391,11 +404,15 @@
}, },
{ {
"name": "sql-azure-setup", "name": "sql-azure-setup",
"displayIndex": 4,
"displayName": "%azure-sqldb-display-name%", "displayName": "%azure-sqldb-display-name%",
"description": "%azure-sqldb-description%", "description": "%azure-sqldb-description%",
"platforms": "*", "platforms": "*",
"icon": "./images/azure-sql-db.svg", "icon": "./images/azure-sql-db.svg",
"tags": ["SQL Server", "Cloud"], "tags": [
"SQL Server",
"Cloud"
],
"okButtonText": [ "okButtonText": [
{ {
"value": "%azure-sqldb-notebook-ok-button-text%", "value": "%azure-sqldb-notebook-ok-button-text%",
@@ -432,7 +449,7 @@
], ],
"providers": [ "providers": [
{ {
"azureSQLDBWizard":{ "azureSQLDBWizard": {
"notebook": "./notebooks/azuredb/create-sqldb.ipynb" "notebook": "./notebooks/azuredb/create-sqldb.ipynb"
}, },
"requiredTools": [ "requiredTools": [
@@ -453,31 +470,38 @@
"when": "resource-type=database-server" "when": "resource-type=database-server"
} }
], ],
"agreement": { "agreements": [
"template": "%azure-sqldb-agreement%", {
"links": [ "template": "%azure-sqldb-agreement%",
{ "links": [
"text": "%microsoft-privacy-statement%", {
"url": "https://go.microsoft.com/fwlink/?LinkId=853010" "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-sqldb-eula%",
}, "url": "https://azure.microsoft.com/support/legal/"
{ },
"text": "%azure-sqldb-agreement-azdata-eula%", {
"url": "https://aka.ms/eula-azdata-en" "text": "%azure-sqldb-agreement-azdata-eula%",
} "url": "https://aka.ms/eula-azdata-en"
] }
} ],
"when": "true"
}
]
}, },
{ {
"name": "azure-sql-vm", "name": "azure-sql-vm",
"displayIndex": 5,
"displayName": "%azure-sqlvm-display-name%", "displayName": "%azure-sqlvm-display-name%",
"description": "%azure-sqlvm-description%", "description": "%azure-sqlvm-description%",
"platforms": "*", "platforms": "*",
"icon": "./images/azure-sql-vm.svg", "icon": "./images/azure-sql-vm.svg",
"tags": ["SQL Server", "Cloud"], "tags": [
"SQL Server",
"Cloud"
],
"providers": [ "providers": [
{ {
"azureSQLVMWizard": { "azureSQLVMWizard": {
@@ -491,23 +515,79 @@
"when": true "when": true
} }
], ],
"agreement": { "agreements": [
"template": "%azure-sqlvm-agreement%", {
"links": [ "template": "%azure-sqlvm-agreement%",
{ "links": [
"text": "%microsoft-privacy-statement%", {
"url": "https://go.microsoft.com/fwlink/?LinkId=853010" "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-sqlvm-eula%",
}, "url": "https://azure.microsoft.com/support/legal/"
{ },
"text": "%azure-sqlvm-agreement-azdata-eula%", {
"url": "https://aka.ms/eula-azdata-en" "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": "I accept {0}, {1} and {2}.",
"azure-sqlvm-agreement-sqlvm-eula": "Azure SQL VM License Terms", "azure-sqlvm-agreement-sqlvm-eula": "Azure SQL VM License Terms",
"azure-sqlvm-agreement-azdata-eula": "azdata 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-azure-location-label": "Azure locations",
"azure-sqlvm-vm-information-page-label": "VM information", "azure-sqlvm-vm-information-page-label": "VM information",
"azure-sqlvm-image-label": "Image", "azure-sqlvm-image-label": "Image",
@@ -80,5 +80,11 @@
"sql-azure-database-server-display-name": "Database Server", "sql-azure-database-server-display-name": "Database Server",
"azure-sqldb-agreement": "I accept {0}, {1} and {2}.", "azure-sqldb-agreement": "I accept {0}, {1} and {2}.",
"azure-sqldb-agreement-sqldb-eula": "Azure SQL DB License Terms", "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; icon: { light: string; dark: string } | string;
options: ResourceTypeOption[]; options: ResourceTypeOption[];
providers: DeploymentProvider[]; providers: DeploymentProvider[];
agreement?: AgreementInfo; agreements?: AgreementInfo[];
displayIndex?: number; displayIndex?: number;
okButtonText?: OkButtonTextValue[]; okButtonText?: OkButtonTextValue[];
getOkButtonText(selectedOptions: { option: string, value: string }[]): string | undefined; getOkButtonText(selectedOptions: { option: string, value: string }[]): string | undefined;
getProvider(selectedOptions: { option: string, value: string }[]): DeploymentProvider | 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[]; 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 { export interface AgreementInfo {
template: string; template: string;
links: azdata.LinkArea[]; links: azdata.LinkArea[];
when: string;
} }
export interface ResourceTypeOption { export interface ResourceTypeOption {

View File

@@ -9,7 +9,7 @@ import * as os from 'os';
import * as path from 'path'; import * as path from 'path';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as nls from 'vscode-nls'; 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 { AzdataService } from './azdataService';
import { KubeService } from './kubeService'; import { KubeService } from './kubeService';
import { INotebookService } from './notebookService'; import { INotebookService } from './notebookService';
@@ -39,19 +39,20 @@ export class ResourceTypeService implements IResourceTypeService {
getResourceTypes(filterByPlatform: boolean = true): ResourceType[] { getResourceTypes(filterByPlatform: boolean = true): ResourceType[] {
if (this._resourceTypes.length === 0) { if (this._resourceTypes.length === 0) {
vscode.extensions.all.forEach((extension) => { vscode.extensions.all.forEach((extension) => {
const extensionResourceTypes = extension.packageJSON.contributes && extension.packageJSON.contributes.resourceDeploymentTypes as ResourceType[]; const extensionResourceTypes = extension.packageJSON.contributes?.resourceDeploymentTypes as ResourceType[];
if (extensionResourceTypes) { extensionResourceTypes?.forEach((extensionResourceType: ResourceType) => {
extensionResourceTypes.forEach((extensionResourceType: ResourceType) => { // Clone the object - we modify it by adding complex types and so if we modify the original contribution then
// 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
// 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.
// stringifying it - which can break with some of the complex types we add. const resourceType = deepClone(extensionResourceType);
const resourceType = deepClone(extensionResourceType); this.updatePathProperties(resourceType, extension.extensionPath);
this.updatePathProperties(resourceType, extension.extensionPath); resourceType.getProvider = (selectedOptions) => { return this.getProvider(resourceType, selectedOptions); };
resourceType.getProvider = (selectedOptions) => { return this.getProvider(resourceType, selectedOptions); }; resourceType.getOkButtonText = (selectedOptions) => { return this.getOkButtonText(resourceType, selectedOptions); };
resourceType.getOkButtonText = (selectedOptions) => { return this.getOkButtonText(resourceType, selectedOptions); }; resourceType.getAgreementInfo = (selectedOptions) => { return this.getAgreementInfo(resourceType, selectedOptions); };
this._resourceTypes.push(resourceType); 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.icon.light = path.join(extensionPath, resourceType.icon.light);
} }
resourceType.providers.forEach((provider) => { resourceType.providers.forEach((provider) => {
if (instanceOfNotebookDeploymentProvider(provider)) { this.updateProviderPathProperties(provider, extensionPath);
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 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 { private updateNotebookPath(objWithNotebookProperty: { notebook: string | NotebookPathInfo | NotebookInfo[] } | undefined, extensionPath: string): void {
if (objWithNotebookProperty && objWithNotebookProperty.notebook) { if (objWithNotebookProperty && objWithNotebookProperty.notebook) {
if (typeof objWithNotebookProperty.notebook === 'string') { 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. * Validate the resource types and returns validation error messages if any.
* @param resourceTypes resource types to be validated * @param resourceTypes resource types to be validated
@@ -177,6 +216,7 @@ export class ResourceTypeService implements IResourceTypeService {
if (dupePositions.length !== 0) { 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(`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; 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 { public startDeployment(resourceType: ResourceType): void {
const wizard = new ResourceTypeWizard(resourceType, new KubeService(), new AzdataService(this.platformService), this.notebookService, this.toolsService, this.platformService, this); 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(() => { return view.initializeModel(this.form!.withLayout({ width: '100%' }).component()).then(() => {
this._agreementContainer.clearItems(); this._agreementContainer.clearItems();
if (this._resourceType.agreement) { if (this._resourceType.agreements) {
const agreementTitle = this.view.modelBuilder.text().withProps({ const agreementTitle = this.view.modelBuilder.text().withProps({
value: localize('resourceDeployment.AgreementTitle', "Accept terms of use"), value: localize('resourceDeployment.AgreementTitle', "Accept terms of use"),
CSSStyles: { CSSStyles: {
@@ -173,7 +173,6 @@ export class ToolsAndEulaPage extends ResourceTypePage {
} }
}).component(); }).component();
this._agreementContainer.addItem(agreementTitle); this._agreementContainer.addItem(agreementTitle);
this._agreementContainer.addItem(this.createAgreementCheckbox(this._resourceType.agreement));
} else { } else {
this.form.removeFormItem({ this.form.removeFormItem({
component: this._agreementContainer component: this._agreementContainer
@@ -227,6 +226,9 @@ export class ToolsAndEulaPage extends ResourceTypePage {
}); });
} }
if (this._agreementContainer) {
this._agreementContainer.addItem(this.createAgreementCheckbox());
}
this.updateOkButtonText(); this.updateOkButtonText();
this.updateToolsDisplayTable(); 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>({ this._agreementCheckBox = this.view.modelBuilder.checkBox().withProperties<azdata.CheckBoxProperties>({
ariaLabel: this.getAgreementDisplayText(agreementInfo), ariaLabel: this.getAgreementDisplayText(agreementInfo),
required: true required: true
@@ -275,26 +278,24 @@ export class ToolsAndEulaPage extends ResourceTypePage {
} }
private getCurrentProvider(): DeploymentProvider { private getCurrentProvider(): DeploymentProvider {
const options: { option: string, value: string }[] = [];
this._optionDropDownMap.forEach((selectBox, option) => { const options = this.getSelectedOptions();
let selectedValue: azdata.CategoryValue = selectBox.value as azdata.CategoryValue;
options.push({ option: option, value: selectedValue.name });
});
this.resourceProvider = this._resourceType.getProvider(options)!; this.resourceProvider = this._resourceType.getProvider(options)!;
return this._resourceType.getProvider(options)!; return this._resourceType.getProvider(options)!;
} }
private getCurrentOkText(): string { 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) => { this._optionDropDownMap.forEach((selectBox, option) => {
let selectedValue: azdata.CategoryValue = selectBox.value as azdata.CategoryValue; let selectedValue: azdata.CategoryValue = selectBox.value as azdata.CategoryValue;
options.push({ option: option, value: selectedValue.name }); options.push({ option: option, value: selectedValue.name });
}); });
return options;
return this._resourceType.getOkButtonText(options)!;
} }
private updateOkButtonText(): void { private updateOkButtonText(): void {

File diff suppressed because it is too large Load Diff