Search in sources :

Example 1 with CertificateCancelDeletionOptions

use of com.microsoft.azure.batch.protocol.models.CertificateCancelDeletionOptions 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;
}
Also used : ServiceCall(com.microsoft.rest.ServiceCall) CertificateCancelDeletionOptions(com.microsoft.azure.batch.protocol.models.CertificateCancelDeletionOptions) DateTime(org.joda.time.DateTime) ResponseBody(okhttp3.ResponseBody) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123)

Example 2 with CertificateCancelDeletionOptions

use of com.microsoft.azure.batch.protocol.models.CertificateCancelDeletionOptions in project azure-sdk-for-java by Azure.

the class CertificatesImpl method cancelDeletion.

/**
     * 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.
     * @throws BatchErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the {@link ServiceResponseWithHeaders} object if successful.
     */
public ServiceResponseWithHeaders<Void, CertificateCancelDeletionHeaders> cancelDeletion(String thumbprintAlgorithm, String thumbprint) throws BatchErrorException, IOException, IllegalArgumentException {
    if (thumbprintAlgorithm == null) {
        throw new IllegalArgumentException("Parameter thumbprintAlgorithm is required and cannot be null.");
    }
    if (thumbprint == null) {
        throw new IllegalArgumentException("Parameter thumbprint is required and cannot be null.");
    }
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be 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());
    return cancelDeletionDelegate(call.execute());
}
Also used : CertificateCancelDeletionOptions(com.microsoft.azure.batch.protocol.models.CertificateCancelDeletionOptions) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) DateTime(org.joda.time.DateTime) ResponseBody(okhttp3.ResponseBody)

Example 3 with CertificateCancelDeletionOptions

use of com.microsoft.azure.batch.protocol.models.CertificateCancelDeletionOptions in project azure-sdk-for-java by Azure.

the class CertificateOperations method cancelDeleteCertificate.

/**
     * Cancels a failed deletion of the specified certificate.  This can be done only when
     * the certificate is in the DeleteFailed state, and restores the certificate to the Active state.
     *
     * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1.
     * @param thumbprint The thumbprint of the certificate that failed to delete.
     * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
     * @throws BatchErrorException Exception thrown from REST call
     * @throws IOException Exception thrown from serialization/deserialization
     */
public void cancelDeleteCertificate(String thumbprintAlgorithm, String thumbprint, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
    CertificateCancelDeletionOptions options = new CertificateCancelDeletionOptions();
    BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
    bhMgr.applyRequestBehaviors(options);
    this._parentBatchClient.protocolLayer().certificates().cancelDeletion(thumbprintAlgorithm, thumbprint, options);
}
Also used : CertificateCancelDeletionOptions(com.microsoft.azure.batch.protocol.models.CertificateCancelDeletionOptions)

Aggregations

CertificateCancelDeletionOptions (com.microsoft.azure.batch.protocol.models.CertificateCancelDeletionOptions)3 DateTimeRfc1123 (com.microsoft.rest.DateTimeRfc1123)2 ResponseBody (okhttp3.ResponseBody)2 DateTime (org.joda.time.DateTime)2 ServiceCall (com.microsoft.rest.ServiceCall)1