Skip to content

Commit 0dfbb0d

Browse files
KdHyeon0661ianychoi
authored andcommitted
[keyvalut] Enhance code style for one sample file
Modernize to follow with up-to-date coding style for sdk/keyvault/azure-keyvault-keys/samples/backup_restore_operations_async.py Closes: Azure#18
1 parent ea34c9c commit 0dfbb0d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

sdk/keyvault/azure-keyvault-keys/samples/backup_restore_operations_async.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -46,29 +46,29 @@ async def run_sample():
4646
# if the key already exists in the Key Vault, then a new version of the key is created.
4747
print("\n.. Create Key")
4848
key = await client.create_key("keyNameAsync", "RSA")
49-
print("Key with name '{0}' created with key type '{1}'".format(key.name, key.key_type))
49+
print(f"Key with name '{key.name}' created with key type '{key.key_type}'")
5050

5151
# Backups are good to have, if in case keys gets deleted accidentally.
5252
# For long term storage, it is ideal to write the backup to a file.
5353
print("\n.. Create a backup for an existing Key")
5454
key_backup = await client.backup_key(key.name)
55-
print("Backup created for key with name '{0}'.".format(key.name))
55+
print(f"Backup created for key with name '{key.name}'.")
5656

5757
# The rsa key is no longer in use, so you delete it.
5858
deleted_key = await client.delete_key(key.name)
59-
print("Deleted key with name '{0}'".format(deleted_key.name))
59+
print(f"Deleted key with name '{deleted_key.name}'")
6060

6161
# Purge the deleted key.
6262
# The purge will take some time, so wait before restoring the backup to avoid a conflict.
6363
print("\n.. Purge the key")
6464
await client.purge_deleted_key(key.name)
6565
await asyncio.sleep(60)
66-
print("Purged key with name '{0}'".format(deleted_key.name))
66+
print(f"Purged key with name '{deleted_key.name}'")
6767

6868
# In the future, if the key is required again, we can use the backup value to restore it in the Key Vault.
6969
print("\n.. Restore the key using the backed up key bytes")
7070
key = await client.restore_key_backup(key_backup)
71-
print("Restored key with name '{0}'".format(key.name))
71+
print(f"Restored key with name '{key.name}'")
7272

7373
print("\nrun_sample done")
7474
await credential.close()

0 commit comments

Comments
 (0)