def list_properties_of_issuers(self, **kwargs: "**Any") -> AsyncIterable[IssuerProperties]: """Lists properties of the certificate issuers for the key vault. Returns the set of certificate issuer resources in the key vault. This operation requires the certificates/manageissuers/getissuers permission. :return: An iterator like instance of Issuers :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.certificates.models.CertificateIssuer] :raises: :class:`~azure.core.exceptions.HttpResponseError` Example: .. literalinclude:: ../tests/test_examples_certificates_async.py :start-after: [START list_properties_of_issuers] :end-before: [END list_properties_of_issuers] :language: python :caption: List issuers of a vault :dedent: 8 """ max_page_size = kwargs.pop("max_page_size", None) return self._client.get_certificate_issuers( vault_base_url=self.vault_url, maxresults=max_page_size, cls=lambda objs: [IssuerProperties._from_issuer_item(x) for x in objs], **kwargs )
async def test_crud_issuer(self, vault_client, **kwargs): self.assertIsNotNone(vault_client) client = vault_client.certificates issuer_name = "issuer" admin_details = [ AdministratorDetails(first_name="John", last_name="Doe", email="*****@*****.**", phone="4255555555") ] # create certificate issuer issuer = await client.create_issuer(name=issuer_name, provider="Test", account_id="keyvaultuser", admin_details=admin_details, enabled=True) properties = IssuerProperties(issuer_id=client.vault_url + "/certificates/issuers/" + issuer_name, provider="Test") expected = Issuer(properties=properties, account_id="keyvaultuser", admin_details=admin_details, attributes=IssuerAttributes(enabled=True)) self._validate_certificate_issuer(issuer=issuer, expected=expected) # get certificate issuer issuer = await client.get_issuer(name=issuer_name) self._validate_certificate_issuer(issuer=issuer, expected=expected) # list certificate issuers await client.create_issuer(name=issuer_name + "2", provider="Test", account_id="keyvaultuser2", admin_details=admin_details, enabled=True) expected_base_1 = IssuerProperties(issuer_id=client.vault_url + "/certificates/issuers/" + issuer_name, provider="Test") expected_base_2 = IssuerProperties(issuer_id=client.vault_url + "/certificates/issuers/" + issuer_name + "2", provider="Test") expected_issuers = [expected_base_1, expected_base_2] issuers = client.list_issuers() async for issuer in issuers: exp_issuer = next( (i for i in expected_issuers if i.name == issuer.name), None) self.assertIsNotNone(exp_issuer) self._validate_certificate_issuer_properties(issuer=issuer, expected=exp_issuer) expected_issuers.remove(exp_issuer) self.assertEqual(len(expected_issuers), 0) # update certificate issuer admin_details = [ AdministratorDetails(first_name="Jane", last_name="Doe", email="*****@*****.**", phone="4255555555") ] expected = Issuer(properties=properties, account_id="keyvaultuser", admin_details=admin_details, attributes=IssuerAttributes(enabled=True)) issuer = await client.update_issuer(name=issuer_name, admin_details=admin_details) self._validate_certificate_issuer(issuer=issuer, expected=expected) # delete certificate issuer await client.delete_issuer(name=issuer_name) # get certificate issuer returns not found try: await client.get_issuer(name=issuer_name) self.fail('Get should fail') except Exception as ex: if not hasattr(ex, 'message') or 'not found' not in ex.message.lower(): raise ex