Search in sources :

Example 1 with DockerImageType

use of com.microsoft.azure.toolkit.lib.legacy.appservice.DockerImageType in project azure-gradle-plugins by microsoft.

the class AzureWebappPluginExtension method getTelemetryProperties.

public Map<String, String> getTelemetryProperties() {
    final Map<String, String> result = new HashMap<>();
    final GradleRuntimeConfig runtime = getRuntime();
    final String os = java.util.Optional.ofNullable(runtime).map(GradleRuntimeConfig::os).orElse(null);
    result.put(OS_KEY, os);
    result.put(JAVA_VERSION_KEY, java.util.Optional.ofNullable(runtime).map(GradleRuntimeConfig::javaVersion).orElse(null));
    result.put(JAVA_WEB_CONTAINER_KEY, java.util.Optional.ofNullable(runtime).map(GradleRuntimeConfig::webContainer).orElse(null));
    result.put(PRICING_TIER_KEY, pricingTier);
    result.put(REGION_KEY, region);
    if (runtime != null && StringUtils.equalsIgnoreCase(os, OperatingSystem.DOCKER.getValue())) {
        final boolean isCustomRegistry = StringUtils.isNotEmpty(runtime.registryUrl());
        final DockerImageType imageType;
        if (isCustomRegistry) {
            imageType = StringUtils.isEmpty(runtime.password()) ? DockerImageType.PRIVATE_REGISTRY : DockerImageType.UNKNOWN;
        } else {
            imageType = StringUtils.isEmpty(runtime.password()) ? DockerImageType.PRIVATE_DOCKER_HUB : DockerImageType.PUBLIC_DOCKER_HUB;
        }
        result.put(DOCKER_IMAGE_TYPE_KEY, imageType.name());
    } else {
        result.put(DOCKER_IMAGE_TYPE_KEY, DockerImageType.NONE.toString());
    }
    final boolean isDeployToSlot = java.util.Optional.ofNullable(getDeploymentSlot()).map(GradleDeploymentSlotConfig::name).map(StringUtils::isNotEmpty).orElse(false);
    result.put(DEPLOY_TO_SLOT_KEY, String.valueOf(isDeployToSlot));
    result.put(SKIP_CREATE_RESOURCE_KEY, System.getProperty("azure.resource.create.skip", "false"));
    return result;
}
Also used : GradleRuntimeConfig(com.microsoft.azure.gradle.configuration.GradleRuntimeConfig) DockerImageType(com.microsoft.azure.toolkit.lib.legacy.appservice.DockerImageType) GradleDeploymentSlotConfig(com.microsoft.azure.gradle.configuration.GradleDeploymentSlotConfig) HashMap(java.util.HashMap)

Aggregations

GradleDeploymentSlotConfig (com.microsoft.azure.gradle.configuration.GradleDeploymentSlotConfig)1 GradleRuntimeConfig (com.microsoft.azure.gradle.configuration.GradleRuntimeConfig)1 DockerImageType (com.microsoft.azure.toolkit.lib.legacy.appservice.DockerImageType)1 HashMap (java.util.HashMap)1