Class DeployMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- com.microsoft.azure.maven.AbstractAzureMojo
-
- com.microsoft.azure.maven.AbstractAppServiceMojo
-
- com.microsoft.azure.maven.function.AbstractFunctionMojo
-
- com.microsoft.azure.maven.function.DeployMojo
-
- All Implemented Interfaces:
com.microsoft.azure.maven.auth.AuthConfiguration,com.microsoft.azure.maven.telemetry.TelemetryConfiguration,org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="deploy", defaultPhase=DEPLOY) public class DeployMojo extends AbstractFunctionMojoDeploy artifacts to target Azure Functions in Azure. If target Azure Functions doesn't exist, it will be created.
-
-
Field Summary
-
Fields inherited from class com.microsoft.azure.maven.function.AbstractFunctionMojo
appInsightsInstance, appInsightsKey, disableAppInsights, finalName, outputDirectory, pricingTier, region, runtime, skip, TRIGGER_TYPE
-
Fields inherited from class com.microsoft.azure.maven.AbstractAppServiceMojo
appName, appServiceClient, appServicePlanName, appServicePlanResourceGroup, appSettings, deploymentSlotSetting, deploymentType, MAVEN_PLUGIN_POSTFIX, PORTAL_URL_PATTERN, resourceGroup
-
Fields inherited from class com.microsoft.azure.maven.AbstractAzureMojo
allowTelemetry, 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_TEMPLATE, subscriptionId, telemetries, telemetryProxy, USING_AZURE_ENVIRONMENT
-
-
Constructor Summary
Constructors Constructor Description DeployMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private voidbindApplicationInsights(Map appSettings, boolean isCreation)Binding Function App with Application Insights Will follow the below sequence appInsightsKey -> appInsightsInstance -> Create New AI Instance (Function creation only)private com.microsoft.azure.toolkit.lib.applicationinsights.ApplicationInsightsEntitycreateApplicationInsights(String name)protected com.microsoft.azure.toolkit.lib.appservice.service.IFunctionAppDeploymentSlotcreateDeploymentSlot(com.microsoft.azure.toolkit.lib.appservice.service.IFunctionAppDeploymentSlot deploymentSlot)protected com.microsoft.azure.toolkit.lib.appservice.service.IFunctionAppcreateFunctionApp(com.microsoft.azure.toolkit.lib.appservice.service.IFunctionApp functionApp)protected com.microsoft.azure.toolkit.lib.appservice.service.IFunctionAppBasecreateOrUpdateResource()private voiddeployArtifact(com.microsoft.azure.toolkit.lib.appservice.service.IFunctionAppBase target)protected voiddoExecute()protected voiddoValidate()private com.microsoft.azure.toolkit.lib.applicationinsights.ApplicationInsightsEntitygetApplicationInsights(String appInsightsInstance)private FilegetArtifactToDeploy()private com.microsoft.azure.toolkit.lib.appservice.model.DockerConfigurationgetDockerConfiguration()private com.microsoft.azure.toolkit.lib.applicationinsights.ApplicationInsightsEntitygetOrCreateApplicationInsights(boolean enableCreation)private com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlangetOrCreateAppServicePlan()private com.microsoft.azure.toolkit.lib.common.model.ResourceGroupgetOrCreateResourceGroup()private com.microsoft.azure.toolkit.lib.appservice.model.PricingTiergetParsedPricingTier()private com.microsoft.azure.toolkit.lib.common.model.RegiongetParsedRegion()private com.microsoft.azure.toolkit.lib.appservice.model.RuntimegetRuntime()private com.microsoft.azure.toolkit.lib.appservice.model.RuntimegetRuntimeOrDefault()private StringgetServicePlanResourceGroup()private List<com.microsoft.azure.toolkit.lib.appservice.entity.FunctionEntity>listFunctions(com.microsoft.azure.toolkit.lib.appservice.service.IFunctionApp functionApp)protected voidlistHTTPTriggerUrls(com.microsoft.azure.toolkit.lib.appservice.service.IFunctionApp target)List anonymous HTTP Triggers url after deploymentprivate FilepackageStagingDirectory()voidprocessAppSettingsWithDefaultValue()private voidsetDefaultAppSetting(Map result, String settingName, String settingIsEmptyMessage, String defaultValue, String warningMessage)protected com.microsoft.azure.toolkit.lib.appservice.service.IFunctionAppDeploymentSlotupdateDeploymentSlot(com.microsoft.azure.toolkit.lib.appservice.service.IFunctionAppDeploymentSlot deploymentSlot)protected com.microsoft.azure.toolkit.lib.appservice.service.IFunctionAppupdateFunctionApp(com.microsoft.azure.toolkit.lib.appservice.service.IFunctionApp functionApp)private voidvalidateApplicationInsightsConfiguration()protected voidvalidateArtifactCompileVersion()protected voidvalidateParameters()Deprecated.-
Methods inherited from class com.microsoft.azure.maven.function.AbstractFunctionMojo
getAppInsightsInstance, getAppInsightsKey, getFinalName, getFunctionApp, getRegion, getRuntimeConfiguration, getTelemetryProperties, isDisableAppInsights, isSkipMojo, validateAppName
-
Methods inherited from class com.microsoft.azure.maven.AbstractAppServiceMojo
getAppName, getAppServicePlanName, getAppServicePlanResourceGroup, getAppSettings, getDeploymentSlotSetting, getDeploymentStagingDirectoryPath, getDeploymentType, getOrCreateAzureAppServiceClient, getPortalUrl, getResourceGroup, getResourcePortalUrl, getResources, printCurrentSubscription, setDeploymentSlot
-
Methods inherited from class com.microsoft.azure.maven.AbstractAzureMojo
afterMojoExecution, beforeMojoExecution, checkSubscription, execute, executeWithTimeRecorder, getActualAuthType, getAuthenticationSetting, getAuthType, getAzureAccount, getAzureClient, getBuildDirectoryAbsolutePath, getHttpProxyHost, getHttpProxyPort, getInstallationId, getMavenResourcesFiltering, getOrCreateAzureClient, getPluginName, getPluginVersion, getProject, getSession, getSessionId, getSettings, getSubscriptionId, getTargetSubscriptionId, getTelemetries, getTelemetryProxy, getUserAgent, highlightDefaultValue, infoWithMultipleLines, initTelemetryProxy, isAllowTelemetry, isFailsOnError, login, onMojoError, onSkipped, printCredentialDescription, printCurrentSubscription, selectSubscription, selectSubscription, trackMojoFailure
-
-
-
-
Field Detail
-
DEPLOY_START
private static final String DEPLOY_START
- See Also:
- Constant Field Values
-
DEPLOY_FINISH
private static final String DEPLOY_FINISH
- See Also:
- Constant Field Values
-
FUNCTION_SLOT_CREATE_START
private static final String FUNCTION_SLOT_CREATE_START
- See Also:
- Constant Field Values
-
FUNCTION_SLOT_CREATED
private static final String FUNCTION_SLOT_CREATED
- See Also:
- Constant Field Values
-
FUNCTION_SLOT_UPDATE
private static final String FUNCTION_SLOT_UPDATE
- See Also:
- Constant Field Values
-
FUNCTION_SLOT_UPDATE_DONE
private static final String FUNCTION_SLOT_UPDATE_DONE
- See Also:
- Constant Field Values
-
APPINSIGHTS_INSTRUMENTATION_KEY
private static final String APPINSIGHTS_INSTRUMENTATION_KEY
- See Also:
- Constant Field Values
-
APPLICATION_INSIGHTS_CONFIGURATION_CONFLICT
private static final String APPLICATION_INSIGHTS_CONFIGURATION_CONFLICT
- See Also:
- Constant Field Values
-
FAILED_TO_GET_APPLICATION_INSIGHTS
private static final String FAILED_TO_GET_APPLICATION_INSIGHTS
- See Also:
- Constant Field Values
-
SKIP_CREATING_APPLICATION_INSIGHTS
private static final String SKIP_CREATING_APPLICATION_INSIGHTS
- See Also:
- Constant Field Values
-
APPLICATION_INSIGHTS_CREATE_START
private static final String APPLICATION_INSIGHTS_CREATE_START
- See Also:
- Constant Field Values
-
APPLICATION_INSIGHTS_CREATED
private static final String APPLICATION_INSIGHTS_CREATED
- See Also:
- Constant Field Values
-
APPLICATION_INSIGHTS_CREATE_FAILED
private static final String APPLICATION_INSIGHTS_CREATE_FAILED
- See Also:
- Constant Field Values
-
INSTRUMENTATION_KEY_IS_NOT_VALID
private static final String INSTRUMENTATION_KEY_IS_NOT_VALID
- See Also:
- Constant Field Values
-
UNABLE_TO_LIST_NONE_ANONYMOUS_HTTP_TRIGGERS
private static final String UNABLE_TO_LIST_NONE_ANONYMOUS_HTTP_TRIGGERS
- See Also:
- Constant Field Values
-
HTTP_TRIGGER_URLS
private static final String HTTP_TRIGGER_URLS
- See Also:
- Constant Field Values
-
NO_ANONYMOUS_HTTP_TRIGGER
private static final String NO_ANONYMOUS_HTTP_TRIGGER
- See Also:
- Constant Field Values
-
AUTH_LEVEL
private static final String AUTH_LEVEL
- See Also:
- Constant Field Values
-
HTTP_TRIGGER
private static final String HTTP_TRIGGER
- See Also:
- Constant Field Values
-
ARTIFACT_INCOMPATIBLE
private static final String ARTIFACT_INCOMPATIBLE
- See Also:
- Constant Field Values
-
FUNCTIONS_WORKER_RUNTIME_NAME
private static final String FUNCTIONS_WORKER_RUNTIME_NAME
- See Also:
- Constant Field Values
-
FUNCTIONS_WORKER_RUNTIME_VALUE
private static final String FUNCTIONS_WORKER_RUNTIME_VALUE
- See Also:
- Constant Field Values
-
SET_FUNCTIONS_WORKER_RUNTIME
private static final String SET_FUNCTIONS_WORKER_RUNTIME
- See Also:
- Constant Field Values
-
CUSTOMIZED_FUNCTIONS_WORKER_RUNTIME_WARNING
private static final String CUSTOMIZED_FUNCTIONS_WORKER_RUNTIME_WARNING
- See Also:
- Constant Field Values
-
FUNCTIONS_EXTENSION_VERSION_NAME
private static final String FUNCTIONS_EXTENSION_VERSION_NAME
- See Also:
- Constant Field Values
-
FUNCTIONS_EXTENSION_VERSION_VALUE
private static final String FUNCTIONS_EXTENSION_VERSION_VALUE
- See Also:
- Constant Field Values
-
SET_FUNCTIONS_EXTENSION_VERSION
private static final String SET_FUNCTIONS_EXTENSION_VERSION
- See Also:
- Constant Field Values
-
RUNNING
private static final String RUNNING
- See Also:
- Constant Field Values
-
CREATE_FUNCTION_APP
private static final String CREATE_FUNCTION_APP
- See Also:
- Constant Field Values
-
CREATE_FUNCTION_APP_DONE
private static final String CREATE_FUNCTION_APP_DONE
- See Also:
- Constant Field Values
-
CREATE_APP_SERVICE_PLAN
private static final String CREATE_APP_SERVICE_PLAN
- See Also:
- Constant Field Values
-
CREATE_APP_SERVICE_DONE
private static final String CREATE_APP_SERVICE_DONE
- See Also:
- Constant Field Values
-
CREATE_RESOURCE_GROUP
private static final String CREATE_RESOURCE_GROUP
- See Also:
- Constant Field Values
-
CREATE_RESOURCE_GROUP_DONE
private static final String CREATE_RESOURCE_GROUP_DONE
- See Also:
- Constant Field Values
-
CREATE_NEW_FUNCTION_APP
private static final String CREATE_NEW_FUNCTION_APP
- See Also:
- Constant Field Values
-
CREATE_NEW_APP_SERVICE_PLAN
private static final String CREATE_NEW_APP_SERVICE_PLAN
- See Also:
- Constant Field Values
-
CREATE_NEW_RESOURCE_GROUP
private static final String CREATE_NEW_RESOURCE_GROUP
- See Also:
- Constant Field Values
-
UPDATE_FUNCTION_APP
private static final String UPDATE_FUNCTION_APP
- See Also:
- Constant Field Values
-
UPDATE_FUNCTION_DONE
private static final String UPDATE_FUNCTION_DONE
- See Also:
- Constant Field Values
-
NO_ARTIFACT_FOUNDED
private static final String NO_ARTIFACT_FOUNDED
- See Also:
- Constant Field Values
-
LOCAL_SETTINGS_FILE
private static final String LOCAL_SETTINGS_FILE
- See Also:
- Constant Field Values
-
LIST_TRIGGERS_MAX_RETRY
private static final int LIST_TRIGGERS_MAX_RETRY
- See Also:
- Constant Field Values
-
LIST_TRIGGERS_RETRY_PERIOD_IN_SECONDS
private static final int LIST_TRIGGERS_RETRY_PERIOD_IN_SECONDS
- See Also:
- Constant Field Values
-
SYNCING_TRIGGERS_AND_FETCH_FUNCTION_INFORMATION
private static final String SYNCING_TRIGGERS_AND_FETCH_FUNCTION_INFORMATION
- See Also:
- Constant Field Values
-
NO_TRIGGERS_FOUNDED
private static final String NO_TRIGGERS_FOUNDED
- See Also:
- Constant Field Values
-
APP_NAME_PATTERN
private static final String APP_NAME_PATTERN
- See Also:
- Constant Field Values
-
RESOURCE_GROUP_PATTERN
private static final String RESOURCE_GROUP_PATTERN
- See Also:
- Constant Field Values
-
SLOT_NAME_PATTERN
private static final String SLOT_NAME_PATTERN
- See Also:
- Constant Field Values
-
APP_SERVICE_PLAN_NAME_PATTERN
private static final String APP_SERVICE_PLAN_NAME_PATTERN
- See Also:
- Constant Field Values
-
EMPTY_APP_NAME
private static final String EMPTY_APP_NAME
- See Also:
- Constant Field Values
-
INVALID_APP_NAME
private static final String INVALID_APP_NAME
- See Also:
- Constant Field Values
-
EMPTY_RESOURCE_GROUP
private static final String EMPTY_RESOURCE_GROUP
- See Also:
- Constant Field Values
-
INVALID_RESOURCE_GROUP_NAME
private static final String INVALID_RESOURCE_GROUP_NAME
- See Also:
- Constant Field Values
-
INVALID_SERVICE_PLAN_NAME
private static final String INVALID_SERVICE_PLAN_NAME
- See Also:
- Constant Field Values
-
INVALID_SERVICE_PLAN_RESOURCE_GROUP_NAME
private static final String INVALID_SERVICE_PLAN_RESOURCE_GROUP_NAME
- See Also:
- Constant Field Values
-
EMPTY_SLOT_NAME
private static final String EMPTY_SLOT_NAME
- See Also:
- Constant Field Values
-
INVALID_SLOT_NAME
private static final String INVALID_SLOT_NAME
- See Also:
- Constant Field Values
-
INVALID_REGION
private static final String INVALID_REGION
- See Also:
- Constant Field Values
-
EMPTY_IMAGE_NAME
private static final String EMPTY_IMAGE_NAME
- See Also:
- Constant Field Values
-
INVALID_OS
private static final String INVALID_OS
- See Also:
- Constant Field Values
-
INVALID_JAVA_VERSION
private static final String INVALID_JAVA_VERSION
- See Also:
- Constant Field Values
-
INVALID_PRICING_TIER
private static final String INVALID_PRICING_TIER
- See Also:
- Constant Field Values
-
FAILED_TO_LIST_TRIGGERS
private static final String FAILED_TO_LIST_TRIGGERS
- See Also:
- Constant Field Values
-
SKIP_DEPLOYMENT_FOR_DOCKER_APP_SERVICE
private static final String SKIP_DEPLOYMENT_FOR_DOCKER_APP_SERVICE
- See Also:
- Constant Field Values
-
az
private com.microsoft.azure.toolkit.lib.appservice.AzureAppService az
-
-
Method Detail
-
doExecute
protected void doExecute() throws com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException- Specified by:
doExecutein classcom.microsoft.azure.maven.AbstractAzureMojo- Throws:
com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
-
doValidate
protected void doValidate() throws com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException- Throws:
com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
-
validateParameters
@Deprecated protected void validateParameters()
Deprecated.
-
createOrUpdateResource
protected com.microsoft.azure.toolkit.lib.appservice.service.IFunctionAppBase createOrUpdateResource() throws com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException- Throws:
com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
-
createFunctionApp
protected com.microsoft.azure.toolkit.lib.appservice.service.IFunctionApp createFunctionApp(com.microsoft.azure.toolkit.lib.appservice.service.IFunctionApp functionApp) throws com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException- Throws:
com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
-
getOrCreateAppServicePlan
private com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan getOrCreateAppServicePlan()
-
getParsedRegion
private com.microsoft.azure.toolkit.lib.common.model.Region getParsedRegion()
-
getParsedPricingTier
private com.microsoft.azure.toolkit.lib.appservice.model.PricingTier getParsedPricingTier()
-
getOrCreateResourceGroup
private com.microsoft.azure.toolkit.lib.common.model.ResourceGroup getOrCreateResourceGroup()
-
getRuntimeOrDefault
private com.microsoft.azure.toolkit.lib.appservice.model.Runtime getRuntimeOrDefault()
-
getRuntime
private com.microsoft.azure.toolkit.lib.appservice.model.Runtime getRuntime()
-
getDockerConfiguration
private com.microsoft.azure.toolkit.lib.appservice.model.DockerConfiguration getDockerConfiguration() throws com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException- Throws:
com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
-
updateFunctionApp
protected com.microsoft.azure.toolkit.lib.appservice.service.IFunctionApp updateFunctionApp(com.microsoft.azure.toolkit.lib.appservice.service.IFunctionApp functionApp) throws com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException- Throws:
com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
-
getServicePlanResourceGroup
private String getServicePlanResourceGroup()
-
createDeploymentSlot
protected com.microsoft.azure.toolkit.lib.appservice.service.IFunctionAppDeploymentSlot createDeploymentSlot(com.microsoft.azure.toolkit.lib.appservice.service.IFunctionAppDeploymentSlot deploymentSlot) throws com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException- Throws:
com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
-
updateDeploymentSlot
protected com.microsoft.azure.toolkit.lib.appservice.service.IFunctionAppDeploymentSlot updateDeploymentSlot(com.microsoft.azure.toolkit.lib.appservice.service.IFunctionAppDeploymentSlot deploymentSlot) throws com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException- Throws:
com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
-
deployArtifact
private void deployArtifact(com.microsoft.azure.toolkit.lib.appservice.service.IFunctionAppBase target) throws com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException- Throws:
com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
-
packageStagingDirectory
private File packageStagingDirectory()
-
listHTTPTriggerUrls
protected void listHTTPTriggerUrls(com.microsoft.azure.toolkit.lib.appservice.service.IFunctionApp target)
List anonymous HTTP Triggers url after deployment
-
listFunctions
private List<com.microsoft.azure.toolkit.lib.appservice.entity.FunctionEntity> listFunctions(com.microsoft.azure.toolkit.lib.appservice.service.IFunctionApp functionApp)
-
validateArtifactCompileVersion
protected void validateArtifactCompileVersion() throws com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException- Throws:
com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
-
processAppSettingsWithDefaultValue
public void processAppSettingsWithDefaultValue()
-
setDefaultAppSetting
private void setDefaultAppSetting(Map result, String settingName, String settingIsEmptyMessage, String defaultValue, String warningMessage)
-
getArtifactToDeploy
private File getArtifactToDeploy() throws com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
- Throws:
com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
-
bindApplicationInsights
private void bindApplicationInsights(Map appSettings, boolean isCreation) throws com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
Binding Function App with Application Insights Will follow the below sequence appInsightsKey -> appInsightsInstance -> Create New AI Instance (Function creation only)- Parameters:
appSettings- App settings mapisCreation- Define the stage of function app, as we only create ai instance by default when create new function apps- Throws:
com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException- When there are conflicts in configuration or meet errors while finding/creating application insights instance
-
validateApplicationInsightsConfiguration
private void validateApplicationInsightsConfiguration() throws com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException- Throws:
com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
-
getOrCreateApplicationInsights
private com.microsoft.azure.toolkit.lib.applicationinsights.ApplicationInsightsEntity getOrCreateApplicationInsights(boolean enableCreation)
-
getApplicationInsights
private com.microsoft.azure.toolkit.lib.applicationinsights.ApplicationInsightsEntity getApplicationInsights(String appInsightsInstance)
-
createApplicationInsights
private com.microsoft.azure.toolkit.lib.applicationinsights.ApplicationInsightsEntity createApplicationInsights(String name)
-
-