Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
package com.microsoft.azure.batch.protocol;

import com.microsoft.azure.AzureClient;
import com.microsoft.rest.RestClient;
import com.microsoft.azure.RestClient;

/**
* The interface for BatchServiceClient class.
Expand Down Expand Up @@ -51,8 +51,9 @@ public interface BatchServiceClient {
* Sets Gets or sets the preferred language for the response..
*
* @param acceptLanguage the acceptLanguage value.
* @return the service client itself
*/
void withAcceptLanguage(String acceptLanguage);
BatchServiceClient withAcceptLanguage(String acceptLanguage);

/**
* Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30..
Expand All @@ -65,8 +66,9 @@ public interface BatchServiceClient {
* Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30..
*
* @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value.
* @return the service client itself
*/
void withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout);
BatchServiceClient withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout);

/**
* Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true..
Expand All @@ -79,8 +81,9 @@ public interface BatchServiceClient {
* Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true..
*
* @param generateClientRequestId the generateClientRequestId value.
* @return the service client itself
*/
void withGenerateClientRequestId(boolean generateClientRequestId);
BatchServiceClient withGenerateClientRequestId(boolean generateClientRequestId);

/**
* Gets the Applications object to access its operations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import retrofit2.Retrofit;
import com.microsoft.azure.batch.protocol.Accounts;
import com.microsoft.azure.batch.protocol.BatchServiceClient;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.AzureServiceResponseBuilder;
import com.microsoft.azure.batch.protocol.models.AccountListNodeAgentSkusHeaders;
Expand Down Expand Up @@ -45,15 +44,15 @@ public final class AccountsImpl implements Accounts {
/** The Retrofit service to perform REST calls. */
private AccountsService service;
/** The service client containing this operation class. */
private BatchServiceClient client;
private BatchServiceClientImpl client;

/**
* Initializes an instance of AccountsImpl.
*
* @param retrofit the Retrofit instance built from a Retrofit Builder.
* @param client the instance of the service client containing this operation class.
*/
public AccountsImpl(Retrofit retrofit, BatchServiceClient client) {
public AccountsImpl(Retrofit retrofit, BatchServiceClientImpl client) {
this.service = retrofit.create(AccountsService.class);
this.client = client;
}
Expand Down Expand Up @@ -290,7 +289,7 @@ public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response)
}

private ServiceResponseWithHeaders<PageImpl<NodeAgentSku>, AccountListNodeAgentSkusHeaders> listNodeAgentSkusDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
return new AzureServiceResponseBuilder<PageImpl<NodeAgentSku>, BatchErrorException>(this.client.restClient().mapperAdapter())
return new AzureServiceResponseBuilder<PageImpl<NodeAgentSku>, BatchErrorException>(this.client.mapperAdapter())
.register(200, new TypeToken<PageImpl<NodeAgentSku>>() { }.getType())
.registerError(BatchErrorException.class)
.buildWithHeaders(response, AccountListNodeAgentSkusHeaders.class);
Expand Down Expand Up @@ -461,7 +460,7 @@ public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response)
}

private ServiceResponseWithHeaders<PageImpl<NodeAgentSku>, AccountListNodeAgentSkusHeaders> listNodeAgentSkusNextDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
return new AzureServiceResponseBuilder<PageImpl<NodeAgentSku>, BatchErrorException>(this.client.restClient().mapperAdapter())
return new AzureServiceResponseBuilder<PageImpl<NodeAgentSku>, BatchErrorException>(this.client.mapperAdapter())
.register(200, new TypeToken<PageImpl<NodeAgentSku>>() { }.getType())
.registerError(BatchErrorException.class)
.buildWithHeaders(response, AccountListNodeAgentSkusHeaders.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import retrofit2.Retrofit;
import com.microsoft.azure.batch.protocol.Applications;
import com.microsoft.azure.batch.protocol.BatchServiceClient;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.AzureServiceResponseBuilder;
import com.microsoft.azure.batch.protocol.models.ApplicationGetHeaders;
Expand Down Expand Up @@ -49,15 +48,15 @@ public final class ApplicationsImpl implements Applications {
/** The Retrofit service to perform REST calls. */
private ApplicationsService service;
/** The service client containing this operation class. */
private BatchServiceClient client;
private BatchServiceClientImpl client;

/**
* Initializes an instance of ApplicationsImpl.
*
* @param retrofit the Retrofit instance built from a Retrofit Builder.
* @param client the instance of the service client containing this operation class.
*/
public ApplicationsImpl(Retrofit retrofit, BatchServiceClient client) {
public ApplicationsImpl(Retrofit retrofit, BatchServiceClientImpl client) {
this.service = retrofit.create(ApplicationsService.class);
this.client = client;
}
Expand Down Expand Up @@ -288,7 +287,7 @@ public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response)
}

private ServiceResponseWithHeaders<PageImpl<ApplicationSummary>, ApplicationListHeaders> listDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
return new AzureServiceResponseBuilder<PageImpl<ApplicationSummary>, BatchErrorException>(this.client.restClient().mapperAdapter())
return new AzureServiceResponseBuilder<PageImpl<ApplicationSummary>, BatchErrorException>(this.client.mapperAdapter())
.register(200, new TypeToken<PageImpl<ApplicationSummary>>() { }.getType())
.registerError(BatchErrorException.class)
.buildWithHeaders(response, ApplicationListHeaders.class);
Expand Down Expand Up @@ -467,7 +466,7 @@ public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response)
}

