in deployment/sagemaker-dashboards-for-ml/cloudformation/deployment/self-signed-certificate/src/delete.py [0:0]
def attempt_delete_acm_certificate(cert_arn):
acm_client = boto3.client('acm')
try:
acm_client.delete_certificate(CertificateArn=cert_arn)
print(
"Successfully deleted certificate "
"called '{}'.".format(cert_arn)
)
return True
except acm_client.exceptions.ClientError as e:
if "Could not find certificate" in str(e):
print(
"Could not find certificate called '{}'. "
"Skipping delete.".format(cert_arn)
)
return True
if "is in use" in str(e):
print(
"Could not delete certificate called '{}' "
"because it's currently in use.".format(cert_arn)
)
return False
else:
raise e