def set_workflow_config()

in source/aws_lambda/shared/sfn_middleware.py [0:0]


def set_workflow_config(config: Dict) -> Dict:
    """
    Set the defaults for workflowConfiguration for all configured items
    :param config: the configuration dictionary
    :return: the configuration with defaults set
    """

    resources = {
        "datasetGroup": Arity.ONE,
        "solutions": Arity.MANY,
        "recommenders": Arity.MANY,
        "campaigns": Arity.MANY,
        "batchInferenceJobs": Arity.MANY,
        "batchSegmentJobs": Arity.MANY,
        "filters": Arity.MANY,
        "solutionVersion": Arity.ONE,
    }
    # Note: schema creation notification is not supported at this time
    # Note: dataset, dataset import job, event tracker notifications are added in the workflow

    for k, v in config.items():
        if k in {"serviceConfig", "workflowConfig", "bucket", "currentDate"}:
            pass  # do not modify any serviceConfig keys
        elif k in resources.keys() and resources[k] == Arity.ONE:
            config[k].setdefault("workflowConfig", {})
            config[k]["workflowConfig"] |= WORKFLOW_CONFIG_DEFAULT
        elif k in resources.keys() and resources[k] == Arity.MANY:
            for idx, i in enumerate(v):
                config[k][idx].setdefault("workflowConfig", {})
                config[k][idx]["workflowConfig"] |= WORKFLOW_CONFIG_DEFAULT
                config[k][idx] = set_workflow_config(config[k][idx])
        else:
            config[k] = set_workflow_config(config[k]) if config[k] else config[k]

    return config