From 14cf6add73acca9f1455f2854747e8065552e48e Mon Sep 17 00:00:00 2001 From: Aasim Khan Date: Wed, 27 Jan 2021 22:06:53 -0800 Subject: [PATCH] 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 --- extensions/arc/package.json | 539 ++++---- extensions/asde-deployment/package.json | 41 +- .../images/managed-instance.svg} | 0 extensions/resource-deployment/package.json | 194 ++- .../resource-deployment/package.nls.json | 10 +- .../resource-deployment/src/interfaces.ts | 20 +- .../src/services/resourceTypeService.ts | 112 +- .../src/ui/toolsAndEulaSettingsPage.ts | 23 +- .../sample-resource-deployment/package.json | 1164 +++++++++-------- 9 files changed, 1160 insertions(+), 943 deletions(-) rename extensions/{arc/images/miaa.svg => resource-deployment/images/managed-instance.svg} (100%) diff --git a/extensions/arc/package.json b/extensions/arc/package.json index 72e42f3cd0..3873dbb027 100644 --- a/extensions/arc/package.json +++ b/extensions/arc/package.json @@ -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" } } ] diff --git a/extensions/asde-deployment/package.json b/extensions/asde-deployment/package.json index 1e82fd52e1..a8b321df61 100644 --- a/extensions/asde-deployment/package.json +++ b/extensions/asde-deployment/package.json @@ -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" + } + ] } ] }, diff --git a/extensions/arc/images/miaa.svg b/extensions/resource-deployment/images/managed-instance.svg similarity index 100% rename from extensions/arc/images/miaa.svg rename to extensions/resource-deployment/images/managed-instance.svg diff --git a/extensions/resource-deployment/package.json b/extensions/resource-deployment/package.json index a43bb86145..f05501a354 100644 --- a/extensions/resource-deployment/package.json +++ b/extensions/resource-deployment/package.json @@ -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" + } + ] } ] }, diff --git a/extensions/resource-deployment/package.nls.json b/extensions/resource-deployment/package.nls.json index aa69fe5fdb..2ea7498698 100644 --- a/extensions/resource-deployment/package.nls.json +++ b/extensions/resource-deployment/package.nls.json @@ -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" } diff --git a/extensions/resource-deployment/src/interfaces.ts b/extensions/resource-deployment/src/interfaces.ts index c68c02bceb..0efca4018c 100644 --- a/extensions/resource-deployment/src/interfaces.ts +++ b/extensions/resource-deployment/src/interfaces.ts @@ -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 { diff --git a/extensions/resource-deployment/src/services/resourceTypeService.ts b/extensions/resource-deployment/src/services/resourceTypeService.ts index 4e7b32bc34..c0d5405074 100644 --- a/extensions/resource-deployment/src/services/resourceTypeService.ts +++ b/extensions/resource-deployment/src/services/resourceTypeService.ts @@ -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); diff --git a/extensions/resource-deployment/src/ui/toolsAndEulaSettingsPage.ts b/extensions/resource-deployment/src/ui/toolsAndEulaSettingsPage.ts index 20d038db92..872c6626ee 100644 --- a/extensions/resource-deployment/src/ui/toolsAndEulaSettingsPage.ts +++ b/extensions/resource-deployment/src/ui/toolsAndEulaSettingsPage.ts @@ -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({ 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 { diff --git a/samples/sample-resource-deployment/package.json b/samples/sample-resource-deployment/package.json index dc4e3464b1..55c570c865 100644 --- a/samples/sample-resource-deployment/package.json +++ b/samples/sample-resource-deployment/package.json @@ -1,576 +1,592 @@ { - "name": "sample-resource-deployment", - "displayName": "%extension-displayName%", - "description": "%extension-description%", - "version": "0.0.1", - "publisher": "Contoso", - "preview": true, - "license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt", - "icon": "images/sqlserver.png", - "aiKey": "AIF-37eefaf0-8022-4671-a3fb-64752724682e", - "engines": { - "vscode": "*", - "azdata": ">=1.19.0" - }, - "repository": { - "type": "git", - "url": "https://github.com/Microsoft/azuredatastudio.git" - }, - "extensionDependencies": [ - "microsoft.mssql", - "microsoft.notebook", - "microsoft.resource-deployment" - ], - "contributes": { - "resourceDeploymentTypes": [ - { - "name": "validations-wizard", - "displayName": "%validation.wizard.display.name%", - "description": "%validation.wizard.description%", - "platforms": "*", - "icon": { - "light": "./images/book.svg", - "dark": "./images/book_inverse.svg" - }, - "providers": [ - { - "notebookWizard": { - "notebook": "%deployment-notebook-1%", - "runNotebook": false, - "codeCellInsertionPosition": 1, - "actionText": "%deploy.wizard.action%", - "title": "%wizard.new.wizard.title%", - "name": "wizard.new.wizard", - "labelPosition": "left", - "generateSummaryPage": false, - "pages": [ - { - "title": "%wizard.select.cluster.title%", - "sections": [ - { - "fields": [ - { - "label": "%cores-limit.label%", - "description": "%cores-limit.description%", - "variableName": "AZDATA_NB_VAR_CORES_LIMIT", - "type": "number", - "defaultValue": 5, - "required": false, - "validations": [ - { - "type": "is_integer", - "description": "%cores.limit.should.be.integer%" - }, - { - "type": ">=", - "target": "AZDATA_NB_VAR_CORES_REQUEST", - "description": "%cores.limit.greater.than.or.equal.to.requested.cores%" - } - ] - }, - { - "label": "%cores-request.label%", - "description": "%cores-request.description%", - "variableName": "AZDATA_NB_VAR_CORES_REQUEST", - "type": "number", - "defaultValue": 2, - "required": false, - "validations": [ - { - "type": "is_integer", - "description": "%requested.cores.should.be.integer%" - }, - { - "type": "<=", - "target": "AZDATA_NB_VAR_CORES_LIMIT", - "description": "%requested.cores.less.than.or.equal.to.cores.limit%" - } - ] - } - ] - } - ] - } - ] - }, - "requiredTools": [ - { - "name": "kubectl" - } - ], - "when": true - } - ], - "agreement": { - "template": "%wizard.data.controller.agreement%", - "links": [ - { - "text": "%contoso.agreement.privacy.statement%", - "url": "https://go.contoso.com/fwlink/?LinkId=853010" - }, - { - "text": "%wizard.agreement.contosoCmd.eula%", - "url": "https://aka.ms/eula-contosoCmd-en" - } - ] - } - }, - { - "name": "test-wizard", - "displayName": "%resource.type.wizard.display.name%", - "description": "%resource.type.wizard.description%", - "platforms": "*", - "icon": { - "light": "./images/book.svg", - "dark": "./images/book_inverse.svg" - }, - "providers": [ - { - "notebookWizard": { - "notebook": "%deployment-notebook-1%", - "type": "new-arc-control-plane", - "runNotebook": false, - "codeCellInsertionPosition": 1, - "actionText": "%deploy.wizard.action%", - "title": "%wizard.new.wizard.title%", - "name": "wizard.new.wizard", - "labelPosition": "left", - "generateSummaryPage": false, - "pages": [ - { - "title": "%wizard.select.cluster.title%", - "sections": [ - { - "fields": [ - { - "type": "kube_cluster_context_picker", - "label": "%wizard.kube.cluster.context%", - "required": true, - "inputWidth": "350px", - "variableName": "AZDATA_NB_VAR_CLUSTER_CONTEXT", - "configFileVariableName": "AZDATA_NB_VAR_CONFIG_FILE" - } - ] - } - ] - }, - { - "title": "%wizard.cluster.config.profile.title%", - "sections": [ - { - "fields": [ - { - "type": "readonly_text", - "label": "%wizard.project.details.description%", - "labelWidth": "600px" - }, - { - "type": "options", - "label": "%wizard.cluster.config.profile%", - "required": true, - "variableName": "AZDATA_NB_VAR_PROFILE", - "editable": false, - "options": { - "values":[ - "aks-dev-test", - "aks-dev-test-ha", - "aks-dev-test", - "aks-private-preview", - "kubeadm-dev-test", - "kubeadm-private-preview" - ], - "defaultValue": "aks-dev-test", - "optionsType": "radio" - } - }, - { - "type": "options", - "label": "%wizard.data.controllers%", - "required": true, - "variableName": "AZDATA_NB_VAR_CONTROLLER", - "editable": false, - "options": { - "source": { - "type": "ArcControllersOptionsSource", - "variableNames": { - "endpoint": "AZDATA_NB_VAR_CONTROLLER_ENDPOINT", - "username": "AZDATA_NB_VAR_CONTROLLER_USERNAME", - "password": "AZDATA_NB_VAR_CONTROLLER_PASSWORD" - } - }, - "values":[ - "ignored1", - "ignored2" - ], - "optionsType": "dropdown" - } - }, - { - "label": "%wizard.dropdown.options.field%", - "variableName": "AZDATA_NB_VAR_DROPDOWN_OPTIONS", - "type": "options", - "options": { - "values": ["1","2","3"], - "defaultValue": "2", - "optionsType": "dropdown" - } - } - ] - } - ] - }, - { - "title": "%wizard.data.controller.create.summary.title%", - "isSummaryPage": true, - "fieldHeight": "16px", - "sections": [ - { - "title": "", - "collapsible": false, - "fieldWidth": "200px", - "fieldHeight": "12px", - "spaceBetweenFields": 0, - "rows": [ - { - "items": [ - { - "items": [ - { - "label": "%wizard.summary.data.controller%", - "type": "readonly_text", - "enabled": true, - "labelWidth": "185px" - } - ] - }, - { - "items": [ - { - "label": "%wizard.summary.estimated.cost.per.month%", - "type": "readonly_text", - "enabled": true, - "labelWidth": "190px", - "labelCSSStyles": { - "fontWeight": "Bold" - } - - } - ] - } - ] - }, - { - "items": [ - { - "items": [ - { - "label": "%wizard.summary.by.contoso%", - "type": "readonly_text", - "labelWidth": "185px" - } - ] - }, - { - "items": [ - { - "label": "%wizard.summary.free%", - "type": "readonly_text", - "enabled": true, - "defaultValue": "", - "labelWidth": "100px" - } - ] - } - ] - }, - { - "items": [ - { - "items": [ - { - "label": "{0}", - "type": "readonly_text", - "enabled": true, - "labelCSSStyles": { "color": "#0078D4" }, - "labelWidth": "67px", - "links": [ - { - "text": "%wizard.summary.terms.of.use%", - "url": "https://aka.ms/eula-azdata-en" - } - ] - }, - { - "label": "|", - "type": "readonly_text", - "enabled": true, - "defaultValue": "", - "labelWidth": "4px", - "fieldWidth": "6px" - }, - { - "label": "{0}", - "type": "readonly_text", - "enabled": true, - "labelCSSStyles": { "color": "#0078D4" }, - "labelWidth": "102px", - "links": [ - { - "text": "%wizard.summary.terms.privacy.policy%", - "url": "https://go.contoso.com/fwlink/?LinkId=853010" - } - ] - } - ] - } - ] - } - ] - }, - { - "title": "%wizard.summary.terms%", - "fieldHeight": "88px", - "fields":[ - { - "label": "%wizard.summary.terms.description%", - "type": "readonly_text", - "enabled": true, - "labelWidth": "750px" - } - ] - }, - { - "title": "%wizard.summary.kubernetes%", - "fields":[ - { - "label": "%wizard.summary.kube.config.file.path%", - "type": "readonly_text", - "isEvaluated": true, - "defaultValue": "$(AZDATA_NB_VAR_CONFIG_FILE)" - }, - { - "label": "%wizard.summary.cluster.context%", - "type": "readonly_text", - "isEvaluated": true, - "defaultValue": "$(AZDATA_NB_VAR_CLUSTER_CONTEXT)" - }, - { - "label": "%wizard.summary.profile%", - "type": "readonly_text", - "isEvaluated": true, - "defaultValue": "$(AZDATA_NB_VAR_PROFILE)" - }, - { - "label": "%wizard.dropdown.options.field%", - "type": "readonly_text", - "isEvaluated": true, - "defaultValue": "$(AZDATA_NB_VAR_DROPDOWN_OPTIONS)" - }, - { - "label": "%wizard.summary.controller%", - "type": "readonly_text", - "isEvaluated": true, - "defaultValue": "$(AZDATA_NB_VAR_CONTROLLER)" - }, - { - "label": "%wizard.summary.controller.endpoint%", - "type": "readonly_text", - "isEvaluated": true, - "defaultValue": "$(AZDATA_NB_VAR_CONTROLLER_ENDPOINT)" - }, - { - "label": "%wizard.summary.controller.username%", - "type": "readonly_text", - "isEvaluated": true, - "defaultValue": "$(AZDATA_NB_VAR_CONTROLLER_USERNAME)" - }, - { - "label": "%wizard.summary.controller.password%", - "type": "readonly_text", - "isEvaluated": true, - "defaultValue": "$(AZDATA_NB_VAR_CONTROLLER_PASSWORD)" - } - ] - } - ] - } - ] - }, - "requiredTools": [ - { - "name": "kubectl" - } - ], - "when": true - } - ], - "agreement": { - "template": "%wizard.data.controller.agreement%", - "links": [ - { - "text": "%contoso.agreement.privacy.statement%", - "url": "https://go.contoso.com/fwlink/?LinkId=853010" - }, - { - "text": "%wizard.agreement.contosoCmd.eula%", - "url": "https://aka.ms/eula-contosoCmd-en" - } - ] - } - }, - { - "name": "x-data-service", - "displayName": "%resource-type-display-name%", - "description": "%resource-type-description%", - "platforms": [ - "darwin", - "win32", - "linux" - ], - "icon": { - "light": "./images/book.svg", - "dark": "./images/book_inverse.svg" - }, - "options": [ - { - "name": "edition", - "displayName": "%option-display-name%", - "values": [ - { - "name": "evaluation", - "displayName": "%option-value-name-1%" - }, - { - "name": "standard", - "displayName": "%option-value-name-2%" - } - ] - } - ], - "providers": [ - { - "dialog": { - "notebook": "%deployment-notebook-1%", - "title": "%dialog-title-1%", - "name": "dialog1", - "tabs": [ - { - "title": "", - "sections": [ - { - "title": "", - "fields": [ - { - "label": "%text-field%", - "variableName": "AZDATA_NB_VAR_TEXT", - "type": "text", - "defaultValue": "abc", - "required": true - }, - { - "label": "%password-field%", - "variableName": "AZDATA_NB_VAR_PASSWORD", - "type": "password", - "confirmationRequired": true, - "confirmationLabel": "%confirm-password%", - "defaultValue": "", - "required": true - }, - { - "type": "kube_cluster_context_picker", - "label": "%kube.cluster.context%", - "required": true, - "inputWidth": "350px", - "variableName": "AZDATA_NB_VAR_CLUSTER_CONTEXT", - "configFileVariableName": "AZDATA_NB_VAR_CONFIG_FILE" - }, - { - "label": "%number-field%", - "variableName": "AZDATA_NB_VAR_NUMBER", - "type": "number", - "defaultValue": "100", - "required": true, - "min": 1, - "max": 65535 - } - ] - } - ] - } - ] - }, - "requiredTools": [ - { - "name": "kubectl" - } - ], - "when": "edition=evaluation" - }, - { - "dialog": { - "notebook": "%deployment-notebook-2%", - "title": "%dialog-title-2%", - "name": "dialog2", - "tabs": [ - { - "title": "", - "sections": [ - { - "title": "", - "fields": [ - { - "label": "%text-field%", - "variableName": "AZDATA_NB_VAR_TEXT", - "type": "text", - "defaultValue": "abc", - "required": true - }, - { - "label": "%password-field%", - "variableName": "AZDATA_NB_VAR_PASSWORD", - "type": "password", - "confirmationRequired": true, - "confirmationLabel": "%confirm-password%", - "defaultValue": "", - "required": true - }, - { - "label": "%number-field%", - "variableName": "AZDATA_NB_VAR_NUMBER", - "type": "number", - "defaultValue": "100", - "required": true, - "min": 1, - "max": 65535 - } - ] - } - ] - } - ] - }, - "requiredTools": [ - { - "name": "docker" - } - ], - "when": "edition=standard" - } - ], - "agreement": { - "template": "%agreement%", - "links": [ - { - "text": "%agreement-1-name%", - "url": "https://www.contoso.com" - }, - { - "text": "%agreement-2-name%", - "url": "https://portal.azure.com" - } - ] - } - } - ] - } + "name": "sample-resource-deployment", + "displayName": "%extension-displayName%", + "description": "%extension-description%", + "version": "0.0.1", + "publisher": "Contoso", + "preview": true, + "license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt", + "icon": "images/sqlserver.png", + "aiKey": "AIF-37eefaf0-8022-4671-a3fb-64752724682e", + "engines": { + "vscode": "*", + "azdata": ">=1.19.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/Microsoft/azuredatastudio.git" + }, + "extensionDependencies": [ + "microsoft.mssql", + "microsoft.notebook", + "microsoft.resource-deployment" + ], + "contributes": { + "resourceDeploymentTypes": [ + { + "name": "validations-wizard", + "displayName": "%validation.wizard.display.name%", + "description": "%validation.wizard.description%", + "platforms": "*", + "icon": { + "light": "./images/book.svg", + "dark": "./images/book_inverse.svg" + }, + "providers": [ + { + "notebookWizard": { + "notebook": "%deployment-notebook-1%", + "runNotebook": false, + "codeCellInsertionPosition": 1, + "actionText": "%deploy.wizard.action%", + "title": "%wizard.new.wizard.title%", + "name": "wizard.new.wizard", + "labelPosition": "left", + "generateSummaryPage": false, + "pages": [ + { + "title": "%wizard.select.cluster.title%", + "sections": [ + { + "fields": [ + { + "label": "%cores-limit.label%", + "description": "%cores-limit.description%", + "variableName": "AZDATA_NB_VAR_CORES_LIMIT", + "type": "number", + "defaultValue": 5, + "required": false, + "validations": [ + { + "type": "is_integer", + "description": "%cores.limit.should.be.integer%" + }, + { + "type": ">=", + "target": "AZDATA_NB_VAR_CORES_REQUEST", + "description": "%cores.limit.greater.than.or.equal.to.requested.cores%" + } + ] + }, + { + "label": "%cores-request.label%", + "description": "%cores-request.description%", + "variableName": "AZDATA_NB_VAR_CORES_REQUEST", + "type": "number", + "defaultValue": 2, + "required": false, + "validations": [ + { + "type": "is_integer", + "description": "%requested.cores.should.be.integer%" + }, + { + "type": "<=", + "target": "AZDATA_NB_VAR_CORES_LIMIT", + "description": "%requested.cores.less.than.or.equal.to.cores.limit%" + } + ] + } + ] + } + ] + } + ] + }, + "requiredTools": [ + { + "name": "kubectl" + } + ], + "when": true + } + ], + "agreements": [ + { + "template": "%wizard.data.controller.agreement%", + "links": [ + { + "text": "%contoso.agreement.privacy.statement%", + "url": "https://go.contoso.com/fwlink/?LinkId=853010" + }, + { + "text": "%wizard.agreement.contosoCmd.eula%", + "url": "https://aka.ms/eula-contosoCmd-en" + } + ], + "when": true + } + ] + }, + { + "name": "test-wizard", + "displayName": "%resource.type.wizard.display.name%", + "description": "%resource.type.wizard.description%", + "platforms": "*", + "icon": { + "light": "./images/book.svg", + "dark": "./images/book_inverse.svg" + }, + "providers": [ + { + "notebookWizard": { + "notebook": "%deployment-notebook-1%", + "type": "new-arc-control-plane", + "runNotebook": false, + "codeCellInsertionPosition": 1, + "actionText": "%deploy.wizard.action%", + "title": "%wizard.new.wizard.title%", + "name": "wizard.new.wizard", + "labelPosition": "left", + "generateSummaryPage": false, + "pages": [ + { + "title": "%wizard.select.cluster.title%", + "sections": [ + { + "fields": [ + { + "type": "kube_cluster_context_picker", + "label": "%wizard.kube.cluster.context%", + "required": true, + "inputWidth": "350px", + "variableName": "AZDATA_NB_VAR_CLUSTER_CONTEXT", + "configFileVariableName": "AZDATA_NB_VAR_CONFIG_FILE" + } + ] + } + ] + }, + { + "title": "%wizard.cluster.config.profile.title%", + "sections": [ + { + "fields": [ + { + "type": "readonly_text", + "label": "%wizard.project.details.description%", + "labelWidth": "600px" + }, + { + "type": "options", + "label": "%wizard.cluster.config.profile%", + "required": true, + "variableName": "AZDATA_NB_VAR_PROFILE", + "editable": false, + "options": { + "values": [ + "aks-dev-test", + "aks-dev-test-ha", + "aks-dev-test", + "aks-private-preview", + "kubeadm-dev-test", + "kubeadm-private-preview" + ], + "defaultValue": "aks-dev-test", + "optionsType": "radio" + } + }, + { + "type": "options", + "label": "%wizard.data.controllers%", + "required": true, + "variableName": "AZDATA_NB_VAR_CONTROLLER", + "editable": false, + "options": { + "source": { + "type": "ArcControllersOptionsSource", + "variableNames": { + "endpoint": "AZDATA_NB_VAR_CONTROLLER_ENDPOINT", + "username": "AZDATA_NB_VAR_CONTROLLER_USERNAME", + "password": "AZDATA_NB_VAR_CONTROLLER_PASSWORD" + } + }, + "values": [ + "ignored1", + "ignored2" + ], + "optionsType": "dropdown" + } + }, + { + "label": "%wizard.dropdown.options.field%", + "variableName": "AZDATA_NB_VAR_DROPDOWN_OPTIONS", + "type": "options", + "options": { + "values": [ + "1", + "2", + "3" + ], + "defaultValue": "2", + "optionsType": "dropdown" + } + } + ] + } + ] + }, + { + "title": "%wizard.data.controller.create.summary.title%", + "isSummaryPage": true, + "fieldHeight": "16px", + "sections": [ + { + "title": "", + "collapsible": false, + "fieldWidth": "200px", + "fieldHeight": "12px", + "spaceBetweenFields": 0, + "rows": [ + { + "items": [ + { + "items": [ + { + "label": "%wizard.summary.data.controller%", + "type": "readonly_text", + "enabled": true, + "labelWidth": "185px" + } + ] + }, + { + "items": [ + { + "label": "%wizard.summary.estimated.cost.per.month%", + "type": "readonly_text", + "enabled": true, + "labelWidth": "190px", + "labelCSSStyles": { + "fontWeight": "Bold" + } + } + ] + } + ] + }, + { + "items": [ + { + "items": [ + { + "label": "%wizard.summary.by.contoso%", + "type": "readonly_text", + "labelWidth": "185px" + } + ] + }, + { + "items": [ + { + "label": "%wizard.summary.free%", + "type": "readonly_text", + "enabled": true, + "defaultValue": "", + "labelWidth": "100px" + } + ] + } + ] + }, + { + "items": [ + { + "items": [ + { + "label": "{0}", + "type": "readonly_text", + "enabled": true, + "labelCSSStyles": { + "color": "#0078D4" + }, + "labelWidth": "67px", + "links": [ + { + "text": "%wizard.summary.terms.of.use%", + "url": "https://aka.ms/eula-azdata-en" + } + ] + }, + { + "label": "|", + "type": "readonly_text", + "enabled": true, + "defaultValue": "", + "labelWidth": "4px", + "fieldWidth": "6px" + }, + { + "label": "{0}", + "type": "readonly_text", + "enabled": true, + "labelCSSStyles": { + "color": "#0078D4" + }, + "labelWidth": "102px", + "links": [ + { + "text": "%wizard.summary.terms.privacy.policy%", + "url": "https://go.contoso.com/fwlink/?LinkId=853010" + } + ] + } + ] + } + ] + } + ] + }, + { + "title": "%wizard.summary.terms%", + "fieldHeight": "88px", + "fields": [ + { + "label": "%wizard.summary.terms.description%", + "type": "readonly_text", + "enabled": true, + "labelWidth": "750px" + } + ] + }, + { + "title": "%wizard.summary.kubernetes%", + "fields": [ + { + "label": "%wizard.summary.kube.config.file.path%", + "type": "readonly_text", + "isEvaluated": true, + "defaultValue": "$(AZDATA_NB_VAR_CONFIG_FILE)" + }, + { + "label": "%wizard.summary.cluster.context%", + "type": "readonly_text", + "isEvaluated": true, + "defaultValue": "$(AZDATA_NB_VAR_CLUSTER_CONTEXT)" + }, + { + "label": "%wizard.summary.profile%", + "type": "readonly_text", + "isEvaluated": true, + "defaultValue": "$(AZDATA_NB_VAR_PROFILE)" + }, + { + "label": "%wizard.dropdown.options.field%", + "type": "readonly_text", + "isEvaluated": true, + "defaultValue": "$(AZDATA_NB_VAR_DROPDOWN_OPTIONS)" + }, + { + "label": "%wizard.summary.controller%", + "type": "readonly_text", + "isEvaluated": true, + "defaultValue": "$(AZDATA_NB_VAR_CONTROLLER)" + }, + { + "label": "%wizard.summary.controller.endpoint%", + "type": "readonly_text", + "isEvaluated": true, + "defaultValue": "$(AZDATA_NB_VAR_CONTROLLER_ENDPOINT)" + }, + { + "label": "%wizard.summary.controller.username%", + "type": "readonly_text", + "isEvaluated": true, + "defaultValue": "$(AZDATA_NB_VAR_CONTROLLER_USERNAME)" + }, + { + "label": "%wizard.summary.controller.password%", + "type": "readonly_text", + "isEvaluated": true, + "defaultValue": "$(AZDATA_NB_VAR_CONTROLLER_PASSWORD)" + } + ] + } + ] + } + ] + }, + "requiredTools": [ + { + "name": "kubectl" + } + ], + "when": true + } + ], + "agreements": [ + { + "template": "%wizard.data.controller.agreement%", + "links": [ + { + "text": "%contoso.agreement.privacy.statement%", + "url": "https://go.contoso.com/fwlink/?LinkId=853010" + }, + { + "text": "%wizard.agreement.contosoCmd.eula%", + "url": "https://aka.ms/eula-contosoCmd-en" + } + ], + "when": true + } + ] + }, + { + "name": "x-data-service", + "displayName": "%resource-type-display-name%", + "description": "%resource-type-description%", + "platforms": [ + "darwin", + "win32", + "linux" + ], + "icon": { + "light": "./images/book.svg", + "dark": "./images/book_inverse.svg" + }, + "options": [ + { + "name": "edition", + "displayName": "%option-display-name%", + "values": [ + { + "name": "evaluation", + "displayName": "%option-value-name-1%" + }, + { + "name": "standard", + "displayName": "%option-value-name-2%" + } + ] + } + ], + "providers": [ + { + "dialog": { + "notebook": "%deployment-notebook-1%", + "title": "%dialog-title-1%", + "name": "dialog1", + "tabs": [ + { + "title": "", + "sections": [ + { + "title": "", + "fields": [ + { + "label": "%text-field%", + "variableName": "AZDATA_NB_VAR_TEXT", + "type": "text", + "defaultValue": "abc", + "required": true + }, + { + "label": "%password-field%", + "variableName": "AZDATA_NB_VAR_PASSWORD", + "type": "password", + "confirmationRequired": true, + "confirmationLabel": "%confirm-password%", + "defaultValue": "", + "required": true + }, + { + "type": "kube_cluster_context_picker", + "label": "%kube.cluster.context%", + "required": true, + "inputWidth": "350px", + "variableName": "AZDATA_NB_VAR_CLUSTER_CONTEXT", + "configFileVariableName": "AZDATA_NB_VAR_CONFIG_FILE" + }, + { + "label": "%number-field%", + "variableName": "AZDATA_NB_VAR_NUMBER", + "type": "number", + "defaultValue": "100", + "required": true, + "min": 1, + "max": 65535 + } + ] + } + ] + } + ] + }, + "requiredTools": [ + { + "name": "kubectl" + } + ], + "when": "edition=evaluation" + }, + { + "dialog": { + "notebook": "%deployment-notebook-2%", + "title": "%dialog-title-2%", + "name": "dialog2", + "tabs": [ + { + "title": "", + "sections": [ + { + "title": "", + "fields": [ + { + "label": "%text-field%", + "variableName": "AZDATA_NB_VAR_TEXT", + "type": "text", + "defaultValue": "abc", + "required": true + }, + { + "label": "%password-field%", + "variableName": "AZDATA_NB_VAR_PASSWORD", + "type": "password", + "confirmationRequired": true, + "confirmationLabel": "%confirm-password%", + "defaultValue": "", + "required": true + }, + { + "label": "%number-field%", + "variableName": "AZDATA_NB_VAR_NUMBER", + "type": "number", + "defaultValue": "100", + "required": true, + "min": 1, + "max": 65535 + } + ] + } + ] + } + ] + }, + "requiredTools": [ + { + "name": "docker" + } + ], + "when": "edition=standard" + } + ], + "agreements": [ + { + "template": "%agreement%", + "links": [ + { + "text": "%agreement-1-name%", + "url": "https://www.contoso.com" + }, + { + "text": "%agreement-2-name%", + "url": "https://portal.azure.com" + } + ], + "when": "edition=standard" + } + ] + } + ] + } }