コード例 #1
0
    async def delete_certificate(self, name: str, **kwargs: "**Any") -> DeletedCertificate:
        """Delete all versions of a certificate. Requires certificates/delete permission.

        If the vault has soft-delete enabled, deletion may take several seconds to complete.

        :param str name: The name of the certificate.
        :returns: The deleted certificate
        :rtype: ~azure.keyvault.certificates.models.DeletedCertificate
        :raises:
            :class:`~azure.core.exceptions.ResourceNotFoundError` if the certificate doesn't exist,
            :class:`~azure.core.exceptions.HttpResponseError` for other errors

        Example:
            .. literalinclude:: ../tests/test_examples_certificates_async.py
                :start-after: [START delete_certificate]
                :end-before: [END delete_certificate]
                :language: python
                :caption: Delete a certificate
                :dedent: 8
        """
        polling_interval = kwargs.pop("_polling_interval", None)
        if polling_interval is None:
            polling_interval = 2
        deleted_cert_bundle = await self._client.delete_certificate(
            vault_base_url=self.vault_url, certificate_name=name, error_map=_error_map, **kwargs
        )
        deleted_certificate = DeletedCertificate._from_deleted_certificate_bundle(deleted_cert_bundle)
        sd_disabled = deleted_certificate.recovery_id is None
        command = partial(self.get_deleted_certificate, name=name, **kwargs)

        delete_certificate_poller = DeleteAsyncPollingMethod(
            initial_status="deleting", finished_status="deleted", sd_disabled=sd_disabled, interval=polling_interval
        )
        return await async_poller(command, deleted_certificate, None, delete_certificate_poller)
コード例 #2
0
    async def get_deleted_certificate(self, name: str, **kwargs: "**Any") -> DeletedCertificate:
        """Retrieves information about the specified deleted certificate.

        Retrieves the deleted certificate information plus its attributes,
        such as retention interval, scheduled permanent deletion, and the
        current deletion recovery level. This operation requires the certificates/
        get permission.

        :param str name: The name of the certificate.
        :return: The deleted certificate
        :rtype: ~azure.keyvault.certificates.models.DeletedCertificate
        :raises:
            :class:`~azure.core.exceptions.ResourceNotFoundError` if the certificate doesn't exist,
            :class:`~azure.core.exceptions.HttpResponseError` for other errors

        Example:
            .. literalinclude:: ../tests/test_examples_certificates_async.py
                :start-after: [START get_deleted_certificate]
                :end-before: [END get_deleted_certificate]
                :language: python
                :caption: Get a deleted certificate
                :dedent: 8
        """
        bundle = await self._client.get_deleted_certificate(
            vault_base_url=self.vault_url, certificate_name=name, error_map=_error_map, **kwargs
        )
        return DeletedCertificate._from_deleted_certificate_bundle(deleted_certificate_bundle=bundle)
コード例 #3
0
    async def delete_certificate(self, name: str,
                                 **kwargs: "**Any") -> DeletedCertificate:
        """Deletes a certificate from the key vault.

        Deletes all versions of a certificate object along with its associated
        policy. Delete certificate cannot be used to remove individual versions
        of a certificate object. This operation requires the
        certificates/delete permission.

        :param str name: The name of the certificate.
        :returns: The deleted certificate
        :rtype: ~azure.keyvault.certificates.models.DeletedCertificate
        :raises:
            :class:`~azure.core.exceptions.ResourceNotFoundError` if the certificate doesn't exist,
            :class:`~azure.core.exceptions.HttpResponseError` for other errors

        Example:
            .. literalinclude:: ../tests/test_examples_certificates_async.py
                :start-after: [START delete_certificate]
                :end-before: [END delete_certificate]
                :language: python
                :caption: Delete a certificate
                :dedent: 8
        """
        bundle = await self._client.delete_certificate(
            vault_base_url=self.vault_endpoint,
            certificate_name=name,
            error_map=_error_map,
            **kwargs)
        return DeletedCertificate._from_deleted_certificate_bundle(
            deleted_certificate_bundle=bundle)