use of com.microsoft.rest.ServiceCall in project azure-sdk-for-java by Azure.
the class CertificatesImpl method cancelDeletionAsync.
/**
* Cancels a failed deletion of a certificate from the specified account.
*
* @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1.
* @param thumbprint The thumbprint of the certificate being deleted.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if callback is null
* @return the {@link Call} object
*/
public ServiceCall cancelDeletionAsync(String thumbprintAlgorithm, String thumbprint, final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
if (thumbprintAlgorithm == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter thumbprintAlgorithm is required and cannot be null."));
return null;
}
if (thumbprint == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter thumbprint is required and cannot be null."));
return null;
}
if (this.client.apiVersion() == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."));
return null;
}
final CertificateCancelDeletionOptions certificateCancelDeletionOptions = null;
Integer timeout = null;
String clientRequestId = null;
Boolean returnClientRequestId = null;
DateTime ocpDate = null;
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
Call<ResponseBody> call = service.cancelDeletion(thumbprintAlgorithm, thumbprint, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
final ServiceCall serviceCall = new ServiceCall(call);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
try {
serviceCallback.success(cancelDeletionDelegate(response));
} catch (BatchErrorException | IOException exception) {
serviceCallback.failure(exception);
}
}
});
return serviceCall;
}
use of com.microsoft.rest.ServiceCall in project azure-sdk-for-java by Azure.
the class CertificatesImpl method deleteAsync.
/**
* Deletes a certificate from the specified account.
*
* @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1.
* @param thumbprint The thumbprint of the certificate to be deleted.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if callback is null
* @return the {@link Call} object
*/
public ServiceCall deleteAsync(String thumbprintAlgorithm, String thumbprint, final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
if (thumbprintAlgorithm == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter thumbprintAlgorithm is required and cannot be null."));
return null;
}
if (thumbprint == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter thumbprint is required and cannot be null."));
return null;
}
if (this.client.apiVersion() == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."));
return null;
}
final CertificateDeleteOptions certificateDeleteOptions = null;
Integer timeout = null;
String clientRequestId = null;
Boolean returnClientRequestId = null;
DateTime ocpDate = null;
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
Call<ResponseBody> call = service.delete(thumbprintAlgorithm, thumbprint, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
final ServiceCall serviceCall = new ServiceCall(call);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
try {
serviceCallback.success(deleteDelegate(response));
} catch (BatchErrorException | IOException exception) {
serviceCallback.failure(exception);
}
}
});
return serviceCall;
}
use of com.microsoft.rest.ServiceCall in project azure-sdk-for-java by Azure.
the class CertificatesImpl method listAsync.
/**
* Lists all of the certificates that have been added to the specified account.
*
* @param certificateListOptions Additional parameters for the operation
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if callback is null
* @return the {@link Call} object
*/
public ServiceCall listAsync(final CertificateListOptions certificateListOptions, final ListOperationCallback<Certificate> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
if (this.client.apiVersion() == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."));
return null;
}
Validator.validate(certificateListOptions, serviceCallback);
String filter = null;
if (certificateListOptions != null) {
filter = certificateListOptions.filter();
}
String select = null;
if (certificateListOptions != null) {
select = certificateListOptions.select();
}
Integer maxResults = null;
if (certificateListOptions != null) {
maxResults = certificateListOptions.maxResults();
}
Integer timeout = null;
if (certificateListOptions != null) {
timeout = certificateListOptions.timeout();
}
String clientRequestId = null;
if (certificateListOptions != null) {
clientRequestId = certificateListOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (certificateListOptions != null) {
returnClientRequestId = certificateListOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (certificateListOptions != null) {
ocpDate = certificateListOptions.ocpDate();
}
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
Call<ResponseBody> call = service.list(this.client.apiVersion(), this.client.acceptLanguage(), filter, select, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
final ServiceCall serviceCall = new ServiceCall(call);
call.enqueue(new ServiceResponseCallback<List<Certificate>>(serviceCallback) {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<PageImpl<Certificate>, CertificateListHeaders> result = listDelegate(response);
serviceCallback.load(result.getBody().getItems());
if (result.getBody().getNextPageLink() != null && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) {
CertificateListNextOptions certificateListNextOptions = null;
if (certificateListOptions != null) {
certificateListNextOptions = new CertificateListNextOptions();
certificateListNextOptions.withClientRequestId(certificateListOptions.clientRequestId());
certificateListNextOptions.withReturnClientRequestId(certificateListOptions.returnClientRequestId());
certificateListNextOptions.withOcpDate(certificateListOptions.ocpDate());
}
listNextAsync(result.getBody().getNextPageLink(), certificateListNextOptions, serviceCall, serviceCallback);
} else {
serviceCallback.success(new ServiceResponseWithHeaders<>(serviceCallback.get(), result.getHeaders(), result.getResponse()));
}
} catch (BatchErrorException | IOException exception) {
serviceCallback.failure(exception);
}
}
});
return serviceCall;
}
use of com.microsoft.rest.ServiceCall in project azure-sdk-for-java by Azure.
the class ApplicationsImpl method listAsync.
/**
* Lists all of the applications available in the specified account.
*
* @param applicationListOptions Additional parameters for the operation
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if callback is null
* @return the {@link Call} object
*/
public ServiceCall listAsync(final ApplicationListOptions applicationListOptions, final ListOperationCallback<ApplicationSummary> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
if (this.client.apiVersion() == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."));
return null;
}
Validator.validate(applicationListOptions, serviceCallback);
Integer maxResults = null;
if (applicationListOptions != null) {
maxResults = applicationListOptions.maxResults();
}
Integer timeout = null;
if (applicationListOptions != null) {
timeout = applicationListOptions.timeout();
}
String clientRequestId = null;
if (applicationListOptions != null) {
clientRequestId = applicationListOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (applicationListOptions != null) {
returnClientRequestId = applicationListOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (applicationListOptions != null) {
ocpDate = applicationListOptions.ocpDate();
}
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
Call<ResponseBody> call = service.list(this.client.apiVersion(), this.client.acceptLanguage(), maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
final ServiceCall serviceCall = new ServiceCall(call);
call.enqueue(new ServiceResponseCallback<List<ApplicationSummary>>(serviceCallback) {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<PageImpl<ApplicationSummary>, ApplicationListHeaders> result = listDelegate(response);
serviceCallback.load(result.getBody().getItems());
if (result.getBody().getNextPageLink() != null && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) {
ApplicationListNextOptions applicationListNextOptions = null;
if (applicationListOptions != null) {
applicationListNextOptions = new ApplicationListNextOptions();
applicationListNextOptions.withClientRequestId(applicationListOptions.clientRequestId());
applicationListNextOptions.withReturnClientRequestId(applicationListOptions.returnClientRequestId());
applicationListNextOptions.withOcpDate(applicationListOptions.ocpDate());
}
listNextAsync(result.getBody().getNextPageLink(), applicationListNextOptions, serviceCall, serviceCallback);
} else {
serviceCallback.success(new ServiceResponseWithHeaders<>(serviceCallback.get(), result.getHeaders(), result.getResponse()));
}
} catch (BatchErrorException | IOException exception) {
serviceCallback.failure(exception);
}
}
});
return serviceCall;
}
use of com.microsoft.rest.ServiceCall in project azure-sdk-for-java by Azure.
the class AccountsImpl method listNodeAgentSkusAsync.
/**
* Lists all node agent SKUs supported by the Azure Batch service.
*
* @param accountListNodeAgentSkusOptions Additional parameters for the operation
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if callback is null
* @return the {@link Call} object
*/
public ServiceCall listNodeAgentSkusAsync(final AccountListNodeAgentSkusOptions accountListNodeAgentSkusOptions, final ListOperationCallback<NodeAgentSku> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
if (this.client.apiVersion() == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."));
return null;
}
Validator.validate(accountListNodeAgentSkusOptions, serviceCallback);
String filter = null;
if (accountListNodeAgentSkusOptions != null) {
filter = accountListNodeAgentSkusOptions.filter();
}
Integer maxResults = null;
if (accountListNodeAgentSkusOptions != null) {
maxResults = accountListNodeAgentSkusOptions.maxResults();
}
Integer timeout = null;
if (accountListNodeAgentSkusOptions != null) {
timeout = accountListNodeAgentSkusOptions.timeout();
}
String clientRequestId = null;
if (accountListNodeAgentSkusOptions != null) {
clientRequestId = accountListNodeAgentSkusOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (accountListNodeAgentSkusOptions != null) {
returnClientRequestId = accountListNodeAgentSkusOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (accountListNodeAgentSkusOptions != null) {
ocpDate = accountListNodeAgentSkusOptions.ocpDate();
}
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
Call<ResponseBody> call = service.listNodeAgentSkus(this.client.apiVersion(), this.client.acceptLanguage(), filter, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
final ServiceCall serviceCall = new ServiceCall(call);
call.enqueue(new ServiceResponseCallback<List<NodeAgentSku>>(serviceCallback) {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<PageImpl<NodeAgentSku>, AccountListNodeAgentSkusHeaders> result = listNodeAgentSkusDelegate(response);
serviceCallback.load(result.getBody().getItems());
if (result.getBody().getNextPageLink() != null && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) {
AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions = null;
if (accountListNodeAgentSkusOptions != null) {
accountListNodeAgentSkusNextOptions = new AccountListNodeAgentSkusNextOptions();
accountListNodeAgentSkusNextOptions.withClientRequestId(accountListNodeAgentSkusOptions.clientRequestId());
accountListNodeAgentSkusNextOptions.withReturnClientRequestId(accountListNodeAgentSkusOptions.returnClientRequestId());
accountListNodeAgentSkusNextOptions.withOcpDate(accountListNodeAgentSkusOptions.ocpDate());
}
listNodeAgentSkusNextAsync(result.getBody().getNextPageLink(), accountListNodeAgentSkusNextOptions, serviceCall, serviceCallback);
} else {
serviceCallback.success(new ServiceResponseWithHeaders<>(serviceCallback.get(), result.getHeaders(), result.getResponse()));
}
} catch (BatchErrorException | IOException exception) {
serviceCallback.failure(exception);
}
}
});
return serviceCall;
}
Aggregations