Search in sources :

Example 1 with CertificateDeleteOptions

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

the class CertificateOperations method deleteCertificate.

/**
     * Deletes the certificate from the Batch account.
     *
     * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1.
     * @param thumbprint The thumbprint of the certificate 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 deleteCertificate(String thumbprintAlgorithm, String thumbprint, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
    CertificateDeleteOptions options = new CertificateDeleteOptions();
    BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
    bhMgr.applyRequestBehaviors(options);
    this._parentBatchClient.protocolLayer().certificates().delete(thumbprintAlgorithm, thumbprint, options);
}
Also used : CertificateDeleteOptions(com.microsoft.azure.batch.protocol.models.CertificateDeleteOptions)

Example 2 with CertificateDeleteOptions

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

Example 3 with CertificateDeleteOptions

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

the class CertificatesImpl method delete.

/**
     * 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.
     * @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, CertificateDeleteHeaders> delete(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 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());
    return deleteDelegate(call.execute());
}
Also used : DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) DateTime(org.joda.time.DateTime) CertificateDeleteOptions(com.microsoft.azure.batch.protocol.models.CertificateDeleteOptions) ResponseBody(okhttp3.ResponseBody)

Aggregations

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