aws-frauddetector-label/src/aws_frauddetector_label/helpers/api_helpers.py [293:471]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@retry_not_found_exceptions
@api_call_with_debug_logs
def call_update_variable(
    frauddetector_client,
    variable_name: str,
    variable_default_value: str,
    variable_description: str,
):
    """
    Calls update_variable with the given frauddetector client
    :param variable_description: new description for the variable
    :param variable_default_value: new default value for the variable
    :param variable_name: name of the variable
    :param frauddetector_client: boto3 client to make the call with
    :return: API response from update_variable
    """
    # Only update description, variable type, and default value
    args = {
        "defaultValue": variable_default_value,
        "description": variable_description,
        "name": variable_name,
    }
    validation_helpers.remove_none_arguments(args)
    return frauddetector_client.update_variable(**args)


# Get APIs


@retry_not_found_exceptions
@paginated_api_call(item_to_collect="outcomes")
@api_call_with_debug_logs
def call_get_outcomes(frauddetector_client, outcome_name: str = None):
    """
    Call get_outcomes with the given frauddetector client and the given arguments.
    :param frauddetector_client: boto3 frauddetector client to use to make the call
    :param outcome_name: name of the outcome to get (default is None)
    :return: get a single outcome if outcome_name is specified, otherwise get all outcomes
    """
    args = {"name": outcome_name}
    validation_helpers.remove_none_arguments(args)
    return frauddetector_client.get_outcomes(**args)


@retry_not_found_exceptions
@paginated_api_call(item_to_collect="variables")
@api_call_with_debug_logs
def call_get_variables(frauddetector_client, variable_name: str = None):
    """
    Call get_variables with the given frauddetector client and the given arguments.
    :param frauddetector_client: boto3 frauddetector client to use to make the call
    :param variable_name: name of the variable to get (default is None)
    :return: get a single variable if variable_name is specified, otherwise get all variables
    """
    args = {"name": variable_name}
    validation_helpers.remove_none_arguments(args)
    return frauddetector_client.get_variables(**args)


@retry_not_found_exceptions
@paginated_api_call(item_to_collect="detectors")
@api_call_with_debug_logs
def call_get_detectors(frauddetector_client, detector_id: str = None):
    args = {"detectorId": detector_id}
    validation_helpers.remove_none_arguments(args)
    return frauddetector_client.get_detectors(**args)


@retry_not_found_exceptions
@paginated_api_call(item_to_collect="labels")
@api_call_with_debug_logs
def call_get_labels(frauddetector_client, label_name: str = None):
    args = {"name": label_name}
    validation_helpers.remove_none_arguments(args)
    return frauddetector_client.get_labels(**args)


@retry_not_found_exceptions
@paginated_api_call(item_to_collect="entityTypes")
@api_call_with_debug_logs
def call_get_entity_types(frauddetector_client, entity_type_name: str = None):
    args = {"name": entity_type_name}
    validation_helpers.remove_none_arguments(args)
    return frauddetector_client.get_entity_types(**args)


@retry_not_found_exceptions
@paginated_api_call(item_to_collect="eventTypes")
@api_call_with_debug_logs
def call_get_event_types(frauddetector_client, event_type_name: str = None):
    args = {"name": event_type_name}
    validation_helpers.remove_none_arguments(args)
    return frauddetector_client.get_event_types(**args)


@api_call_with_debug_logs
def call_batch_get_variable(frauddetector_client, variable_names: List[str]):
    return frauddetector_client.batch_get_variable(names=variable_names)


# Delete APIs


@api_call_with_debug_logs
def call_delete_outcome(frauddetector_client, outcome_name: str):
    """
    Call delete_outcome for a given outcome name with the given frauddetector client.
    :param frauddetector_client: boto3 frauddetector client to use to make the call
    :param outcome_name: name of the outcome to delete
    :return: success will return a 200 with no body
    """
    return frauddetector_client.delete_outcome(name=outcome_name)


@api_call_with_debug_logs
def call_delete_detector(frauddetector_client, detector_id: str):
    return frauddetector_client.delete_detector(detectorId=detector_id)


@api_call_with_debug_logs
def call_delete_variable(frauddetector_client, variable_name: str):
    return frauddetector_client.delete_variable(name=variable_name)


