Search in sources :

Example 1 with MavenDockerCredentialProvider

use of com.microsoft.azure.maven.MavenDockerCredentialProvider in project azure-maven-plugins by microsoft.

the class ConfigParser method getRuntimeConfig.

public RuntimeConfig getRuntimeConfig() throws AzureExecutionException {
    final RuntimeConfiguration runtime = mojo.getRuntimeConfiguration();
    if (runtime == null) {
        return null;
    }
    final OperatingSystem os = Optional.ofNullable(runtime.getOs()).map(OperatingSystem::fromString).orElse(null);
    final JavaVersion javaVersion = Optional.ofNullable(runtime.getJavaVersion()).map(JavaVersion::fromString).orElse(null);
    final RuntimeConfig result = new RuntimeConfig().os(os).javaVersion(javaVersion).webContainer(WebContainer.JAVA_OFF).image(runtime.getImage()).registryUrl(runtime.getRegistryUrl());
    if (StringUtils.isNotEmpty(runtime.getServerId())) {
        final MavenDockerCredentialProvider credentialProvider = MavenDockerCredentialProvider.fromMavenSettings(mojo.getSettings(), runtime.getServerId());
        result.username(credentialProvider.getUsername()).password(credentialProvider.getPassword());
    }
    return result;
}
Also used : OperatingSystem(com.microsoft.azure.toolkit.lib.appservice.model.OperatingSystem) MavenDockerCredentialProvider(com.microsoft.azure.maven.MavenDockerCredentialProvider) RuntimeConfig(com.microsoft.azure.toolkit.lib.appservice.config.RuntimeConfig) JavaVersion(com.microsoft.azure.toolkit.lib.appservice.model.JavaVersion) RuntimeConfiguration(com.microsoft.azure.toolkit.lib.legacy.function.configurations.RuntimeConfiguration)

Example 2 with MavenDockerCredentialProvider

use of com.microsoft.azure.maven.MavenDockerCredentialProvider in project azure-maven-plugins by microsoft.

the class ConfigParser method getRuntimeConfig.

private RuntimeConfig getRuntimeConfig() throws AzureExecutionException {
    final MavenRuntimeConfig runtime = mojo.getRuntime();
    if (runtime == null || runtime.isEmpty()) {
        return null;
    }
    final OperatingSystem os = getOs(runtime);
    final JavaVersion javaVersion = StringUtils.isEmpty(runtime.getJavaVersion()) ? null : parseExpandableParameter(JavaVersion::fromString, runtime.getJavaVersion(), EXPANDABLE_JAVA_VERSION_WARNING);
    final WebContainer webContainer = StringUtils.isEmpty(runtime.getWebContainer()) ? null : parseExpandableParameter(WebContainer::fromString, runtime.getWebContainer(), EXPANDABLE_WEB_CONTAINER_WARNING);
    final RuntimeConfig result = new RuntimeConfig().os(os).javaVersion(javaVersion).webContainer(webContainer).image(runtime.getImage()).registryUrl(runtime.getRegistryUrl());
    if (StringUtils.isNotEmpty(runtime.getServerId())) {
        final MavenDockerCredentialProvider credentialProvider = getDockerCredential(runtime.getServerId());
        result.username(credentialProvider.getUsername()).password(credentialProvider.getPassword());
    }
    return result;
}
Also used : OperatingSystem(com.microsoft.azure.toolkit.lib.appservice.model.OperatingSystem) MavenDockerCredentialProvider(com.microsoft.azure.maven.MavenDockerCredentialProvider) MavenRuntimeConfig(com.microsoft.azure.maven.webapp.configuration.MavenRuntimeConfig) WebContainer(com.microsoft.azure.toolkit.lib.appservice.model.WebContainer) RuntimeConfig(com.microsoft.azure.toolkit.lib.appservice.config.RuntimeConfig) MavenRuntimeConfig(com.microsoft.azure.maven.webapp.configuration.MavenRuntimeConfig) JavaVersion(com.microsoft.azure.toolkit.lib.appservice.model.JavaVersion)

Aggregations

MavenDockerCredentialProvider (com.microsoft.azure.maven.MavenDockerCredentialProvider)2 RuntimeConfig (com.microsoft.azure.toolkit.lib.appservice.config.RuntimeConfig)2 JavaVersion (com.microsoft.azure.toolkit.lib.appservice.model.JavaVersion)2 OperatingSystem (com.microsoft.azure.toolkit.lib.appservice.model.OperatingSystem)2 MavenRuntimeConfig (com.microsoft.azure.maven.webapp.configuration.MavenRuntimeConfig)1 WebContainer (com.microsoft.azure.toolkit.lib.appservice.model.WebContainer)1 RuntimeConfiguration (com.microsoft.azure.toolkit.lib.legacy.function.configurations.RuntimeConfiguration)1