Skip to content

Commit

Permalink
[Key Vault] Correct type hints for cer attributes (#28966)
Browse files Browse the repository at this point in the history
  • Loading branch information
mccoyp committed Feb 23, 2023
1 parent 6344696 commit f6fdec3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions sdk/keyvault/azure-keyvault-certificates/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
### Breaking Changes

### Bugs Fixed
- The type hints for `KeyVaultCertificate.cer` and `DeletedCertificate.cer` are now
`Optional[bytearray]` instead of `Optional[bytes]`
([#28959](https://github.com/Azure/azure-sdk-for-python/issues/28959))

### Other Changes
- Updated minimum `azure-core` version to 1.24.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,14 @@ class KeyVaultCertificate(object):
:param properties: The certificate's properties.
:type properties: ~azure.keyvault.certificates.CertificateProperties or None
:param cer: CER contents of the X509 certificate.
:type cer: bytes or None
:type cer: bytearray or None
"""

def __init__(
self,
policy: "Optional[CertificatePolicy]" = None,
properties: "Optional[CertificateProperties]" = None,
cer: "Optional[bytes]" = None,
cer: "Optional[bytearray]" = None,
**kwargs,
) -> None:
self._properties = properties
Expand All @@ -312,7 +312,7 @@ def _from_certificate_bundle(cls, certificate_bundle: models.CertificateBundle)
key_id=certificate_bundle.kid,
secret_id=certificate_bundle.sid,
policy=policy,
cer=certificate_bundle.cer,
cer=certificate_bundle.cer, # type: ignore
)

@property
Expand Down Expand Up @@ -364,10 +364,10 @@ def policy(self) -> "Optional[CertificatePolicy]":
return self._policy

@property
def cer(self) -> "Optional[bytes]":
def cer(self) -> "Optional[bytearray]":
"""The CER contents of the certificate.
:rtype: bytes or None
:rtype: bytearray or None
"""
return self._cer

Expand Down Expand Up @@ -1280,7 +1280,7 @@ class DeletedCertificate(KeyVaultCertificate):
:param policy: The management policy of the deleted certificate.
:type policy: ~azure.keyvault.certificates.CertificatePolicy or None
:param cer: CER contents of the X509 certificate.
:type cer: bytes or None
:type cer: bytearray or None
:param deleted_on: The time when the certificate was deleted, in UTC.
:type deleted_on: ~datetime.datetime or None
:param recovery_id: The url of the recovery object, used to identify and recover the deleted certificate.
Expand All @@ -1293,7 +1293,7 @@ def __init__(
self,
properties: "Optional[CertificateProperties]" = None,
policy: "Optional[CertificatePolicy]" = None,
cer: "Optional[bytes]" = None,
cer: "Optional[bytearray]" = None,
**kwargs,
) -> None:
super(DeletedCertificate, self).__init__(properties=properties, policy=policy, cer=cer, **kwargs)
Expand Down Expand Up @@ -1333,7 +1333,7 @@ def _from_deleted_certificate_bundle(
key_id=deleted_certificate_bundle.kid,
secret_id=deleted_certificate_bundle.sid,
policy=CertificatePolicy._from_certificate_policy_bundle(deleted_certificate_bundle.policy),
cer=deleted_certificate_bundle.cer,
cer=deleted_certificate_bundle.cer, # type: ignore
deleted_on=deleted_certificate_bundle.deleted_date,
recovery_id=deleted_certificate_bundle.recovery_id,
scheduled_purge_date=deleted_certificate_bundle.scheduled_purge_date,
Expand Down

0 comments on commit f6fdec3

Please sign in to comment.