diff --git a/.gitignore b/.gitignore index abf3e16c07..a15a9cb030 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,9 @@ hs_err_pid* .idea *.iml .DS_Store + +# Eclipse/VSCode Java files +.settings/ +.project +.factorypath +.classpath \ No newline at end of file diff --git a/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java b/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java index a5434eced8..bdf77f711b 100644 --- a/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java +++ b/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java @@ -507,6 +507,37 @@ public Observable> call(ServiceResponse the return type of the caller + * @param the type of the response header + * @param resourceType the java.lang.reflect.Type of the resource. + * @param headerType the type of the response header + * @return the task describing the asynchronous polling. + */ + public Observable> getPostOrDeleteResultWithHeadersAsync(Observable> observable, final LongRunningOperationOptions lroOptions, Type resourceType, final Class headerType) { + Observable> bodyResponse = getPostOrDeleteResultAsync(observable, lroOptions, resourceType); + return bodyResponse + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(ServiceResponse serviceResponse) { + try { + return Observable + .just(new ServiceResponseWithHeaders<>(serviceResponse.body(), + restClient().serializerAdapter().deserialize(restClient().serializerAdapter().serialize(serviceResponse.response().headers()), headerType), + serviceResponse.response())); + } catch (IOException e) { + return Observable.error(e); + } + } + }); + } + /** * Given a polling state representing state of a LRO operation, this method returns {@link Single} object, * when subscribed to it, a single poll will be performed and emits the latest polling state. A poll will be