use of com.microsoft.azure.toolkit.lib.appservice.model.FunctionDeployType in project azure-tools-for-java by Microsoft.
the class FunctionAppService method deployFunctionApp.
public void deployFunctionApp(final IFunctionApp functionApp, final File stagingFolder) throws IOException {
AzureMessager.getMessager().info(DEPLOY_START);
final FunctionDeployType deployType = getDeployType(functionApp);
AzureTelemetry.getActionContext().setProperty(DEPLOYMENT_TYPE, deployType.name());
functionApp.deploy(packageStagingDirectory(stagingFolder), deployType);
if (!StringUtils.equalsIgnoreCase(functionApp.state(), RUNNING)) {
functionApp.start();
}
final String resourceUrl = String.format(PORTAL_URL_PATTERN, IdentityAzureManager.getInstance().getPortalUrl(), functionApp.id());
AzureMessager.getMessager().info(String.format(DEPLOY_FINISH, resourceUrl));
}
use of com.microsoft.azure.toolkit.lib.appservice.model.FunctionDeployType in project azure-gradle-plugins by microsoft.
the class DeployHandler method deployArtifact.
private void deployArtifact(@Nonnull final FunctionAppBase<?, ?, ?> target) {
final boolean isDockerRuntime = Optional.ofNullable(target.getRuntime()).map(Runtime::isDocker).orElse(false);
if (isDockerRuntime) {
AzureMessager.getMessager().info(SKIP_DEPLOYMENT_FOR_DOCKER_APP_SERVICE);
return;
}
AzureMessager.getMessager().info(DEPLOY_START);
String deploymentType = ctx.getDeploymentType();
FunctionDeployType deployType;
try {
deployType = StringUtils.isEmpty(deploymentType) ? null : FunctionDeployType.fromString(deploymentType);
} catch (AzureToolkitRuntimeException ex) {
throw new AzureToolkitRuntimeException(UNKNOWN_DEPLOYMENT_TYPE, ex);
}
// For ftp deploy, we need to upload entire staging directory not the zipped package
final File file = deployType == FunctionDeployType.FTP ? new File(ctx.getDeploymentStagingDirectoryPath()) : packageStagingDirectory();
final RunnableWithException deployRunnable = deployType == null ? () -> target.deploy(file) : () -> target.deploy(file, deployType);
executeWithTimeRecorder(deployRunnable, DEPLOY);
// todo: check function status after deployment
if (!target.getFormalStatus().isRunning()) {
target.start();
}
AzureMessager.getMessager().info(String.format(DEPLOY_FINISH, getResourcePortalUrl(target.getId())));
}
use of com.microsoft.azure.toolkit.lib.appservice.model.FunctionDeployType in project azure-maven-plugins by microsoft.
the class DeployMojo method deployArtifact.
private void deployArtifact(final IFunctionAppBase<?> target) {
final File file = new File(getDeploymentStagingDirectoryPath());
final FunctionDeployType type = StringUtils.isEmpty(deploymentType) ? null : FunctionDeployType.fromString(deploymentType);
new DeployFunctionAppTask(target, file, type).execute();
}
use of com.microsoft.azure.toolkit.lib.appservice.model.FunctionDeployType in project azure-tools-for-java by microsoft.
the class FunctionAppService method deployFunctionApp.
public void deployFunctionApp(final IFunctionApp functionApp, final File stagingFolder) throws IOException {
AzureMessager.getMessager().info(DEPLOY_START);
final FunctionDeployType deployType = getDeployType(functionApp);
AzureTelemetry.getActionContext().setProperty(DEPLOYMENT_TYPE, deployType.name());
functionApp.deploy(packageStagingDirectory(stagingFolder), deployType);
if (!StringUtils.equalsIgnoreCase(functionApp.state(), RUNNING)) {
functionApp.start();
}
final String resourceUrl = String.format(PORTAL_URL_PATTERN, IdentityAzureManager.getInstance().getPortalUrl(), functionApp.id());
AzureMessager.getMessager().info(String.format(DEPLOY_FINISH, resourceUrl));
}
use of com.microsoft.azure.toolkit.lib.appservice.model.FunctionDeployType in project azure-gradle-plugins by microsoft.
the class DeployHandler method deployArtifact.
private void deployArtifact(IFunctionAppBase target) throws AzureExecutionException {
if (target.getRuntime().isDocker()) {
AzureMessager.getMessager().info(SKIP_DEPLOYMENT_FOR_DOCKER_APP_SERVICE);
return;
}
AzureMessager.getMessager().info(DEPLOY_START);
String deploymentType = ctx.getDeploymentType();
FunctionDeployType deployType;
try {
deployType = StringUtils.isEmpty(deploymentType) ? null : FunctionDeployType.fromString(deploymentType);
} catch (AzureToolkitRuntimeException ex) {
throw new AzureExecutionException(UNKNOWN_DEPLOYMENT_TYPE);
}
// For ftp deploy, we need to upload entire staging directory not the zipped package
final File file = deployType == FunctionDeployType.FTP ? new File(ctx.getDeploymentStagingDirectoryPath()) : packageStagingDirectory();
final RunnableWithException deployRunnable = deployType == null ? () -> target.deploy(file) : () -> target.deploy(file, deployType);
executeWithTimeRecorder(deployRunnable, DEPLOY);
// todo: check function status after deployment
if (!StringUtils.equalsIgnoreCase(target.state(), RUNNING)) {
target.start();
}
AzureMessager.getMessager().info(String.format(DEPLOY_FINISH, getResourcePortalUrl(target.id())));
}
Aggregations