Skip to content

create_certificate_authority_association async

create_certificate_authority_association(
    certificate_authority_arn: Arn,
    associated_resource_arn: AssociatedResourceArn,
    *,
    config_overrides: Optional[AsyncACMPCAClientConfig] = None,
) -> None

Associates an Amazon Web Services resource with a service-affiliated private certificate authority (CA), authorizing the affiliated Amazon Web Services service to use the CA to issue certificates for that resource. The association is identified by the private CA and the Amazon Resource Name (ARN) of the associated resource. This operation is idempotent; associating a resource that is already associated with the private CA succeeds.

Parameters:

  • certificate_authority_arn (Arn) –

    The Amazon Resource Name (ARN) of the service-affiliated private CA to associate the resource with.

  • associated_resource_arn (AssociatedResourceArn) –

    The Amazon Resource Name (ARN) of the Amazon Web Services resource to associate with the private CA.

Raises:

  • ConflictException –

    The request was rejected because it conflicts with the current state of the specified resource.

  • InvalidArgsException –

    One or more of the specified arguments was not valid.

  • 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.

  • ResourceNotFoundException –

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

  • UnknownServiceError –

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

Source code in docs_src/capo_acm_pca/_services/async_acmpca.py
async def create_certificate_authority_association(
    self,
    certificate_authority_arn: "capo_acm_pca.types.arn.Arn",
    associated_resource_arn: "capo_acm_pca.types.associated_resource_arn.AssociatedResourceArn",
    *,
    config_overrides: Optional[AsyncACMPCAClientConfig] = None,
) -> None:
    """<p>Associates an Amazon Web Services resource with a service-affiliated private certificate authority (CA), authorizing the affiliated Amazon Web Services service to use the CA to issue certificates for that resource. The association is identified by the private CA and the Amazon Resource Name (ARN) of the associated resource. This operation is idempotent; associating a resource that is already associated with the private CA succeeds.</p>

    Args:
        certificate_authority_arn: <p>The Amazon Resource Name (ARN) of the service-affiliated private CA to associate the resource with.</p>
        associated_resource_arn: <p>The Amazon Resource Name (ARN) of the Amazon Web Services resource to associate with the private CA.</p>

    Raises:
        capo_acm_pca.errors.conflict_exception.ConflictException: <p>The request was rejected because it conflicts with the current state of the specified resource.</p>
        capo_acm_pca.errors.invalid_args_exception.InvalidArgsException: <p>One or more of the specified arguments was not valid.</p>
        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.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.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_acm_pca.types.create_certificate_authority_association_request.CreateCertificateAuthorityAssociationRequest]",
    ) -> AsyncOperationResponse[None]:
        if req.options.protocol == "awsJson1_1":
            import capo_acm_pca._operations.acm_private_ca.aws_json1_1.create_certificate_authority_association

            (
                output,
                http_response,
            ) = await capo_acm_pca._operations.acm_private_ca.aws_json1_1.create_certificate_authority_association.async_create_certificate_authority_association(
                req.options, req.input
            )
        elif req.options.protocol == "rpcv2Cbor":
            import capo_acm_pca._operations.acm_private_ca.rpcv2_cbor.create_certificate_authority_association

            (
                output,
                http_response,
            ) = await capo_acm_pca._operations.acm_private_ca.rpcv2_cbor.create_certificate_authority_association.async_create_certificate_authority_association(
                req.options, req.input
            )
        else:
            raise ValueError(f"unknown protocol {req.options.protocol!r}")
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateCertificateAuthorityAssociation")
    )
    input_: capo_acm_pca.types.create_certificate_authority_association_request.CreateCertificateAuthorityAssociationRequest = {
        "certificate_authority_arn": certificate_authority_arn,
        "associated_resource_arn": associated_resource_arn,
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output