示例#1
0
def dns_zone_delete_route(user_id, domain_id):
    data = dict(request.params.items())
    data['user_id'] = user_id
    data['domain_id'] = domain_id
    params = DNSQueryValidator.parse(data)
    sandbox(delete_dns_zone, **params)
    dbconn.session.safe_commit()
    return ok({})
示例#2
0
def dns_zone_delete_record(user_id, domain_id, dns_record_id):
    """
    DELETE /domains/<domain_id>/dns/records/<dns_record_id>
    """
    data = dict(request.params.items())
    data['user_id'] = user_id
    data['domain_id'] = domain_id
    data['dns_record_id'] = dns_record_id
    params = DNSRecordQueryValidator.parse(data)
    sandbox(delete_dns_record, user_id=params['user_id'],
            dns_record_id=params['dns_record_id'])
    dbconn.session.safe_commit()
    return ok({})
示例#3
0
def dns_zone_get_records(user_id, domain_id):
    """
    GET /domains/<domain_id>/dns/records
    """
    data = dict(request.params.items())
    data['user_id'] = user_id
    data['domain_id'] = domain_id
    params = DNSGetValidator.parse(data)
    records = sandbox(get_dns_records, **params)
    return ok({'records': [x.as_dict() for x in records]})
示例#4
0
def get_dns_route(user_id, domain_id):
    """
    GET /domains/<domain_id>/dns route
    """
    data = dict(request.params.items())
    data['user_id'] = user_id
    data['domain_id'] = domain_id
    params = DNSGetValidator.parse(data)
    zone = sandbox(get_dns_zone, **params)
    dbconn.session.safe_commit()
    return ok(zone.as_dict())
示例#5
0
def dns_zone_get_record(user_id, domain_id, dns_record_id):
    """
    GET /domains/<domain_id>/dns/records/<dns_record_id>
    """
    data = dict(request.params.items())
    data['user_id'] = user_id
    data['domain_id'] = domain_id
    data['dns_record_id'] = dns_record_id
    params = DNSRecordQueryValidator.parse(data)
    record = sandbox(get_dns_record, user_id=params['user_id'],
                          dns_record_id=params['dns_record_id'])
    return ok(record.as_dict())
示例#6
0
def dns_zone_add_route(user_id, domain_id):
    """
    PUT /domains/<domain_id>/dns
    """
    data = dict(request.json)
    qdata = {}
    qdata['user_id'] = user_id
    qdata['domain_id'] = domain_id
    params = DNSZoneValidator.parse(data)
    qparams = DNSQueryValidator.parse(qdata)
    params.update(qparams)
    zone = sandbox(add_user_dns_zone, **params)
    dbconn.session.safe_commit()
    return ok(zone.as_dict())
示例#7
0
def dns_zone_add_records(user_id, domain_id):
    """
    Add new DNS record to DNS zone
    """
    data = dict(request.params.items())
    qdata = {}
    qdata['user_id'] = user_id
    qdata['domain_id'] = domain_id
    qparams = DNSQueryValidator.parse(qdata)
    params = DNSRecordParser.parse(data)
    params.update(qparams)
    record = sandbox(add_dns_record, **params)
    dbconn.session.safe_commit()
    return ok(record.as_dict())
示例#8
0
def dns_zone_modify_record(user_id, domain_id, dns_record_id):
    """
    PUT/POST /domains/<domain_id>/dns/records/<dns_record_id>
    """

    qdata = {}
    qdata['user_id'] = user_id
    qdata['domain_id'] = domain_id
    qdata['dns_record_id'] = dns_record_id
    qparams = DNSRecordQueryValidator.parse(qdata)
    params = DNSRecordParser.parse(data)
    params.update(qparams)
    record = sandbox(modify_dns_record, **params)
    dbconn.session.safe_commit()
    return ok(record.as_dict())