Example #1
0
def graph_svg():
    Graph.reset_counters()
    dot = DotGraph('', file_contents=run_tf_graph())

    module_depth = request.args.get('module_depth', default=None, type=int)
    if module_depth is not None and module_depth >= 0:
        dot.set_module_depth(module_depth)
    return dot.svg()
Example #2
0
def graph_json():
    Graph.reset_counters()
    dot = DotGraph('', file_contents=run_tf_graph())
    module_depth = request.args.get('module_depth', default=None, type=int)
    if module_depth is not None and module_depth >= 0:
        dot.set_module_depth(module_depth) 

    tf = Terraform(os.getcwd())
    for node in dot.nodes:
        node.definition = tf.get_def(node)

    return dot.json()
Example #3
0
def graph_svg():
    Graph.reset_counters()
    dot = DotGraph('', file_contents=run_tf_graph())

    module_depth = request.args.get('module_depth', default=None, type=int)
    refocus = request.args.get('refocus', default=None, type=str)

    if module_depth is not None and module_depth >= 0:
        dot.set_module_depth(module_depth)

    if refocus is not None:
        node = dot.get_node_by_name(refocus)
        if node:
            dot.center(node)

    return dot.svg()
Example #4
0
def graph_json():
    Graph.reset_counters()
    # dot = DotGraph('','',file_contents=run_tf_graph()) we will create jsn with extended svg info
    dot = DotGraph('', '', file_contents=simple_graph())
    module_depth = request.args.get('module_depth', default=None, type=int)
    refocus = request.args.get('refocus', default=None, type=str)
    if module_depth is not None and module_depth >= 0:
        dot.set_module_depth(module_depth)

    tf = Terraform(os.getcwd())
    for node in dot.nodes:
        node.definition = tf.get_def(node)

    if refocus is not None:
        node = dot.get_node_by_name(refocus)
        if node:
            dot.center(node)

    return dot.json()