def get_model_for_inline_event_type()

in aws-frauddetector-detector/src/aws_frauddetector_detector/helpers/model_helpers.py [0:0]


def get_model_for_inline_event_type(frauddetector_client, event_type, referenced_resources: dict):
    # build model from event type
    model = models.EventType(
        Name=event_type.get("name", ""),
        Tags=[],
        Description=event_type.get("description", ""),
        EventVariables=[],
        Labels=[],
        EntityTypes=[],
        Arn=event_type.get("arn", ""),
        CreatedTime=event_type.get("createdTime", ""),
        LastUpdatedTime=event_type.get("lastUpdatedTime", ""),
        Inline=True,
    )

    # attach Tags
    event_type_arn = event_type.get("arn", "")
    event_type_tags = _get_tags_for_given_arn(frauddetector_client, event_type_arn)
    # TODO: reorder tags to the same order as the input model to work around contract test bug?
    model.Tags = get_tag_models_from_tags(event_type_tags)

    # attach EventVariables
    event_variables = event_type.get("eventVariables", [])
    model.EventVariables = _get_variables_and_return_event_variables_model(
        frauddetector_client, event_variables, referenced_resources["event_variables"]
    )

    # attach Labels
    event_type_labels = event_type.get("labels", [])
    model.Labels = _get_labels_and_return_labels_model(
        frauddetector_client, event_type_labels, referenced_resources["labels"]
    )

    # attach EntityTypes
    event_type_entity_types = event_type.get("entityTypes", [])
    model.EntityTypes = _get_entity_types_and_return_entity_types_model(
        frauddetector_client,
        event_type_entity_types,
        referenced_resources["entity_types"],
    )

    # remove empty description/tags
    if not model.Tags:
        del model.Tags
    if model.Description is None or model.Description == "":
        del model.Description

    # return model
    return model