Class 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 AbstractFunctionMojo
    Deploy artifacts to target Azure Functions in Azure. If target Azure Functions doesn't exist, it will be created.
    • Constructor Detail

      • DeployMojo

        public DeployMojo()
    • Method Detail

      • doExecute

        protected void doExecute()
                          throws com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
        Specified by:
        doExecute in class com.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 map
        isCreation - 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)