@Mojo(name="deploy",
defaultPhase=DEPLOY)
public class DeployMojo
extends AbstractFunctionMojo
AbstractAzureMojo.DefaultUncaughtExceptionHandler, AbstractAzureMojo.RunnableWithExceptionappInsightsInstance, appInsightsKey, disableAppInsights, finalName, outputDirectory, pricingTier, region, runtime, skip, TRIGGER_TYPEappName, appServicePlanName, appServicePlanResourceGroup, appSettings, deploymentSlotSetting, deploymentType, MAVEN_PLUGIN_POSTFIX, PORTAL_URL_PATTERN, resourceGroupallowTelemetry, auth, authentication, authType, buildDirectory, DEPLOY, failsOnError, httpProxyHost, httpProxyPort, INSTALLATION_ID_KEY, mavenResourcesFiltering, plugin, PLUGIN_NAME_KEY, PLUGIN_VERSION_KEY, project, session, SESSION_ID_KEY, settings, settingsDecrypter, SUBSCRIPTION_ID_KEY, SUBSCRIPTION_NOT_FOUND, SUBSCRIPTION_NOT_SPECIFIED, SUBSCRIPTION_TEMPLATE, subscriptionId, USING_AZURE_ENVIRONMENT| Constructor and Description |
|---|
DeployMojo() |
| Modifier and Type | Method and Description |
|---|---|
private void |
bindApplicationInsights(Map appSettings,
boolean isCreation)
Binding Function App with Application Insights
Will follow the below sequence appInsightsKey -> appInsightsInstance -> Create New AI Instance (Function creation only)
|
protected void |
checkArtifactCompileVersion() |
protected void |
configureAppSettings(java.util.function.Consumer<Map> withAppSettings,
Map appSettings) |
private com.microsoft.azure.management.applicationinsights.v2015_05_01.ApplicationInsightsComponent |
createApplicationInsights(com.microsoft.azure.common.applicationinsights.ApplicationInsightsManager applicationInsightsManager,
String name) |
protected com.microsoft.azure.management.appservice.FunctionDeploymentSlot |
createDeploymentSlot(com.microsoft.azure.management.appservice.FunctionApp functionApp,
com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandler runtimeHandler) |
protected com.microsoft.azure.management.appservice.FunctionApp |
createFunctionApp(com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandler runtimeHandler) |
protected com.microsoft.azure.management.appservice.WebAppBase |
createOrUpdateResource() |
private void |
deployArtifact(com.microsoft.azure.common.deploytarget.DeployTarget deployTarget) |
protected void |
doExecute() |
private com.microsoft.azure.management.applicationinsights.v2015_05_01.ApplicationInsightsComponent |
getApplicationInsights(com.microsoft.azure.common.applicationinsights.ApplicationInsightsManager applicationInsightsManager,
String appInsightsInstance) |
protected com.microsoft.azure.common.handlers.ArtifactHandler |
getArtifactHandler() |
private File |
getArtifactToDeploy() |
com.microsoft.azure.common.appservice.DeploymentType |
getDeploymentType() |
protected com.microsoft.azure.common.appservice.DeploymentType |
getDeploymentTypeByRuntime() |
com.microsoft.azure.common.function.configurations.FunctionExtensionVersion |
getFunctionExtensionVersion() |
protected com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandler |
getFunctionRuntimeHandler() |
private com.microsoft.azure.management.applicationinsights.v2015_05_01.ApplicationInsightsComponent |
getOrCreateApplicationInsights(boolean enableCreation) |
protected com.microsoft.azure.common.appservice.OperatingSystemEnum |
getOsEnum() |
protected boolean |
isDedicatedPricingTier() |
private boolean |
isDeployToSlot() |
private List<com.microsoft.azure.common.function.model.FunctionResource> |
listFunctions()
Sync triggers and return function list of deployed function app
Will retry when get empty result, the max retry times is LIST_TRIGGERS_MAX_RETRY
|
protected void |
listHTTPTriggerUrls()
List anonymous HTTP Triggers url after deployment
|
protected void |
parseConfiguration() |
void |
processAppSettingsWithDefaultValue() |
private void |
setDefaultAppSetting(Map result,
String settingName,
String settingIsEmptyMessage,
String settingValue) |
private void |
setDefaultAppSetting(Map result,
String settingName,
String settingIsEmptyMessage,
String defaultValue,
String warningMessage) |
protected com.microsoft.azure.management.appservice.FunctionDeploymentSlot |
updateDeploymentSlot(com.microsoft.azure.management.appservice.FunctionDeploymentSlot deploymentSlot,
com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandler runtimeHandler) |
protected com.microsoft.azure.management.appservice.FunctionApp |
updateFunctionApp(com.microsoft.azure.management.appservice.FunctionApp app,
com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandler runtimeHandler) |
private com.microsoft.azure.management.appservice.WebAppBase.Update |
updateFunctionAppSettings(com.microsoft.azure.management.appservice.WebAppBase.Update update) |
private void |
validateApplicationInsightsConfiguration() |
getAppInsightsInstance, getAppInsightsKey, getFinalName, getFunctionApp, getPricingTier, getRegion, getRuntime, getTelemetryProperties, isDisableAppInsights, isSkipMojo, validateAppNamegetAppName, getAppServicePlanName, getAppServicePlanResourceGroup, getAppSettings, getDeploymentSlotSetting, getDeploymentStagingDirectoryPath, getPortalUrl, getResourceGroup, getResourcePortalUrl, getResources, setDeploymentSlotexecute, executeWithTimeRecorder, getAuthenticationSetting, getAuthMethod, getAuthType, getAzureClient, getAzureCredentialWrapper, getBuildDirectoryAbsolutePath, getHttpProxyHost, getHttpProxyPort, getInstallationId, getMavenResourcesFiltering, getOrCreateAzureClient, getPluginName, getPluginVersion, getProject, getSession, getSessionId, getSettings, getSubscriptionId, getTelemetryProxy, getUserAgent, handleException, highlightDefaultValue, infoWithMultipleLines, initTelemetry, isAuthConfigurationExist, isFailingOnError, isTelemetryAllowed, printCurrentSubscription, selectSubscription, trackMojoFailure, trackMojoSkip, trackMojoStart, trackMojoSuccessprivate static final int LIST_TRIGGERS_MAX_RETRY
private static final int LIST_TRIGGERS_RETRY_PERIOD_IN_SECONDS
private static final String DEPLOY_START
private static final String DEPLOY_FINISH
private static final String FUNCTION_APP_CREATE_START
private static final String FUNCTION_APP_CREATED
private static final String FUNCTION_SLOT_CREATE_START
private static final String FUNCTION_SLOT_CREATED
private static final String FUNCTION_APP_UPDATE
private static final String FUNCTION_APP_UPDATE_DONE
private static final String FUNCTION_SLOT_UPDATE
private static final String FUNCTION_SLOT_UPDATE_DONE
private static final String DEPLOYMENT_TYPE_KEY
private static final String UNKNOWN_DEPLOYMENT_TYPE
private static final String APPINSIGHTS_INSTRUMENTATION_KEY
private static final String APPLICATION_INSIGHTS_NOT_SUPPORTED
private static final String APPLICATION_INSIGHTS_CONFIGURATION_CONFLICT
private static final String FAILED_TO_GET_APPLICATION_INSIGHTS
private static final String SKIP_CREATING_APPLICATION_INSIGHTS
private static final String APPLICATION_INSIGHTS_CREATE_START
private static final String APPLICATION_INSIGHTS_CREATED
private static final String APPLICATION_INSIGHTS_CREATE_FAILED
private static final String INSTRUMENTATION_KEY_IS_NOT_VALID
private static final String FAILED_TO_GET_FUNCTION_APP_PRICING_TIER
private static final String FAILED_TO_LIST_TRIGGERS
private static final String UNABLE_TO_LIST_NONE_ANONYMOUS_HTTP_TRIGGERS
private static final String HTTP_TRIGGER_URLS
private static final String NO_ANONYMOUS_HTTP_TRIGGER
private static final String AUTH_LEVEL
private static final String HTTP_TRIGGER
private static final String NO_TRIGGERS_FOUNDED
private static final String SYNCING_TRIGGERS_AND_FETCH_FUNCTION_INFORMATION
private static final String ARTIFACT_INCOMPATIBLE
private static final String FUNCTION_APP_NOT_EXISTS
private static final String FUNCTIONS_WORKER_RUNTIME_NAME
private static final String FUNCTIONS_WORKER_RUNTIME_VALUE
private static final String SET_FUNCTIONS_WORKER_RUNTIME
private static final String CUSTOMIZED_FUNCTIONS_WORKER_RUNTIME_WARNING
private static final String FUNCTIONS_EXTENSION_VERSION_NAME
private static final String FUNCTIONS_EXTENSION_VERSION_VALUE
private static final String SET_FUNCTIONS_EXTENSION_VERSION
private static final String CREATE_NEW_FUNCTION_APP
private static final String RUNNING
private com.microsoft.azure.management.appservice.JavaVersion parsedJavaVersion
public com.microsoft.azure.common.appservice.DeploymentType getDeploymentType()
throws com.microsoft.azure.common.exceptions.AzureExecutionException
getDeploymentType in class AbstractAppServiceMojocom.microsoft.azure.common.exceptions.AzureExecutionExceptionprotected void doExecute()
throws com.microsoft.azure.common.exceptions.AzureExecutionException
doExecute in class AbstractAzureMojocom.microsoft.azure.common.exceptions.AzureExecutionExceptionprivate void deployArtifact(com.microsoft.azure.common.deploytarget.DeployTarget deployTarget)
throws com.microsoft.azure.common.exceptions.AzureExecutionException,
AzureAuthFailureException
com.microsoft.azure.common.exceptions.AzureExecutionExceptionAzureAuthFailureExceptionprotected com.microsoft.azure.management.appservice.WebAppBase createOrUpdateResource()
throws com.microsoft.azure.common.exceptions.AzureExecutionException,
AzureAuthFailureException
com.microsoft.azure.common.exceptions.AzureExecutionExceptionAzureAuthFailureExceptionprotected com.microsoft.azure.management.appservice.FunctionApp createFunctionApp(com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandler runtimeHandler)
throws AzureAuthFailureException,
com.microsoft.azure.common.exceptions.AzureExecutionException
AzureAuthFailureExceptioncom.microsoft.azure.common.exceptions.AzureExecutionExceptionprotected com.microsoft.azure.management.appservice.FunctionApp updateFunctionApp(com.microsoft.azure.management.appservice.FunctionApp app,
com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandler runtimeHandler)
throws AzureAuthFailureException,
com.microsoft.azure.common.exceptions.AzureExecutionException
AzureAuthFailureExceptioncom.microsoft.azure.common.exceptions.AzureExecutionExceptionprotected com.microsoft.azure.management.appservice.FunctionDeploymentSlot createDeploymentSlot(com.microsoft.azure.management.appservice.FunctionApp functionApp,
com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandler runtimeHandler)
throws com.microsoft.azure.common.exceptions.AzureExecutionException,
AzureAuthFailureException
com.microsoft.azure.common.exceptions.AzureExecutionExceptionAzureAuthFailureExceptionprotected com.microsoft.azure.management.appservice.FunctionDeploymentSlot updateDeploymentSlot(com.microsoft.azure.management.appservice.FunctionDeploymentSlot deploymentSlot,
com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandler runtimeHandler)
throws AzureAuthFailureException,
com.microsoft.azure.common.exceptions.AzureExecutionException
AzureAuthFailureExceptioncom.microsoft.azure.common.exceptions.AzureExecutionExceptionprotected void listHTTPTriggerUrls()
protected com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandler getFunctionRuntimeHandler()
throws AzureAuthFailureException,
com.microsoft.azure.common.exceptions.AzureExecutionException
AzureAuthFailureExceptioncom.microsoft.azure.common.exceptions.AzureExecutionExceptionprotected com.microsoft.azure.common.appservice.OperatingSystemEnum getOsEnum()
throws com.microsoft.azure.common.exceptions.AzureExecutionException
com.microsoft.azure.common.exceptions.AzureExecutionExceptionprotected com.microsoft.azure.common.handlers.ArtifactHandler getArtifactHandler()
throws com.microsoft.azure.common.exceptions.AzureExecutionException
com.microsoft.azure.common.exceptions.AzureExecutionExceptionprotected com.microsoft.azure.common.appservice.DeploymentType getDeploymentTypeByRuntime()
throws com.microsoft.azure.common.exceptions.AzureExecutionException
com.microsoft.azure.common.exceptions.AzureExecutionExceptionprotected boolean isDedicatedPricingTier()
throws com.microsoft.azure.common.exceptions.AzureExecutionException
com.microsoft.azure.common.exceptions.AzureExecutionExceptionprotected void checkArtifactCompileVersion()
throws com.microsoft.azure.common.exceptions.AzureExecutionException
com.microsoft.azure.common.exceptions.AzureExecutionExceptionprotected void parseConfiguration()
public void processAppSettingsWithDefaultValue()
private void setDefaultAppSetting(Map result, String settingName, String settingIsEmptyMessage, String settingValue)
private void setDefaultAppSetting(Map result, String settingName, String settingIsEmptyMessage, String defaultValue, String warningMessage)
public com.microsoft.azure.common.function.configurations.FunctionExtensionVersion getFunctionExtensionVersion()
throws com.microsoft.azure.common.exceptions.AzureExecutionException
com.microsoft.azure.common.exceptions.AzureExecutionExceptionprotected void configureAppSettings(java.util.function.Consumer<Map> withAppSettings, Map appSettings)
private com.microsoft.azure.management.appservice.WebAppBase.Update updateFunctionAppSettings(com.microsoft.azure.management.appservice.WebAppBase.Update update)
throws com.microsoft.azure.common.exceptions.AzureExecutionException,
AzureAuthFailureException
com.microsoft.azure.common.exceptions.AzureExecutionExceptionAzureAuthFailureExceptionprivate File getArtifactToDeploy() throws com.microsoft.azure.common.exceptions.AzureExecutionException
com.microsoft.azure.common.exceptions.AzureExecutionExceptionprivate List<com.microsoft.azure.common.function.model.FunctionResource> listFunctions() throws com.microsoft.azure.common.exceptions.AzureExecutionException, AzureAuthFailureException, InterruptedException
com.microsoft.azure.common.exceptions.AzureExecutionException - Throw if get empty result after LIST_TRIGGERS_MAX_RETRY times retryAzureAuthFailureException - Throw if meet Authentication exception while getting Azure client or Function appInterruptedException - Throw when thread was interrupted while sleeping between retryprivate void bindApplicationInsights(Map appSettings, boolean isCreation) throws com.microsoft.azure.common.exceptions.AzureExecutionException, AzureAuthFailureException
appSettings - App settings mapisCreation - Define the stage of function app, as we only create ai instance by default when create new function appscom.microsoft.azure.common.exceptions.AzureExecutionException - When there are conflicts in configuration or meet errors while finding/creating application insights instanceAzureAuthFailureExceptionprivate void validateApplicationInsightsConfiguration()
throws com.microsoft.azure.common.exceptions.AzureExecutionException
com.microsoft.azure.common.exceptions.AzureExecutionExceptionprivate boolean isDeployToSlot()
private com.microsoft.azure.management.applicationinsights.v2015_05_01.ApplicationInsightsComponent getOrCreateApplicationInsights(boolean enableCreation)
throws AzureAuthFailureException,
com.microsoft.azure.common.exceptions.AzureExecutionException
AzureAuthFailureExceptioncom.microsoft.azure.common.exceptions.AzureExecutionExceptionprivate com.microsoft.azure.management.applicationinsights.v2015_05_01.ApplicationInsightsComponent getApplicationInsights(com.microsoft.azure.common.applicationinsights.ApplicationInsightsManager applicationInsightsManager,
String appInsightsInstance)
private com.microsoft.azure.management.applicationinsights.v2015_05_01.ApplicationInsightsComponent createApplicationInsights(com.microsoft.azure.common.applicationinsights.ApplicationInsightsManager applicationInsightsManager,
String name)
Copyright © 2021. All rights reserved.