class BasicContainer(object):
    def __init__(self):
    def create_docker_client(self):
    def create_lambda_container(self, user_file_path, container_memory="1g", container_cpu_shares=1024):
    def start_lambda_container(self, container):
    def get_container_log(self, container): class Python27Container(basic_container.BasicContainer):
    def __init__(self): class Python35Container(basic_container.BasicContainer):
    def __init__(self): class UbuntuContainer(basic_container.BasicContainer):
    def __init__(self): class CentosContainer(basic_container.BasicContainer):
    def __init__(self): class GolangContainer(basic_container.BasicContainer):
    def __init__(self): class RubyContainer(basic_container.BasicContainer):
    def __init__(self): class ErlangContainer(basic_container.BasicContainer):
    def __init__(self): class NodeContainer(basic_container.BasicContainer):
    def __init__(self): class PhpContainer(basic_container.BasicContainer):
    def __init__(self): class Java9Container(basic_container.BasicContainer):
    def __init__(self): class JavaOpenjdk9Container(basic_container.BasicContainer):
    def __init__(self): class RContainer(basic_container.BasicContainer):
    def __init__(self): class HaskellContainer(basic_container.BasicContainer):
    def __init__(self): class PerlContainer(basic_container.BasicContainer):
    def __init__(self): class CContainer(basic_container.BasicContainer):
    def __init__(self): class CppContainer(basic_container.BasicContainer):
    def __init__(self): class LuaContainer(basic_container.BasicContainer):
    def __init__(self): class SwiftContainer(basic_container.BasicContainer):
    def __init__(self): class ObjectiveCContainer(basic_container.BasicContainer):
    def __init__(self): class ElixirContainer(basic_container.BasicContainer):
    def __init__(self): class RustContainer(basic_container.BasicContainer):
    def __init__(self): class TensorFlowContainer(basic_container.BasicContainer):
    def __init__(self):
import os
import time
import web
from web import form
from runtime import basic_container
from runtime import python27_container
from runtime import python35_container
from runtime import ubuntu_container
from runtime import centos_container
from runtime import golang_container
from runtime import ruby_container
from runtime import erlang_container
from runtime import node_container
from runtime import php_container
from runtime import java9_container
from runtime import javaopenjdk9_container
from runtime import r_container
from runtime import haskell_container
from runtime import perl_container
from runtime import c_container
from runtime import cpp_container
from runtime import lua_container
from runtime import swift_container
from runtime import objectivec_container
from runtime import elixir_container
from runtime import rust_container
from runtime import tensorflow_container
#!/usr/bin/env python




render = web.template.render('static/templates/')

RUNTIME_PYTHON27 = "Python 2.7"
RUNTIME_PYTHON35 = "Python 3.5"
RUNTIME_GOLANG = "Golang"
RUNTIME_UBUNTU = "Linux/Ubuntu"
RUNTIME_CENTOS = "Linux/CentOS"
RUNTIME_C = "C"
RUNTIME_CPP = "CPP"
RUNTIME_RUBY = "Ruby"
RUNTIME_ERLANG = "Erlang"
RUNTIME_NODE = "NodeJS"
RUNTIME_PHP = "PHP"
RUNTIME_JAVA9 = "Java 9"
RUNTIME_JAVAOPENJDK9 = "Java OpenJDK 9"
RUNTIME_R = "R"
RUNTIME_HASKELL = "Haskell"
RUNTIME_PERL = "Perl"
RUNTIME_LUA = "Lua"
RUNTIME_SWIFT = "Swift"
RUNTIME_OBJECTIVEC = "Objective-c"
RUNTIME_ELIXIR = "Elixir"
RUNTIME_RUST = "Rust"
RUNTIME_TENSORFLOW = "TensorFlow"

myform = form.Form(
    form.Dropdown("Runtime", [RUNTIME_PYTHON27, RUNTIME_PYTHON35, RUNTIME_GOLANG, RUNTIME_UBUNTU, RUNTIME_CENTOS, RUNTIME_C, RUNTIME_CPP, RUNTIME_RUBY, RUNTIME_ERLANG, RUNTIME_NODE, RUNTIME_PHP, RUNTIME_JAVA9, RUNTIME_JAVAOPENJDK9, RUNTIME_R, RUNTIME_HASKELL, RUNTIME_PERL, RUNTIME_LUA, RUNTIME_SWIFT, RUNTIME_OBJECTIVEC, RUNTIME_ELIXIR, RUNTIME_RUST, RUNTIME_TENSORFLOW]),
    form.Textbox("Load local file"),
    form.Checkbox("Edit online code"),
    form.Textarea("Online code"))

urls = (
        '/', 'index'
    )

class index:

    '''
    Return web form to trigger lambda service.
    '''
    def GET(self):
        form = myform()

        return render.index(form)

    '''
    Post to start container to run user code
    '''
    def POST(self):

        # Parse post parameter
        parameters = web.input()
        print(parameters)

        # Example: "python27"
        runtime = parameters.get("Runtime")

        # Start lambda container
        if runtime == RUNTIME_PYTHON27:
            containerRuntime = python27_container.Python27Container()
        elif runtime == RUNTIME_PYTHON35:
            containerRuntime = python35_container.Python35Container()
        elif runtime == RUNTIME_GOLANG:
            containerRuntime = golang_container.GolangContainer()
        elif runtime == RUNTIME_UBUNTU:
            containerRuntime = ubuntu_container.UbuntuContainer()
        elif runtime == RUNTIME_CENTOS:
            containerRuntime = centos_container.CentosContainer()
	elif runtime == RUNTIME_C:
	    containerRuntime = c_container.CContainer()
	elif runtime == RUNTIME_CPP:
	    containerRuntime = cpp_container.CppContainer()
        elif runtime == RUNTIME_RUBY:
            containerRuntime = ruby_container.RubyContainer()
        elif runtime == RUNTIME_ERLANG:
            containerRuntime = erlang_container.ErlangContainer()
	elif runtime == RUNTIME_NODE:
	    containerRuntime = node_container.NodeContainer()
	elif runtime == RUNTIME_PHP:
	    containerRuntime = php_container.PhpContainer()
	elif runtime == RUNTIME_JAVA9:
	    containerRuntime = java9_container.Java9Container()
	elif runtime == RUNTIME_JAVAOPENJDK9:
	    containerRuntime = javaopenjdk9_container.JavaOpenjdk9Container()
	elif runtime == RUNTIME_R:
	    containerRuntime = r_container.RContainer()
	elif runtime == RUNTIME_HASKELL:
	    containerRuntime = haskell_container.HaskellContainer()
	elif runtime == RUNTIME_PERL:
	    containerRuntime = perl_container.PerlContainer()
	elif runtime == RUNTIME_LUA:
	    containerRuntime = lua_container.LuaContainer()
	elif runtime == RUNTIME_SWIFT:

	    containerRuntime = swift_container.SwiftContainer()