Skip to content

Commit f02feec

Browse files
Merge pull request #3 from Azure-Samples/UpdatedSample
Moved samples to 4.1
2 parents 7f65438 + e239677 commit f02feec

File tree

4 files changed

+403
-136
lines changed

4 files changed

+403
-136
lines changed

Diff for: README.md

+36-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,42 @@ author: selvasingh
77
#Getting Started with Network - Manage Simple Application Gateway - in Java #
88

99

10-
Main function which runs the actual sample.
11-
@param azure instance of the azure client
12-
@return true if sample runs successfully
13-
10+
Azure network sample for managing application gateways.
11+
12+
- CREATE an application gateway for load balancing
13+
HTTP/HTTPS requests to backend server pools of virtual machines
14+
15+
This application gateway serves traffic for multiple
16+
domain names
17+
18+
Routing Rule 1
19+
Hostname 1 = None
20+
Backend server pool 1 = 4 virtual machines with IP addresses
21+
Backend server pool 1 settings = HTTP:8080
22+
Front end port 1 = HTTP:80
23+
Listener 1 = HTTP
24+
Routing rule 1 = HTTP listener 1 => backend server pool 1
25+
(round-robin load distribution)
26+
27+
- MODIFY the application gateway - re-configure the Routing Rule 1 for SSL offload &
28+
add a host name, www.contoso.com
29+
30+
Change listener 1 from HTTP to HTTPS
31+
Add SSL certificate to the listener
32+
Update front end port 1 to HTTPS:1443
33+
Add a host name, www.contoso.com
34+
Enable cookie-based affinity
35+
36+
Modified Routing Rule 1
37+
Hostname 1 = www.contoso.com
38+
Backend server pool 1 = 4 virtual machines with IP addresses
39+
Backend server pool 1 settings = HTTP:8080
40+
Front end port 1 = HTTPS:1443
41+
Listener 1 = HTTPS
42+
Routing rule 1 = HTTPS listener 1 => backend server pool 1
43+
(round-robin load distribution)
44+
45+
1446

1547
## Running this Sample ##
1648

Diff for: pom.xml

+64-66
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,64 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2-
<modelVersion>4.0.0</modelVersion>
3-
<groupId>com.microsoft.azure</groupId>
4-
<artifactId>application-gateway-java-manage-simple-application-gateways</artifactId>
5-
<version>0.0.1-SNAPSHOT</version>
6-
<name>ManageSimpleApplicationGateway.java</name>
7-
<description></description>
8-
<url>https://github.com/Azure/application-gateway-java-manage-simple-application-gateways</url>
9-
<dependencies>
10-
<dependency>
11-
<groupId>com.microsoft.azure</groupId>
12-
<artifactId>azure</artifactId>
13-
<version>1.0.0-beta5</version>
14-
</dependency>
15-
</dependencies>
16-
<build>
17-
<sourceDirectory>src</sourceDirectory>
18-
<resources>
19-
<resource>
20-
<directory>resources</directory>
21-
</resource>
22-
</resources>
23-
<plugins>
24-
<plugin>
25-
<groupId>org.codehaus.mojo</groupId>
26-
<artifactId>exec-maven-plugin</artifactId>
27-
<version>1.4.0</version>
28-
<configuration>
29-
<mainClass>com.microsoft.azure.management.network.samples.ManageSimpleApplicationGateway</mainClass>
30-
</configuration>
31-
</plugin>
32-
<plugin>
33-
<groupId>org.apache.maven.plugins</groupId>
34-
<artifactId>maven-compiler-plugin</artifactId>
35-
<version>3.0</version>
36-
<configuration>
37-
<source>1.7</source>
38-
<target>1.7</target>
39-
</configuration>
40-
</plugin>
41-
<plugin>
42-
<!-- Generate a fully packaged executable jar with dependencies -->
43-
<groupId>org.apache.maven.plugins</groupId>
44-
<artifactId>maven-assembly-plugin</artifactId>
45-
<executions>
46-
<execution>
47-
<goals>
48-
<goal>attached</goal>
49-
</goals>
50-
<phase>package</phase>
51-
<configuration>
52-
<descriptorRefs>
53-
<descriptorRef>jar-with-dependencies</descriptorRef>
54-
</descriptorRefs>
55-
<archive>
56-
<manifest>
57-
<mainClass>com.microsoft.azure.management.network.samples.ManageSimpleApplicationGateway.java</mainClass>
58-
</manifest>
59-
</archive>
60-
</configuration>
61-
</execution>
62-
</executions>
63-
</plugin>
64-
</plugins>
65-
</build>
66-
</project>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>com.microsoft.azure</groupId>
6+
<artifactId>application-gateway-java-manage-simple-application-gateways</artifactId>
7+
<version>0.0.1-SNAPSHOT</version>
8+
<name>ManageSimpleApplicationGateway.java</name>
9+
<description></description>
10+
<url>https://github.com/Azure/application-gateway-java-manage-simple-application-gateways</url>
11+
<build>
12+
<plugins>
13+
<plugin>
14+
<groupId>org.codehaus.mojo</groupId>
15+
<artifactId>exec-maven-plugin</artifactId>
16+
<version>1.4.0</version>
17+
<configuration>
18+
<mainClass>com.microsoft.azure.management.network.samples.ManageSimpleApplicationGateway</mainClass>
19+
</configuration>
20+
</plugin>
21+
<plugin>
22+
<artifactId>maven-compiler-plugin</artifactId>
23+
<version>3.0</version>
24+
<configuration>
25+
<source>1.7</source>
26+
<target>1.7</target>
27+
</configuration>
28+
</plugin>
29+
<plugin>
30+
<artifactId>maven-assembly-plugin</artifactId>
31+
<executions>
32+
<execution>
33+
<phase>package</phase>
34+
<goals>
35+
<goal>attached</goal>
36+
</goals>
37+
<configuration>
38+
<descriptorRefs>
39+
<descriptorRef>jar-with-dependencies</descriptorRef>
40+
</descriptorRefs>
41+
<archive>
42+
<manifest>
43+
<mainClass>com.microsoft.azure.management.network.samples.ManageSimpleApplicationGateway.java</mainClass>
44+
</manifest>
45+
</archive>
46+
</configuration>
47+
</execution>
48+
</executions>
49+
</plugin>
50+
</plugins>
51+
</build>
52+
<dependencies>
53+
<dependency>
54+
<groupId>com.microsoft.azure</groupId>
55+
<artifactId>azure</artifactId>
56+
<version>1.0.0</version>
57+
</dependency>
58+
<dependency>
59+
<groupId>commons-net</groupId>
60+
<artifactId>commons-net</artifactId>
61+
<version>3.3</version>
62+
</dependency>
63+
</dependencies>
64+
</project>

