diff --git a/package-lock.json b/package-lock.json index afb8b65c..3b9c22f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,8 +16,9 @@ "@azure/container-registry": "1.0.0-beta.5", "@azure/core-rest-pipeline": "1.10.3", "@azure/storage-blob": "^12.4.1", - "@microsoft/vscode-azext-azureutils": "^1.0.1", - "@microsoft/vscode-azext-utils": "^1.2.0", + "@microsoft/vscode-azext-azureutils": "^2.0.0", + "@microsoft/vscode-azext-serviceconnector": "file:../vscode-azuretools/serviceconnector/microsoft-vscode-azext-serviceconnector-0.0.1.tgz", + "@microsoft/vscode-azext-utils": "^2.0.0", "@microsoft/vscode-azureresources-api": "^2.0.2", "@octokit/rest": "^18.5.2", "buffer": "^6.0.3", @@ -206,6 +207,28 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" }, + "node_modules/@azure/arm-servicelinker": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@azure/arm-servicelinker/-/arm-servicelinker-2.1.0.tgz", + "integrity": "sha512-IENuxll0IxjnrO3B2TkZOKn3KLVD9gR09Adtzd+rk/ipe2ESTRp7Nsn5MhK89jxzb0Xd3uRy0a6uGMjI7d9E1A==", + "dependencies": { + "@azure/abort-controller": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-client": "^1.6.1", + "@azure/core-lro": "^2.2.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-rest-pipeline": "^1.8.0", + "tslib": "^2.2.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@azure/arm-servicelinker/node_modules/tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" + }, "node_modules/@azure/arm-storage": { "version": "18.1.0", "resolved": "https://registry.npmjs.org/@azure/arm-storage/-/arm-storage-18.1.0.tgz", @@ -493,14 +516,14 @@ "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" }, "node_modules/@azure/logger": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.0.3.tgz", - "integrity": "sha512-aK4s3Xxjrx3daZr3VylxejK3vG5ExXck5WOHDJ8in/k9AqlfIyFMMT1uG7u8mNjX+QRILTIn0/Xgschfh/dQ9g==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.0.4.tgz", + "integrity": "sha512-ustrPY8MryhloQj7OWGe+HrYx+aoiOxzbXTtgblbV3xwCqpzUK36phH3XNHQKj3EPonyFUuDTfR3qFhTEAuZEg==", "dependencies": { "tslib": "^2.2.0" }, "engines": { - "node": ">=12.0.0" + "node": ">=14.0.0" } }, "node_modules/@azure/logger/node_modules/tslib": { @@ -511,8 +534,7 @@ "node_modules/@azure/ms-rest-azure-env": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@azure/ms-rest-azure-env/-/ms-rest-azure-env-2.0.0.tgz", - "integrity": "sha512-dG76W7ElfLi+fbTjnZVGj+M9e0BIEJmRxU6fHaUQ12bZBe8EJKYb2GV50YWNaP2uJiVQ5+7nXEVj1VN1UQtaEw==", - "dev": true + "integrity": "sha512-dG76W7ElfLi+fbTjnZVGj+M9e0BIEJmRxU6fHaUQ12bZBe8EJKYb2GV50YWNaP2uJiVQ5+7nXEVj1VN1UQtaEw==" }, "node_modules/@azure/ms-rest-azure-js": { "version": "2.1.0", @@ -894,9 +916,9 @@ } }, "node_modules/@microsoft/vscode-azext-azureutils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-azureutils/-/vscode-azext-azureutils-1.0.1.tgz", - "integrity": "sha512-2RzRpFNwdv3oJlimzhF0d4cPJ6G6qN+B9+r0VnBYOPNBXW4lGmk8mBLr0RssDmL7ZBjLewehjg8Vfbc3IEfTdA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-azureutils/-/vscode-azext-azureutils-2.0.0.tgz", + "integrity": "sha512-e8ZpCa/iWZN3CYb2D4pRHAE0m7JdwWTgCl3hhsAqmCUv3j5dqKSSB/wyDeDQvXiqTDrh5br60MU27ts4OUteqA==", "dependencies": { "@azure/arm-resources": "^5.0.0", "@azure/arm-resources-profile-2020-09-01-hybrid": "^2.0.0", @@ -905,10 +927,13 @@ "@azure/arm-storage-profile-2020-09-01-hybrid": "^2.0.0", "@azure/core-client": "^1.6.0", "@azure/core-rest-pipeline": "^1.9.0", - "@microsoft/vscode-azext-utils": "^1.0.0", + "@azure/logger": "^1.0.4", + "@microsoft/vscode-azext-utils": "^2.0.0", "semver": "^7.3.7", - "uuid": "^9.0.0", - "vscode-nls": "^5.0.1" + "uuid": "^9.0.0" + }, + "peerDependencies": { + "@azure/ms-rest-azure-env": "^2.0.0" } }, "node_modules/@microsoft/vscode-azext-azureutils/node_modules/uuid": { @@ -919,11 +944,6 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/@microsoft/vscode-azext-azureutils/node_modules/vscode-nls": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-5.2.0.tgz", - "integrity": "sha512-RAaHx7B14ZU04EU31pT+rKz2/zSl7xMsfIZuo8pd+KZO6PXtQmpevpq3vxvWNcrGbdmhM/rr5Uw5Mz+NBfhVng==" - }, "node_modules/@microsoft/vscode-azext-dev": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-dev/-/vscode-azext-dev-1.0.4.tgz", @@ -1012,21 +1032,34 @@ "node": ">=4" } }, + "node_modules/@microsoft/vscode-azext-serviceconnector": { + "version": "0.0.1", + "resolved": "file:../vscode-azuretools/serviceconnector/microsoft-vscode-azext-serviceconnector-0.0.1.tgz", + "integrity": "sha512-hvhFMVDaFpSayyoAGFcdUtqI/6P1h4SFAs62ghb+EnpvT4oUxowrXXJD8HppOvnusBJVM4GF4Hg3vrp/P/aKKg==", + "license": "MIT", + "dependencies": { + "@azure/arm-servicelinker": "^2.1.0", + "@microsoft/vscode-azext-azureutils": "^2.0.0", + "@microsoft/vscode-azext-utils": "^2.0.0" + } + }, "node_modules/@microsoft/vscode-azext-utils": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-utils/-/vscode-azext-utils-1.2.0.tgz", - "integrity": "sha512-zD+1Efa6HSx0yqHTaFo0eICqUVEJHAfyphl+/XcdA6Bc8Wm1EXuKquKOOptt6hpF4hze8wcDo2RqxMcVaMXRLA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-utils/-/vscode-azext-utils-2.0.0.tgz", + "integrity": "sha512-I75IMSo1CvrF8J7S/RoHrvl4yQRWufvFGHSdlGfjBPdYFJ7O9J5hjeDCmv9/WIa8+qbSUmFPPyNZIXibbplSUQ==", "dependencies": { - "@microsoft/vscode-azureresources-api": "^2.0.2", + "@microsoft/vscode-azureresources-api": "^2.0.4", "@vscode/extension-telemetry": "^0.6.2", "dayjs": "^1.11.2", "escape-string-regexp": "^2.0.0", "html-to-text": "^8.2.0", "semver": "^7.3.7", "uuid": "^9.0.0", - "vscode-nls": "^5.0.1", "vscode-tas-client": "^0.1.47", "vscode-uri": "^3.0.6" + }, + "peerDependencies": { + "@azure/ms-rest-azure-env": "^2.0.0" } }, "node_modules/@microsoft/vscode-azext-utils/node_modules/escape-string-regexp": { @@ -1045,15 +1078,10 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/@microsoft/vscode-azext-utils/node_modules/vscode-nls": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-5.0.1.tgz", - "integrity": "sha512-hHQV6iig+M21lTdItKPkJAaWrxALQb/nqpVffakO4knJOh3DrU2SXOMzUzNgo1eADPzu3qSsJY1weCzvR52q9A==" - }, "node_modules/@microsoft/vscode-azureresources-api": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@microsoft/vscode-azureresources-api/-/vscode-azureresources-api-2.0.2.tgz", - "integrity": "sha512-O+JlAZg+3SjnQUX9nzUh0wfzLRBqqMk9f7rtSr4CX2Yrp753ufRBopLkWtFWOpTzKkoe7cp696nxESFi1AN6Hw==" + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@microsoft/vscode-azureresources-api/-/vscode-azureresources-api-2.0.4.tgz", + "integrity": "sha512-LridV1h2rCydrBzEpwy+pUIUx61GpZNwrK04G7LdlhoxHrzuM/WAoy8jXaSC/FSKSsXD1QXuE6u/YofEfsuKeg==" }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", @@ -12378,6 +12406,27 @@ } } }, + "@azure/arm-servicelinker": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@azure/arm-servicelinker/-/arm-servicelinker-2.1.0.tgz", + "integrity": "sha512-IENuxll0IxjnrO3B2TkZOKn3KLVD9gR09Adtzd+rk/ipe2ESTRp7Nsn5MhK89jxzb0Xd3uRy0a6uGMjI7d9E1A==", + "requires": { + "@azure/abort-controller": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-client": "^1.6.1", + "@azure/core-lro": "^2.2.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-rest-pipeline": "^1.8.0", + "tslib": "^2.2.0" + }, + "dependencies": { + "tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" + } + } + }, "@azure/arm-storage": { "version": "18.1.0", "resolved": "https://registry.npmjs.org/@azure/arm-storage/-/arm-storage-18.1.0.tgz", @@ -12642,9 +12691,9 @@ } }, "@azure/logger": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.0.3.tgz", - "integrity": "sha512-aK4s3Xxjrx3daZr3VylxejK3vG5ExXck5WOHDJ8in/k9AqlfIyFMMT1uG7u8mNjX+QRILTIn0/Xgschfh/dQ9g==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.0.4.tgz", + "integrity": "sha512-ustrPY8MryhloQj7OWGe+HrYx+aoiOxzbXTtgblbV3xwCqpzUK36phH3XNHQKj3EPonyFUuDTfR3qFhTEAuZEg==", "requires": { "tslib": "^2.2.0" }, @@ -12659,8 +12708,7 @@ "@azure/ms-rest-azure-env": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@azure/ms-rest-azure-env/-/ms-rest-azure-env-2.0.0.tgz", - "integrity": "sha512-dG76W7ElfLi+fbTjnZVGj+M9e0BIEJmRxU6fHaUQ12bZBe8EJKYb2GV50YWNaP2uJiVQ5+7nXEVj1VN1UQtaEw==", - "dev": true + "integrity": "sha512-dG76W7ElfLi+fbTjnZVGj+M9e0BIEJmRxU6fHaUQ12bZBe8EJKYb2GV50YWNaP2uJiVQ5+7nXEVj1VN1UQtaEw==" }, "@azure/ms-rest-azure-js": { "version": "2.1.0", @@ -12993,9 +13041,9 @@ } }, "@microsoft/vscode-azext-azureutils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-azureutils/-/vscode-azext-azureutils-1.0.1.tgz", - "integrity": "sha512-2RzRpFNwdv3oJlimzhF0d4cPJ6G6qN+B9+r0VnBYOPNBXW4lGmk8mBLr0RssDmL7ZBjLewehjg8Vfbc3IEfTdA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-azureutils/-/vscode-azext-azureutils-2.0.0.tgz", + "integrity": "sha512-e8ZpCa/iWZN3CYb2D4pRHAE0m7JdwWTgCl3hhsAqmCUv3j5dqKSSB/wyDeDQvXiqTDrh5br60MU27ts4OUteqA==", "requires": { "@azure/arm-resources": "^5.0.0", "@azure/arm-resources-profile-2020-09-01-hybrid": "^2.0.0", @@ -13004,21 +13052,16 @@ "@azure/arm-storage-profile-2020-09-01-hybrid": "^2.0.0", "@azure/core-client": "^1.6.0", "@azure/core-rest-pipeline": "^1.9.0", - "@microsoft/vscode-azext-utils": "^1.0.0", + "@azure/logger": "^1.0.4", + "@microsoft/vscode-azext-utils": "^2.0.0", "semver": "^7.3.7", - "uuid": "^9.0.0", - "vscode-nls": "^5.0.1" + "uuid": "^9.0.0" }, "dependencies": { "uuid": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==" - }, - "vscode-nls": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-5.2.0.tgz", - "integrity": "sha512-RAaHx7B14ZU04EU31pT+rKz2/zSl7xMsfIZuo8pd+KZO6PXtQmpevpq3vxvWNcrGbdmhM/rr5Uw5Mz+NBfhVng==" } } }, @@ -13100,19 +13143,27 @@ } } }, + "@microsoft/vscode-azext-serviceconnector": { + "version": "file:..\\vscode-azuretools\\serviceconnector\\microsoft-vscode-azext-serviceconnector-0.0.1.tgz", + "integrity": "sha512-hvhFMVDaFpSayyoAGFcdUtqI/6P1h4SFAs62ghb+EnpvT4oUxowrXXJD8HppOvnusBJVM4GF4Hg3vrp/P/aKKg==", + "requires": { + "@azure/arm-servicelinker": "^2.1.0", + "@microsoft/vscode-azext-azureutils": "^2.0.0", + "@microsoft/vscode-azext-utils": "^2.0.0" + } + }, "@microsoft/vscode-azext-utils": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-utils/-/vscode-azext-utils-1.2.0.tgz", - "integrity": "sha512-zD+1Efa6HSx0yqHTaFo0eICqUVEJHAfyphl+/XcdA6Bc8Wm1EXuKquKOOptt6hpF4hze8wcDo2RqxMcVaMXRLA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-utils/-/vscode-azext-utils-2.0.0.tgz", + "integrity": "sha512-I75IMSo1CvrF8J7S/RoHrvl4yQRWufvFGHSdlGfjBPdYFJ7O9J5hjeDCmv9/WIa8+qbSUmFPPyNZIXibbplSUQ==", "requires": { - "@microsoft/vscode-azureresources-api": "^2.0.2", + "@microsoft/vscode-azureresources-api": "^2.0.4", "@vscode/extension-telemetry": "^0.6.2", "dayjs": "^1.11.2", "escape-string-regexp": "^2.0.0", "html-to-text": "^8.2.0", "semver": "^7.3.7", "uuid": "^9.0.0", - "vscode-nls": "^5.0.1", "vscode-tas-client": "^0.1.47", "vscode-uri": "^3.0.6" }, @@ -13126,18 +13177,13 @@ "version": "9.0.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==" - }, - "vscode-nls": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-5.0.1.tgz", - "integrity": "sha512-hHQV6iig+M21lTdItKPkJAaWrxALQb/nqpVffakO4knJOh3DrU2SXOMzUzNgo1eADPzu3qSsJY1weCzvR52q9A==" } } }, "@microsoft/vscode-azureresources-api": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@microsoft/vscode-azureresources-api/-/vscode-azureresources-api-2.0.2.tgz", - "integrity": "sha512-O+JlAZg+3SjnQUX9nzUh0wfzLRBqqMk9f7rtSr4CX2Yrp753ufRBopLkWtFWOpTzKkoe7cp696nxESFi1AN6Hw==" + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@microsoft/vscode-azureresources-api/-/vscode-azureresources-api-2.0.4.tgz", + "integrity": "sha512-LridV1h2rCydrBzEpwy+pUIUx61GpZNwrK04G7LdlhoxHrzuM/WAoy8jXaSC/FSKSsXD1QXuE6u/YofEfsuKeg==" }, "@nodelib/fs.scandir": { "version": "2.1.5", diff --git a/package.json b/package.json index eba71133..60f5ac08 100644 --- a/package.json +++ b/package.json @@ -165,6 +165,21 @@ "command": "containerApps.stopStreamingLogs", "title": "%containerApps.stopStreamingLogs%", "category": "Azure Container Apps" + }, + { + "command": "containerApps.createServiceConnector", + "title": "%containerApps.createServiceConnector%", + "category": "Azure Container Apps" + }, + { + "command": "containerApps.deleteServiceConnector", + "title": "%containerApps.deleteServiceConnector%", + "category": "Azure Container Apps" + }, + { + "command": "containerApps.validateServiceConnector", + "title": "%containerApps.validateServiceConnector%", + "category": "Azure Container Apps" } ], "menus": { @@ -277,6 +292,21 @@ "command": "containerApps.stopStreamingLogs", "when": "view == azureResourceGroups && viewItem =~ /containerApp[^s]/i", "group": "4@2" + }, + { + "command": "containerApps.createServiceConnector", + "when": "view == azureResourceGroups && viewItem =~ /containerApp[^s]/i", + "group": "4@3" + }, + { + "command": "containerApps.deleteServiceConnector", + "when": "view == azureResourceGroups && viewItem =~ /containerApp[^s]/i", + "group": "4@4" + }, + { + "command": "containerApps.validateServiceConnector", + "when": "view == azureResourceGroups && viewItem =~ /containerApp[^s]/i", + "group": "4@5" } ], "commandPalette": [ @@ -374,10 +404,11 @@ "@azure/arm-operationalinsights": "^8.0.0", "@azure/arm-resources": "^5.0.1", "@azure/container-registry": "1.0.0-beta.5", - "@azure/storage-blob": "^12.4.1", "@azure/core-rest-pipeline": "1.10.3", - "@microsoft/vscode-azext-azureutils": "^1.0.1", - "@microsoft/vscode-azext-utils": "^1.2.0", + "@azure/storage-blob": "^12.4.1", + "@microsoft/vscode-azext-azureutils": "^2.0.0", + "@microsoft/vscode-azext-serviceconnector": "file:../vscode-azuretools/serviceconnector/microsoft-vscode-azext-serviceconnector-0.0.1.tgz", + "@microsoft/vscode-azext-utils": "^2.0.0", "@microsoft/vscode-azureresources-api": "^2.0.2", "@octokit/rest": "^18.5.2", "buffer": "^6.0.3", diff --git a/package.nls.json b/package.nls.json index 2dfb9283..35831a9c 100644 --- a/package.nls.json +++ b/package.nls.json @@ -29,5 +29,8 @@ "containerApps.addScaleRule": "Add Scale Rule...", "containerApps.connectToGitHub": "Connect to GitHub Repository...", "containerApps.startStreamingLogs": "Start Streaming Logs...", - "containerApps.stopStreamingLogs": "Stop Streaming Logs..." + "containerApps.stopStreamingLogs": "Stop Streaming Logs...", + "containerApps.createServiceConnector": "Create Service Connector...", + "containerApps.deleteServiceConnector": "Delete Service Connector...", + "containerApps.validateServiceConnector": "Validate Service Connector..." } diff --git a/src/commands/logStream/ContainerListStep.ts b/src/commands/logStream/ReplicaContainerListStep.ts similarity index 93% rename from src/commands/logStream/ContainerListStep.ts rename to src/commands/logStream/ReplicaContainerListStep.ts index cf3d3a1c..ecbe59ab 100644 --- a/src/commands/logStream/ContainerListStep.ts +++ b/src/commands/logStream/ReplicaContainerListStep.ts @@ -8,7 +8,7 @@ import { AzureWizardPromptStep, IAzureQuickPickItem, nonNullProp, nonNullValue } import { localize } from "../../utils/localize"; import { IStreamLogsContext } from "./IStreamLogsContext"; -export class ContainerListStep extends AzureWizardPromptStep { +export class ReplicaContainerListStep extends AzureWizardPromptStep { public async prompt(context: IStreamLogsContext): Promise { const placeHolder: string = localize('selectContainer', 'Select a container'); context.container = (await context.ui.showQuickPick(this.getPicks(context), { placeHolder })).data; diff --git a/src/commands/logStream/startStreamingLogs.ts b/src/commands/logStream/startStreamingLogs.ts index 0e84119e..947751d1 100644 --- a/src/commands/logStream/startStreamingLogs.ts +++ b/src/commands/logStream/startStreamingLogs.ts @@ -8,8 +8,8 @@ import { ContainerAppItem } from "../../tree/ContainerAppItem"; import { createActivityContext } from "../../utils/activityUtils"; import { localize } from "../../utils/localize"; import { pickContainerApp } from "../../utils/pickContainerApp"; -import { ContainerListStep } from "./ContainerListStep"; import { IStreamLogsContext } from "./IStreamLogsContext"; +import { ReplicaContainerListStep } from "./ReplicaContainerListStep"; import { ReplicaListStep } from "./ReplicaListStep"; import { RevisionListStep } from "./RevisionListStep"; import { logStreamRequest } from "./logStreamRequest"; @@ -35,7 +35,7 @@ export async function startStreamingLogs(context: IActionContext, item?: Pick[] = [ new RevisionListStep(), new ReplicaListStep(), - new ContainerListStep(), + new ReplicaContainerListStep(), ]; const wizard: AzureWizard = new AzureWizard(wizardContext, { diff --git a/src/commands/registerCommands.ts b/src/commands/registerCommands.ts index 8dc0c504..d7e77bac 100644 --- a/src/commands/registerCommands.ts +++ b/src/commands/registerCommands.ts @@ -25,6 +25,9 @@ import { deactivateRevision } from './revisionCommands/deactivateRevision'; import { restartRevision } from './revisionCommands/restartRevision'; import { addScaleRule } from './scaling/addScaleRule/addScaleRule'; import { editScalingRange } from './scaling/editScalingRange'; +import { createServiceConnector } from './serviceConnector/createServiceConnector'; +import { deleteServiceConnector } from './serviceConnector/deleteServiceConnector'; +import { validateServiceConnector } from './serviceConnector/validateServiceConnector'; export function registerCommands(): void { // managed environments @@ -62,6 +65,11 @@ export function registerCommands(): void { registerCommandWithTreeNodeUnwrapping('containerApps.startStreamingLogs', startStreamingLogs); registerCommandWithTreeNodeUnwrapping('containerApps.stopStreamingLogs', stopStreamingLogs); + // service connector + registerCommandWithTreeNodeUnwrapping('containerApps.createServiceConnector', createServiceConnector); + registerCommandWithTreeNodeUnwrapping('containerApps.deleteServiceConnector', deleteServiceConnector); + registerCommandWithTreeNodeUnwrapping('containerApps.validateServiceConnector', validateServiceConnector); + // Suppress "Report an Issue" button for all errors in favor of the command registerErrorHandler(c => c.errorHandling.suppressReportIssue = true); registerReportIssueCommand('containerApps.reportIssue'); diff --git a/src/commands/serviceConnector/ContainerListStep.ts b/src/commands/serviceConnector/ContainerListStep.ts new file mode 100644 index 00000000..f6a62645 --- /dev/null +++ b/src/commands/serviceConnector/ContainerListStep.ts @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. See License.md in the project root for license information. +*--------------------------------------------------------------------------------------------*/ + +import { AzureWizardPromptStep, IAzureQuickPickItem, nonNullValue } from "@microsoft/vscode-azext-utils"; +import { localize } from "../../utils/localize"; +import { IServiceConnectorContext } from "./IServiceConnectorContext"; + +export class ContainerListStep extends AzureWizardPromptStep { + public async prompt(context: IServiceConnectorContext): Promise { + const placeHolder: string = localize('selectContainer', 'Select a container'); + context.scope = (await context.ui.showQuickPick(this.getPicks(context), { placeHolder })).data; + } + + public shouldPrompt(context: IServiceConnectorContext): boolean { + return !context.scope; + } + + public async configureBeforePrompt(context: IServiceConnectorContext): Promise { + const picks = this.getPicks(context); + if (picks.length === 1) { + context.scope = picks[0].data; + } + } + + private getPicks(context: IServiceConnectorContext): IAzureQuickPickItem[] { + const containers = nonNullValue(context.containerApp?.template?.containers); + return containers.map(c => { + return { + label: nonNullValue(c.name), + data: nonNullValue(c.name) + } + }) + } +} diff --git a/src/commands/serviceConnector/IServiceConnectorContext.ts b/src/commands/serviceConnector/IServiceConnectorContext.ts new file mode 100644 index 00000000..4110f6f7 --- /dev/null +++ b/src/commands/serviceConnector/IServiceConnectorContext.ts @@ -0,0 +1,10 @@ +/*--------------------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. See License.md in the project root for license information. +*--------------------------------------------------------------------------------------------*/ + +import { ICreateLinkerContext } from "@microsoft/vscode-azext-serviceconnector"; +import { IContainerAppContext } from "../createContainerApp/IContainerAppContext"; + +export interface IServiceConnectorContext extends ICreateLinkerContext, IContainerAppContext { +} diff --git a/src/commands/serviceConnector/createServiceConnector.ts b/src/commands/serviceConnector/createServiceConnector.ts new file mode 100644 index 00000000..f4625ee1 --- /dev/null +++ b/src/commands/serviceConnector/createServiceConnector.ts @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. See License.md in the project root for license information. +*--------------------------------------------------------------------------------------------*/ + +import { ICreateLinkerContext, createLinker } from "@microsoft/vscode-azext-serviceconnector"; +import { AzureWizardPromptStep } from "@microsoft/vscode-azext-utils"; +import { ContainerAppItem } from "../../tree/ContainerAppItem"; +import { createActivityContext } from "../../utils/activityUtils"; +import { localize } from "../../utils/localize"; +import { pickContainerApp } from "../../utils/pickContainerApp"; +import { ContainerListStep } from "./ContainerListStep"; +import { IServiceConnectorContext } from "./IServiceConnectorContext"; + +export async function createServiceConnector(context: ICreateLinkerContext, item?: ContainerAppItem): Promise { + item ??= await pickContainerApp(context); + const { subscription, containerApp } = item; + + const activityContext = { + ...context, + ...await createActivityContext(), + containerApp: containerApp, + activityTitle: localize('createServiceConnector', 'Create Service Connector'), + } + + const promptSteps: AzureWizardPromptStep[] = [ + new ContainerListStep(), + ]; + + await createLinker(activityContext, { id: containerApp.id, subscription }, promptSteps); +} diff --git a/src/commands/serviceConnector/deleteServiceConnector.ts b/src/commands/serviceConnector/deleteServiceConnector.ts new file mode 100644 index 00000000..9407b6c5 --- /dev/null +++ b/src/commands/serviceConnector/deleteServiceConnector.ts @@ -0,0 +1,32 @@ +/*--------------------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. See License.md in the project root for license information. +*--------------------------------------------------------------------------------------------*/ + +import { ICreateLinkerContext, deleteLinker } from "@microsoft/vscode-azext-serviceconnector"; +import { AzureWizardPromptStep } from "@microsoft/vscode-azext-utils"; +import { ContainerAppItem } from "../../tree/ContainerAppItem"; +import { createActivityContext } from "../../utils/activityUtils"; +import { localize } from "../../utils/localize"; +import { pickContainerApp } from "../../utils/pickContainerApp"; +import { ContainerListStep } from "./ContainerListStep"; +import { IServiceConnectorContext } from "./IServiceConnectorContext"; + + +export async function deleteServiceConnector(context: ICreateLinkerContext, item?: ContainerAppItem): Promise { + item ??= await pickContainerApp(context); + const { subscription, containerApp } = item; + + const activityContext = { + ...context, + ...await createActivityContext(), + containerApp: containerApp, + activityTitle: localize('deleteServiceConnector', 'Delete Service Connector'), + } + + const promptSteps: AzureWizardPromptStep[] = [ + new ContainerListStep(), + ]; + + await deleteLinker(activityContext, { id: containerApp.id, subscription }, promptSteps); +} diff --git a/src/commands/serviceConnector/validateServiceConnector.ts b/src/commands/serviceConnector/validateServiceConnector.ts new file mode 100644 index 00000000..67c6f3d7 --- /dev/null +++ b/src/commands/serviceConnector/validateServiceConnector.ts @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. See License.md in the project root for license information. +*--------------------------------------------------------------------------------------------*/ + +import { ICreateLinkerContext, validateLinker } from "@microsoft/vscode-azext-serviceconnector"; +import { AzureWizardPromptStep } from "@microsoft/vscode-azext-utils"; +import { ContainerAppItem } from "../../tree/ContainerAppItem"; +import { createActivityContext } from "../../utils/activityUtils"; +import { localize } from "../../utils/localize"; +import { pickContainerApp } from "../../utils/pickContainerApp"; +import { ContainerListStep } from "./ContainerListStep"; +import { IServiceConnectorContext } from "./IServiceConnectorContext"; + +export async function validateServiceConnector(context: ICreateLinkerContext, item?: ContainerAppItem): Promise { + item ??= await pickContainerApp(context); + const { subscription, containerApp } = item; + + const activityContext = { + ...context, + ...await createActivityContext(), + containerApp: containerApp, + activityTitle: localize('validateServiceConnector', 'Validate Service Connector'), + } + + const promptSteps: AzureWizardPromptStep[] = [ + new ContainerListStep(), + ]; + + await validateLinker(activityContext, { id: containerApp.id, subscription }, promptSteps); +} diff --git a/src/utils/azureClients.ts b/src/utils/azureClients.ts index 872ebcf1..a4b428fe 100644 --- a/src/utils/azureClients.ts +++ b/src/utils/azureClients.ts @@ -28,11 +28,6 @@ export async function createContainerRegistryManagementClient(context: AzExtClie export function createContainerRegistryClient(context: AzExtClientContext, registry: Registry): ContainerRegistryClient { const clientContext = parseClientContext(context); - // @azure/container-registry doesn't support ADAL tokens at all. If it sees `signRequest` is defined - // it errors, but we don't actually need `signRequest` because this is a T2 package - const credential = clientContext.credentials as { signRequest: unknown }; - credential.signRequest = undefined; - return new ContainerRegistryClient(`https://${registry.loginServer}`, clientContext.credentials, { audience: KnownContainerRegistryAudience.AzureResourceManagerPublicCloud }); }