Skip to content

Commit 1f7916f

Browse files
authored
Generate Track 1 Java SDK for 2024-07-01 API (#41696)
* Generate Track 1 Java SDK for 2024-07-01 API * Fix pom xml configuration * Add start and deallocate Compute Node methods * Add new unit test coverage * Fix Pool Tests * Update Record Tests * Update changelog * Update version numbers
1 parent 12e9efe commit 1f7916f

File tree

106 files changed

+4873
-3726
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+4873
-3726
lines changed

eng/spotbugs-aggregate-report/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
<dependency>
9393
<groupId>com.microsoft.azure</groupId>
9494
<artifactId>azure-batch</artifactId>
95-
<version>11.2.0-beta.1</version> <!-- {x-version-update;com.microsoft.azure:azure-batch;current} -->
95+
<version>11.2.0</version> <!-- {x-version-update;com.microsoft.azure:azure-batch;current} -->
9696
</dependency>
9797
<dependency>
9898
<groupId>com.microsoft.azure</groupId>

eng/versioning/version_data.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Note: com.azure:azure-sdk-parent is in version_client.txt
44

55
com.azure:azure-data-sdk-parent;1.3.0;1.3.0
6-
com.microsoft.azure:azure-batch;11.1.1;11.2.0-beta.1
6+
com.microsoft.azure:azure-batch;11.1.1;11.2.0
77
com.microsoft.azure:azure-applicationinsights-query-sample;1.0.0-Preview-1;1.0.0-Preview-1
88
com.microsoft.azure.cognitiveservices:azure-cognitiveservices-spellcheck;1.1.0-beta.1;1.1.0-beta.1
99
com.microsoft.azure.cognitiveservices:azure-cognitiveservices-luis-runtime;1.1.0-beta.1;1.1.0-beta.1

sdk/batch/microsoft-azure-batch/CHANGELOG.md

+24-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,34 @@
11
# Release History
22

3-
## 11.2.0-beta.1 (Unreleased)
3+
## 11.2.0 (2024-09-10)
44

55
### Features Added
66

7-
### Breaking Changes
7+
- Force delete/terminate job or job schedule:
8+
- Added `force` parameter of type Boolean to `JobDeleteOptions`, `JobTerminateOptions`, `JobScheduleDeleteOptions`, and `JobScheduleTerminateOptions`.
89

9-
### Bugs Fixed
10+
- Support for compute node start/deallocate operations:
11+
- Added `startComputeNode(poolId, nodeId)` and `deallocateComputeNode(poolId, nodeId)` methods to `ComputeNodeOperations`, along with `ComputeNodeStartOptions` and `ComputeNodeDeallocateOptions`.
1012

11-
### Other Changes
13+
- Container task data mount isolation:
14+
- Added `containerHostBatchBindMounts` of type `List<ContainerHostBatchBindMountEntry>` to `TaskContainerSettings`.
15+
16+
- Patch improvements for pool and job:
17+
- Added `displayName`, `vmSize`, `taskSlotsPerNode`, `taskSchedulingPolicy`, `enableInterNodeCommunication`, `virtualMachineConfiguration`, `networkConfiguration`, `userAccounts`, `mountConfiguration`, `upgradePolicy`, and `resourceTags` to `PoolPatchParameter`.
18+
- Added `networkConfiguration` to `JobPatchParameter`.
19+
20+
- Confidential VM support:
21+
- Added `confidentialVM` to `SecurityTypes`.
22+
- Added `securityProfile` of type `VMDiskSecurityProfile` to `ManagedDisk`.
23+
24+
- Support for shared and community gallery images:
25+
- Added `sharedGalleryImageId` and `communityGalleryImageId` to `ImageReference`.
26+
27+
### Breaking Changes
28+
29+
- Removed `getComputeNodeRemoteDesktop(poolId, nodeId)` method from `ComputeNodeOperations`. Use `getComputeNodeRemoteLoginSettings(poolId, nodeId)` instead to remotely login to a compute node.
30+
- Removed `CloudServiceConfiguration` from pool models and operations. Use `VirtualMachineConfiguration` when creating pools.
31+
- Removed `ApplicationLicenses` from pool models and operations.
1232

1333
## 11.1.1 (2024-04-09)
1434

sdk/batch/microsoft-azure-batch/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ You can find sample code that illustrates Batch usage scenarios in https://githu
6262
<dependency>
6363
<groupId>com.microsoft.azure</groupId>
6464
<artifactId>azure-batch</artifactId>
65-
<version>11.1.1</version>
65+
<version>11.2.0</version>
6666
</dependency>
6767
```
6868
[//]: # ({x-version-update-end})

sdk/batch/microsoft-azure-batch/package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,8 @@
2020
"gulp": "^3.9.0",
2121
"gulp-exec": "2.1.2",
2222
"yargs": "3.29.0"
23+
},
24+
"dependencies": {
25+
"azure-sdk-for-java-codegen": "file:"
2326
}
24-
}
27+
}

sdk/batch/microsoft-azure-batch/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<groupId>com.microsoft.azure</groupId>
1717
<artifactId>azure-batch</artifactId>
1818
<packaging>jar</packaging>
19-
<version>11.2.0-beta.1</version> <!-- {x-version-update;com.microsoft.azure:azure-batch;current} -->
19+
<version>11.2.0</version> <!-- {x-version-update;com.microsoft.azure:azure-batch;current} -->
2020

2121
<name>Microsoft Azure Batch SDK Root</name>
2222
<description>This package contains the root module of Microsoft Azure Batch SDK.</description>
@@ -71,7 +71,7 @@
7171
<dependency>
7272
<groupId>com.fasterxml.jackson.core</groupId>
7373
<artifactId>jackson-core</artifactId>
74-
<version>2.13.5</version> <!-- {x-version-update;java7support_com.fasterxml.jackson.core:jackson-core;external_dependency} -->
74+
<version>2.17.2</version> <!-- {x-version-update;com.fasterxml.jackson.core:jackson-core;external_dependency} -->
7575
<scope>test</scope>
7676
</dependency>
7777

sdk/batch/microsoft-azure-batch/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java

+82-37
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,20 @@
77
import com.microsoft.azure.batch.protocol.models.BatchErrorException;
88
import com.microsoft.azure.batch.protocol.models.ComputeNode;
99
import com.microsoft.azure.batch.protocol.models.ComputeNodeAddUserOptions;
10+
import com.microsoft.azure.batch.protocol.models.ComputeNodeDeallocateOption;
11+
import com.microsoft.azure.batch.protocol.models.ComputeNodeDeallocateOptions;
1012
import com.microsoft.azure.batch.protocol.models.ComputeNodeDeleteUserOptions;
1113
import com.microsoft.azure.batch.protocol.models.ComputeNodeDisableSchedulingOptions;
1214
import com.microsoft.azure.batch.protocol.models.ComputeNodeEnableSchedulingOptions;
1315
import com.microsoft.azure.batch.protocol.models.ComputeNodeGetOptions;
14-
import com.microsoft.azure.batch.protocol.models.ComputeNodeGetRemoteDesktopOptions;
1516
import com.microsoft.azure.batch.protocol.models.ComputeNodeGetRemoteLoginSettingsOptions;
1617
import com.microsoft.azure.batch.protocol.models.ComputeNodeGetRemoteLoginSettingsResult;
1718
import com.microsoft.azure.batch.protocol.models.ComputeNodeListOptions;
1819
import com.microsoft.azure.batch.protocol.models.ComputeNodeRebootOption;
1920
import com.microsoft.azure.batch.protocol.models.ComputeNodeRebootOptions;
2021
import com.microsoft.azure.batch.protocol.models.ComputeNodeReimageOption;
2122
import com.microsoft.azure.batch.protocol.models.ComputeNodeReimageOptions;
23+
import com.microsoft.azure.batch.protocol.models.ComputeNodeStartOptions;
2224
import com.microsoft.azure.batch.protocol.models.ComputeNodeUpdateUserOptions;
2325
import com.microsoft.azure.batch.protocol.models.ComputeNodeUploadBatchServiceLogsOptions;
2426
import com.microsoft.azure.batch.protocol.models.ComputeNodeUser;
@@ -28,7 +30,6 @@
2830
import com.microsoft.azure.batch.protocol.models.UploadBatchServiceLogsResult;
2931
import org.joda.time.DateTime;
3032

31-
import java.io.ByteArrayOutputStream;
3233
import java.io.IOException;
3334
import java.util.Collection;
3435

@@ -429,41 +430,6 @@ public void enableComputeNodeScheduling(String poolId, String nodeId, Iterable<B
429430
this.parentBatchClient.protocolLayer().computeNodes().enableScheduling(poolId, nodeId, options);
430431
}
431432

432-
/**
433-
* Gets a Remote Desktop Protocol (RDP) file for the specified node.
434-
*
435-
* @param poolId The ID of the pool that contains the compute node.
436-
* @param nodeId The ID of the compute node for which to get a Remote Desktop file.
437-
* @return The RDP file contents.
438-
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
439-
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
440-
*/
441-
public String getComputeNodeRemoteDesktop(String poolId, String nodeId) throws BatchErrorException, IOException {
442-
return getComputeNodeRemoteDesktop(poolId, nodeId, null);
443-
}
444-
445-
/**
446-
* Gets a Remote Desktop Protocol (RDP) file for the specified node.
447-
*
448-
* @param poolId The ID of the pool that contains the compute node.
449-
* @param nodeId The ID of the compute node for which to get a Remote Desktop file.
450-
* @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
451-
* @return The RDP file contents.
452-
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
453-
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
454-
*/
455-
public String getComputeNodeRemoteDesktop(String poolId, String nodeId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
456-
ComputeNodeGetRemoteDesktopOptions options = new ComputeNodeGetRemoteDesktopOptions();
457-
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
458-
bhMgr.applyRequestBehaviors(options);
459-
460-
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
461-
this.parentBatchClient.protocolLayer().computeNodes().getRemoteDesktop(poolId, nodeId, options, outputStream);
462-
String rdpContent = outputStream.toString("UTF-8");
463-
outputStream.close();
464-
return rdpContent;
465-
}
466-
467433
/**
468434
* Gets the settings required for remote login to a compute node.
469435
*
@@ -582,4 +548,83 @@ public UploadBatchServiceLogsResult uploadBatchServiceLogs(String poolId, String
582548

583549
return this.parentBatchClient.protocolLayer().computeNodes().uploadBatchServiceLogs(poolId, nodeId, configuration, options);
584550
}
551+
552+
/**
553+
* Deallocates the specified compute node.
554+
* <p>You can deallocate a compute node only when it is in the {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#IDLE Idle} or {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#RUNNING Running} state.</p>
555+
*
556+
* @param poolId The ID of the pool that contains the compute node.
557+
* @param nodeId The ID of the compute node to deallocate.
558+
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
559+
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
560+
*/
561+
public void deallocateComputeNode(String poolId, String nodeId) throws BatchErrorException, IOException {
562+
deallocateComputeNode(poolId, nodeId, null, null);
563+
}
564+
565+
/**
566+
* Deallocates the specified compute node.
567+
* <p>You can deallocate a compute node only when it is in the {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#IDLE Idle} or {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#RUNNING Running} state.</p>
568+
*
569+
* @param poolId The ID of the pool that contains the compute node.
570+
* @param nodeId The ID of the compute node to deallocate.
571+
* @param nodeDeallocateOption Specifies when to deallocate the node and what to do with currently running tasks.
572+
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
573+
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
574+
*/
575+
public void deallocateComputeNode(String poolId, String nodeId, ComputeNodeDeallocateOption nodeDeallocateOption) throws BatchErrorException, IOException {
576+
deallocateComputeNode(poolId, nodeId, nodeDeallocateOption, null);
577+
}
578+
579+
/**
580+
* Deallocates the specified compute node.
581+
* <p>You can deallocate a compute node only when it is in the {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#IDLE Idle} or {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#RUNNING Running} state.</p>
582+
*
583+
* @param poolId The ID of the pool that contains the compute node.
584+
* @param nodeId The ID of the compute node to deallocate.
585+
* @param nodeDeallocateOption Specifies when to deallocate the node and what to do with currently running tasks.
586+
* @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
587+
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
588+
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
589+
*/
590+
public void deallocateComputeNode(String poolId, String nodeId, ComputeNodeDeallocateOption nodeDeallocateOption, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
591+
ComputeNodeDeallocateOptions options = new ComputeNodeDeallocateOptions();
592+
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
593+
bhMgr.applyRequestBehaviors(options);
594+
595+
this.parentBatchClient.protocolLayer().computeNodes().deallocate(poolId, nodeId, nodeDeallocateOption, options);
596+
}
597+
598+
/**
599+
* Starts the specified compute node.
600+
* <p>You can start a compute node only if it has been deallocated.</p>
601+
*
602+
* @param poolId The ID of the pool that contains the compute node.
603+
* @param nodeId The ID of the compute node to start.
604+
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
605+
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
606+
*/
607+
public void startComputeNode(String poolId, String nodeId) throws BatchErrorException, IOException {
608+
startComputeNode(poolId, nodeId, null);
609+
}
610+
611+
/**
612+
* Starts the specified compute node.
613+
* <p>You can start a compute node only if it has been deallocated.</p>
614+
*
615+
* @param poolId The ID of the pool that contains the compute node.
616+
* @param nodeId The ID of the compute node to start.
617+
* @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
618+
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
619+
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
620+
*/
621+
public void startComputeNode(String poolId, String nodeId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
622+
ComputeNodeStartOptions options = new ComputeNodeStartOptions();
623+
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
624+
bhMgr.applyRequestBehaviors(options);
625+
626+
this.parentBatchClient.protocolLayer().computeNodes().start(poolId, nodeId, options);
627+
}
628+
629+
585630
}

sdk/batch/microsoft-azure-batch/src/main/java/com/microsoft/azure/batch/PoolOperations.java

-93
Original file line numberDiff line numberDiff line change
@@ -231,99 +231,6 @@ public void deletePool(String poolId, Iterable<BatchClientBehavior> additionalBe
231231
this.parentBatchClient.protocolLayer().pools().delete(poolId, options);
232232
}
233233

234-
/**
235-
* Adds a pool to the Batch account.
236-
*
237-
* @param poolId
238-
* The ID of the pool.
239-
* @param virtualMachineSize
240-
* The size of virtual machines in the pool. See <a href=
241-
* "https://azure.microsoft.com/documentation/articles/virtual-machines-size-specs/">https://azure.microsoft.com/documentation/articles/virtual-machines-size-specs/</a>
242-
* for sizes.
243-
* @param cloudServiceConfiguration
244-
* The {@link CloudServiceConfiguration} for the pool.
245-
* @param targetDedicatedNodes
246-
* The desired number of dedicated compute nodes in the pool.
247-
* @throws BatchErrorException
248-
* Exception thrown when an error response is received from the
249-
* Batch service.
250-
* @throws IOException
251-
* Exception thrown when there is an error in
252-
* serialization/deserialization of data sent to/received from the
253-
* Batch service.
254-
*/
255-
public void createPool(String poolId, String virtualMachineSize,
256-
CloudServiceConfiguration cloudServiceConfiguration, int targetDedicatedNodes)
257-
throws BatchErrorException, IOException {
258-
createPool(poolId, virtualMachineSize, cloudServiceConfiguration, targetDedicatedNodes, 0, null);
259-
}
260-
261-
/**
262-
* Adds a pool to the Batch account.
263-
*
264-
* @param poolId
265-
* The ID of the pool.
266-
* @param virtualMachineSize
267-
* The size of virtual machines in the pool. See <a href=
268-
* "https://azure.microsoft.com/documentation/articles/virtual-machines-size-specs/">https://azure.microsoft.com/documentation/articles/virtual-machines-size-specs/</a>
269-
* for sizes.
270-
* @param cloudServiceConfiguration
271-
* The {@link CloudServiceConfiguration} for the pool.
272-
* @param targetDedicatedNodes
273-
* The desired number of dedicated compute nodes in the pool.
274-
* @param targetLowPriorityNodes
275-
* The desired number of low-priority compute nodes in the pool.
276-
* @throws BatchErrorException
277-
* Exception thrown when an error response is received from the
278-
* Batch service.
279-
* @throws IOException
280-
* Exception thrown when there is an error in
281-
* serialization/deserialization of data sent to/received from the
282-
* Batch service.
283-
*/
284-
public void createPool(String poolId, String virtualMachineSize,
285-
CloudServiceConfiguration cloudServiceConfiguration, int targetDedicatedNodes, int targetLowPriorityNodes)
286-
throws BatchErrorException, IOException {
287-
createPool(poolId, virtualMachineSize, cloudServiceConfiguration, targetDedicatedNodes, targetLowPriorityNodes,
288-
null);
289-
}
290-
291-
/**
292-
* Adds a pool to the Batch account.
293-
*
294-
* @param poolId
295-
* The ID of the pool.
296-
* @param virtualMachineSize
297-
* The size of virtual machines in the pool. See <a href=
298-
* "https://azure.microsoft.com/documentation/articles/virtual-machines-size-specs/">https://azure.microsoft.com/documentation/articles/virtual-machines-size-specs/</a>
299-
* for sizes.
300-
* @param cloudServiceConfiguration
301-
* The {@link CloudServiceConfiguration} for the pool.
302-
* @param targetDedicatedNodes
303-
* The desired number of dedicated compute nodes in the pool.
304-
* @param targetLowPriorityNodes
305-
* The desired number of low-priority compute nodes in the pool.
306-
* @param additionalBehaviors
307-
* A collection of {@link BatchClientBehavior} instances that are
308-
* applied to the Batch service request.
309-
* @throws BatchErrorException
310-
* Exception thrown when an error response is received from the
311-
* Batch service.
312-
* @throws IOException
313-
* Exception thrown when there is an error in
314-
* serialization/deserialization of data sent to/received from the
315-
* Batch service.
316-
*/
317-
public void createPool(String poolId, String virtualMachineSize,
318-
CloudServiceConfiguration cloudServiceConfiguration, int targetDedicatedNodes, int targetLowPriorityNodes,
319-
Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
320-
PoolAddParameter parameter = new PoolAddParameter().withId(poolId)
321-
.withCloudServiceConfiguration(cloudServiceConfiguration).withTargetDedicatedNodes(targetDedicatedNodes)
322-
.withTargetLowPriorityNodes(targetLowPriorityNodes).withVmSize(virtualMachineSize);
323-
324-
createPool(parameter, additionalBehaviors);
325-
}
326-
327234
/**
328235
* Adds a pool to the Batch account.
329236
*

0 commit comments

Comments
 (0)