public abstract class AbstractAzureMojo extends org.apache.maven.plugin.AbstractMojo implements TelemetryConfiguration, AuthConfiguration
| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractAzureMojo.DefaultUncaughtExceptionHandler |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
allowTelemetry
Boolean flag to turn on/off telemetry within current Maven plugin.
|
protected com.microsoft.azure.auth.configuration.AuthConfiguration |
auth |
static String |
AUTH_METHOD |
static String |
AUTH_TYPE |
protected AuthenticationSetting |
authentication
Authentication setting for Azure Management API.
Below are the supported sub-elements within <authentication>. |
private boolean |
authInitialized |
protected String |
authType
Authentication type, could be OAuth, DeviceLogin, Azure_CLI, Azure_Secret_File
If this is not set, maven plugin try all available auth methods with default order
|
private com.microsoft.azure.management.Azure |
azure |
static String |
AZURE_INIT_FAIL |
private com.microsoft.azure.auth.AzureTokenWrapper |
azureTokenWrapper |
protected File |
buildDirectory |
private static String |
CONFIGURATION_PATH |
protected boolean |
failsOnError
Boolean flag to control whether throwing exception from current Maven plugin when meeting any error.
If set to true, the exception from current Maven plugin will fail the current Maven run. |
static String |
FAILURE_REASON |
private static String |
FIRST_RUN_KEY |
protected String |
httpProxyHost
Use a HTTP proxy host for the Azure Auth Client
|
protected int |
httpProxyPort
Use a HTTP proxy port for the Azure Auth Client
|
static String |
INIT_FAILURE |
static String |
INSTALLATION_ID_KEY |
private String |
installationId |
private static String |
INVALID_AUTH_TYPE |
protected org.apache.maven.shared.filtering.MavenResourcesFiltering |
mavenResourcesFiltering |
protected org.apache.maven.plugin.descriptor.PluginDescriptor |
plugin |
static String |
PLUGIN_NAME_KEY |
static String |
PLUGIN_VERSION_KEY |
private static String |
PRIVACY_STATEMENT |
protected org.apache.maven.project.MavenProject |
project |
protected org.apache.maven.execution.MavenSession |
session |
static String |
SESSION_ID_KEY |
private String |
sessionId |
protected org.apache.maven.settings.Settings |
settings
The system settings for Maven.
|
protected org.apache.maven.settings.crypto.SettingsDecrypter |
settingsDecrypter |
static String |
SUBSCRIPTION_ID_KEY |
protected String |
subscriptionId
Azure subscription Id.
|
static String |
TELEMETRY_NOT_ALLOWED |
private TelemetryProxy |
telemetryProxy |
private static String |
UNSUPPORTED_AZURE_ENVIRONMENT |
private static String |
USING_AZURE_ENVIRONMENT |
| Constructor and Description |
|---|
AbstractAzureMojo() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
doExecute()
Entry point of sub-class.
|
void |
execute() |
AuthenticationSetting |
getAuthenticationSetting() |
String |
getAuthMethod() |
protected com.microsoft.azure.auth.configuration.AuthType |
getAuthTypeEnum() |
com.microsoft.azure.management.Azure |
getAzureClient() |
protected com.microsoft.azure.management.Azure |
getAzureClientByAuthType() |
protected com.microsoft.azure.auth.AzureTokenWrapper |
getAzureTokenWrapper() |
String |
getBuildDirectoryAbsolutePath() |
String |
getHttpProxyHost() |
int |
getHttpProxyPort() |
String |
getInstallationId() |
org.apache.maven.shared.filtering.MavenResourcesFiltering |
getMavenResourcesFiltering() |
String |
getPluginName() |
String |
getPluginVersion() |
org.apache.maven.project.MavenProject |
getProject() |
org.apache.maven.execution.MavenSession |
getSession() |
String |
getSessionId() |
org.apache.maven.settings.Settings |
getSettings() |
String |
getSubscriptionId() |
Map<String,String> |
getTelemetryProperties() |
TelemetryProxy |
getTelemetryProxy() |
String |
getUserAgent() |
protected void |
handleException(Exception exception) |
void |
infoWithMultipleLines(String messages) |
protected void |
initAuth() |
protected void |
initializeAuthConfiguration() |
protected void |
initTelemetry() |
protected boolean |
isAuthConfigurationExist() |
boolean |
isFailingOnError() |
private boolean |
isFirstRun(Properties prop) |
protected boolean |
isSkipMojo()
Sub-class can override this method to decide whether skip execution.
|
boolean |
isTelemetryAllowed() |
protected void |
trackMojoFailure(String message) |
protected void |
trackMojoSkip() |
protected void |
trackMojoStart() |
protected void |
trackMojoSuccess() |
private void |
updateConfigurationFile(Properties prop) |
public static final String PLUGIN_NAME_KEY
public static final String PLUGIN_VERSION_KEY
public static final String INSTALLATION_ID_KEY
public static final String SESSION_ID_KEY
public static final String SUBSCRIPTION_ID_KEY
public static final String AUTH_TYPE
public static final String AUTH_METHOD
public static final String TELEMETRY_NOT_ALLOWED
public static final String INIT_FAILURE
public static final String AZURE_INIT_FAIL
public static final String FAILURE_REASON
private static final String CONFIGURATION_PATH
private static final String FIRST_RUN_KEY
private static final String PRIVACY_STATEMENT
private static final String INVALID_AUTH_TYPE
private static final String UNSUPPORTED_AZURE_ENVIRONMENT
private static final String USING_AZURE_ENVIRONMENT
@Parameter(defaultValue="${project}",
readonly=true,
required=true)
protected org.apache.maven.project.MavenProject project
@Parameter(defaultValue="${session}",
readonly=true,
required=true)
protected org.apache.maven.execution.MavenSession session
@Parameter(defaultValue="${project.build.directory}",
readonly=true,
required=true)
protected File buildDirectory
@Parameter(defaultValue="${plugin}",
readonly=true,
required=true)
protected org.apache.maven.plugin.descriptor.PluginDescriptor plugin
@Parameter(defaultValue="${settings}",
readonly=true,
required=true)
protected org.apache.maven.settings.Settings settings
@Component(role=org.apache.maven.shared.filtering.MavenResourcesFiltering.class,
hint="default")
protected org.apache.maven.shared.filtering.MavenResourcesFiltering mavenResourcesFiltering
@Parameter protected AuthenticationSetting authentication
<authentication>. You can use one of them to authenticate
with azure<serverId> specifies the credentials of your Azure service principal, by referencing a server definition
in Maven's settings.xml<file> specifies the absolute path of your authentication file for Azure.@Parameter protected String subscriptionId
@Parameter(property="allowTelemetry",
defaultValue="true")
protected boolean allowTelemetry
@Parameter(property="failsOnError",
defaultValue="true")
protected boolean failsOnError
@Parameter(property="httpProxyHost",
readonly=false,
required=false)
protected String httpProxyHost
@Parameter(property="httpProxyPort",
defaultValue="80")
protected int httpProxyPort
@Parameter(property="authType") protected String authType
@Parameter(property="auth") protected com.microsoft.azure.auth.configuration.AuthConfiguration auth
@Component protected org.apache.maven.settings.crypto.SettingsDecrypter settingsDecrypter
private com.microsoft.azure.management.Azure azure
private TelemetryProxy telemetryProxy
private com.microsoft.azure.auth.AzureTokenWrapper azureTokenWrapper
private String sessionId
private String installationId
private boolean authInitialized
public org.apache.maven.project.MavenProject getProject()
public org.apache.maven.execution.MavenSession getSession()
public String getBuildDirectoryAbsolutePath()
public org.apache.maven.shared.filtering.MavenResourcesFiltering getMavenResourcesFiltering()
public org.apache.maven.settings.Settings getSettings()
getSettings in interface AuthConfigurationpublic AuthenticationSetting getAuthenticationSetting()
getAuthenticationSetting in interface AuthConfigurationpublic String getSubscriptionId()
getSubscriptionId in interface AuthConfigurationpublic boolean isTelemetryAllowed()
public boolean isFailingOnError()
public String getSessionId()
public String getInstallationId()
public String getPluginName()
public String getPluginVersion()
public String getUserAgent()
getUserAgent in interface AuthConfigurationpublic String getHttpProxyHost()
getHttpProxyHost in interface AuthConfigurationpublic int getHttpProxyPort()
getHttpProxyPort in interface AuthConfigurationpublic com.microsoft.azure.management.Azure getAzureClient()
throws AzureAuthFailureException
AzureAuthFailureExceptionprotected com.microsoft.azure.management.Azure getAzureClientByAuthType()
throws AzureAuthFailureException
AzureAuthFailureExceptionprotected com.microsoft.azure.auth.AzureTokenWrapper getAzureTokenWrapper()
protected com.microsoft.azure.auth.configuration.AuthType getAuthTypeEnum()
public TelemetryProxy getTelemetryProxy()
protected void initTelemetry()
protected void initAuth()
throws AzureAuthFailureException
AzureAuthFailureExceptionprotected void initializeAuthConfiguration()
throws AzureAuthFailureException
AzureAuthFailureExceptionprotected boolean isAuthConfigurationExist()
public Map<String,String> getTelemetryProperties()
getTelemetryProperties in interface TelemetryConfigurationpublic String getAuthMethod()
public void execute()
throws org.apache.maven.plugin.MojoExecutionException
execute in interface org.apache.maven.plugin.Mojoorg.apache.maven.plugin.MojoExecutionExceptionprotected boolean isSkipMojo()
protected abstract void doExecute()
throws AzureExecutionException
AzureExecutionExceptionprotected void trackMojoSkip()
protected void trackMojoStart()
protected void trackMojoSuccess()
protected void trackMojoFailure(String message)
protected void handleException(Exception exception) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprivate boolean isFirstRun(Properties prop)
private void updateConfigurationFile(Properties prop)
public void infoWithMultipleLines(String messages)
Copyright © 2020. All rights reserved.