diff --git a/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/AppServiceAppBase.java b/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/AppServiceAppBase.java index 39ae2af39..79394dbf1 100644 --- a/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/AppServiceAppBase.java +++ b/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/AppServiceAppBase.java @@ -279,4 +279,14 @@ public IdentityConfiguration getIdentityConfiguration() { public void updateIdentityConfiguration(@Nonnull final IdentityConfiguration configuration) { throw new AzureToolkitRuntimeException("not supported"); } + + public void enableWebSockets() { + toggleWebSockets(true); + } + + public void disableWebSockets() { + toggleWebSockets(false); + } + + protected abstract void toggleWebSockets(boolean enabled); } diff --git a/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/function/FunctionApp.java b/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/function/FunctionApp.java index 21e886583..b98c5cdeb 100644 --- a/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/function/FunctionApp.java +++ b/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/function/FunctionApp.java @@ -287,4 +287,9 @@ public void updateIdentityConfiguration(final @NotNull IdentityConfiguration con AzureMessager.getMessager().info(String.format("Updating identity configuration for function app %s...", this.getName())); update.apply(); } + + @Override + protected void toggleWebSockets(final boolean enabled) { + doModify(() -> Objects.requireNonNull(getRemote()).update().withWebSocketsEnabled(enabled).apply(), Status.UPDATING); + } } diff --git a/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/function/FunctionAppDeploymentSlot.java b/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/function/FunctionAppDeploymentSlot.java index dfc9929ef..018e4d891 100644 --- a/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/function/FunctionAppDeploymentSlot.java +++ b/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/function/FunctionAppDeploymentSlot.java @@ -19,6 +19,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.stream.Collectors; public class FunctionAppDeploymentSlot extends FunctionAppBase { @@ -93,4 +94,9 @@ protected String getRemoteDebugPort() { } throw new AzureToolkitRuntimeException("Could not found free port to enable remote debug."); } + + @Override + protected void toggleWebSockets(final boolean enabled) { + doModify(() -> Objects.requireNonNull(getRemote()).update().withWebSocketsEnabled(enabled).apply(), Status.UPDATING); + } } diff --git a/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/webapp/WebApp.java b/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/webapp/WebApp.java index 6b6ad74bc..e220f7e6d 100644 --- a/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/webapp/WebApp.java +++ b/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/webapp/WebApp.java @@ -101,4 +101,9 @@ public void updateIdentityConfiguration(final @NotNull IdentityConfiguration con AzureMessager.getMessager().info(String.format("Updating identity configuration for web app %s...", this.getName())); update.apply(); } + + @Override + protected void toggleWebSockets(final boolean enabled) { + doModify(() -> Objects.requireNonNull(getRemote()).update().withWebSocketsEnabled(enabled).apply(), Status.UPDATING); + } } diff --git a/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/webapp/WebAppDeploymentSlot.java b/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/webapp/WebAppDeploymentSlot.java index 1b5f6050b..fe01cb5d2 100644 --- a/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/webapp/WebAppDeploymentSlot.java +++ b/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/webapp/WebAppDeploymentSlot.java @@ -12,6 +12,7 @@ import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; +import java.util.Objects; public class WebAppDeploymentSlot extends WebAppBase { @@ -35,4 +36,9 @@ protected WebAppDeploymentSlot(@Nonnull WebDeploymentSlotBasic remote, @Nonnull public List> getSubModules() { return Collections.emptyList(); } + + @Override + protected void toggleWebSockets(final boolean enabled) { + doModify(() -> Objects.requireNonNull(getRemote()).update().withWebSocketsEnabled(enabled).apply(), Status.UPDATING); + } }