From d6ce418910a93d0a18b3185b844e96c2c218e981 Mon Sep 17 00:00:00 2001 From: bennettn4 Date: Mon, 18 Nov 2024 14:27:26 -0500 Subject: [PATCH] update azure gov values --- .../LandingZoneAzureConfiguration.java | 6 ++++-- .../step/CreateBatchLogSettingsStep.java | 21 +++++++++++-------- .../postgres/CreatePostgresqlDNSStep.java | 11 ++++++---- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/library/src/main/java/bio/terra/landingzone/library/configuration/LandingZoneAzureConfiguration.java b/library/src/main/java/bio/terra/landingzone/library/configuration/LandingZoneAzureConfiguration.java index 084de065..2ca057d6 100644 --- a/library/src/main/java/bio/terra/landingzone/library/configuration/LandingZoneAzureConfiguration.java +++ b/library/src/main/java/bio/terra/landingzone/library/configuration/LandingZoneAzureConfiguration.java @@ -37,11 +37,13 @@ public void setManagedAppTenantId(String managedAppTenantId) { this.managedAppTenantId = managedAppTenantId; } + + // AzureCloud or AzureUSGovernmentCloud public AzureEnvironment getAzureEnvironment() { switch (azureEnvironment) { - case "AZURE": + case "AzureCloud": return AzureEnvironment.AZURE; - case "AZURE_GOV": + case "AzureUSGovernmentCloud": return AzureEnvironment.AZURE_US_GOVERNMENT; default: throw new IllegalArgumentException( diff --git a/library/src/main/java/bio/terra/landingzone/stairway/flight/create/resource/step/CreateBatchLogSettingsStep.java b/library/src/main/java/bio/terra/landingzone/stairway/flight/create/resource/step/CreateBatchLogSettingsStep.java index 7c573d13..a6c584d5 100644 --- a/library/src/main/java/bio/terra/landingzone/stairway/flight/create/resource/step/CreateBatchLogSettingsStep.java +++ b/library/src/main/java/bio/terra/landingzone/stairway/flight/create/resource/step/CreateBatchLogSettingsStep.java @@ -6,10 +6,9 @@ import bio.terra.landingzone.stairway.flight.ResourceNameRequirements; import bio.terra.stairway.FlightContext; import bio.terra.stairway.StepResult; +import com.azure.resourcemanager.monitor.models.DiagnosticSettingsCategory; import java.util.List; import java.util.Optional; - -import com.azure.resourcemanager.monitor.models.DiagnosticSettingsCategory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,10 +39,14 @@ protected void createResource(FlightContext context, ArmManagers armManagers) { var batchLogSettingsName = resourceNameProvider.getName(getResourceType()); - - - for(DiagnosticSettingsCategory diagnosticSettingsCategory : armManagers.monitorManager().diagnosticSettings().listCategoriesByResource(batchAccountId)){ - logger.info("Currently valid diagnostic settings category for batch in current azure Environment :" +diagnosticSettingsCategory.name()); + for (DiagnosticSettingsCategory diagnosticSettingsCategory : + armManagers + .monitorManager() + .diagnosticSettings() + .listCategoriesByResource(batchAccountId)) { + logger.info( + "Currently valid diagnostic settings category for batch in current azure Environment :" + + diagnosticSettingsCategory.name()); } var batchLogSettings = @@ -53,9 +56,9 @@ protected void createResource(FlightContext context, ArmManagers armManagers) { .define(batchLogSettingsName) .withResource(batchAccountId) .withLogAnalytics(logAnalyticsWorkspaceId) - //withLog("ServiceLogs", 0) // retention is handled by the log analytics workspace - .withLog("ServiceLog", 0) // temporary change for different logs in gov vs commercial - //.withLog("AuditLog", 0) + // withLog("ServiceLogs", 0) // retention is handled by the log analytics workspace + .withLog("ServiceLog", 0) // temporary change for different logs in gov vs commercial + // .withLog("AuditLog", 0) .create(); logger.info(RESOURCE_CREATED, getResourceType(), batchLogSettings.id(), getMRGName(context)); } diff --git a/library/src/main/java/bio/terra/landingzone/stairway/flight/create/resource/step/postgres/CreatePostgresqlDNSStep.java b/library/src/main/java/bio/terra/landingzone/stairway/flight/create/resource/step/postgres/CreatePostgresqlDNSStep.java index 2b8e2282..bc6c6670 100644 --- a/library/src/main/java/bio/terra/landingzone/stairway/flight/create/resource/step/postgres/CreatePostgresqlDNSStep.java +++ b/library/src/main/java/bio/terra/landingzone/stairway/flight/create/resource/step/postgres/CreatePostgresqlDNSStep.java @@ -10,12 +10,11 @@ import bio.terra.landingzone.stairway.flight.ResourceNameRequirements; import bio.terra.landingzone.stairway.flight.create.resource.step.BaseResourceCreateStep; import bio.terra.stairway.FlightContext; +import com.azure.core.management.AzureEnvironment; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.UUID; - -import com.azure.core.management.AzureEnvironment; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -24,7 +23,8 @@ public class CreatePostgresqlDNSStep extends BaseResourceCreateStep { public static final String POSTGRESQL_DNS_ID = "POSTGRESQL_DNS_ID"; public static final String POSTGRESQL_DNS_RESOURCE_KEY = "POSTGRESQL_DNS"; public static final String POSTGRES_DNS_SUFFIX = ".private.postgres.database.azure.com"; - public static final String POSTGRES_DNS_SUFFIX_GOV = ".private.postgres.database.usgovcloudapi.net"; + public static final String POSTGRES_DNS_SUFFIX_GOV = + ".private.postgres.database.usgovcloudapi.net"; public CreatePostgresqlDNSStep( ArmManagers armManagers, ResourceNameProvider resourceNameProvider) { @@ -42,7 +42,10 @@ protected void createResource(FlightContext context, ArmManagers armManagers) { var dnsZoneName = resourceNameProvider.getName(getResourceType()); - String postgresDnsSuffixForEnvironment = azureEnvironment == AzureEnvironment.AZURE_US_GOVERNMENT ? POSTGRES_DNS_SUFFIX_GOV : POSTGRES_DNS_SUFFIX; + String postgresDnsSuffixForEnvironment = + azureEnvironment == AzureEnvironment.AZURE_US_GOVERNMENT + ? POSTGRES_DNS_SUFFIX_GOV + : POSTGRES_DNS_SUFFIX; var dns = armManagers