Skip to content

Commit

Permalink
Fix whitespace, re-trigger pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
mccoyp committed Nov 18, 2020
1 parent 7a26b13 commit 22a1497
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 146 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ def test_create_certificate_client():
vault_url = "vault_url"
# pylint:disable=unused-variable
# [START create_certificate_client]

from azure.identity import DefaultAzureCredential
from azure.keyvault.certificates import CertificateClient

# Create a CertificateClient using default Azure credentials
credential = DefaultAzureCredential()
certificate_client = CertificateClient(vault_url=vault_url, credential=credential)

# [END create_certificate_client]


Expand Down Expand Up @@ -78,33 +76,27 @@ def test_example_certificate_crud_operations(self, client, **kwargs):
print(certificate.id)
print(certificate.name)
print(certificate.policy.issuer_name)

# [END create_certificate]

# [START get_certificate]

# get the certificate
certificate = certificate_client.get_certificate(cert_name)

print(certificate.id)
print(certificate.name)
print(certificate.policy.issuer_name)

# [END get_certificate]

version = certificate.properties.version

# [START get_certificate_version]

certificate = certificate_client.get_certificate_version(cert_name, version)

print(certificate.id)
print(certificate.properties.version)

# [END get_certificate_version]

# [START update_certificate]

# update attributes of an existing certificate
tags = {"foo": "updated tag"}
updated_certificate = certificate_client.update_certificate_properties(
Expand All @@ -114,10 +106,9 @@ def test_example_certificate_crud_operations(self, client, **kwargs):
print(updated_certificate.properties.version)
print(updated_certificate.properties.updated_on)
print(updated_certificate.properties.tags)

# [END update_certificate]
# [START delete_certificate]

# [START delete_certificate]
# delete a certificate
deleted_certificate = certificate_client.begin_delete_certificate(certificate.name).result()

Expand All @@ -128,7 +119,6 @@ def test_example_certificate_crud_operations(self, client, **kwargs):
print(deleted_certificate.deleted_on)
print(deleted_certificate.scheduled_purge_date)
print(deleted_certificate.recovery_id)

# [END delete_certificate]

@ResourceGroupPreparer(random_name_enabled=True)
Expand All @@ -154,7 +144,6 @@ def test_example_certificate_list_operations(self, client, **kwargs):
certificate_client.begin_create_certificate(certificate_name, cert_policy).wait()

# [START list_properties_of_certificates]

# get an iterator of certificates
certificates = certificate_client.list_properties_of_certificates()

Expand All @@ -164,28 +153,24 @@ def test_example_certificate_list_operations(self, client, **kwargs):
print(certificate.name)
print(certificate.updated_on)
print(certificate.enabled)

# [END list_properties_of_certificates]

# create a second version of the cert
certificate_client.begin_create_certificate(certificate_name, cert_policy).wait()

# [START list_properties_of_certificate_versions]

# get an iterator of a certificate's versions
certificate_versions = certificate_client.list_properties_of_certificate_versions(certificate_name)

for certificate in certificate_versions:
print(certificate.id)
print(certificate.updated_on)
print(certificate.version)

# [END list_properties_of_certificate_versions]

certificate_client.begin_delete_certificate(certificate_name).wait()

# [START list_deleted_certificates]

# get an iterator of deleted certificates (requires soft-delete enabled for the vault)
deleted_certificates = certificate_client.list_deleted_certificates()

Expand All @@ -195,7 +180,6 @@ def test_example_certificate_list_operations(self, client, **kwargs):
print(certificate.deleted_on)
print(certificate.scheduled_purge_date)
print(certificate.deleted_on)

# [END list_deleted_certificates]

@ResourceGroupPreparer(random_name_enabled=True)
Expand Down Expand Up @@ -269,7 +253,6 @@ def test_example_certificate_recover(self, client, **kwargs):

certificate_client.begin_delete_certificate(certificate_name=cert_name).wait()
# [START get_deleted_certificate]

# get a deleted certificate (requires soft-delete enabled for the vault)
deleted_certificate = certificate_client.get_deleted_certificate(cert_name)
print(deleted_certificate.name)
Expand All @@ -279,16 +262,14 @@ def test_example_certificate_recover(self, client, **kwargs):
print(deleted_certificate.deleted_on)
print(deleted_certificate.scheduled_purge_date)
print(deleted_certificate.recovery_id)

# [END get_deleted_certificate]
# [START recover_deleted_certificate]

# [START recover_deleted_certificate]
# recover a deleted certificate to its latest version (requires soft-delete enabled for the vault)
recovered_certificate = certificate_client.begin_recover_deleted_certificate(cert_name).result()

print(recovered_certificate.id)
print(recovered_certificate.name)

# [END recover_deleted_certificate]

@ResourceGroupPreparer(random_name_enabled=True)
Expand All @@ -311,30 +292,25 @@ def test_example_contacts(self, client, **kwargs):
print(contact.name)
print(contact.email)
print(contact.phone)

# [END set_contacts]

# [START get_contacts]

contacts = certificate_client.get_contacts()

# Loop through the certificate contacts for this key vault.
for contact in contacts:
print(contact.name)
print(contact.email)
print(contact.phone)

# [END get_contacts]

# [START delete_contacts]

deleted_contacts = certificate_client.delete_contacts()

for deleted_contact in deleted_contacts:
print(deleted_contact.name)
print(deleted_contact.email)
print(deleted_contact.phone)

# [END delete_contacts]

@ResourceGroupPreparer(random_name_enabled=True)
Expand Down Expand Up @@ -368,11 +344,9 @@ def test_example_issuers(self, client, **kwargs):
print(contact.last_name)
print(contact.email)
print(contact.phone)

# [END create_issuer]

# [START get_issuer]

issuer = certificate_client.get_issuer("issuer1")

print(issuer.name)
Expand All @@ -384,25 +358,21 @@ def test_example_issuers(self, client, **kwargs):
print(contact.last_name)
print(contact.email)
print(contact.phone)

# [END get_issuer]

certificate_client.create_issuer(
issuer_name="issuer2", provider="Test", account_id="keyvaultuser", enabled=True
)

# [START list_properties_of_issuers]

issuers = certificate_client.list_properties_of_issuers()

for issuer in issuers:
print(issuer.name)
print(issuer.provider)

# [END list_properties_of_issuers]

# [START delete_issuer]

deleted_issuer = certificate_client.delete_issuer("issuer1")

print(deleted_issuer.name)
Expand All @@ -414,5 +384,4 @@ def test_example_issuers(self, client, **kwargs):
print(contact.last_name)
print(contact.email)
print(contact.phone)

# [END delete_issuer]
Loading

0 comments on commit 22a1497

Please sign in to comment.