Пример #1
0
client = CertificateClient(vault_url=VAULT_URL, credential=credential)

# First we specify the AdministratorContact for our issuers.
admin_contacts = [
    AdministratorContact(first_name="John",
                         last_name="Doe",
                         email="*****@*****.**",
                         phone="4255555555")
]

# Next we create an issuer with these administrator details
# The name field refers to the name you would like to get the issuer. There are also pre-set names, such as 'Self' and 'Unknown'
# The provider for your issuer must exist for your vault location and tenant id.
client.create_issuer(issuer_name="issuer1",
                     provider="Test",
                     account_id="keyvaultuser",
                     admin_contacts=admin_contacts,
                     enabled=True)

# Now we get this issuer by name
issuer1 = client.get_issuer(issuer_name="issuer1")

print(issuer1.name)
print(issuer1.provider)
print(issuer1.account_id)

for contact in issuer1.admin_contacts:
    print(contact.first_name)
    print(contact.last_name)
    print(contact.email)
    print(contact.phone)
Пример #2
0
                           credential=credential)
try:
    # First we specify the AdministratorDetails for our issuers.
    admin_details = [
        AdministratorDetails(first_name="John",
                             last_name="Doe",
                             email="*****@*****.**",
                             phone="4255555555")
    ]

    # Next we create an issuer with these administrator details
    # The name field refers to the name you would like to get the issuer. There are also pre-set names, such as 'Self' and 'Unknown'
    # The provider for your issuer must exist for your vault location and tenant id.
    client.create_issuer(name="issuer1",
                         provider="Test",
                         account_id="keyvaultuser",
                         admin_details=admin_details,
                         enabled=True)

    # Now we get this issuer by name
    issuer1 = client.get_issuer(name="issuer1")

    print(issuer1.name)
    print(issuer1.properties.provider)
    print(issuer1.account_id)

    for admin_detail in issuer1.admin_details:
        print(admin_detail.first_name)
        print(admin_detail.last_name)
        print(admin_detail.email)
        print(admin_detail.phone)