Search in sources :

Example 1 with FTPUploader

use of com.microsoft.azure.toolkit.lib.legacy.appservice.handlers.artifact.FTPUploader in project azure-maven-plugins by microsoft.

the class FTPFunctionDeployHandler method deploy.

@Override
public void deploy(final File file, final WebAppBase webAppBase) {
    final FTPUploader uploader = new FTPUploader();
    final PublishingProfile profile = webAppBase.getPublishingProfile();
    final String serverUrl = profile.ftpUrl().split("/", 2)[0];
    try {
        uploader.uploadDirectoryWithRetries(serverUrl, profile.ftpUsername(), profile.ftpPassword(), file.getAbsolutePath(), DEFAULT_WEBAPP_ROOT, DEFAULT_MAX_RETRY_TIMES);
    } catch (AzureExecutionException e) {
        throw new AzureToolkitRuntimeException("Failed to upload artifact to azure", e);
    }
    if (webAppBase instanceof FunctionApp) {
        ((FunctionApp) webAppBase).syncTriggers();
    }
    AzureMessager.getMessager().info(String.format(DEPLOY_FINISH, webAppBase.defaultHostname()));
}
Also used : AzureExecutionException(com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException) FTPUploader(com.microsoft.azure.toolkit.lib.legacy.appservice.handlers.artifact.FTPUploader) AzureToolkitRuntimeException(com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitRuntimeException) PublishingProfile(com.azure.resourcemanager.appservice.models.PublishingProfile) FunctionApp(com.azure.resourcemanager.appservice.models.FunctionApp)

Aggregations

FunctionApp (com.azure.resourcemanager.appservice.models.FunctionApp)1 PublishingProfile (com.azure.resourcemanager.appservice.models.PublishingProfile)1 AzureExecutionException (com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException)1 AzureToolkitRuntimeException (com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitRuntimeException)1 FTPUploader (com.microsoft.azure.toolkit.lib.legacy.appservice.handlers.artifact.FTPUploader)1