Skip to content

tag_certificate_authority

tag_certificate_authority(
    certificate_authority_arn: Arn,
    tags: TagList,
    *,
    config_overrides: Optional[ACMPCAClientConfig] = None,
) -> None

Adds one or more tags to your private CA. Tags are labels that you can use to identify and organize your Amazon Web Services resources. Each tag consists of a key and an optional value. You specify the private CA on input by its Amazon Resource Name (ARN). You specify the tag by using a key-value pair. You can apply a tag to just one private CA if you want to identify a specific characteristic of that CA, or you can apply the same tag to multiple private CAs if you want to filter for a common relationship among those CAs. To remove one or more tags, use the UntagCertificateAuthority action. Call the ListTags action to see what tags are associated with your CA.

To attach tags to a private CA during the creation procedure, a CA administrator must first associate an inline IAM policy with the CreateCertificateAuthority action and explicitly allow tagging. For more information, see Attaching tags to a CA at the time of creation.

Parameters:

  • certificate_authority_arn (Arn) –

    The Amazon Resource Name (ARN) that was returned when you called CreateCertificateAuthority. This must be of the form:

    arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012

  • tags (TagList) –

    List of tags to be associated with the CA.

Raises:

  • InvalidArnException –

    The requested Amazon Resource Name (ARN) does not refer to an existing resource.

  • InvalidStateException –

    The state of the private CA does not allow this action to occur.

  • InvalidTagException –

    The tag associated with the CA is not valid. The invalid argument is contained in the message field.

  • ResourceNotFoundException –

    A resource such as a private CA, S3 bucket, certificate, audit report, or policy cannot be found.

  • TooManyTagsException –

    You can associate up to 50 tags with a private CA. Exception information is contained in the exception message field.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_acm_pca/_services/acmpca.py
def tag_certificate_authority(
    self,
    certificate_authority_arn: "capo_acm_pca.types.arn.Arn",
    tags: "capo_acm_pca.types.tag_list.TagList",
    *,
    config_overrides: Optional[ACMPCAClientConfig] = None,
) -> None:
    """<p>Adds one or more tags to your private CA. Tags are labels that you can use to identify and organize your Amazon Web Services resources. Each tag consists of a key and an optional value. You specify the private CA on input by its Amazon Resource Name (ARN). You specify the tag by using a key-value pair. You can apply a tag to just one private CA if you want to identify a specific characteristic of that CA, or you can apply the same tag to multiple private CAs if you want to filter for a common relationship among those CAs. To remove one or more tags, use the <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_UntagCertificateAuthority.html">UntagCertificateAuthority</a> action. Call the <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_ListTags.html">ListTags</a> action to see what tags are associated with your CA. </p> <note> <p>To attach tags to a private CA during the creation procedure, a CA administrator must first associate an inline IAM policy with the <code>CreateCertificateAuthority</code> action and explicitly allow tagging. For more information, see <a href="https://docs.aws.amazon.com/privateca/latest/userguide/auth-InlinePolicies.html#policy-tag-ca">Attaching tags to a CA at the time of creation</a>.</p> </note>

    Args:
        certificate_authority_arn: <p>The Amazon Resource Name (ARN) that was returned when you called <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_CreateCertificateAuthority.html">CreateCertificateAuthority</a>. This must be of the form: </p> <p> <code>arn:aws:acm-pca:<i>region</i>:<i>account</i>:certificate-authority/<i>12345678-1234-1234-1234-123456789012</i> </code> </p>
        tags: <p>List of tags to be associated with the CA.</p>

    Raises:
        capo_acm_pca.errors.invalid_arn_exception.InvalidArnException: <p>The requested Amazon Resource Name (ARN) does not refer to an existing resource.</p>
        capo_acm_pca.errors.invalid_state_exception.InvalidStateException: <p>The state of the private CA does not allow this action to occur.</p>
        capo_acm_pca.errors.invalid_tag_exception.InvalidTagException: <p>The tag associated with the CA is not valid. The invalid argument is contained in the message field.</p>
        capo_acm_pca.errors.resource_not_found_exception.ResourceNotFoundException: <p>A resource such as a private CA, S3 bucket, certificate, audit report, or policy cannot be found.</p>
        capo_acm_pca.errors.too_many_tags_exception.TooManyTagsException: <p>You can associate up to 50 tags with a private CA. Exception information is contained in the exception message field.</p>
        capo_acm_pca.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_acm_pca.types.tag_certificate_authority_request.TagCertificateAuthorityRequest]",
    ) -> OperationResponse[None]:
        import capo_acm_pca._operations.acm_private_ca.tag_certificate_authority

        output, http_response = (
            capo_acm_pca._operations.acm_private_ca.tag_certificate_authority.tag_certificate_authority(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("TagCertificateAuthority")
    )
    input_: capo_acm_pca.types.tag_certificate_authority_request.TagCertificateAuthorityRequest = {
        "certificate_authority_arn": certificate_authority_arn,
        "tags": tags,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output