diff --git a/azure/pom.xml b/azure/pom.xml index 0e2fbe21..8529508e 100644 --- a/azure/pom.xml +++ b/azure/pom.xml @@ -53,7 +53,7 @@ com.azure.resourcemanager - azure-resourcemanager-postgresql + azure-resourcemanager-postgresqlflexibleserver diff --git a/azure/src/main/java/sunstone/azure/impl/AzureIdentifiableSunstoneResource.java b/azure/src/main/java/sunstone/azure/impl/AzureIdentifiableSunstoneResource.java index 3fe3554e..4c798ff7 100644 --- a/azure/src/main/java/sunstone/azure/impl/AzureIdentifiableSunstoneResource.java +++ b/azure/src/main/java/sunstone/azure/impl/AzureIdentifiableSunstoneResource.java @@ -5,8 +5,8 @@ import com.azure.resourcemanager.appservice.models.AppServicePlan; import com.azure.resourcemanager.appservice.models.WebApp; import com.azure.resourcemanager.compute.models.VirtualMachine; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; -import com.azure.resourcemanager.postgresql.models.Server; +import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; +import com.azure.resourcemanager.postgresqlflexibleserver.models.Server; import sunstone.azure.annotation.AzureAppServicePlan; import sunstone.azure.annotation.AzureAutoResolve; import sunstone.azure.annotation.AzurePgSqlServer; diff --git a/azure/src/main/java/sunstone/azure/impl/AzureIdentifiableSunstoneResourceUtils.java b/azure/src/main/java/sunstone/azure/impl/AzureIdentifiableSunstoneResourceUtils.java index 75407e15..1d1d1160 100644 --- a/azure/src/main/java/sunstone/azure/impl/AzureIdentifiableSunstoneResourceUtils.java +++ b/azure/src/main/java/sunstone/azure/impl/AzureIdentifiableSunstoneResourceUtils.java @@ -3,7 +3,7 @@ import com.azure.resourcemanager.appservice.models.WebApp; import com.azure.resourcemanager.compute.models.VirtualMachine; -import com.azure.resourcemanager.postgresql.models.Server; +import com.azure.resourcemanager.postgresqlflexibleserver.models.Server; import sunstone.inject.Hostname; import sunstone.core.exceptions.SunstoneException; import sunstone.core.exceptions.UnsupportedSunstoneOperationException; diff --git a/azure/src/main/java/sunstone/azure/impl/AzureSunstoneResourceInjector.java b/azure/src/main/java/sunstone/azure/impl/AzureSunstoneResourceInjector.java index 993f4ebb..6ad1cf33 100644 --- a/azure/src/main/java/sunstone/azure/impl/AzureSunstoneResourceInjector.java +++ b/azure/src/main/java/sunstone/azure/impl/AzureSunstoneResourceInjector.java @@ -5,8 +5,8 @@ import com.azure.resourcemanager.appservice.models.AppServicePlan; import com.azure.resourcemanager.appservice.models.WebApp; import com.azure.resourcemanager.compute.models.VirtualMachine; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; -import com.azure.resourcemanager.postgresql.models.Server; +import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; +import com.azure.resourcemanager.postgresqlflexibleserver.models.Server; import org.junit.jupiter.api.extension.ExtensionContext; import sunstone.inject.Hostname; import sunstone.azure.annotation.AzureResourceIdentificationAnnotation; diff --git a/azure/src/main/java/sunstone/azure/impl/AzureSunstoneStore.java b/azure/src/main/java/sunstone/azure/impl/AzureSunstoneStore.java index cec76b8b..6ee5f5de 100644 --- a/azure/src/main/java/sunstone/azure/impl/AzureSunstoneStore.java +++ b/azure/src/main/java/sunstone/azure/impl/AzureSunstoneStore.java @@ -2,7 +2,7 @@ import com.azure.resourcemanager.AzureResourceManager; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; import org.junit.jupiter.api.extension.ExtensionContext; import sunstone.core.SunstoneStore; diff --git a/azure/src/main/java/sunstone/azure/impl/AzureUtils.java b/azure/src/main/java/sunstone/azure/impl/AzureUtils.java index 1edec572..abcc5529 100644 --- a/azure/src/main/java/sunstone/azure/impl/AzureUtils.java +++ b/azure/src/main/java/sunstone/azure/impl/AzureUtils.java @@ -9,8 +9,8 @@ import com.azure.resourcemanager.appservice.models.AppServicePlan; import com.azure.resourcemanager.appservice.models.WebApp; import com.azure.resourcemanager.compute.models.VirtualMachine; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; -import com.azure.resourcemanager.postgresql.models.Server; +import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; +import com.azure.resourcemanager.postgresqlflexibleserver.models.Server; import sunstone.core.SunstoneConfig; import java.util.Optional; diff --git a/azure/src/test/java/sunstone/azure/armTemplates/di/AzClientsTests.java b/azure/src/test/java/sunstone/azure/armTemplates/di/AzClientsTests.java index 373d1ed5..ffe66081 100644 --- a/azure/src/test/java/sunstone/azure/armTemplates/di/AzClientsTests.java +++ b/azure/src/test/java/sunstone/azure/armTemplates/di/AzClientsTests.java @@ -1,7 +1,7 @@ package sunstone.azure.armTemplates.di; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; import sunstone.azure.annotation.AzureAutoResolve; import com.azure.resourcemanager.AzureResourceManager; import org.junit.jupiter.api.BeforeAll; diff --git a/azure/src/test/java/sunstone/azure/armTemplates/di/AzPgSqlTests.java b/azure/src/test/java/sunstone/azure/armTemplates/di/AzPgSqlTests.java index bb6d5595..11dec2fa 100644 --- a/azure/src/test/java/sunstone/azure/armTemplates/di/AzPgSqlTests.java +++ b/azure/src/test/java/sunstone/azure/armTemplates/di/AzPgSqlTests.java @@ -1,7 +1,7 @@ package sunstone.azure.armTemplates.di; -import com.azure.resourcemanager.postgresql.models.Server; +import com.azure.resourcemanager.postgresqlflexibleserver.models.Server; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import sunstone.annotation.Parameter; @@ -14,14 +14,14 @@ @WithAzureArmTemplate(parameters = { - @Parameter(k = "username", v = AzPgSqlTests.PGSQL_USER), - @Parameter(k = "password", v = AzPgSqlTests.PGSQL_PASSWORD), + @Parameter(k = "administratorLogin", v = AzPgSqlTests.PGSQL_USER), + @Parameter(k = "administratorLoginPassword", v = AzPgSqlTests.PGSQL_PASSWORD), @Parameter(k = "serverName", v = AzPgSqlTests.PGSQL_NAME), }, template = "sunstone/azure/armTemplates/posgresql.json", group = AzPgSqlTests.groupName) public class AzPgSqlTests { static final String groupName = "AzPgSqlTests-" + deployGroup; - public static final String PGSQL_NAME = "DSAzureTest-pgsql"; + public static final String PGSQL_NAME = "ds-azure-test-pgsql-${ts.test.run}"; public static final String PGSQL_USER = "user"; public static final String PGSQL_PASSWORD = "1234567890Ab"; diff --git a/azure/src/test/resources/sunstone/azure/armTemplates/posgresql.json b/azure/src/test/resources/sunstone/azure/armTemplates/posgresql.json index d3d103c0..4cc83bbb 100644 --- a/azure/src/test/resources/sunstone/azure/armTemplates/posgresql.json +++ b/azure/src/test/resources/sunstone/azure/armTemplates/posgresql.json @@ -2,54 +2,119 @@ "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { - "username": { + "administratorLogin": { "type": "string" }, - "password": { + "administratorLoginPassword": { "type": "securestring" }, "serverName": { "type": "string" }, + "version": { "type": "string", - "defaultValue": "9.6" + "defaultValue": "15" }, "tags": { "type": "object", "defaultValue": {} + }, + "firewallRules": { + "type": "object", + "defaultValue": { + "rules": [ + { + "name": "AllowAllAzureServicesAndResourcesWithinAzureIps_2024-1-5_9-41-31", + "endIPAddress": "0.0.0.0", + "startIPAddress": "0.0.0.0" + }, + { + "name": "AllowAll", + "startIPAddress": "0.0.0.0", + "endIPAddress": "255.255.255.255" + } + ] + } + }, + "guid": { + "type": "string", + "defaultValue": "[newGuid()]" } }, + "variables": { + "firewallRules": "[parameters('firewallRules').rules]" + }, "resources": [ { - "apiVersion": "2017-12-01", - "kind": "", + "apiVersion": "2022-12-01", "location": "[resourceGroup().location]", "name": "[parameters('serverName')]", + "identity": "[json('null')]", "properties": { + "createMode": "Default", "version": "[parameters('version')]", - "sslEnforcement": "Disabled", - "minimalTlsVersion": "TLSEnforcementDisabled", - "infrastructureEncryption": "Disabled", - "publicNetworkAccess": "Enabled", - "administratorLogin": "[parameters('username')]", - "administratorLoginPassword": "[parameters('password')]", - "storageProfile": { - "storageMB": 5120, + "administratorLogin": "[parameters('administratorLogin')]", + "administratorLoginPassword": "[parameters('administratorLoginPassword')]", + "Network": "[json('null')]", + "availabilityZone": "", + "Storage": { + "StorageSizeGB": "32", + "Type": "[json('null')]", + "Autogrow": "Disabled", + "tier": "json('null')", + "Iops": "[json('null')]", + "Throughput": "[json('null')]" + }, + "Backup": { "backupRetentionDays": 7, - "geoRedundantBackup": "Disabled", - "storageAutoGrow": "Disabled" - } + "geoRedundantBackup": "Disabled" + }, + "highAvailability": { + "mode": "Disabled", + "standbyAvailabilityZone": "" + }, + "dataencryption": "[json('null')]", + "authConfig": "[json('null')]" }, "sku": { - "name": "B_Gen5_1", - "tier": "Basic", - "family": "Gen5", - "capacity": 1 + "name": "Standard_D4s_v3", + "tier": "GeneralPurpose" }, "tags": "[parameters('tags')]", - "type": "Microsoft.DBforPostgreSQL/servers" + "type": "Microsoft.DBforPostgreSQL/flexibleServers" + }, + { + "condition": "[greater(length(variables('firewallRules')), 0)]", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2019-08-01", + "name": "[concat('firewallRules-', parameters('guid'), '-', copyIndex())]", + "copy": { + "count": "[if(greater(length(variables('firewallRules')), 0), length(variables('firewallRules')), 1)]", + "mode": "Serial", + "name": "firewallRulesIterator" + }, + "dependsOn": [ + "[concat('Microsoft.DBforPostgreSQL/flexibleServers/', parameters('serverName'))]" + ], + "properties": { + "mode": "Incremental", + "template": { + "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [ + { + "type": "Microsoft.DBforPostgreSQL/flexibleServers/firewallRules", + "name": "[concat(parameters('serverName'),'/',variables('firewallRules')[copyIndex()].name)]", + "apiVersion": "2022-12-01", + "properties": { + "StartIpAddress": "[variables('firewallRules')[copyIndex()].startIPAddress]", + "EndIpAddress": "[variables('firewallRules')[copyIndex()].endIPAddress]" + } + } + ] + } + } } - ], - "variables": {} + ] } \ No newline at end of file diff --git a/pom.xml b/pom.xml index 26e53bc9..68362367 100644 --- a/pom.xml +++ b/pom.xml @@ -71,10 +71,9 @@ - 2.20.0 - 1.6.1 - 1.12.6 - 1.0.2 + 2.34.0 + 1.2.19 + 1.0.0 4.10.0 @@ -320,26 +319,28 @@ - - com.azure.resourcemanager - azure-resourcemanager - ${version.azure-resourcemanager} - com.azure - azure-identity - ${version.com.azure.azure-identity} + azure-sdk-bom + ${version.azure-sdk-bom} + pom + import - com.azure - azure-core-http-netty - ${version.com.azure.azure-core-http-netty} + com.azure.resourcemanager + azure-resourcemanager + ${version.azure-resourcemanager} com.azure.resourcemanager azure-resourcemanager-postgresql ${version.azure-resourcemanager-postgresql} + + com.azure.resourcemanager + azure-resourcemanager-postgresqlflexibleserver + ${version.azure-resourcemanager-postgresqlflexibleserver} +