MCPcopy Create free account
hub / github.com/awsdocs/aws-doc-sdk-examples / AcmCertificate

Class AcmCertificate

python/example_code/acm/certificate_basics.py:24–317  ·  view source on GitHub ↗

Encapsulates ACM functions.

Source from the content-addressed store, hash-verified

22
23# snippet-start:[python.example_code.acm.AcmCertificate]
24class AcmCertificate:
25 """
26 Encapsulates ACM functions.
27 """
28
29 def __init__(self, acm_client):
30 """
31 :param acm_client: A Boto3 ACM client.
32 """
33 self.acm_client = acm_client
34
35 # snippet-end:[python.example_code.acm.AcmCertificate]
36
37 # snippet-start:[python.example_code.acm.DescribeCertificate]
38 def describe(self, certificate_arn):
39 """
40 Gets certificate metadata.
41
42 :param certificate_arn: The Amazon Resource Name (ARN) of the certificate.
43 :return: Metadata about the certificate.
44 """
45 try:
46 response = self.acm_client.describe_certificate(
47 CertificateArn=certificate_arn
48 )
49 certificate = response["Certificate"]
50 logger.info(
51 "Got metadata for certificate for domain %s.", certificate["DomainName"]
52 )
53 except ClientError:
54 logger.exception("Couldn't get data for certificate %s.", certificate_arn)
55 raise
56 else:
57 return certificate
58
59 # snippet-end:[python.example_code.acm.DescribeCertificate]
60
61 # snippet-start:[python.example_code.acm.GetCertificate]
62 def get(self, certificate_arn):
63 """
64 Gets the body and certificate chain of a certificate.
65
66 :param certificate_arn: The ARN of the certificate.
67 :return: The body and chain of a certificate.
68 """
69 try:
70 response = self.acm_client.get_certificate(CertificateArn=certificate_arn)
71 logger.info("Got certificate %s and its chain.", certificate_arn)
72 except ClientError:
73 logger.exception("Couldn't get certificate %s.", certificate_arn)
74 raise
75 else:
76 return response
77
78 # snippet-end:[python.example_code.acm.GetCertificate]
79
80 # snippet-start:[python.example_code.acm.ListCertificates]
81 def list(

Callers 11

test_describeFunction · 0.90
test_getFunction · 0.90
test_listFunction · 0.90
test_import_certificateFunction · 0.90
test_removeFunction · 0.90
test_add_tagsFunction · 0.90
test_list_tagsFunction · 0.90
test_remove_tagsFunction · 0.90
test_request_validationFunction · 0.90
usage_demoFunction · 0.85

Calls

no outgoing calls

Tested by 10

test_describeFunction · 0.72
test_getFunction · 0.72
test_listFunction · 0.72
test_import_certificateFunction · 0.72
test_removeFunction · 0.72
test_add_tagsFunction · 0.72
test_list_tagsFunction · 0.72
test_remove_tagsFunction · 0.72
test_request_validationFunction · 0.72