Skip to content

Commit c33c230

Browse files
authored
[Key Vault] Clean up docstring class references for certs, keys, secrets (Azure#19133)
1 parent bc7730c commit c33c230

File tree

6 files changed

+110
-57
lines changed

6 files changed

+110
-57
lines changed

sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,9 @@ def import_certificate(self, certificate_name, certificate_bytes, **kwargs):
340340
341341
Imports an existing valid certificate, containing a private key, into Azure Key Vault. The certificate to be
342342
imported can be in either PFX or PEM format. If the certificate is in PEM format the PEM file must contain the
343-
key as well as x509 certificates, and you must provide a ``policy`` with :attr:`CertificatePolicy.content_type`
344-
of :attr:`CertificateContentType.pem`.
343+
key as well as x509 certificates, and you must provide a ``policy``
344+
with :attr:`~azure.keyvault.certificates.CertificatePolicy.content_type` of
345+
:attr:`~azure.keyvault.certificates.CertificateContentType.pem`.
345346
346347
:param str certificate_name: The name of the certificate.
347348
:param bytes certificate_bytes: Bytes of the certificate object to import. This certificate
@@ -350,9 +351,10 @@ def import_certificate(self, certificate_name, certificate_bytes, **kwargs):
350351
:keyword tags: Application specific metadata in the form of key-value pairs.
351352
:paramtype tags: dict[str, str]
352353
:keyword str password: If the private key in the passed in certificate is encrypted, it
353-
is the password used for encryption.
354+
is the password used for encryption.
354355
:keyword policy: The management policy for the certificate. Required if importing a PEM-format certificate,
355-
with :attr:`CertificatePolicy.content_type` set to :attr:`CertificateContentType.pem`.
356+
with :attr:`~azure.keyvault.certificates.CertificatePolicy.content_type` set to
357+
:attr:`~azure.keyvault.certificates.CertificateContentType.pem`.
356358
:paramtype policy: ~azure.keyvault.certificates.CertificatePolicy
357359
:returns: The imported KeyVaultCertificate
358360
:rtype: ~azure.keyvault.certificates.KeyVaultCertificate

sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/aio/_client.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,9 @@ async def import_certificate(
316316
317317
Imports an existing valid certificate, containing a private key, into Azure Key Vault. The certificate to be
318318
imported can be in either PFX or PEM format. If the certificate is in PEM format the PEM file must contain the
319-
key as well as x509 certificates, and you must provide a ``policy`` with :attr:`CertificatePolicy.content_type`
320-
of :attr:`CertificateContentType.pem`.
319+
key as well as x509 certificates, and you must provide a ``policy``
320+
with :attr:`~azure.keyvault.certificates.CertificatePolicy.content_type` of
321+
:attr:`~azure.keyvault.certificates.CertificateContentType.pem`.
321322
322323
:param str certificate_name: The name of the certificate.
323324
:param bytes certificate_bytes: Bytes of the certificate object to import.
@@ -326,9 +327,10 @@ async def import_certificate(
326327
:keyword tags: Application specific metadata in the form of key-value pairs.
327328
:paramtype tags: dict[str, str]
328329
:keyword str password: If the private key in the passed in certificate is encrypted, it
329-
is the password used for encryption.
330+
is the password used for encryption.
330331
:keyword policy: The management policy for the certificate. Required if importing a PEM-format certificate,
331-
with :attr:`CertificatePolicy.content_type` set to :attr:`CertificateContentType.pem`.
332+
with :attr:`~azure.keyvault.certificates.CertificatePolicy.content_type` set to
333+
:attr:`~azure.keyvault.certificates.CertificateContentType.pem`.
332334
:paramtype policy: ~azure.keyvault.certificates.CertificatePolicy
333335
:returns: The imported KeyVaultCertificate
334336
:rtype: ~azure.keyvault.certificates.KeyVaultCertificate
@@ -749,7 +751,7 @@ async def merge_certificate(
749751
750752
Requires the certificates/create permission. Performs the merging of a certificate or
751753
certificate chain with a key pair currently available in the service.
752-
Make sure when creating the certificate to merge using :func:`begin_create_certificate` that you set
754+
Make sure when creating the certificate to merge using :func:`create_certificate` that you set
753755
its issuer to 'Unknown'. This way Key Vault knows that the certificate will not be signed
754756
by an issuer known to it.
755757

sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_client.py

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class KeyClient(KeyVaultClientBase):
4747
@distributed_trace
4848
def create_key(self, name, key_type, **kwargs):
4949
# type: (str, Union[str, azure.keyvault.keys.KeyType], **Any) -> KeyVaultKey
50-
"""Create a key or, if `name` is already in use, create a new version of the key.
50+
"""Create a key or, if ``name`` is already in use, create a new version of the key.
5151
5252
Requires keys/create permission.
5353
@@ -109,7 +109,7 @@ def create_key(self, name, key_type, **kwargs):
109109
@distributed_trace
110110
def create_rsa_key(self, name, **kwargs):
111111
# type: (str, **Any) -> KeyVaultKey
112-
"""Create a new RSA key or, if `name` is already in use, create a new version of the key
112+
"""Create a new RSA key or, if ``name`` is already in use, create a new version of the key
113113
114114
Requires the keys/create permission.
115115
@@ -143,7 +143,7 @@ def create_rsa_key(self, name, **kwargs):
143143
@distributed_trace
144144
def create_ec_key(self, name, **kwargs):
145145
# type: (str, **Any) -> KeyVaultKey
146-
"""Create a new elliptic curve key or, if `name` is already in use, create a new version of the key.
146+
"""Create a new elliptic curve key or, if ``name`` is already in use, create a new version of the key.
147147
148148
Requires the keys/create permission.
149149
@@ -177,7 +177,7 @@ def create_ec_key(self, name, **kwargs):
177177
@distributed_trace
178178
def create_oct_key(self, name, **kwargs):
179179
# type: (str, **Any) -> KeyVaultKey
180-
"""Create a new octet sequence (symmetric) key or, if `name` is already in use, create a new version of the key.
180+
"""Create a new octet sequence (symmetric) key or, if ``name`` is in use, create a new version of the key.
181181
182182
Requires the keys/create permission.
183183
@@ -210,10 +210,11 @@ def create_oct_key(self, name, **kwargs):
210210
@distributed_trace
211211
def begin_delete_key(self, name, **kwargs):
212212
# type: (str, **Any) -> DeletedKey
213-
"""Delete all versions of a key and its cryptographic material. Requires keys/delete permission.
213+
"""Delete all versions of a key and its cryptographic material.
214214
215-
When this method returns Key Vault has begun deleting the key. Deletion may take several seconds in a vault
216-
with soft-delete enabled. This method therefore returns a poller enabling you to wait for deletion to complete.
215+
Requires keys/delete permission. When this method returns Key Vault has begun deleting the key. Deletion may
216+
take several seconds in a vault with soft-delete enabled. This method therefore returns a poller enabling you to
217+
wait for deletion to complete.
217218
218219
:param str name: The name of the key to delete.
219220
:returns: A poller for the delete key operation. The poller's `result` method returns the
@@ -254,7 +255,9 @@ def begin_delete_key(self, name, **kwargs):
254255
@distributed_trace
255256
def get_key(self, name, version=None, **kwargs):
256257
# type: (str, Optional[str], **Any) -> KeyVaultKey
257-
"""Get a key's attributes and, if it's an asymmetric key, its public material. Requires keys/get permission.
258+
"""Get a key's attributes and, if it's an asymmetric key, its public material.
259+
260+
Requires keys/get permission.
258261
259262
:param str name: The name of the key to get.
260263
:param str version: (optional) A specific version of the key to get. If not specified, gets the latest version
@@ -278,7 +281,9 @@ def get_key(self, name, version=None, **kwargs):
278281
@distributed_trace
279282
def get_deleted_key(self, name, **kwargs):
280283
# type: (str, **Any) -> DeletedKey
281-
"""Get a deleted key. Possible only in a vault with soft-delete enabled. Requires keys/get permission.
284+
"""Get a deleted key. Possible only in a vault with soft-delete enabled.
285+
286+
Requires keys/get permission.
282287
283288
:param str name: The name of the key
284289
:returns: The deleted key
@@ -327,7 +332,9 @@ def list_deleted_keys(self, **kwargs):
327332
@distributed_trace
328333
def list_properties_of_keys(self, **kwargs):
329334
# type: (**Any) -> ItemPaged[KeyProperties]
330-
"""List identifiers and properties of all keys in the vault. Requires keys/list permission.
335+
"""List identifiers and properties of all keys in the vault.
336+
337+
Requires keys/list permission.
331338
332339
:returns: An iterator of keys without their cryptographic material or version information
333340
:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.keys.KeyProperties]
@@ -351,7 +358,9 @@ def list_properties_of_keys(self, **kwargs):
351358
@distributed_trace
352359
def list_properties_of_key_versions(self, name, **kwargs):
353360
# type: (str, **Any) -> ItemPaged[KeyProperties]
354-
"""List the identifiers and properties of a key's versions. Requires keys/list permission.
361+
"""List the identifiers and properties of a key's versions.
362+
363+
Requires keys/list permission.
355364
356365
:param str name: The name of the key
357366
:returns: An iterator of keys without their cryptographic material
@@ -385,7 +394,6 @@ def purge_deleted_key(self, name, **kwargs):
385394
This method is only necessary for purging a key before its
386395
:py:attr:`~azure.keyvault.keys.DeletedKey.scheduled_purge_date`.
387396
388-
389397
Requires keys/purge permission.
390398
391399
:param str name: The name of the deleted key to purge
@@ -448,7 +456,9 @@ def begin_recover_deleted_key(self, name, **kwargs):
448456
@distributed_trace
449457
def update_key_properties(self, name, version=None, **kwargs):
450458
# type: (str, Optional[str], **Any) -> KeyVaultKey
451-
"""Change a key's properties (not its cryptographic material). Requires keys/update permission.
459+
"""Change a key's properties (not its cryptographic material).
460+
461+
Requires keys/update permission.
452462
453463
:param str name: The name of key to update
454464
:param str version: (optional) The version of the key to update. If unspecified, the latest version is updated.
@@ -500,7 +510,9 @@ def update_key_properties(self, name, version=None, **kwargs):
500510
@distributed_trace
501511
def backup_key(self, name, **kwargs):
502512
# type: (str, **Any) -> bytes
503-
"""Back up a key in a protected form useable only by Azure Key Vault. Requires keys/backup permission.
513+
"""Back up a key in a protected form useable only by Azure Key Vault.
514+
515+
Requires keys/backup permission.
504516
505517
This is intended to allow copying a key from one vault to another. Both vaults must be owned by the same Azure
506518
subscription. Also, backup / restore cannot be performed across geopolitical boundaries. For example, a backup
@@ -526,7 +538,9 @@ def backup_key(self, name, **kwargs):
526538
@distributed_trace
527539
def restore_key_backup(self, backup, **kwargs):
528540
# type: (bytes, **Any) -> KeyVaultKey
529-
"""Restore a key backup to the vault. Requires keys/restore permission.
541+
"""Restore a key backup to the vault.
542+
543+
Requires keys/restore permission.
530544
531545
This imports all versions of the key, with its name, attributes, and access control policies. If the key's name
532546
is already in use, restoring it will fail. Also, the target vault must be owned by the same Microsoft Azure
@@ -558,9 +572,9 @@ def restore_key_backup(self, backup, **kwargs):
558572
@distributed_trace
559573
def import_key(self, name, key, **kwargs):
560574
# type: (str, JsonWebKey, **Any) -> KeyVaultKey
561-
"""Import a key created externally. Requires keys/import permission.
575+
"""Import a key created externally.
562576
563-
If `name` is already in use, the key will be imported as a new version.
577+
Requires keys/import permission. If ``name`` is already in use, the key will be imported as a new version.
564578
565579
:param str name: Name for the imported key
566580
:param key: The JSON web key to import

sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/aio/_client.py

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class KeyClient(AsyncKeyVaultClientBase):
4545

4646
@distributed_trace_async
4747
async def create_key(self, name: str, key_type: "Union[str, KeyType]", **kwargs: "Any") -> KeyVaultKey:
48-
"""Create a key or, if `name` is already in use, create a new version of the key.
48+
"""Create a key or, if ``name`` is already in use, create a new version of the key.
4949
5050
Requires keys/create permission.
5151
@@ -107,7 +107,7 @@ async def create_key(self, name: str, key_type: "Union[str, KeyType]", **kwargs:
107107

108108
@distributed_trace_async
109109
async def create_rsa_key(self, name: str, **kwargs: "Any") -> KeyVaultKey:
110-
"""Create a new RSA key or, if `name` is already in use, create a new version of the key
110+
"""Create a new RSA key or, if ``name`` is already in use, create a new version of the key
111111
112112
Requires the keys/create permission.
113113
@@ -140,7 +140,7 @@ async def create_rsa_key(self, name: str, **kwargs: "Any") -> KeyVaultKey:
140140

141141
@distributed_trace_async
142142
async def create_ec_key(self, name: str, **kwargs: "Any") -> KeyVaultKey:
143-
"""Create a new elliptic curve key or, if `name` is already in use, create a new version of the key.
143+
"""Create a new elliptic curve key or, if ``name`` is already in use, create a new version of the key.
144144
145145
Requires the keys/create permission.
146146
@@ -173,7 +173,7 @@ async def create_ec_key(self, name: str, **kwargs: "Any") -> KeyVaultKey:
173173

174174
@distributed_trace_async
175175
async def create_oct_key(self, name: str, **kwargs: "Any") -> KeyVaultKey:
176-
"""Create a new octet sequence (symmetric) key or, if `name` is already in use, create a new version of the key.
176+
"""Create a new octet sequence (symmetric) key or, if ``name`` is in use, create a new version of the key.
177177
178178
Requires the keys/create permission.
179179
@@ -205,9 +205,10 @@ async def create_oct_key(self, name: str, **kwargs: "Any") -> KeyVaultKey:
205205

206206
@distributed_trace_async
207207
async def delete_key(self, name: str, **kwargs: "Any") -> DeletedKey:
208-
"""Delete all versions of a key and its cryptographic material. Requires keys/delete permission.
208+
"""Delete all versions of a key and its cryptographic material.
209209
210-
If the vault has soft-delete enabled, deletion may take several seconds to complete.
210+
Requires keys/delete permission. If the vault has soft-delete enabled, deletion may take several seconds to
211+
complete.
211212
212213
:param str name: The name of the key to delete
213214
:returns: The deleted key
@@ -244,7 +245,9 @@ async def delete_key(self, name: str, **kwargs: "Any") -> DeletedKey:
244245

245246
@distributed_trace_async
246247
async def get_key(self, name: str, version: "Optional[str]" = None, **kwargs: "Any") -> KeyVaultKey:
247-
"""Get a key's attributes and, if it's an asymmetric key, its public material. Requires keys/get permission.
248+
"""Get a key's attributes and, if it's an asymmetric key, its public material.
249+
250+
Requires keys/get permission.
248251
249252
:param str name: The name of the key to get.
250253
:param str version: (optional) A specific version of the key to get. If not specified, gets the latest version
@@ -270,7 +273,9 @@ async def get_key(self, name: str, version: "Optional[str]" = None, **kwargs: "A
270273

271274
@distributed_trace_async
272275
async def get_deleted_key(self, name: str, **kwargs: "Any") -> DeletedKey:
273-
"""Get a deleted key. Possible only in a vault with soft-delete enabled. Requires keys/get permission.
276+
"""Get a deleted key. Possible only in a vault with soft-delete enabled.
277+
278+
Requires keys/get permission.
274279
275280
:param str name: The name of the key
276281
:returns: The deleted key
@@ -317,7 +322,9 @@ def list_deleted_keys(self, **kwargs: "Any") -> "AsyncItemPaged[DeletedKey]":
317322

318323
@distributed_trace
319324
def list_properties_of_keys(self, **kwargs: "Any") -> "AsyncItemPaged[KeyProperties]":
320-
"""List identifiers and properties of all keys in the vault. Requires keys/list permission.
325+
"""List identifiers and properties of all keys in the vault.
326+
327+
Requires keys/list permission.
321328
322329
:returns: An iterator of keys without their cryptographic material or version information
323330
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.keys.KeyProperties]
@@ -340,7 +347,9 @@ def list_properties_of_keys(self, **kwargs: "Any") -> "AsyncItemPaged[KeyPropert
340347

341348
@distributed_trace
342349
def list_properties_of_key_versions(self, name: str, **kwargs: "Any") -> "AsyncItemPaged[KeyProperties]":
343-
"""List the identifiers and properties of a key's versions. Requires keys/list permission.
350+
"""List the identifiers and properties of a key's versions.
351+
352+
Requires keys/list permission.
344353
345354
:param str name: The name of the key
346355
:returns: An iterator of keys without their cryptographic material
@@ -427,7 +436,9 @@ async def recover_deleted_key(self, name: str, **kwargs: "Any") -> KeyVaultKey:
427436

428437
@distributed_trace_async
429438
async def update_key_properties(self, name: str, version: "Optional[str]" = None, **kwargs: "Any") -> KeyVaultKey:
430-
"""Change a key's properties (not its cryptographic material). Requires keys/update permission.
439+
"""Change a key's properties (not its cryptographic material).
440+
441+
Requires keys/update permission.
431442
432443
:param str name: The name of key to update
433444
:param str version: (optional) The version of the key to update. If unspecified, the latest version is updated.
@@ -478,7 +489,9 @@ async def update_key_properties(self, name: str, version: "Optional[str]" = None
478489

479490
@distributed_trace_async
480491
async def backup_key(self, name: str, **kwargs: "Any") -> bytes:
481-
"""Back up a key in a protected form useable only by Azure Key Vault. Requires key/backup permission.
492+
"""Back up a key in a protected form useable only by Azure Key Vault.
493+
494+
Requires key/backup permission.
482495
483496
This is intended to allow copying a key from one vault to another. Both vaults must be owned by the same Azure
484497
subscription. Also, backup / restore cannot be performed across geopolitical boundaries. For example, a backup
@@ -503,7 +516,9 @@ async def backup_key(self, name: str, **kwargs: "Any") -> bytes:
503516

504517
@distributed_trace_async
505518
async def restore_key_backup(self, backup: bytes, **kwargs: "Any") -> KeyVaultKey:
506-
"""Restore a key backup to the vault. Requires keys/restore permission.
519+
"""Restore a key backup to the vault.
520+
521+
Requires keys/restore permission.
507522
508523
This imports all versions of the key, with its name, attributes, and access control policies. If the key's name
509524
is already in use, restoring it will fail. Also, the target vault must be owned by the same Microsoft Azure
@@ -534,9 +549,9 @@ async def restore_key_backup(self, backup: bytes, **kwargs: "Any") -> KeyVaultKe
534549

535550
@distributed_trace_async
536551
async def import_key(self, name: str, key: JsonWebKey, **kwargs: "Any") -> KeyVaultKey:
537-
"""Import a key created externally. Requires keys/import permission.
552+
"""Import a key created externally.
538553
539-
If `name` is already in use, the key will be imported as a new version.
554+
Requires keys/import permission. If ``name`` is already in use, the key will be imported as a new version.
540555
541556
:param str name: Name for the imported key
542557
:param key: The JSON web key to import

0 commit comments

Comments
 (0)