@api_call_with_debug_logs
def call_delete_event_type(frauddetector_client, event_type_name: str):
    return frauddetector_client.delete_event_type(name=event_type_name)


@api_call_with_debug_logs
def call_delete_entity_type(frauddetector_client, entity_type_name: str):
    return frauddetector_client.delete_entity_type(name=entity_type_name)


@api_call_with_debug_logs
def call_delete_label(frauddetector_client, label_name: str):
    return frauddetector_client.delete_label(name=label_name)


# Tagging


@retry_not_found_exceptions
@paginated_api_call(item_to_collect="tags")
@api_call_with_debug_logs
def call_list_tags_for_resource(frauddetector_client, resource_arn: str):
    """
    Call list_tags_for_resource for a given ARN with the given frauddetector client.
    :param frauddetector_client: boto3 frauddetector client to use to make the call
    :param resource_arn: ARN of the resource to get tags for
    :return: result has an exhaustive list of tags attached to the resource
    """
    return frauddetector_client.list_tags_for_resource(resourceARN=resource_arn)


@retry_not_found_exceptions
@api_call_with_debug_logs
def call_tag_resource(frauddetector_client, resource_arn: str, tags: List[dict]):
    """
    Call tag_resource with the given frauddetector client and parameters.
    :param frauddetector_client: boto3 frauddetector client to use to make the call
    :param resource_arn: ARN of the resource to attach tags to
    :param tags: tags to attach to the resource, as a list of dicts [{'key': '...', 'value': '...'}]
    :return: success will return a 200 with no body
    """
    return frauddetector_client.tag_resource(resourceARN=resource_arn, tags=tags)


@retry_not_found_exceptions
@api_call_with_debug_logs
def call_untag_resource(frauddetector_client, resource_arn: str, tag_keys: List[str]):
    """
    Call untag_resource with the given frauddetector client and parameters.
    :param frauddetector_client: boto3 frauddetector client to use to make the call
    :param resource_arn: ARN of the resource to remove tags from
    :param tag_keys: tags to attach to the resource, as a list of str ['key1', 'key2']
    :return: success will return a 200 with no body
    """
    return frauddetector_client.untag_resource(resourceARN=resource_arn, tagKeys=tag_keys)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



aws-frauddetector-variable/src/aws_frauddetector_variable/helpers/api_helpers.py [274:452]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@retry_not_found_exceptions
@api_call_with_debug_logs
def call_update_variable(
    frauddetector_client,
    variable_name: str,
    variable_default_value: str,
    variable_description: str,
):
    """
    Calls update_variable with the given frauddetector client
    :param variable_description: new description for the variable
    :param variable_default_value: new default value for the variable
    :param variable_name: name of the variable
    :param frauddetector_client: boto3 client to make the call with
    :return: API response from update_variable
    """
    # Only update description, variable type, and default value
    args = {
        "defaultValue": variable_default_value,
        "description": variable_description,
        "name": variable_name,
    }
    validation_helpers.remove_none_arguments(args)
    return frauddetector_client.update_variable(**args)


# Get APIs


@retry_not_found_exceptions
@paginated_api_call(item_to_collect="outcomes")
@api_call_with_debug_logs
def call_get_outcomes(frauddetector_client, outcome_name: str = None):
    """
    Call get_outcomes with the given frauddetector client and the given arguments.
    :param frauddetector_client: boto3 frauddetector client to use to make the call
    :param outcome_name: name of the outcome to get (default is None)
    :return: get a single outcome if outcome_name is specified, otherwise get all outcomes
    """
    args = {"name": outcome_name}
    validation_helpers.remove_none_arguments(args)
    return frauddetector_client.get_outcomes(**args)


@retry_not_found_exceptions
@paginated_api_call(item_to_collect="variables")
@api_call_with_debug_logs
def call_get_variables(frauddetector_client, variable_name: str = None):
    """
    Call get_variables with the given frauddetector client and the given arguments.
    :param frauddetector_client: boto3 frauddetector client to use to make the call
    :param variable_name: name of the variable to get (default is None)
    :return: get a single variable if variable_name is specified, otherwise get all variables
    """
    args = {"name": variable_name}
    validation_helpers.remove_none_arguments(args)
    return frauddetector_client.get_variables(**args)


