Skip to content

Commit

Permalink
Regenerate with RC runtime (#1)
Browse files Browse the repository at this point in the history
* Regeneate with RC runtime

* Allow throwing on 404 GET
  • Loading branch information
jianghaolu authored and xingwu1 committed Feb 17, 2017
1 parent b5f5657 commit 0abe87e
Show file tree
Hide file tree
Showing 325 changed files with 3,131 additions and 974 deletions.
25 changes: 3 additions & 22 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ gulp.task('default', function() {
console.log("--autorest-args\n\tPasses additional argument to AutoRest generator");
});

var isWindows = (process.platform.lastIndexOf('win') === 0);
var isLinux= (process.platform.lastIndexOf('linux') === 0);
var isMac = (process.platform.lastIndexOf('darwin') === 0);

var specRoot = args['spec-root'] || "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master";
var projects = 'batchService'; // default
var autoRestVersion = '1.0.0-Nightly20170129'; // default
Expand All @@ -49,10 +45,8 @@ gulp.task('codegen', function(cb) {
handleInput(projects, cb);
});
} else {
autoRestExe = autoRestVersion + "/" + GetAutoRestFolder() + "AutoRest.exe";
if (!isWindows) {
autoRestExe = "mono " + autoRestExe;
}
autoRestExe = autoRestVersion + "/src/core/AutoRest/bin/Debug/netcoreapp1.0/AutoRest.dll";
autoRestExe = "dotnet " + autoRestExe;
handleInput(projects, cb);
}

Expand Down Expand Up @@ -115,17 +109,4 @@ var deleteFolderRecursive = function(path) {
}
});
}
};

function GetAutoRestFolder() {
if (isWindows) {
return "src/core/AutoRest/bin/Debug/net451/win7-x64/";
}
if( isMac ) {
return "src/core/AutoRest/bin/Debug/net451/osx.10.11-x64/";
}
if( isLinux ) {
return "src/core/AutoRest/bin/Debug/net451/ubuntu.14.04-x64/"
}
throw new Error("Unknown platform?");
}
};
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-client-runtime</artifactId>
<version>1.0.0-beta6-SNAPSHOT</version>
<version>1.0.0-rc-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
Expand Down Expand Up @@ -160,7 +160,7 @@
<version>2.5.3</version>
</plugin>

<plugin>
<plugin>
<groupId>com.googlecode.addjars-maven-plugin</groupId>
<artifactId>addjars-maven-plugin</artifactId>
<version>1.0.5</version>
Expand Down
20 changes: 19 additions & 1 deletion src/main/java/com/microsoft/azure/batch/BatchClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@

package com.microsoft.azure.batch;

import com.microsoft.azure.AzureResponseBuilder;
import com.microsoft.azure.batch.auth.BatchCredentials;
import com.microsoft.azure.batch.interceptor.ClientRequestIdInterceptor;
import com.microsoft.azure.batch.protocol.BatchServiceClient;
import com.microsoft.azure.batch.protocol.implementation.BatchServiceClientImpl;
import com.microsoft.azure.serializer.AzureJacksonAdapter;
import com.microsoft.rest.RestClient;
import com.microsoft.rest.RestException;
import com.microsoft.rest.protocol.ResponseBuilder;
import com.microsoft.rest.protocol.SerializerAdapter;

import java.util.Collection;
import java.util.LinkedList;
Expand Down Expand Up @@ -41,7 +47,19 @@ public BatchServiceClient protocolLayer() {
}

