# Path: tsuru_autoscale/wizard/forms.py
# OPERATOR_CHOICES = (
#     ('>', '>'),
#     ('>=', '>='),
#     ('<=', '<='),
#     ('<', '<'),
#     ('!=', '!='),
# )
# AGGREGATOR_CHOICES = (
#     ('avg', 'average'),
#     ('max', 'maximum'),
# )
# class ScaleForm(forms.Form):
# class ConfigForm(forms.Form):
#     def __init__(self, min_wait, *args, **kwargs):
#     def clean_value(self):
#     def clean_step(self):
# 
# Path: tsuru_autoscale/wizard/client.py
# def host():
# def tsuru_host():
# def clean_token(token):
# def app_info(name, token):
# def pool_info(name, token):
# def process_list(instance_name, token):
# def new(data, token):
# def get(name, token):
# def remove(name, token):
# def enable(name, token):
# def disable(name, token):
# def events(name, token):
# 
# 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.wizard import forms
from tsuru_autoscale.wizard import client
from tsuru_autoscale.datasource import client as dclient
import requests
import urllib




def get_or_create_tsuru_instance(instance_name, token):
    token = urllib.unquote(token)
    token = "bearer {}".format(token)

# Path: tsuru_autoscale/wizard/forms.py
# OPERATOR_CHOICES = (
#     ('>', '>'),
#     ('>=', '>='),
#     ('<=', '<='),
#     ('<', '<'),
#     ('!=', '!='),
# )
# AGGREGATOR_CHOICES = (
#     ('avg', 'average'),
#     ('max', 'maximum'),
# )
# class ScaleForm(forms.Form):
# class ConfigForm(forms.Form):
#     def __init__(self, min_wait, *args, **kwargs):
#     def clean_value(self):
#     def clean_step(self):
# 
# Path: tsuru_autoscale/wizard/client.py
# def host():
# def tsuru_host():
# def clean_token(token):
# def app_info(name, token):
# def pool_info(name, token):
# def process_list(instance_name, token):
# def new(data, token):
# def get(name, token):
# def remove(name, token):
# def enable(name, token):
# def disable(name, token):
# def events(name, token):
# 
# 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/wizard/views.py
from django.shortcuts import render, redirect
from django.core.urlresolvers import reverse
from django.contrib import messages
from tsuru_autoscale.wizard import forms
from tsuru_autoscale.wizard import client
from tsuru_autoscale.datasource import client as dclient
import requests
import urllib





def get_or_create_tsuru_instance(instance_name, token):
    token = urllib.unquote(token)
    token = "bearer {}".format(token)

    url = "{}/services/autoscale/instances/{}".format(client.tsuru_host(), instance_name)