From 69fc969e9835a5dd30d4e4d440d0639049b1f357 Mon Sep 17 00:00:00 2001 From: Bert Blommers Date: Fri, 15 Mar 2024 11:27:42 +0000 Subject: [PATCH] Techdebt: Update ACM coverage doc (#7472) --- IMPLEMENTATION_COVERAGE.md | 8 ++++---- docs/docs/services/acm.rst | 6 +++--- moto/acm/models.py | 13 +++++-------- moto/acm/responses.py | 6 +++--- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/IMPLEMENTATION_COVERAGE.md b/IMPLEMENTATION_COVERAGE.md index 6d28d4849..b18aa501f 100644 --- a/IMPLEMENTATION_COVERAGE.md +++ b/IMPLEMENTATION_COVERAGE.md @@ -1,16 +1,16 @@ ## acm
-40% implemented +60% implemented - [X] add_tags_to_certificate - [X] delete_certificate -- [ ] describe_certificate +- [X] describe_certificate - [X] export_certificate - [ ] get_account_configuration - [X] get_certificate -- [ ] import_certificate -- [ ] list_certificates +- [X] import_certificate +- [X] list_certificates - [ ] list_tags_for_certificate - [ ] put_account_configuration - [X] remove_tags_from_certificate diff --git a/docs/docs/services/acm.rst b/docs/docs/services/acm.rst index 8b1ee3654..cebe0d025 100644 --- a/docs/docs/services/acm.rst +++ b/docs/docs/services/acm.rst @@ -16,12 +16,12 @@ acm - [X] add_tags_to_certificate - [X] delete_certificate -- [ ] describe_certificate +- [X] describe_certificate - [X] export_certificate - [ ] get_account_configuration - [X] get_certificate -- [ ] import_certificate -- [ ] list_certificates +- [X] import_certificate +- [X] list_certificates - [ ] list_tags_for_certificate - [ ] put_account_configuration - [X] remove_tags_from_certificate diff --git a/moto/acm/models.py b/moto/acm/models.py index 484de6430..585d99530 100644 --- a/moto/acm/models.py +++ b/moto/acm/models.py @@ -454,7 +454,7 @@ class AWSCertificateManagerBackend(BaseBackend): "expires": utcnow() + datetime.timedelta(hours=1), } - def import_cert( + def import_certificate( self, certificate: bytes, private_key: bytes, @@ -492,13 +492,7 @@ class AWSCertificateManagerBackend(BaseBackend): return bundle.arn - def get_certificates_list(self, statuses: List[str]) -> Iterable[CertBundle]: - """ - Get list of certificates - - :return: List of certificates - :rtype: list of CertBundle - """ + def list_certificates(self, statuses: List[str]) -> Iterable[CertBundle]: for arn in self._certificates.keys(): cert = self.get_certificate(arn) if not statuses or cert.status in statuses: @@ -512,6 +506,9 @@ class AWSCertificateManagerBackend(BaseBackend): cert_bundle.check() return cert_bundle + def describe_certificate(self, arn: str) -> CertBundle: + return self.get_certificate(arn) + def delete_certificate(self, arn: str) -> None: if arn not in self._certificates: raise CertificateNotFound(arn=arn, account_id=self.account_id) diff --git a/moto/acm/responses.py b/moto/acm/responses.py index 7b3636e95..899cbbf24 100644 --- a/moto/acm/responses.py +++ b/moto/acm/responses.py @@ -57,7 +57,7 @@ class AWSCertificateManagerResponse(BaseResponse): dict(status=400), ) - cert_bundle = self.acm_backend.get_certificate(arn) + cert_bundle = self.acm_backend.describe_certificate(arn) return json.dumps(cert_bundle.describe()) @@ -120,7 +120,7 @@ class AWSCertificateManagerResponse(BaseResponse): "The certificate chain is not PEM-encoded or is not valid." ) - arn = self.acm_backend.import_cert( + arn = self.acm_backend.import_certificate( certificate, private_key, chain=chain, arn=current_arn, tags=tags ) @@ -129,7 +129,7 @@ class AWSCertificateManagerResponse(BaseResponse): def list_certificates(self) -> str: certs = [] statuses = self._get_param("CertificateStatuses") - for cert_bundle in self.acm_backend.get_certificates_list(statuses): + for cert_bundle in self.acm_backend.list_certificates(statuses): certs.append(cert_bundle.describe()["Certificate"]) result = {"CertificateSummaryList": certs}