Skip to content

Commit 0b7d908

Browse files
Merge pull request #5 from Azure-Samples/UpdatedSample
Moved samples to 4.1
2 parents d5519a9 + f7c3d7d commit 0b7d908

File tree

3 files changed

+362
-128
lines changed

3 files changed

+362
-128
lines changed

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>compute-java-manage-virtual-machines-in-parallel</artifactId>
5-
<version>0.0.1-SNAPSHOT</version>
6-
<name>ManageVirtualMachinesInParallel.java</name>
7-
<description></description>
8-
<url>https://github.com/Azure/compute-java-manage-virtual-machines-in-parallel</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.compute.samples.ManageVirtualMachinesInParallel</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.compute.samples.ManageVirtualMachinesInParallel.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>compute-java-manage-virtual-machines-in-parallel</artifactId>
7+
<version>0.0.1-SNAPSHOT</version>
8+
<name>ManageVirtualMachinesInParallel.java</name>
9+
<description></description>
10+
<url>https://github.com/Azure/compute-java-manage-virtual-machines-in-parallel</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.compute.samples.ManageVirtualMachinesInParallel</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.compute.samples.ManageVirtualMachinesInParallel.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>

src/main/java/com/microsoft/azure/management/compute/samples/ManageVirtualMachinesInParallel.java

+6-8
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.compute.samples;
@@ -39,7 +38,7 @@ public final class ManageVirtualMachinesInParallel {
3938
*/
4039
public static boolean runSample(Azure azure) {
4140
final int vmCount = 10;
42-
final Region region = Region.US_WEST_CENTRAL;
41+
final Region region = Region.US_EAST;
4342
final String rgName = SdkContext.randomResourceName("rgCOPP", 24);
4443
final String networkName = SdkContext.randomResourceName("vnetCOMV", 24);
4544
final String storageAccountName = SdkContext.randomResourceName("stgCOMV", 20);
@@ -71,8 +70,8 @@ public static boolean runSample(Azure azure) {
7170
.withRegion(region)
7271
.withExistingResourceGroup(resourceGroup)
7372
.withNewPrimaryNetwork(creatableNetwork)
74-
.withPrimaryPrivateIpAddressDynamic()
75-
.withoutPrimaryPublicIpAddress()
73+
.withPrimaryPrivateIPAddressDynamic()
74+
.withoutPrimaryPublicIPAddress()
7675
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
7776
.withRootUsername(userName)
7877
.withRootPassword(password)
@@ -105,8 +104,7 @@ public static boolean runSample(Azure azure) {
105104

106105
try {
107106
System.out.println("Deleting Resource Group: " + rgName);
108-
azure.resourceGroups().deleteByName(rgName);
109-
System.out.println("Deleted Resource Group: " + rgName);
107+
azure.resourceGroups().beginDeleteByName(rgName);
110108
} catch (NullPointerException npe) {
111109
System.out.println("Did not create any resources in Azure. No clean up is necessary");
112110
} catch (Exception g) {

0 commit comments

Comments
 (0)