Skip to content

Commit f402d43

Browse files
committed
Release 2.17.0
1 parent 400d625 commit f402d43

File tree

2 files changed

+27
-18
lines changed

2 files changed

+27
-18
lines changed

Diff for: pom.xml

+2-7
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,12 @@
5454
<dependency>
5555
<groupId>com.azure.resourcemanager</groupId>
5656
<artifactId>azure-resourcemanager</artifactId>
57-
<version>2.10.0</version>
57+
<version>2.17.0</version>
5858
</dependency>
5959
<dependency>
6060
<groupId>com.azure</groupId>
6161
<artifactId>azure-identity</artifactId>
62-
<version>1.4.1</version>
63-
</dependency>
64-
<dependency>
65-
<groupId>com.jcraft</groupId>
66-
<artifactId>jsch</artifactId>
67-
<version>0.1.55</version>
62+
<version>1.5.3</version>
6863
</dependency>
6964
<dependency>
7065
<groupId>commons-net</groupId>

Diff for: src/main/java/com/azure/resourcemanager/samples/Utils.java

+25-11
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import com.azure.core.http.rest.PagedIterable;
1717
import com.azure.core.http.rest.Response;
1818
import com.azure.core.http.rest.SimpleResponse;
19+
import com.azure.core.management.Region;
1920
import com.azure.core.management.exception.ManagementException;
2021
import com.azure.core.util.logging.ClientLogger;
2122
import com.azure.core.util.serializer.JacksonAdapter;
@@ -71,8 +72,8 @@
7172
import com.azure.resourcemanager.dns.models.AaaaRecordSet;
7273
import com.azure.resourcemanager.dns.models.CnameRecordSet;
7374
import com.azure.resourcemanager.dns.models.DnsZone;
74-
import com.azure.resourcemanager.dns.models.MxRecordSet;
7575
import com.azure.resourcemanager.dns.models.MxRecord;
76+
import com.azure.resourcemanager.dns.models.MxRecordSet;
7677
import com.azure.resourcemanager.dns.models.NsRecordSet;
7778
import com.azure.resourcemanager.dns.models.PtrRecordSet;
7879
import com.azure.resourcemanager.dns.models.SoaRecord;
@@ -163,7 +164,6 @@
163164
import com.azure.resourcemanager.redis.models.RedisCache;
164165
import com.azure.resourcemanager.redis.models.RedisCachePremium;
165166
import com.azure.resourcemanager.redis.models.ScheduleEntry;
166-
import com.azure.core.management.Region;
167167
import com.azure.resourcemanager.resources.fluentcore.arm.models.PrivateLinkResource;
168168
import com.azure.resourcemanager.resources.fluentcore.utils.ResourceManagerUtils;
169169
import com.azure.resourcemanager.resources.models.ManagementLock;
@@ -201,7 +201,6 @@
201201
import com.azure.resourcemanager.trafficmanager.models.TrafficManagerExternalEndpoint;
202202
import com.azure.resourcemanager.trafficmanager.models.TrafficManagerNestedProfileEndpoint;
203203
import com.azure.resourcemanager.trafficmanager.models.TrafficManagerProfile;
204-
import com.jcraft.jsch.JSchException;
205204
import org.apache.commons.net.ftp.FTP;
206205
import org.apache.commons.net.ftp.FTPClient;
207206
import reactor.core.publisher.Mono;
@@ -215,7 +214,6 @@
215214
import java.io.IOException;
216215
import java.io.InputStream;
217216
import java.io.InputStreamReader;
218-
import java.io.UnsupportedEncodingException;
219217
import java.nio.charset.StandardCharsets;
220218
import java.nio.file.Files;
221219
import java.security.KeyPair;
@@ -241,9 +239,10 @@
241239
/**
242240
* Common utils for Azure management samples.
243241
*/
244-
245242
public final class Utils {
246243

244+
// IMPORTANT: do not use SSHShell in Utils
245+
247246
private static final ClientLogger LOGGER = new ClientLogger(Utils.class);
248247

249248
private static String sshPublicKey;
@@ -396,6 +395,12 @@ public static void print(VirtualMachine resource) {
396395
storageProfile.append("\n\t\t\tCaching: ").append(resource.storageProfile().osDisk().caching());
397396
storageProfile.append("\n\t\t\tCreateOption: ").append(resource.storageProfile().osDisk().createOption());
398397
storageProfile.append("\n\t\t\tDiskSizeGB: ").append(resource.storageProfile().osDisk().diskSizeGB());
398+
if (resource.storageProfile().osDisk().managedDisk() != null) {
399+
if (resource.storageProfile().osDisk().managedDisk().diskEncryptionSet() != null) {
400+
storageProfile.append("\n\t\t\tDiskEncryptionSet Id: ")
401+
.append(resource.storageProfile().osDisk().managedDisk().diskEncryptionSet().id());
402+
}
403+
}
399404
if (resource.storageProfile().osDisk().image() != null) {
400405
storageProfile.append("\n\t\t\tImage Uri: ").append(resource.storageProfile().osDisk().image().uri());
401406
}
@@ -430,6 +435,9 @@ public static void print(VirtualMachine resource) {
430435
if (resource.isManagedDiskEnabled()) {
431436
if (disk.managedDisk() != null) {
432437
storageProfile.append("\n\t\t\tManaged Disk Id: ").append(disk.managedDisk().id());
438+
if (disk.managedDisk().diskEncryptionSet() != null) {
439+
storageProfile.append("\n\t\t\tDiskEncryptionSet Id: ").append(disk.managedDisk().diskEncryptionSet().id());
440+
}
433441
}
434442
} else {
435443
if (disk.vhd().uri() != null) {
@@ -1626,7 +1634,7 @@ public static void print(SearchService searchService) {
16261634
*
16271635
* @param envSecondaryServicePrincipal an Azure Container Registry
16281636
* @return a service principal client ID
1629-
* @throws Exception exception
1637+
* @throws IOException exception
16301638
*/
16311639
public static String getSecondaryServicePrincipalClientID(String envSecondaryServicePrincipal) throws IOException {
16321640
String content = new String(Files.readAllBytes(new File(envSecondaryServicePrincipal).toPath()), StandardCharsets.UTF_8).trim();
@@ -1649,7 +1657,7 @@ public static String getSecondaryServicePrincipalClientID(String envSecondarySer
16491657
*
16501658
* @param envSecondaryServicePrincipal an Azure Container Registry
16511659
* @return a service principal secret
1652-
* @throws Exception exception
1660+
* @throws IOException exception
16531661
*/
16541662
public static String getSecondaryServicePrincipalSecret(String envSecondaryServicePrincipal) throws IOException {
16551663
String content = new String(Files.readAllBytes(new File(envSecondaryServicePrincipal).toPath()), StandardCharsets.UTF_8).trim();
@@ -1686,7 +1694,6 @@ public static String getSecondaryServicePrincipalSecret(String envSecondaryServi
16861694
* @param password alias password
16871695
* @param cnName domain name
16881696
* @param dnsName dns name in subject alternate name
1689-
* @throws Exception exceptions from the creation
16901697
* @throws IOException IO Exception
16911698
*/
16921699
public static void createCertificate(String certPath, String pfxPath, String alias,
@@ -1754,7 +1761,7 @@ public static void createCertificate(String certPath, String pfxPath, String ali
17541761
* @param ignoreErrorStream : Boolean which controls whether to throw exception or not
17551762
* based on error stream.
17561763
* @return result :- depending on the method invocation.
1757-
* @throws Exception exceptions thrown from the execution
1764+
* @throws IOException exceptions thrown from the execution
17581765
*/
17591766
public static String cmdInvocation(String[] command,
17601767
boolean ignoreErrorStream) throws IOException {
@@ -1771,7 +1778,7 @@ public static String cmdInvocation(String[] command,
17711778
result = br.readLine();
17721779
process.waitFor();
17731780
error = ebr.readLine();
1774-
if (error != null && (!error.equals(""))) {
1781+
if (error != null && (!"".equals(error))) {
17751782
// To do - Log error message
17761783

17771784
if (!ignoreErrorStream) {
@@ -3346,7 +3353,6 @@ public static void print(SpringApp springApp) {
33463353
StringBuilder info = new StringBuilder("Spring Service: ")
33473354
.append("\n\tId: ").append(springApp.id())
33483355
.append("\n\tName: ").append(springApp.name())
3349-
.append("\n\tCreated Time: ").append(springApp.createdTime())
33503356
.append("\n\tPublic Endpoint: ").append(springApp.isPublic())
33513357
.append("\n\tUrl: ").append(springApp.url())
33523358
.append("\n\tHttps Only: ").append(springApp.isHttpsOnly())
@@ -3527,11 +3533,19 @@ private static Mono<Response<String>> stringResponse(Mono<HttpResponse> response
35273533
new RetryPolicy("Retry-After", ChronoUnit.SECONDS))
35283534
.build();
35293535

3536+
/**
3537+
* Get the size of the iterable.
3538+
*
3539+
* @param iterable iterable to count size
3540+
* @param <T> generic type parameter of the iterable
3541+
* @return size of the iterable
3542+
*/
35303543
public static <T> int getSize(Iterable<T> iterable) {
35313544
int res = 0;
35323545
Iterator<T> iterator = iterable.iterator();
35333546
while (iterator.hasNext()) {
35343547
iterator.next();
3548+
res++;
35353549
}
35363550
return res;
35373551
}

0 commit comments

Comments
 (0)