Skip to content

create_label async

create_label(
    label_group_name: LabelGroupName,
    start_time: Timestamp,
    end_time: Timestamp,
    rating: LabelRating,
    client_token: IdempotenceToken,
    *,
    config_overrides: Optional[AsyncLookoutEquipmentClientConfig] = None,
    fault_code: Optional[FaultCode] = None,
    notes: Optional[Comments] = None,
    equipment: Optional[Equipment] = None,
) -> CreateLabelResponse

Creates a label for an event.

Parameters:

  • label_group_name (LabelGroupName) –

    The name of a group of labels.

    Data in this field will be retained for service usage. Follow best practices for the security of your data.

  • start_time (Timestamp) –

    The start time of the labeled event.

  • end_time (Timestamp) –

    The end time of the labeled event.

  • rating (LabelRating) –

    Indicates whether a labeled event represents an anomaly.

  • fault_code (Optional[FaultCode], default: None ) –

    Provides additional information about the label. The fault code must be defined in the FaultCodes attribute of the label group.

    Data in this field will be retained for service usage. Follow best practices for the security of your data.

  • notes (Optional[Comments], default: None ) –

    Metadata providing additional information about the label.

    Data in this field will be retained for service usage. Follow best practices for the security of your data.

  • equipment (Optional[Equipment], default: None ) –

    Indicates that a label pertains to a particular piece of equipment.

    Data in this field will be retained for service usage. Follow best practices for the security of your data.

  • client_token (IdempotenceToken) –

    A unique identifier for the request to create a label. If you do not set the client request token, Lookout for Equipment generates one.

Raises:

  • AccessDeniedException –

    The request could not be completed because you do not have access to the resource.

  • ConflictException –

    The request could not be completed due to a conflict with the current state of the target resource.

  • InternalServerException –

    Processing of the request has failed because of an unknown error, exception or failure.

  • ResourceNotFoundException –

    The resource requested could not be found. Verify the resource ID and retry your request.

  • ServiceQuotaExceededException –

    Resource limitations have been exceeded.

  • ThrottlingException –

    The request was denied due to request throttling.

  • ValidationException –

    The input fails to satisfy constraints specified by Amazon Lookout for Equipment or a related Amazon Web Services service that's being utilized.

  • UnknownServiceError –

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

Source code in docs_src/capo_lookoutequipment/_services/async_lookout_equipment.py
async def create_label(
    self,
    label_group_name: "capo_lookoutequipment.types.label_group_name.LabelGroupName",
    start_time: "capo_lookoutequipment.types.timestamp.Timestamp",
    end_time: "capo_lookoutequipment.types.timestamp.Timestamp",
    rating: "capo_lookoutequipment.types.label_rating.LabelRating",
    client_token: "capo_lookoutequipment.types.idempotence_token.IdempotenceToken",
    *,
    config_overrides: Optional[AsyncLookoutEquipmentClientConfig] = None,
    fault_code: Optional["capo_lookoutequipment.types.fault_code.FaultCode"] = None,
    notes: Optional["capo_lookoutequipment.types.comments.Comments"] = None,
    equipment: Optional["capo_lookoutequipment.types.equipment.Equipment"] = None,
) -> "capo_lookoutequipment.types.create_label_response.CreateLabelResponse":
    """<p> Creates a label for an event. </p>

    Args:
        label_group_name: <p> The name of a group of labels. </p> <p>Data in this field will be retained for service usage. Follow best practices for the security of your data. </p>
        start_time: <p> The start time of the labeled event. </p>
        end_time: <p> The end time of the labeled event. </p>
        rating: <p> Indicates whether a labeled event represents an anomaly. </p>
        fault_code: <p> Provides additional information about the label. The fault code must be defined in the FaultCodes attribute of the label group.</p> <p>Data in this field will be retained for service usage. Follow best practices for the security of your data. </p>
        notes: <p> Metadata providing additional information about the label. </p> <p>Data in this field will be retained for service usage. Follow best practices for the security of your data.</p>
        equipment: <p> Indicates that a label pertains to a particular piece of equipment. </p> <p>Data in this field will be retained for service usage. Follow best practices for the security of your data.</p>
        client_token: <p> A unique identifier for the request to create a label. If you do not set the client request token, Lookout for Equipment generates one. </p>

    Raises:
        capo_lookoutequipment.errors.access_denied_exception.AccessDeniedException: <p>The request could not be completed because you do not have access to the resource. </p>
        capo_lookoutequipment.errors.conflict_exception.ConflictException: <p> The request could not be completed due to a conflict with the current state of the target resource. </p>
        capo_lookoutequipment.errors.internal_server_exception.InternalServerException: <p> Processing of the request has failed because of an unknown error, exception or failure. </p>
        capo_lookoutequipment.errors.resource_not_found_exception.ResourceNotFoundException: <p> The resource requested could not be found. Verify the resource ID and retry your request. </p>
        capo_lookoutequipment.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p> Resource limitations have been exceeded. </p>
        capo_lookoutequipment.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_lookoutequipment.errors.validation_exception.ValidationException: <p> The input fails to satisfy constraints specified by Amazon Lookout for Equipment or a related Amazon Web Services service that's being utilized. </p>
        capo_lookoutequipment.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_lookoutequipment.types.create_label_request.CreateLabelRequest]",
    ) -> AsyncOperationResponse[
        "capo_lookoutequipment.types.create_label_response.CreateLabelResponse"
    ]:
        import capo_lookoutequipment._operations.aws_lookout_equipment_frontend_service.create_label

        (
            output,
            http_response,
        ) = await capo_lookoutequipment._operations.aws_lookout_equipment_frontend_service.create_label.async_create_label(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateLabel")
    )
    input_: capo_lookoutequipment.types.create_label_request.CreateLabelRequest = {
        "label_group_name": label_group_name,
        "start_time": start_time,
        "end_time": end_time,
        "rating": rating,
        "client_token": client_token,
    }
    if fault_code is not None:
        input_["fault_code"] = fault_code
    if notes is not None:
        input_["notes"] = notes
    if equipment is not None:
        input_["equipment"] = equipment

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