Skip to content

start_events_detection_job async

start_events_detection_job(
    input_data_config: InputDataConfig,
    output_data_config: OutputDataConfig,
    data_access_role_arn: IamRoleArn,
    language_code: LanguageCode,
    target_event_types: TargetEventTypes,
    *,
    config_overrides: Optional[AsyncComprehendClientConfig] = None,
    job_name: Optional[JobName] = None,
    client_request_token: Optional[ClientRequestTokenString] = None,
    tags: Optional[TagList] = None,
) -> StartEventsDetectionJobResponse

Starts an asynchronous event detection job for a collection of documents.

Parameters:

  • input_data_config (InputDataConfig) –

    Specifies the format and location of the input data for the job.

  • output_data_config (OutputDataConfig) –

    Specifies where to send the output files.

  • data_access_role_arn (IamRoleArn) –

    The Amazon Resource Name (ARN) of the IAM role that grants Amazon Comprehend read access to your input data.

  • job_name (Optional[JobName], default: None ) –

    The identifier of the events detection job.

  • language_code (LanguageCode) –

    The language code of the input documents.

  • client_request_token (Optional[ClientRequestTokenString], default: None ) –

    An unique identifier for the request. If you don't set the client request token, Amazon Comprehend generates one.

  • target_event_types (TargetEventTypes) –

    The types of events to detect in the input documents.

  • tags (Optional[TagList], default: None ) –

    Tags to associate with the events detection job. A tag is a key-value pair that adds metadata to a resource used by Amazon Comprehend. For example, a tag with "Sales" as the key might be added to a resource to indicate its use by the sales department.

Raises:

  • InternalServerException –

    An internal server error occurred. Retry your request.

  • InvalidRequestException –

    The request is invalid.

  • KmsKeyValidationException –

    The KMS customer managed key (CMK) entered cannot be validated. Verify the key and re-enter it.

  • ResourceInUseException –

    The specified resource name is already in use. Use a different name and try your request again.

  • TooManyRequestsException –

    The number of requests exceeds the limit. Resubmit your request later.

  • TooManyTagsException –

    The request contains more tags than can be associated with a resource (50 tags per resource). The maximum number of tags includes both existing tags and those included in your current request.

  • UnknownServiceError –

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

Source code in docs_src/capo_comprehend/_services/async_comprehend.py
async def start_events_detection_job(
    self,
    input_data_config: "capo_comprehend.types.input_data_config.InputDataConfig",
    output_data_config: "capo_comprehend.types.output_data_config.OutputDataConfig",
    data_access_role_arn: "capo_comprehend.types.iam_role_arn.IamRoleArn",
    language_code: "capo_comprehend.types.language_code.LanguageCode",
    target_event_types: "capo_comprehend.types.target_event_types.TargetEventTypes",
    *,
    config_overrides: Optional[AsyncComprehendClientConfig] = None,
    job_name: Optional["capo_comprehend.types.job_name.JobName"] = None,
    client_request_token: Optional[
        "capo_comprehend.types.client_request_token_string.ClientRequestTokenString"
    ] = None,
    tags: Optional["capo_comprehend.types.tag_list.TagList"] = None,
) -> "capo_comprehend.types.start_events_detection_job_response.StartEventsDetectionJobResponse":
    """<p>Starts an asynchronous event detection job for a collection of documents.</p>

    Args:
        input_data_config: <p>Specifies the format and location of the input data for the job.</p>
        output_data_config: <p>Specifies where to send the output files.</p>
        data_access_role_arn: <p>The Amazon Resource Name (ARN) of the IAM role that grants Amazon Comprehend read access to your input data.</p>
        job_name: <p>The identifier of the events detection job.</p>
        language_code: <p>The language code of the input documents.</p>
        client_request_token: <p>An unique identifier for the request. If you don't set the client request token, Amazon Comprehend generates one.</p>
        target_event_types: <p>The types of events to detect in the input documents.</p>
        tags: <p>Tags to associate with the events detection job. A tag is a key-value pair that adds metadata to a resource used by Amazon Comprehend. For example, a tag with "Sales" as the key might be added to a resource to indicate its use by the sales department.</p>

    Raises:
        capo_comprehend.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_comprehend.errors.invalid_request_exception.InvalidRequestException: <p>The request is invalid.</p>
        capo_comprehend.errors.kms_key_validation_exception.KmsKeyValidationException: <p>The KMS customer managed key (CMK) entered cannot be validated. Verify the key and re-enter it.</p>
        capo_comprehend.errors.resource_in_use_exception.ResourceInUseException: <p>The specified resource name is already in use. Use a different name and try your request again.</p>
        capo_comprehend.errors.too_many_requests_exception.TooManyRequestsException: <p>The number of requests exceeds the limit. Resubmit your request later.</p>
        capo_comprehend.errors.too_many_tags_exception.TooManyTagsException: <p>The request contains more tags than can be associated with a resource (50 tags per resource). The maximum number of tags includes both existing tags and those included in your current request. </p>
        capo_comprehend.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_comprehend.types.start_events_detection_job_request.StartEventsDetectionJobRequest]",
    ) -> AsyncOperationResponse[
        "capo_comprehend.types.start_events_detection_job_response.StartEventsDetectionJobResponse"
    ]:
        import capo_comprehend._operations.comprehend_20171127.start_events_detection_job

        (
            output,
            http_response,
        ) = await capo_comprehend._operations.comprehend_20171127.start_events_detection_job.async_start_events_detection_job(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartEventsDetectionJob")
    )
    input_: capo_comprehend.types.start_events_detection_job_request.StartEventsDetectionJobRequest = {
        "input_data_config": input_data_config,
        "output_data_config": output_data_config,
        "data_access_role_arn": data_access_role_arn,
        "language_code": language_code,
        "target_event_types": target_event_types,
    }
    if job_name is not None:
        input_["job_name"] = job_name
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token
    if tags is not None:
        input_["tags"] = tags

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