# Path: tsuru_autoscale/datasource/forms.py
# class DataSourceForm(forms.Form):
#     name = forms.CharField()
#     url = forms.CharField()
#     method = forms.CharField()
#     body = forms.CharField(required=False)
#     headers = forms.CharField(required=False)
# 
# Path: tsuru_autoscale/datasource/client.py
# def host():
# def new(data, token):
# def list(token):
# def remove(name, token):
# def get(name, token):


from django.shortcuts import render, redirect
from django.core.urlresolvers import reverse
from django.contrib import messages
from tsuru_autoscale.datasource.forms import DataSourceForm
from tsuru_autoscale.datasource import client



def new(request):
    form = DataSourceForm(request.POST or None)

    if form.is_valid():
        token = request.GET.get("TSURU_TOKEN")

# Path: tsuru_autoscale/datasource/forms.py
# class DataSourceForm(forms.Form):
#     name = forms.CharField()
#     url = forms.CharField()
#     method = forms.CharField()
#     body = forms.CharField(required=False)
#     headers = forms.CharField(required=False)
# 
# Path: tsuru_autoscale/datasource/client.py
# def host():
# def new(data, token):
# def list(token):
# def remove(name, token):
# def get(name, token):


# Path: tsuru_autoscale/datasource/views.py
from django.shortcuts import render, redirect
from django.core.urlresolvers import reverse
from django.contrib import messages
from tsuru_autoscale.datasource.forms import DataSourceForm
from tsuru_autoscale.datasource import client




def new(request):
    form = DataSourceForm(request.POST or None)

    if form.is_valid():
        token = request.GET.get("TSURU_TOKEN")

        response = client.new(form.cleaned_data, token)