private ServiceResponseWithHeaders<ApplicationSummary, ApplicationGetHeaders> getDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
return new AzureServiceResponseBuilder<ApplicationSummary, BatchErrorException>(this.client.restClient().mapperAdapter())
return new AzureServiceResponseBuilder<ApplicationSummary, BatchErrorException>(this.client.mapperAdapter())
.register(200, new TypeToken<ApplicationSummary>() { }.getType())
.registerError(BatchErrorException.class)
.buildWithHeaders(response, ApplicationGetHeaders.class);
Expand Down Expand Up @@ -638,7 +637,7 @@ public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response)
}

private ServiceResponseWithHeaders<PageImpl<ApplicationSummary>, ApplicationListHeaders> listNextDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
return new AzureServiceResponseBuilder<PageImpl<ApplicationSummary>, BatchErrorException>(this.client.restClient().mapperAdapter())
return new AzureServiceResponseBuilder<PageImpl<ApplicationSummary>, BatchErrorException>(this.client.mapperAdapter())
.register(200, new TypeToken<PageImpl<ApplicationSummary>>() { }.getType())
.registerError(BatchErrorException.class)
.buildWithHeaders(response, ApplicationListHeaders.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
import com.microsoft.azure.batch.protocol.JobSchedules;
import com.microsoft.azure.batch.protocol.Pools;
import com.microsoft.azure.batch.protocol.Tasks;
import com.microsoft.azure.serializer.AzureJacksonMapperAdapter;
import com.microsoft.azure.RestClient;
import com.microsoft.rest.credentials.ServiceClientCredentials;
import com.microsoft.rest.RestClient;

/**
* Initializes a new instance of the BatchServiceClientImpl class.
Expand Down Expand Up @@ -65,9 +64,11 @@ public String acceptLanguage() {
* Sets Gets or sets the preferred language for the response.
*
* @param acceptLanguage the acceptLanguage value.
* @return the service client itself
*/
public void withAcceptLanguage(String acceptLanguage) {
public BatchServiceClientImpl withAcceptLanguage(String acceptLanguage) {
this.acceptLanguage = acceptLanguage;
return this;
}

/** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */
Expand All @@ -86,9 +87,11 @@ public int longRunningOperationRetryTimeout() {
* Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.
*
* @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value.
* @return the service client itself
*/
public void withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) {
public BatchServiceClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) {
this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout;
return this;
}

/** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */
Expand All @@ -107,9 +110,11 @@ public boolean generateClientRequestId() {
* Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
*
* @param generateClientRequestId the generateClientRequestId value.
* @return the service client itself
*/
public void withGenerateClientRequestId(boolean generateClientRequestId) {
public BatchServiceClientImpl withGenerateClientRequestId(boolean generateClientRequestId) {
this.generateClientRequestId = generateClientRequestId;
return this;
}

/**
Expand Down Expand Up @@ -245,8 +250,8 @@ public BatchServiceClientImpl(ServiceClientCredentials credentials) {
* @param credentials the management credentials for Azure
*/
public BatchServiceClientImpl(String baseUrl, ServiceClientCredentials credentials) {
this(new RestClient.Builder(baseUrl)
.withMapperAdapter(new AzureJacksonMapperAdapter())
this(new RestClient.Builder()
.withBaseUrl(baseUrl)
.withCredentials(credentials)
.build());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import retrofit2.Retrofit;
import com.microsoft.azure.batch.protocol.Certificates;
import com.microsoft.azure.batch.protocol.BatchServiceClient;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.AzureServiceResponseBuilder;
import com.microsoft.azure.batch.protocol.models.BatchErrorException;
Expand Down Expand Up @@ -59,15 +58,15 @@ public final class CertificatesImpl implements Certificates {
/** The Retrofit service to perform REST calls. */
private CertificatesService service;
/** The service client containing this operation class. */
private BatchServiceClient client;
private BatchServiceClientImpl client;

/**
* Initializes an instance of CertificatesImpl.
*
* @param retrofit the Retrofit instance built from a Retrofit Builder.
* @param client the instance of the service client containing this operation class.
*/
public CertificatesImpl(Retrofit retrofit, BatchServiceClient client) {
public CertificatesImpl(Retrofit retrofit, BatchServiceClientImpl client) {
this.service = retrofit.create(CertificatesService.class);
this.client = client;
}
Expand Down Expand Up @@ -280,7 +279,7 @@ public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response)
}

private ServiceResponseWithHeaders<Void, CertificateAddHeaders> addDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
return new AzureServiceResponseBuilder<Void, BatchErrorException>(this.client.restClient().mapperAdapter())
return new AzureServiceResponseBuilder<Void, BatchErrorException>(this.client.mapperAdapter())
.register(201, new TypeToken<Void>() { }.getType())
.registerError(BatchErrorException.class)
.buildWithHeaders(response, CertificateAddHeaders.class);
Expand Down Expand Up @@ -513,7 +512,7 @@ public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response)
}

private ServiceResponseWithHeaders<PageImpl<Certificate>, CertificateListHeaders> listDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
return new AzureServiceResponseBuilder<PageImpl<Certificate>, BatchErrorException>(this.client.restClient().mapperAdapter())
return new AzureServiceResponseBuilder<PageImpl<Certificate>, BatchErrorException>(this.client.mapperAdapter())
.register(200, new TypeToken<PageImpl<Certificate>>() { }.getType())
.registerError(BatchErrorException.class)
.buildWithHeaders(response, CertificateListHeaders.class);
Expand Down Expand Up @@ -710,7 +709,7 @@ public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response)
}

private ServiceResponseWithHeaders<Void, CertificateCancelDeletionHeaders> cancelDeletionDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
return new AzureServiceResponseBuilder<Void, BatchErrorException>(this.client.restClient().mapperAdapter())
return new AzureServiceResponseBuilder<Void, BatchErrorException>(this.client.mapperAdapter())
.register(204, new TypeToken<Void>() { }.getType())
.registerError(BatchErrorException.class)
.buildWithHeaders(response, CertificateCancelDeletionHeaders.class);
Expand Down Expand Up @@ -907,7 +906,7 @@ public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response)
}

