def create_domain(): valid_attributes = ['name', 'email', 'ttl', 'description'] context = flask.request.environ.get('context') values = load_values(flask.request, valid_attributes) domain_schema.validate(values) domain = central_api.create_domain(context, values) response = flask.jsonify(domain_schema.filter(domain)) response.status_int = 201 response.location = flask.url_for('.get_domain', domain_id=domain['id']) return response
def create_domain(): valid_attributes = ['name', 'email', 'ttl', 'description'] context = flask.request.environ.get('context') values = load_values(flask.request, valid_attributes) domain_schema.validate(values) central_api = central_rpcapi.CentralAPI.get_instance() # A V1 zone only supports being a primary (No notion of a type) values['type'] = 'PRIMARY' domain = central_api.create_zone(context, objects.Zone(**values)) response = flask.jsonify(domain_schema.filter(domain)) response.status_int = 201 response.location = flask.url_for('.get_domain', domain_id=domain['id']) return response