Diff for: src/main/java/com/microsoft/azure/management/network/samples/ManageSimpleApplicationGateway.java

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/**
2-
*
32
* Copyright (c) Microsoft Corporation. All rights reserved.
4-
* Licensed under the MIT License. See License.txt in the project root for license information.
5-
*
3+
* Licensed under the MIT License. See License.txt in the project root for
4+
* license information.
65
*/
76

87
package com.microsoft.azure.management.network.samples;
@@ -79,12 +78,12 @@ public static boolean runSample(Azure azure) {
7978
.fromPublicFrontend()
8079
.fromFrontendHttpPort(80)
8180
.toBackendHttpPort(8080)
82-
.toBackendIpAddress("11.1.1.1")
83-
.toBackendIpAddress("11.1.1.2")
84-
.toBackendIpAddress("11.1.1.3")
85-
.toBackendIpAddress("11.1.1.4")
81+
.toBackendIPAddress("11.1.1.1")
82+
.toBackendIPAddress("11.1.1.2")
83+
.toBackendIPAddress("11.1.1.3")
84+
.toBackendIPAddress("11.1.1.4")
8685
.attach()
87-
.withNewPublicIpAddress()
86+
.withNewPublicIPAddress()
8887
.create();
8988

9089
long t2 = System.currentTimeMillis();
@@ -110,10 +109,10 @@ public static boolean runSample(Azure azure) {
110109
.withSslCertificateFromPfxFile(new File(ManageSimpleApplicationGateway.class.getClassLoader().getResource("myTest.pfx").getPath()))
111110
.withSslCertificatePassword("Abc123")
112111
.toBackendHttpPort(8080)
113-
.toBackendIpAddress("11.1.1.1")
114-
.toBackendIpAddress("11.1.1.2")
115-
.toBackendIpAddress("11.1.1.3")
116-
.toBackendIpAddress("11.1.1.4")
112+
.toBackendIPAddress("11.1.1.1")
113+
.toBackendIPAddress("11.1.1.2")
114+
.toBackendIPAddress("11.1.1.3")
115+
.toBackendIPAddress("11.1.1.4")
117116
.withHostName("www.contoso.com")
118117
.withCookieBasedAffinity()
119118
.attach()

0 commit comments

Comments
 (0)