private ServiceResponseWithHeaders<Void, CertificateDeleteHeaders> deleteDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
return new AzureServiceResponseBuilder<Void, BatchErrorException>(this.client.restClient().mapperAdapter())
return new AzureServiceResponseBuilder<Void, BatchErrorException>(this.client.mapperAdapter())
.register(202, new TypeToken<Void>() { }.getType())
.registerError(BatchErrorException.class)
.buildWithHeaders(response, CertificateDeleteHeaders.class);
Expand Down Expand Up @@ -1114,7 +1113,7 @@ public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response)
}

private ServiceResponseWithHeaders<Certificate, CertificateGetHeaders> getDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
return new AzureServiceResponseBuilder<Certificate, BatchErrorException>(this.client.restClient().mapperAdapter())
return new AzureServiceResponseBuilder<Certificate, BatchErrorException>(this.client.mapperAdapter())
.register(200, new TypeToken<Certificate>() { }.getType())
.registerError(BatchErrorException.class)
.buildWithHeaders(response, CertificateGetHeaders.class);
Expand Down Expand Up @@ -1285,7 +1284,7 @@ public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response)
}

private ServiceResponseWithHeaders<PageImpl<Certificate>, CertificateListHeaders> listNextDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
return new AzureServiceResponseBuilder<PageImpl<Certificate>, BatchErrorException>(this.client.restClient().mapperAdapter())
return new AzureServiceResponseBuilder<PageImpl<Certificate>, BatchErrorException>(this.client.mapperAdapter())
.register(200, new TypeToken<PageImpl<Certificate>>() { }.getType())
.registerError(BatchErrorException.class)
.buildWithHeaders(response, CertificateListHeaders.class);
Expand Down
Loading