@retry_not_found_exceptions
@paginated_api_call(item_to_collect="detectors")
@api_call_with_debug_logs
def call_get_detectors(frauddetector_client, detector_id: str = None):
    args = {"detectorId": detector_id}
    validation_helpers.remove_none_arguments(args)
    return frauddetector_client.get_detectors(**args)


@retry_not_found_exceptions
@paginated_api_call(item_to_collect="labels")
@api_call_with_debug_logs
def call_get_labels(frauddetector_client, label_name: str = None):
    args = {"name": label_name}
    validation_helpers.remove_none_arguments(args)
    return frauddetector_client.get_labels(**args)


@retry_not_found_exceptions
@paginated_api_call(item_to_collect="entityTypes")
@api_call_with_debug_logs
def call_get_entity_types(frauddetector_client, entity_type_name: str = None):
    args = {"name": entity_type_name}
    validation_helpers.remove_none_arguments(args)
    return frauddetector_client.get_entity_types(**args)


@retry_not_found_exceptions
@paginated_api_call(item_to_collect="eventTypes")
@api_call_with_debug_logs
def call_get_event_types(frauddetector_client, event_type_name: str = None):
    args = {"name": event_type_name}
    validation_helpers.remove_none_arguments(args)
    return frauddetector_client.get_event_types(**args)


@api_call_with_debug_logs
def call_batch_get_variable(frauddetector_client, variable_names: List[str]):
    return frauddetector_client.batch_get_variable(names=variable_names)


# Delete APIs


@api_call_with_debug_logs
def call_delete_outcome(frauddetector_client, outcome_name: str):
    """
    Call delete_outcome for a given outcome name with the given frauddetector client.
    :param frauddetector_client: boto3 frauddetector client to use to make the call
    :param outcome_name: name of the outcome to delete
    :return: success will return a 200 with no body
    """
    return frauddetector_client.delete_outcome(name=outcome_name)


@api_call_with_debug_logs
def call_delete_detector(frauddetector_client, detector_id: str):
    return frauddetector_client.delete_detector(detectorId=detector_id)


@api_call_with_debug_logs
def call_delete_variable(frauddetector_client, variable_name: str):
    return frauddetector_client.delete_variable(name=variable_name)


@api_call_with_debug_logs
def call_delete_event_type(frauddetector_client, event_type_name: str):
    return frauddetector_client.delete_event_type(name=event_type_name)


@api_call_with_debug_logs
def call_delete_entity_type(frauddetector_client, entity_type_name: str):
    return frauddetector_client.delete_entity_type(name=entity_type_name)


@api_call_with_debug_logs
def call_delete_label(frauddetector_client, label_name: str):
    return frauddetector_client.delete_label(name=label_name)


# Tagging


@retry_not_found_exceptions
@paginated_api_call(item_to_collect="tags")
@api_call_with_debug_logs
def call_list_tags_for_resource(frauddetector_client, resource_arn: str):
    """
    Call list_tags_for_resource for a given ARN with the given frauddetector client.
    :param frauddetector_client: boto3 frauddetector client to use to make the call
    :param resource_arn: ARN of the resource to get tags for
    :return: result has an exhaustive list of tags attached to the resource
    """
    return frauddetector_client.list_tags_for_resource(resourceARN=resource_arn)


@retry_not_found_exceptions
@api_call_with_debug_logs
def call_tag_resource(frauddetector_client, resource_arn: str, tags: List[dict]):
    """
    Call tag_resource with the given frauddetector client and parameters.
    :param frauddetector_client: boto3 frauddetector client to use to make the call
    :param resource_arn: ARN of the resource to attach tags to
    :param tags: tags to attach to the resource, as a list of dicts [{'key': '...', 'value': '...'}]
    :return: success will return a 200 with no body
    """
    return frauddetector_client.tag_resource(resourceARN=resource_arn, tags=tags)


@retry_not_found_exceptions
@api_call_with_debug_logs
def call_untag_resource(frauddetector_client, resource_arn: str, tag_keys: List[str]):
    """
    Call untag_resource with the given frauddetector client and parameters.
    :param frauddetector_client: boto3 frauddetector client to use to make the call
    :param resource_arn: ARN of the resource to remove tags from
    :param tag_keys: tags to attach to the resource, as a list of str ['key1', 'key2']
    :return: success will return a 200 with no body
    """
    return frauddetector_client.untag_resource(resourceARN=resource_arn, tagKeys=tag_keys)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



