def new(organization, name, zone=None, default=False):
     log.info("Creating environment: %s" % name)
     if not zone:
         zone = organization.zone.zoneId
     data = {'isDefault': default,
             'name': name,
             'backend': zone,
             'organizationId': organization.organizationId}
     resp = router.post_organization_environment(org_id=organization.organizationId, data=json.dumps(data)).json()
     return Environment(organization, id=resp['id'])
 def new(organization, name, zone_id=None, default=False):
     log.info("Creating environment: %s" % name)
     if not zone_id:
         zone_id = organization.zone.zoneId
     data = {'isDefault': default,
             'name': name,
             'backend': zone_id,
             'organizationId': organization.organizationId}
     log.debug(data)
     resp = router.post_organization_environment(org_id=organization.organizationId, data=json.dumps(data)).json()
     env = Environment(organization, id=resp['id'])
     log.info("Environment created: %s (%s)" % (name,env.environmentId))
     return env