Skip to content

Commit

Permalink
Update to 4.0.0 for new Rest API (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
bgklein authored and xingwu1 committed Aug 23, 2018
1 parent 4f99499 commit 25d60c7
Show file tree
Hide file tree
Showing 368 changed files with 3,259 additions and 3,689 deletions.
37 changes: 25 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

## Azure Batch Libraries for Java

This README is based on the latest released version Azure Batch SDK (3.1.0). If you are looking for other releases, see the [More Information](#more-information) section below.
This README is based on the latest released version Azure Batch SDK (4.0.0). If you are looking for other releases, see the [More Information](#more-information) section below.

The Azure Batch Libraries for Java is a higher-level, object-oriented API for interacting with the Azure Batch service.


> **3.2.0** is a release that supports all features of Azure Batch service with API version "2018-03-01.6.1". We will be adding support for more new features and tweaking the API associated with Azure Batch service newer release.
> **4.0.0** is a release that supports all features of Azure Batch service with API version "2018-08-01.7.1". We will be adding support for more new features and tweaking the API associated with Azure Batch service newer release.
**Azure Batch Authentication**

Expand Down Expand Up @@ -60,25 +60,20 @@ You can find sample code that illustrates Batch usage scenarios in https://githu
# Download


**3.1.0**
**4.0.0**

If you are using released builds from 3.1.0, add the following to your POM file:
If you are using released builds from 4.0.0, add the following to your POM file:

```xml
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-batch</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.rest</groupId>
<artifactId>client-runtime</artifactId>
<version>1.3.0</version>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-client-runtime</artifactId>
<version>1.3.0</version>
<version>1.6.1</version>
</dependency>
```

Expand All @@ -103,6 +98,23 @@ If you would like to become an active contributor to this project please follow
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

# Build Code
To build the code open a console, navigate to the git repository, and run
```
maven build
```

# Test Code
To run tests, set the following environment variables:
* AZURE_BATCH_ENDPOINT
* CLIENT_ID
* APPLICATION_SECRET
* AZURE_BATCH_ACCOUNT
* AZURE_BATCH_ACCESS_KEY
* STORAGE_ACCOUNT_NAME
* STORAGE_ACCOUNT_KEY
Then run any test in src/test/java directory.

# More Information
* [Javadoc](http://azure.github.io/azure-sdk-for-java)
* [http://azure.com/java](http://azure.com/java)
Expand All @@ -112,7 +124,8 @@ If you would like to become an active contributor to this project please follow

| Version | SHA1 | Remarks |
|-------------------|-------------------------------------------------------------------------------------------|-------------------------------------------------------|
| 3.2.0 | [3.2.0](https://github.com/Azure/azure-batch-sdk-for-java/tree/master) | Tagged release for 3.2.0 version of Azure Batch libraries |
| 4.0.0 | [4.0.0](https://github.com/Azure/azure-batch-sdk-for-java/tree/master) | Tagged release for 4.0.0 version of Azure Batch libraries |
| 3.2.0 | [3.2.0](https://github.com/Azure/azure-batch-sdk-for-java/releases/tag/v3.2.0) | Tagged release for 3.2.0 version of Azure Batch libraries |
| 3.1.0 | [3.1.0](https://github.com/Azure/azure-batch-sdk-for-java/releases/tag/v3.1.0) | Tagged release for 3.1.0 version of Azure Batch libraries |
| 3.0.0 | [3.0.0](https://github.com/Azure/azure-batch-sdk-for-java/releases/tag/v3.0.0) | Tagged release for 3.0.0 version of Azure Batch libraries |
| 2.1.0 | [2.1.0](https://github.com/Azure/azure-batch-sdk-for-java/releases/tag/v2.1.0) | Tagged release for 2.1.0 version of Azure Batch libraries |
Expand Down
11 changes: 11 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Azure Batch SDK for Java release notes

## Changes in 4.0.0
### Features
- Added the functionality to get which version of the Azure Batch Node Agent(https://github.com/Azure/Batch/blob/master/changelogs/nodeagent/CHANGELOG.md) is running on nodes via the NodeAgentInformation property of ComputeNode.
- Added additional error handling to task add operations to prevent deadlock scenarios.
- Removed validation status from count operations.
- Updated adal, azure-client-runtime, and commons-codec dependencies.
- Update 'List' methods to return the lower layer PagedList object instead of the standard List.

### REST API version
This version of the Batch Java client library targets version 2018-08-01.7.1 of the Azure Batch REST API. See this [document](https://docs.microsoft.com/en-us/rest/api/batchservice/batch-service-rest-api-versioning#latest-version-2018-08-0171) for detail.

## Changes in 3.3.0
### Features
- `createTasks` rethrow `RuntimeException` catched by internal threads.
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var fs = require('fs');

var mappings = {
'batchService': {
'source': 'specification/batch/data-plane/Microsoft.Batch/stable/2018-03-01.6.1/BatchService.json',
'source': 'specification/batch/data-plane/Microsoft.Batch/stable/2018-08-01.7.1/BatchService.json',
'package': 'com.microsoft.azure.batch.protocol',
'fluent': false,
'args': '-FT 1'
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-client-runtime</artifactId>
<version>1.3.0</version>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>adal4j</artifactId>
<version>1.1.2</version>
<version>1.6.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
<version>1.11</version>
</dependency>

<!-- Test dependencies -->
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/microsoft/azure/batch/AccountOperations.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

package com.microsoft.azure.batch;

import com.microsoft.azure.PagedList;
import com.microsoft.azure.batch.protocol.models.*;

import java.io.IOException;
import java.util.Collection;
import java.util.List;

/**
* Performs account-related operations on an Azure Batch account.
Expand Down Expand Up @@ -57,7 +57,7 @@ public IInheritedBehaviors withCustomBehaviors(Collection<BatchClientBehavior> b
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
*/
public List<NodeAgentSku> listNodeAgentSkus() throws BatchErrorException, IOException {
public PagedList<NodeAgentSku> listNodeAgentSkus() throws BatchErrorException, IOException {
return listNodeAgentSkus(null, null);
}

Expand All @@ -69,7 +69,7 @@ public List<NodeAgentSku> listNodeAgentSkus() throws BatchErrorException, IOExce
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
*/
public List<NodeAgentSku> listNodeAgentSkus(DetailLevel detailLevel) throws BatchErrorException, IOException {
public PagedList<NodeAgentSku> listNodeAgentSkus(DetailLevel detailLevel) throws BatchErrorException, IOException {
return listNodeAgentSkus(detailLevel, null);
}

Expand All @@ -82,7 +82,7 @@ public List<NodeAgentSku> listNodeAgentSkus(DetailLevel detailLevel) throws Batc
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
*/
public List<NodeAgentSku> listNodeAgentSkus(DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
public PagedList<NodeAgentSku> listNodeAgentSkus(DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
AccountListNodeAgentSkusOptions options = new AccountListNodeAgentSkusOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel);
Expand All @@ -98,7 +98,7 @@ public List<NodeAgentSku> listNodeAgentSkus(DetailLevel detailLevel, Iterable<Ba
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
*/
public List<PoolNodeCounts> listPoolNodeCounts() throws BatchErrorException, IOException {
public PagedList<PoolNodeCounts> listPoolNodeCounts() throws BatchErrorException, IOException {
return listPoolNodeCounts(null, null);
}

Expand All @@ -111,7 +111,7 @@ public List<PoolNodeCounts> listPoolNodeCounts() throws BatchErrorException, IOE
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
*/
public List<PoolNodeCounts> listPoolNodeCounts(DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
public PagedList<PoolNodeCounts> listPoolNodeCounts(DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
AccountListPoolNodeCountsOptions options = new AccountListPoolNodeCountsOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

package com.microsoft.azure.batch;

import com.microsoft.azure.PagedList;
import com.microsoft.azure.batch.protocol.models.ApplicationGetOptions;
import com.microsoft.azure.batch.protocol.models.ApplicationListOptions;
import com.microsoft.azure.batch.protocol.models.ApplicationSummary;
Expand Down Expand Up @@ -60,7 +61,7 @@ public IInheritedBehaviors withCustomBehaviors(Collection<BatchClientBehavior> b
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
*/
public List<ApplicationSummary> listApplications() throws BatchErrorException, IOException {
public PagedList<ApplicationSummary> listApplications() throws BatchErrorException, IOException {
return listApplications(null);
}

Expand All @@ -72,7 +73,7 @@ public List<ApplicationSummary> listApplications() throws BatchErrorException, I
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
*/
public List<ApplicationSummary> listApplications(Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
public PagedList<ApplicationSummary> listApplications(Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
ApplicationListOptions options = new ApplicationListOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

package com.microsoft.azure.batch;

import com.microsoft.azure.PagedList;
import com.microsoft.azure.batch.protocol.models.BatchErrorException;
import com.microsoft.azure.batch.protocol.models.Certificate;
import com.microsoft.azure.batch.protocol.models.CertificateAddOptions;
Expand Down Expand Up @@ -289,7 +290,7 @@ public Certificate getCertificate(String thumbprintAlgorithm, String thumbprint,
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
*/
public List<Certificate> listCertificates() throws BatchErrorException, IOException {
public PagedList<Certificate> listCertificates() throws BatchErrorException, IOException {
return listCertificates(null, null);
}

Expand All @@ -301,7 +302,7 @@ public List<Certificate> listCertificates() throws BatchErrorException, IOExcept
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
*/
public List<Certificate> listCertificates(DetailLevel detailLevel) throws BatchErrorException, IOException {
public PagedList<Certificate> listCertificates(DetailLevel detailLevel) throws BatchErrorException, IOException {
return listCertificates(detailLevel, null);
}

Expand All @@ -314,7 +315,7 @@ public List<Certificate> listCertificates(DetailLevel detailLevel) throws BatchE
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
*/
public List<Certificate> listCertificates(DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
public PagedList<Certificate> listCertificates(DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {

CertificateListOptions certificateListOptions = new CertificateListOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

package com.microsoft.azure.batch;

import com.microsoft.azure.PagedList;
import com.microsoft.azure.batch.protocol.models.*;
import org.joda.time.DateTime;

Expand Down Expand Up @@ -485,7 +486,7 @@ public ComputeNodeGetRemoteLoginSettingsResult getComputeNodeRemoteLoginSettings
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
*/
public List<ComputeNode> listComputeNodes(String poolId) throws BatchErrorException, IOException {
public PagedList<ComputeNode> listComputeNodes(String poolId) throws BatchErrorException, IOException {
return listComputeNodes(poolId, null, null);
}

Expand All @@ -498,7 +499,7 @@ public List<ComputeNode> listComputeNodes(String poolId) throws BatchErrorExcept
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
*/
public List<ComputeNode> listComputeNodes(String poolId, DetailLevel detailLevel) throws BatchErrorException, IOException {
public PagedList<ComputeNode> listComputeNodes(String poolId, DetailLevel detailLevel) throws BatchErrorException, IOException {
return listComputeNodes(poolId, detailLevel, null);
}

Expand All @@ -512,7 +513,7 @@ public List<ComputeNode> listComputeNodes(String poolId, DetailLevel detailLevel
* @throws BatchErrorException Exception thrown when an error response is received from the Batch service.
* @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
*/
public List<ComputeNode> listComputeNodes(String poolId, DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
public PagedList<ComputeNode> listComputeNodes(String poolId, DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
ComputeNodeListOptions options = new ComputeNodeListOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel);
Expand Down
Loading

0 comments on commit 25d60c7

Please sign in to comment.