Search in sources :

Example 1 with CertificateGetOptions

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

the class CertificatesImpl method get.

/**
     * Gets information about the specified certificate.
     *
     * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1.
     * @param thumbprint The thumbprint of the certificate to get.
     * @throws BatchErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the Certificate object wrapped in {@link ServiceResponseWithHeaders} if successful.
     */
public ServiceResponseWithHeaders<Certificate, CertificateGetHeaders> get(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 CertificateGetOptions certificateGetOptions = null;
    String select = 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.get(thumbprintAlgorithm, thumbprint, this.client.apiVersion(), this.client.acceptLanguage(), select, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
    return getDelegate(call.execute());
}
Also used : CertificateGetOptions(com.microsoft.azure.batch.protocol.models.CertificateGetOptions) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) DateTime(org.joda.time.DateTime) ResponseBody(okhttp3.ResponseBody)

Example 2 with CertificateGetOptions

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

the class CertificateOperations method getCertificate.

/**
     * Gets the specified {@link Certificate}.
     *
     * @param thumbprintAlgorithm the algorithm used to derive the thumbprint parameter. This must be sha1.
     * @param thumbprint the thumbprint of the certificate to get.
     * @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service.
     * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
     * @return A {@link Certificate} containing information about the specified certificate in the Azure Batch account.
     * @throws BatchErrorException Exception thrown from REST call
     * @throws IOException Exception thrown from serialization/deserialization
     */
public Certificate getCertificate(String thumbprintAlgorithm, String thumbprint, DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
    CertificateGetOptions getCertificateOptions = new CertificateGetOptions();
    BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
    bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel);
    bhMgr.applyRequestBehaviors(getCertificateOptions);
    ServiceResponseWithHeaders<Certificate, CertificateGetHeaders> response = this._parentBatchClient.protocolLayer().certificates().get(thumbprintAlgorithm, thumbprint, getCertificateOptions);
    return response.getBody();
}
Also used : CertificateGetOptions(com.microsoft.azure.batch.protocol.models.CertificateGetOptions) CertificateGetHeaders(com.microsoft.azure.batch.protocol.models.CertificateGetHeaders) Certificate(com.microsoft.azure.batch.protocol.models.Certificate) X509Certificate(java.security.cert.X509Certificate)

Example 3 with CertificateGetOptions

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

the class CertificatesImpl method getAsync.

/**
     * Gets information about the specified certificate.
     *
     * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1.
     * @param thumbprint The thumbprint of the certificate to get.
     * @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 getAsync(String thumbprintAlgorithm, String thumbprint, final ServiceCallback<Certificate> 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 CertificateGetOptions certificateGetOptions = null;
    String select = 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.get(thumbprintAlgorithm, thumbprint, this.client.apiVersion(), this.client.acceptLanguage(), select, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
    final ServiceCall serviceCall = new ServiceCall(call);
    call.enqueue(new ServiceResponseCallback<Certificate>(serviceCallback) {

        @Override
        public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
            try {
                serviceCallback.success(getDelegate(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) CertificateGetOptions(com.microsoft.azure.batch.protocol.models.CertificateGetOptions) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) Certificate(com.microsoft.azure.batch.protocol.models.Certificate)

Aggregations

CertificateGetOptions (com.microsoft.azure.batch.protocol.models.CertificateGetOptions)3 Certificate (com.microsoft.azure.batch.protocol.models.Certificate)2 DateTimeRfc1123 (com.microsoft.rest.DateTimeRfc1123)2 ResponseBody (okhttp3.ResponseBody)2 DateTime (org.joda.time.DateTime)2 CertificateGetHeaders (com.microsoft.azure.batch.protocol.models.CertificateGetHeaders)1 ServiceCall (com.microsoft.rest.ServiceCall)1 X509Certificate (java.security.cert.X509Certificate)1