use of com.microsoft.azure.gradle.configuration.GradleDeploymentSlotConfig 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;
}
use of com.microsoft.azure.gradle.configuration.GradleDeploymentSlotConfig in project azure-gradle-plugins by microsoft.
the class AzureWebappPluginExtension method setDeploymentSlot.
public void setDeploymentSlot(Closure closure) {
deploymentSlot = new GradleDeploymentSlotConfig();
project.configure(deploymentSlot, closure);
}
use of com.microsoft.azure.gradle.configuration.GradleDeploymentSlotConfig in project azure-gradle-plugins by microsoft.
the class DeployTask method parseConfiguration.
private GradleWebAppConfig parseConfiguration() {
final AzureWebappPluginExtension ctx = this.azureWebappExtension;
GradleWebAppConfig config = new GradleWebAppConfig();
config.subscriptionId(ctx.getSubscription());
config.resourceGroup(ctx.getResourceGroup());
config.appName(ctx.getAppName());
config.pricingTier(ctx.getPricingTier());
config.region(ctx.getRegion());
config.runtime(ctx.getRuntime());
config.appSettings(ctx.getAppSettings());
config.servicePlanName(ctx.getAppServicePlanName());
config.servicePlanResourceGroup(ctx.getAppServicePlanResourceGroup());
config.deploymentSlotName(Optional.ofNullable(ctx.getDeploymentSlot()).map(GradleDeploymentSlotConfig::name).orElse(null));
config.deploymentSlotConfigurationSource(Optional.ofNullable(ctx.getDeploymentSlot()).map(GradleDeploymentSlotConfig::configurationSource).orElse(null));
if (StringUtils.isNotBlank(this.artifactFile)) {
File file = new File(this.artifactFile);
if (!file.exists()) {
throw new AzureToolkitRuntimeException(String.format("artifact file(%s) cannot be found.", file.getAbsolutePath()));
}
final WebAppArtifact webAppArtifact = WebAppArtifact.builder().deployType(Utils.getDeployTypeByFileExtension(file)).file(file).build();
config.webAppArtifacts(Collections.singletonList(webAppArtifact));
}
return config;
}
use of com.microsoft.azure.gradle.configuration.GradleDeploymentSlotConfig in project azure-gradle-plugins by microsoft.
the class AzureFunctionsExtension method setDeploymentSlot.
public void setDeploymentSlot(Closure closure) {
deploymentSlot = new GradleDeploymentSlotConfig();
project.configure(deploymentSlot, closure);
}
Aggregations