AWSSDK を使用して ACM 証明書からタグを削除する - AWSSDK コードサンプル

AWSDocAWS SDKGitHub サンプルリポジトリには、さらに多くの SDK サンプルがあります

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

AWSSDK を使用して ACM 証明書からタグを削除する

次のコード例は、ACM 証明書からタグを削除する方法を示しています。

Python
SDK for Python (Boto3)
注記

他にもありますGitHub。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

class AcmCertificate: """ Encapsulates ACM functions. """ def __init__(self, acm_client): """ :param acm_client: A Boto3 ACM client. """ self.acm_client = acm_client def remove_tags(self, certificate_arn, tags): """ Removes tags from a certificate. If the value of a tag is specified, the tag is removed only when the value matches the value of the certificate's tag. Otherwise, the tag is removed regardless of its value. :param certificate_arn: The ARN of the certificate. :param tags: The dictionary of tags to remove. """ try: cert_tags = [] for key, value in tags.items(): tag = {'Key': key} if value is not None: tag['Value'] = value cert_tags.append(tag) self.acm_client.remove_tags_from_certificate( CertificateArn=certificate_arn, Tags=cert_tags) logger.info( "Removed %s tags from certificate %s.", len(tags), certificate_arn) except ClientError: logger.exception( "Couldn't remove tags from certificate %s.", certificate_arn) raise
  • API の詳細については、「AWSSDK for Python (Boto3) API リファレンス」のを参照してくださいRemoveTagsFromCertificate