From 973213f64a4f6c9e377ccaa9bb6657028c504b76 Mon Sep 17 00:00:00 2001 From: Azure-Fluent Date: Tue, 14 Jan 2020 16:19:56 +0800 Subject: [PATCH] Release 1.30.0 --- README.md | 44 ++++++++++--------- pom.xml | 12 ++++- .../azure/management/samples/Utils.java | 21 ++++++++- ...qlDatabasesAcrossDifferentDataCenters.java | 6 +-- 4 files changed, 57 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 2d41158..a238af7 100644 --- a/README.md +++ b/README.md @@ -4,40 +4,42 @@ languages: - java products: - azure -- azure-sql-database -description: "Getting Started with Sql - Manage Sql Databases Across Different Data Centers - in Java" -urlFragment: sql-database-java-manage-sql-databases-across-regions +extensions: +- services: Sql +- platforms: java --- -# Manage Azure SQL Databases Across Different Data Centers (Java) +# Getting Started with Sql - Manage Sql Databases Across Different Data Centers - in Java # -Azure SQL sample for managing SQL Database. -- Create 3 SQL Servers in different region. -- Create a master database in master SQL Server. -- Create 2 more SQL Servers in different azure regions -- Create secondary read only databases in these server with source as database in server created in step 1. -- Create 5 virtual networks in different regions. -- Create one VM in each of the virtual network. -- Update all three databases to have firewall rules with range of each of the virtual network. + Azure SQL sample for managing SQL Database - + - Create 3 SQL Servers in different region. + - Create a master database in master SQL Server. + - Create 2 more SQL Servers in different azure regions + - Create secondary read only databases in these server with source as database in server created in step 1. + - Create 5 virtual networks in different regions. + - Create one VM in each of the virtual network. + - Update all three databases to have firewall rules with range of each of the virtual network. -## Running this sample +## Running this Sample ## To run this sample: Set the environment variable `AZURE_AUTH_LOCATION` with the full path for an auth file. See [how to create an auth file](https://github.com/Azure/azure-libraries-for-java/blob/master/AUTH.md). -```bash -git clone https://github.com/Azure-Samples/sql-database-java-manage-sql-databases-across-regions.git -cd sql-database-java-manage-sql-databases-across-regions -mvn clean compile exec:java -``` + git clone https://github.com/Azure-Samples/sql-database-java-manage-sql-databases-across-regions.git -## More information + cd sql-database-java-manage-sql-databases-across-regions + + mvn clean compile exec:java + +## More information ## [http://azure.com/java](http://azure.com/java) -If you don't have a Microsoft Azure subscription you can get a FREE trial account [here](http://go.microsoft.com/fwlink/?LinkId=330212). +If you don't have a Microsoft Azure subscription you can get a FREE trial account [here](http://go.microsoft.com/fwlink/?LinkId=330212) + +--- -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. \ No newline at end of file diff --git a/pom.xml b/pom.xml index e8074d2..f90e846 100644 --- a/pom.xml +++ b/pom.xml @@ -53,12 +53,22 @@ com.microsoft.azure azure - 1.24.1 + 1.30.0 commons-net commons-net 3.3 + + commons-lang + commons-lang + 2.6 + + + org.apache.commons + commons-lang3 + 3.7 + diff --git a/src/main/java/com/microsoft/azure/management/samples/Utils.java b/src/main/java/com/microsoft/azure/management/samples/Utils.java index baf6241..9940f93 100644 --- a/src/main/java/com/microsoft/azure/management/samples/Utils.java +++ b/src/main/java/com/microsoft/azure/management/samples/Utils.java @@ -739,6 +739,24 @@ public static void print(LoadBalancer resource) { } } + // Show HTTPS probes + info.append("\n\tHTTPS probes: ") + .append(resource.httpsProbes().size()); + for (LoadBalancerHttpProbe probe : resource.httpsProbes().values()) { + info.append("\n\t\tProbe name: ").append(probe.name()) + .append("\n\t\t\tPort: ").append(probe.port()) + .append("\n\t\t\tInterval in seconds: ").append(probe.intervalInSeconds()) + .append("\n\t\t\tRetries before unhealthy: ").append(probe.numberOfProbes()) + .append("\n\t\t\tHTTPS request path: ").append(probe.requestPath()); + + // Show associated load balancing rules + info.append("\n\t\t\tReferenced from load balancing rules: ") + .append(probe.loadBalancingRules().size()); + for (LoadBalancingRule rule : probe.loadBalancingRules().values()) { + info.append("\n\t\t\t\tName: ").append(rule.name()); + } + } + // Show load balancing rules info.append("\n\tLoad balancing rules: ") .append(resource.loadBalancingRules().size()); @@ -994,7 +1012,7 @@ public static void print(AppServicePlan resource) { */ public static void print(WebAppBase resource) { StringBuilder builder = new StringBuilder().append("Web app: ").append(resource.id()) - .append("Name: ").append(resource.name()) + .append("\n\tName: ").append(resource.name()) .append("\n\tState: ").append(resource.state()) .append("\n\tResource group: ").append(resource.resourceGroupName()) .append("\n\tRegion: ").append(resource.region()) @@ -1377,6 +1395,7 @@ public static String createRandomName(String namePrefix) { */ public static void createCertificate(String certPath, String pfxPath, String alias, String password, String cnName) throws Exception { + SdkContext.prepareFileLocation(new File(pfxPath), new File(certPath)); if (new File(pfxPath).exists()) { return; } diff --git a/src/main/java/com/microsoft/azure/management/sql/samples/ManageSqlDatabasesAcrossDifferentDataCenters.java b/src/main/java/com/microsoft/azure/management/sql/samples/ManageSqlDatabasesAcrossDifferentDataCenters.java index da0aa5d..3645fd9 100644 --- a/src/main/java/com/microsoft/azure/management/sql/samples/ManageSqlDatabasesAcrossDifferentDataCenters.java +++ b/src/main/java/com/microsoft/azure/management/sql/samples/ManageSqlDatabasesAcrossDifferentDataCenters.java @@ -19,7 +19,7 @@ import com.microsoft.azure.management.resources.fluentcore.model.Creatable; import com.microsoft.azure.management.samples.Utils; import com.microsoft.azure.management.sql.CreateMode; -import com.microsoft.azure.management.sql.DatabaseEditions; +import com.microsoft.azure.management.sql.DatabaseEdition; import com.microsoft.azure.management.sql.SqlDatabase; import com.microsoft.azure.management.sql.SqlFirewallRule; import com.microsoft.azure.management.sql.SqlServer; @@ -82,7 +82,7 @@ public static boolean runSample(Azure azure) { System.out.println("Creating a database"); SqlDatabase masterDatabase = masterSqlServer.databases().define(databaseName) - .withEdition(DatabaseEditions.BASIC) + .withEdition(DatabaseEdition.BASIC) .create(); Utils.print(masterDatabase); @@ -92,7 +92,7 @@ public static boolean runSample(Azure azure) { SqlServer sqlServerInSecondaryLocation = azure.sqlServers() .define(Utils.createRandomName(slaveSqlServer1Name)) - .withRegion(masterDatabase.defaultSecondaryLocation()) + .withRegion(Region.US_EAST2) .withExistingResourceGroup(rgName) .withAdministratorLogin(administratorLogin) .withAdministratorPassword(administratorPassword)