private BatchClient(BatchCredentials credentials) {
this.protocolLayer = new BatchServiceClientImpl(credentials.baseUrl(), credentials);
RestClient restClient = new RestClient.Builder()
.withBaseUrl(credentials.baseUrl())
.withCredentials(credentials)
.withSerializerAdapter(new AzureJacksonAdapter())
.withResponseBuilderFactory(new ResponseBuilder.Factory() {
private final AzureResponseBuilder.Factory baseFactory = new AzureResponseBuilder.Factory();
@Override
public <T, E extends RestException> ResponseBuilder<T, E> newInstance(SerializerAdapter<?> serializerAdapter) {
return baseFactory.<T, E>newInstance(serializerAdapter).withThrowOnGet404(true);
}
})
.build();
this.protocolLayer = new BatchServiceClientImpl(restClient);
this.customBehaviors = new LinkedList<>();
this.customBehaviors.add(new ClientRequestIdInterceptor());
this.certificateOperations = new CertificateOperations(this, customBehaviors());
Expand Down
48 changes: 37 additions & 11 deletions src/main/java/com/microsoft/azure/batch/protocol/Accounts.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
import com.microsoft.azure.batch.protocol.models.AccountListNodeAgentSkusHeaders;
import com.microsoft.azure.batch.protocol.models.AccountListNodeAgentSkusNextOptions;
import com.microsoft.azure.batch.protocol.models.AccountListNodeAgentSkusOptions;
import com.microsoft.azure.batch.protocol.models.BatchErrorException;
import com.microsoft.azure.batch.protocol.models.NodeAgentSku;
import com.microsoft.azure.ListOperationCallback;
import com.microsoft.azure.Page;
import com.microsoft.azure.PagedList;
import com.microsoft.rest.ServiceCall;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponseWithHeaders;
import java.io.IOException;
import java.util.List;
import rx.Observable;

Expand All @@ -28,6 +30,9 @@ public interface Accounts {
/**
* Lists all node agent SKUs supported by the Azure Batch service.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws BatchErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList&lt;NodeAgentSku&gt; object if successful.
*/
PagedList<NodeAgentSku> listNodeAgentSkus();
Expand All @@ -36,27 +41,33 @@ public interface Accounts {
* Lists all node agent SKUs supported by the Azure Batch service.
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link ServiceCall} object
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
ServiceCall<List<NodeAgentSku>> listNodeAgentSkusAsync(final ListOperationCallback<NodeAgentSku> serviceCallback);
ServiceFuture<List<NodeAgentSku>> listNodeAgentSkusAsync(final ListOperationCallback<NodeAgentSku> serviceCallback);

/**
* Lists all node agent SKUs supported by the Azure Batch service.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;NodeAgentSku&gt; object
*/
Observable<Page<NodeAgentSku>> listNodeAgentSkusAsync();

/**
* Lists all node agent SKUs supported by the Azure Batch service.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;NodeAgentSku&gt; object
*/
Observable<ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders>> listNodeAgentSkusWithServiceResponseAsync();
/**
* Lists all node agent SKUs supported by the Azure Batch service.
*
* @param accountListNodeAgentSkusOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws BatchErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList&lt;NodeAgentSku&gt; object if successful.
*/
PagedList<NodeAgentSku> listNodeAgentSkus(final AccountListNodeAgentSkusOptions accountListNodeAgentSkusOptions);
Expand All @@ -66,14 +77,16 @@ public interface Accounts {
*
* @param accountListNodeAgentSkusOptions Additional parameters for the operation
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link ServiceCall} object
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
ServiceCall<List<NodeAgentSku>> listNodeAgentSkusAsync(final AccountListNodeAgentSkusOptions accountListNodeAgentSkusOptions, final ListOperationCallback<NodeAgentSku> serviceCallback);
ServiceFuture<List<NodeAgentSku>> listNodeAgentSkusAsync(final AccountListNodeAgentSkusOptions accountListNodeAgentSkusOptions, final ListOperationCallback<NodeAgentSku> serviceCallback);

/**
* Lists all node agent SKUs supported by the Azure Batch service.
*
* @param accountListNodeAgentSkusOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;NodeAgentSku&gt; object
*/
Observable<Page<NodeAgentSku>> listNodeAgentSkusAsync(final AccountListNodeAgentSkusOptions accountListNodeAgentSkusOptions);
Expand All @@ -82,6 +95,7 @@ public interface Accounts {
* Lists all node agent SKUs supported by the Azure Batch service.
*
* @param accountListNodeAgentSkusOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;NodeAgentSku&gt; object
*/
Observable<ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders>> listNodeAgentSkusWithServiceResponseAsync(final AccountListNodeAgentSkusOptions accountListNodeAgentSkusOptions);
Expand All @@ -90,6 +104,9 @@ public interface Accounts {
* Lists all node agent SKUs supported by the Azure Batch service.
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws BatchErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList&lt;NodeAgentSku&gt; object if successful.
*/
PagedList<NodeAgentSku> listNodeAgentSkusNext(final String nextPageLink);
Expand All @@ -98,16 +115,18 @@ public interface Accounts {
* Lists all node agent SKUs supported by the Azure Batch service.
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @param serviceCall the ServiceCall object tracking the Retrofit calls
* @param serviceFuture the ServiceFuture object tracking the Retrofit calls
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link ServiceCall} object
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
ServiceCall<List<NodeAgentSku>> listNodeAgentSkusNextAsync(final String nextPageLink, final ServiceCall<List<NodeAgentSku>> serviceCall, final ListOperationCallback<NodeAgentSku> serviceCallback);
ServiceFuture<List<NodeAgentSku>> listNodeAgentSkusNextAsync(final String nextPageLink, final ServiceFuture<List<NodeAgentSku>> serviceFuture, final ListOperationCallback<NodeAgentSku> serviceCallback);

/**
* Lists all node agent SKUs supported by the Azure Batch service.
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;NodeAgentSku&gt; object
*/
Observable<Page<NodeAgentSku>> listNodeAgentSkusNextAsync(final String nextPageLink);
Expand All @@ -116,6 +135,7 @@ public interface Accounts {
* Lists all node agent SKUs supported by the Azure Batch service.
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;NodeAgentSku&gt; object
*/
Observable<ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders>> listNodeAgentSkusNextWithServiceResponseAsync(final String nextPageLink);
Expand All @@ -124,6 +144,9 @@ public interface Accounts {
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @param accountListNodeAgentSkusNextOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws BatchErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList&lt;NodeAgentSku&gt; object if successful.
*/
PagedList<NodeAgentSku> listNodeAgentSkusNext(final String nextPageLink, final AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions);
Expand All @@ -133,17 +156,19 @@ public interface Accounts {
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @param accountListNodeAgentSkusNextOptions Additional parameters for the operation
* @param serviceCall the ServiceCall object tracking the Retrofit calls
* @param serviceFuture the ServiceFuture object tracking the Retrofit calls
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link ServiceCall} object
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
ServiceCall<List<NodeAgentSku>> listNodeAgentSkusNextAsync(final String nextPageLink, final AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions, final ServiceCall<List<NodeAgentSku>> serviceCall, final ListOperationCallback<NodeAgentSku> serviceCallback);
ServiceFuture<List<NodeAgentSku>> listNodeAgentSkusNextAsync(final String nextPageLink, final AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions, final ServiceFuture<List<NodeAgentSku>> serviceFuture, final ListOperationCallback<NodeAgentSku> serviceCallback);

/**
* Lists all node agent SKUs supported by the Azure Batch service.
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @param accountListNodeAgentSkusNextOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;NodeAgentSku&gt; object
*/
Observable<Page<NodeAgentSku>> listNodeAgentSkusNextAsync(final String nextPageLink, final AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions);
Expand All @@ -153,6 +178,7 @@ public interface Accounts {
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @param accountListNodeAgentSkusNextOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;NodeAgentSku&gt; object
*/
Observable<ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders>> listNodeAgentSkusNextWithServiceResponseAsync(final String nextPageLink, final AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions);
Expand Down
Loading

0 comments on commit 0abe87e

Please sign in to comment.