Skip to content

associate_resource async

associate_resource(
    group_identifier: GroupIdentifier,
    resource_arn: CanaryArn,
    *,
    config_overrides: Optional[AsyncsyntheticsClientConfig] = None,
) -> AssociateResourceResponse

Associates a canary with a group. Using groups can help you with managing and automating your canaries, and you can also view aggregated run results and statistics for all canaries in a group.

You must run this operation in the Region where the canary exists.

Parameters:

  • group_identifier (GroupIdentifier) –

    Specifies the group. You can specify the group name, the ARN, or the group ID as the GroupIdentifier.

  • resource_arn (CanaryArn) –

    The ARN of the canary that you want to associate with the specified group.

Raises:

Source code in docs_src/capo_synthetics/_services/async_synthetics.py
async def associate_resource(
    self,
    group_identifier: "capo_synthetics.types.group_identifier.GroupIdentifier",
    resource_arn: "capo_synthetics.types.canary_arn.CanaryArn",
    *,
    config_overrides: Optional[AsyncsyntheticsClientConfig] = None,
) -> "capo_synthetics.types.associate_resource_response.AssociateResourceResponse":
    """<p>Associates a canary with a group. Using groups can help you with managing and automating your canaries, and you can also view aggregated run results and statistics for all canaries in a group. </p> <p>You must run this operation in the Region where the canary exists.</p>

    Args:
        group_identifier: <p>Specifies the group. You can specify the group name, the ARN, or the group ID as the <code>GroupIdentifier</code>.</p>
        resource_arn: <p>The ARN of the canary that you want to associate with the specified group.</p>

    Raises:
        capo_synthetics.errors.conflict_exception.ConflictException: <p>A conflicting operation is already in progress.</p>
        capo_synthetics.errors.internal_server_exception.InternalServerException: <p>An unknown internal error occurred.</p>
        capo_synthetics.errors.resource_not_found_exception.ResourceNotFoundException: <p>One of the specified resources was not found.</p>
        capo_synthetics.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request exceeded a service quota value.</p>
        capo_synthetics.errors.validation_exception.ValidationException: <p>A parameter could not be validated.</p>
        capo_synthetics.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_synthetics.types.associate_resource_request.AssociateResourceRequest]",
    ) -> AsyncOperationResponse[
        "capo_synthetics.types.associate_resource_response.AssociateResourceResponse"
    ]:
        import capo_synthetics._operations.synthetics.associate_resource

        (
            output,
            http_response,
        ) = await capo_synthetics._operations.synthetics.associate_resource.async_associate_resource(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AssociateResource")
    )
    input_: capo_synthetics.types.associate_resource_request.AssociateResourceRequest = {
        "group_identifier": group_identifier,
        "resource_arn": resource_arn,
    }

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