// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.iothub.fluent;

import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
import com.azure.resourcemanager.iothub.fluent.models.CertificateDescriptionInner;
import com.azure.resourcemanager.iothub.fluent.models.CertificateListDescriptionInner;
import com.azure.resourcemanager.iothub.fluent.models.CertificateWithNonceDescriptionInner;
import com.azure.resourcemanager.iothub.models.CertificateVerificationDescription;

/** An instance of this class provides access to all the operations defined in CertificatesClient. */
public interface CertificatesClient {
    /**
     * Get the certificate list.
     *
     * <p>Returns the list of certificates.
     *
     * @param resourceGroupName The name of the resource group that contains the IoT hub.
     * @param resourceName The name of the IoT hub.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.resourcemanager.iothub.models.ErrorDetailsException thrown if the request is rejected by
     *     server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the JSON-serialized array of Certificate objects along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    Response<CertificateListDescriptionInner> listByIotHubWithResponse(
        String resourceGroupName, String resourceName, Context context);

    /**
     * Get the certificate list.
     *
     * <p>Returns the list of certificates.
     *
     * @param resourceGroupName The name of the resource group that contains the IoT hub.
     * @param resourceName The name of the IoT hub.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.resourcemanager.iothub.models.ErrorDetailsException thrown if the request is rejected by
     *     server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the JSON-serialized array of Certificate objects.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    CertificateListDescriptionInner listByIotHub(String resourceGroupName, String resourceName);

    /**
     * Get the certificate.
     *
     * <p>Returns the certificate.
     *
     * @param resourceGroupName The name of the resource group that contains the IoT hub.
     * @param resourceName The name of the IoT hub.
     * @param certificateName The name of the certificate.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.resourcemanager.iothub.models.ErrorDetailsException thrown if the request is rejected by
     *     server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the X509 Certificate along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    Response<CertificateDescriptionInner> getWithResponse(
        String resourceGroupName, String resourceName, String certificateName, Context context);

    /**
     * Get the certificate.
     *
     * <p>Returns the certificate.
     *
     * @param resourceGroupName The name of the resource group that contains the IoT hub.
     * @param resourceName The name of the IoT hub.
     * @param certificateName The name of the certificate.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.resourcemanager.iothub.models.ErrorDetailsException thrown if the request is rejected by
     *     server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the X509 Certificate.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    CertificateDescriptionInner get(String resourceGroupName, String resourceName, String certificateName);

    /**
     * Upload the certificate to the IoT hub.
     *
     * <p>Adds new or replaces existing certificate.
     *
     * @param resourceGroupName The name of the resource group that contains the IoT hub.
     * @param resourceName The name of the IoT hub.
     * @param certificateName The name of the certificate.
     * @param certificateDescription The certificate body.
     * @param ifMatch ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update
     *     an existing certificate.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.resourcemanager.iothub.models.ErrorDetailsException thrown if the request is rejected by
     *     server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the X509 Certificate along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    Response<CertificateDescriptionInner> createOrUpdateWithResponse(
        String resourceGroupName,
        String resourceName,
        String certificateName,
        CertificateDescriptionInner certificateDescription,
        String ifMatch,
        Context context);

    /**
     * Upload the certificate to the IoT hub.
     *
     * <p>Adds new or replaces existing certificate.
     *
     * @param resourceGroupName The name of the resource group that contains the IoT hub.
     * @param resourceName The name of the IoT hub.
     * @param certificateName The name of the certificate.
     * @param certificateDescription The certificate body.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.resourcemanager.iothub.models.ErrorDetailsException thrown if the request is rejected by
     *     server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the X509 Certificate.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    CertificateDescriptionInner createOrUpdate(
        String resourceGroupName,
        String resourceName,
        String certificateName,
        CertificateDescriptionInner certificateDescription);

    /**
     * Delete an X509 certificate.
     *
     * <p>Deletes an existing X509 certificate or does nothing if it does not exist.
     *
     * @param resourceGroupName The name of the resource group that contains the IoT hub.
     * @param resourceName The name of the IoT hub.
     * @param certificateName The name of the certificate.
     * @param ifMatch ETag of the Certificate.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.resourcemanager.iothub.models.ErrorDetailsException thrown if the request is rejected by
     *     server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    Response<Void> deleteWithResponse(
        String resourceGroupName, String resourceName, String certificateName, String ifMatch, Context context);

    /**
     * Delete an X509 certificate.
     *
     * <p>Deletes an existing X509 certificate or does nothing if it does not exist.
     *
     * @param resourceGroupName The name of the resource group that contains the IoT hub.
     * @param resourceName The name of the IoT hub.
     * @param certificateName The name of the certificate.
     * @param ifMatch ETag of the Certificate.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.resourcemanager.iothub.models.ErrorDetailsException thrown if the request is rejected by
     *     server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    void delete(String resourceGroupName, String resourceName, String certificateName, String ifMatch);

    /**
     * Generate verification code for proof of possession flow.
     *
     * <p>Generates verification code for proof of possession flow. The verification code will be used to generate a
     * leaf certificate.
     *
     * @param resourceGroupName The name of the resource group that contains the IoT hub.
     * @param resourceName The name of the IoT hub.
     * @param certificateName The name of the certificate.
     * @param ifMatch ETag of the Certificate.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.resourcemanager.iothub.models.ErrorDetailsException thrown if the request is rejected by
     *     server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the X509 Certificate along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    Response<CertificateWithNonceDescriptionInner> generateVerificationCodeWithResponse(
        String resourceGroupName, String resourceName, String certificateName, String ifMatch, Context context);

    /**
     * Generate verification code for proof of possession flow.
     *
     * <p>Generates verification code for proof of possession flow. The verification code will be used to generate a
     * leaf certificate.
     *
     * @param resourceGroupName The name of the resource group that contains the IoT hub.
     * @param resourceName The name of the IoT hub.
     * @param certificateName The name of the certificate.
     * @param ifMatch ETag of the Certificate.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.resourcemanager.iothub.models.ErrorDetailsException thrown if the request is rejected by
     *     server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the X509 Certificate.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    CertificateWithNonceDescriptionInner generateVerificationCode(
        String resourceGroupName, String resourceName, String certificateName, String ifMatch);

    /**
     * Verify certificate's private key possession.
     *
     * <p>Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre
     * uploaded certificate.
     *
     * @param resourceGroupName The name of the resource group that contains the IoT hub.
     * @param resourceName The name of the IoT hub.
     * @param certificateName The name of the certificate.
     * @param ifMatch ETag of the Certificate.
     * @param certificateVerificationBody The name of the certificate.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.resourcemanager.iothub.models.ErrorDetailsException thrown if the request is rejected by
     *     server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the X509 Certificate along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    Response<CertificateDescriptionInner> verifyWithResponse(
        String resourceGroupName,
        String resourceName,
        String certificateName,
        String ifMatch,
        CertificateVerificationDescription certificateVerificationBody,
        Context context);

    /**
     * Verify certificate's private key possession.
     *
     * <p>Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre
     * uploaded certificate.
     *
     * @param resourceGroupName The name of the resource group that contains the IoT hub.
     * @param resourceName The name of the IoT hub.
     * @param certificateName The name of the certificate.
     * @param ifMatch ETag of the Certificate.
     * @param certificateVerificationBody The name of the certificate.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.resourcemanager.iothub.models.ErrorDetailsException thrown if the request is rejected by
     *     server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the X509 Certificate.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    CertificateDescriptionInner verify(
        String resourceGroupName,
        String resourceName,
        String certificateName,
        String ifMatch,
        CertificateVerificationDescription certificateVerificationBody);
}
