Skip to content
This repository was archived by the owner on Jun 17, 2024. It is now read-only.

Commit 154878f

Browse files
committed
Release 1.12.0
1 parent f3cc0ff commit 154878f

File tree

4 files changed

+47
-16
lines changed

4 files changed

+47
-16
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ author: alvadb
1616

1717
To run this sample:
1818

19-
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-sdk-for-java/blob/master/AUTH.md).
19+
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).
2020

2121
git clone https://github.com/Azure-Samples/cosmosdb-java-create-documentdb-and-configure-firewall.git
2222

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@
5353
<dependency>
5454
<groupId>com.microsoft.azure</groupId>
5555
<artifactId>azure</artifactId>
56-
<version>1.8.0</version>
56+
<version>1.12.0</version>
5757
</dependency>
5858
<dependency>
5959
<groupId>commons-net</groupId>
6060
<artifactId>commons-net</artifactId>
61-
<version>3.6</version>
61+
<version>3.3</version>
6262
</dependency>
6363
</dependencies>
6464
</project>

src/main/java/com/microsoft/azure/management/cosmosdb/samples/CreateCosmosDBWithIPRange.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
package com.microsoft.azure.management.cosmosdb.samples;
88

9+
import com.microsoft.azure.CloudException;
910
import com.microsoft.azure.credentials.ApplicationTokenCredentials;
1011
import com.microsoft.azure.management.Azure;
1112
import com.microsoft.azure.management.cosmosdb.DatabaseAccountKind;
@@ -54,7 +55,11 @@ public static boolean runSample(Azure azure, String clientId) {
5455
//============================================================
5556
// Delete CosmosDB
5657
System.out.println("Deleting the CosmosDB");
57-
azure.cosmosDBAccounts().deleteById(cosmosDBAccount.id());
58+
// work around CosmosDB service issue returning 404 CloudException on delete operation
59+
try {
60+
azure.cosmosDBAccounts().deleteById(cosmosDBAccount.id());
61+
} catch (CloudException e) {
62+
}
5863
System.out.println("Deleted the CosmosDB");
5964

6065
return true;
@@ -63,7 +68,7 @@ public static boolean runSample(Azure azure, String clientId) {
6368
} finally {
6469
try {
6570
System.out.println("Deleting resource group: " + rgName);
66-
azure.resourceGroups().deleteByName(rgName);
71+
azure.resourceGroups().beginDeleteByName(rgName);
6772
System.out.println("Deleted resource group: " + rgName);
6873
} catch (NullPointerException npe) {
6974
System.out.println("Did not create any resources in Azure. No clean up is necessary");

src/main/java/com/microsoft/azure/management/samples/Utils.java

+37-11
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.microsoft.azure.management.batch.ApplicationPackage;
2525
import com.microsoft.azure.management.batch.BatchAccount;
2626
import com.microsoft.azure.management.batch.BatchAccountKeys;
27+
import com.microsoft.azure.management.batchai.AzureFileShareReference;
2728
import com.microsoft.azure.management.batchai.BatchAICluster;
2829
import com.microsoft.azure.management.batchai.BatchAIJob;
2930
import com.microsoft.azure.management.compute.AvailabilitySet;
@@ -45,6 +46,8 @@
4546
import com.microsoft.azure.management.containerservice.ContainerServiceOrchestratorTypes;
4647
import com.microsoft.azure.management.containerservice.KubernetesCluster;
4748
import com.microsoft.azure.management.cosmosdb.CosmosDBAccount;
49+
import com.microsoft.azure.management.cosmosdb.DatabaseAccountListKeysResult;
50+
import com.microsoft.azure.management.cosmosdb.DatabaseAccountListReadOnlyKeysResult;
4851
import com.microsoft.azure.management.dns.ARecordSet;
4952
import com.microsoft.azure.management.dns.AaaaRecordSet;
5053
import com.microsoft.azure.management.dns.CNameRecordSet;
@@ -72,7 +75,7 @@
7275
import com.microsoft.azure.management.graphrbac.RoleAssignment;
7376
import com.microsoft.azure.management.graphrbac.RoleDefinition;
7477
import com.microsoft.azure.management.graphrbac.ServicePrincipal;
75-
import com.microsoft.azure.management.graphrbac.implementation.PermissionInner;
78+
import com.microsoft.azure.management.graphrbac.Permission;
7679
import com.microsoft.azure.management.keyvault.AccessPolicy;
7780
import com.microsoft.azure.management.keyvault.Vault;
7881
import com.microsoft.azure.management.locks.ManagementLock;
@@ -2276,6 +2279,14 @@ public static void print(CosmosDBAccount cosmosDBAccount) {
22762279
.append("\n\tDefault consistency level: ").append(cosmosDBAccount.consistencyPolicy().defaultConsistencyLevel())
22772280
.append("\n\tIP range filter: ").append(cosmosDBAccount.ipRangeFilter());
22782281

2282+
DatabaseAccountListKeysResult keys = cosmosDBAccount.listKeys();
2283+
DatabaseAccountListReadOnlyKeysResult readOnlyKeys = cosmosDBAccount.listReadOnlyKeys();
2284+
builder
2285+
.append("\n\tPrimary Master Key: ").append(keys.primaryMasterKey())
2286+
.append("\n\tSecondary Master Key: ").append(keys.secondaryMasterKey())
2287+
.append("\n\tPrimary Read-Only Key: ").append(readOnlyKeys.primaryReadonlyMasterKey())
2288+
.append("\n\tSecondary Read-Only Key: ").append(readOnlyKeys.secondaryReadonlyMasterKey());
2289+
22792290
for (com.microsoft.azure.management.cosmosdb.Location writeReplica : cosmosDBAccount.writableReplications()) {
22802291
builder.append("\n\t\tWrite replication: ")
22812292
.append("\n\t\t\tName :").append(writeReplica.locationName());
@@ -2286,6 +2297,7 @@ public static void print(CosmosDBAccount cosmosDBAccount) {
22862297
builder.append("\n\t\tRead replication: ")
22872298
.append("\n\t\t\tName :").append(readReplica.locationName());
22882299
}
2300+
22892301
}
22902302

22912303
/**
@@ -2317,9 +2329,9 @@ public static void print(RoleDefinition role) {
23172329
.append("\n\tDescription: ").append(role.description())
23182330
.append("\n\tType: ").append(role.type());
23192331

2320-
Set<PermissionInner> permissions = role.permissions();
2332+
Set<Permission> permissions = role.permissions();
23212333
builder.append("\n\tPermissions: ").append(permissions.size());
2322-
for (PermissionInner permission : permissions) {
2334+
for (Permission permission : permissions) {
23232335
builder.append("\n\t\tPermission Actions: " + permission.actions().size());
23242336
for (String action : permission.actions()) {
23252337
builder.append("\n\t\t\tName :").append(action);
@@ -2470,7 +2482,10 @@ public static void print(VerificationIPFlow resource) {
24702482
*/
24712483
public static void print(Topology resource) {
24722484
StringBuilder sb = new StringBuilder().append("Topology: ").append(resource.id())
2473-
.append("\n\tResource group: ").append(resource.resourceGroupName())
2485+
.append("\n\tTopology parameters: ")
2486+
.append("\n\t\tResource group: ").append(resource.topologyParameters().targetResourceGroupName())
2487+
.append("\n\t\tVirtual network: ").append(resource.topologyParameters().targetVirtualNetwork() == null ? "" : resource.topologyParameters().targetVirtualNetwork().id())
2488+
.append("\n\t\tSubnet id: ").append(resource.topologyParameters().targetSubnet() == null ? "" : resource.topologyParameters().targetSubnet().id())
24742489
.append("\n\tCreated time: ").append(resource.createdTime())
24752490
.append("\n\tLast modified time: ").append(resource.lastModifiedTime());
24762491
for (TopologyResource tr : resource.resources().values()) {
@@ -2763,8 +2778,8 @@ public static void print(BatchAICluster resource) {
27632778
StringBuilder info = new StringBuilder("Batch AI cluster: ")
27642779
.append("\n\tId: ").append(resource.id())
27652780
.append("\n\tName: ").append(resource.name())
2766-
.append("\n\tResource group: ").append(resource.resourceGroupName())
2767-
.append("\n\tRegion: ").append(resource.regionName())
2781+
.append("\n\tResource group: ").append(resource.workspace().resourceGroupName())
2782+
.append("\n\tRegion: ").append(resource.workspace().regionName())
27682783
.append("\n\tVM Size: ").append(resource.vmSize())
27692784
.append("\n\tVM Priority: ").append(resource.vmPriority())
27702785
.append("\n\tSubnet: ").append(resource.subnet())
@@ -2804,7 +2819,6 @@ public static void print(BatchAICluster resource) {
28042819
if (resource.nodeSetup() != null && resource.nodeSetup().setupTask() != null) {
28052820
info.append("\n\tSetup task: ")
28062821
.append("\n\t\tCommand line: ").append(resource.nodeSetup().setupTask().commandLine())
2807-
.append("\n\t\tRun elevated: ").append(resource.nodeSetup().setupTask().runElevated())
28082822
.append("\n\t\tStdout/err Path Prefix: ").append(resource.nodeSetup().setupTask().stdOutErrPathPrefix());
28092823
}
28102824
System.out.println(info.toString());
@@ -2819,15 +2833,27 @@ public static void print(BatchAIJob resource) {
28192833
StringBuilder info = new StringBuilder("Batch AI job: ")
28202834
.append("\n\tId: ").append(resource.id())
28212835
.append("\n\tName: ").append(resource.name())
2822-
.append("\n\tResource group: ").append(resource.resourceGroupName())
28232836
.append("\n\tCluster Id: ").append(resource.cluster())
28242837
.append("\n\tCreation time: ").append(resource.creationTime())
28252838
.append("\n\tNode count: ").append(resource.nodeCount())
2826-
.append("\n\tPriority: ").append(resource.priority())
2839+
.append("\n\tPriority: ").append(resource.schedulingPriority())
28272840
.append("\n\tExecution state: ").append(resource.executionState())
28282841
.append("\n\tExecution state transition time: ").append(resource.executionStateTransitionTime())
28292842
.append("\n\tTool type: ").append(resource.toolType())
2830-
.append("\n\tExperiment name: ").append(resource.experimentName());
2843+
.append("\n\tExperiment name: ").append(resource.experiment().name());
2844+
if (resource.mountVolumes() != null) {
2845+
info.append("\n\tMount volumes:");
2846+
if (resource.mountVolumes().azureFileShares() != null) {
2847+
info.append("\n\t\tAzure fileshares:");
2848+
for (AzureFileShareReference share : resource.mountVolumes().azureFileShares()) {
2849+
info.append("\n\t\t\tAccount name:").append(share.accountName())
2850+
.append("\n\t\t\tFile Url:").append(share.azureFileUrl())
2851+
.append("\n\t\t\tDirectory mode:").append(share.directoryMode())
2852+
.append("\n\t\t\tFile mode:").append(share.fileMode())
2853+
.append("\n\t\t\tRelative mount path:").append(share.relativeMountPath());
2854+
}
2855+
}
2856+
}
28312857
System.out.println(info.toString());
28322858
}
28332859

@@ -2901,4 +2927,4 @@ public static String curl(String url) {
29012927
return null;
29022928
}
29032929
}
2904-
}
2930+
}

0 commit comments

Comments
 (0)