def create_record(request):
    json_data = json.loads(request.data)
    json_data['zone_id'] = request.args['zone_id']
    response = invoke_method('create_record',
                             request, data=json.dumps(json_data),
                             status_code=httplib.ACCEPTED)
    record_id = json.loads(response.data)['id']
    response.autocorrect_location_header = False
    response.headers.add_header('Location', record_id)
    response.status_code = httplib.CREATED
    return response
Beispiel #2
0
def create_record(request):
    json_data = json.loads(request.data)
    json_data['zone_id'] = request.args['zone_id']
    response = invoke_method('create_record',
                             request,
                             data=json.dumps(json_data),
                             status_code=httplib.ACCEPTED)
    record_id = json.loads(response.data)['id']
    response.autocorrect_location_header = False
    response.headers.add_header('Location', record_id)
    response.status_code = httplib.CREATED
    return response
Beispiel #3
0
def create_container(request):
    """
    Invoke create_container method and patch response.

    @return: Response object with newly created container name in Location.
    """
    response = invoke_method("create_container", request)
    container_id = json.loads(response.data)["name"]
    response.autocorrect_location_header = False
    response.headers.add_header("Location", container_id)
    response.status_code = httplib.CREATED
    return response
Beispiel #4
0
def create_node(request):
    """
    Invoke create_node method and patch response.

    @return: Response object with newly created node ID in Location.
    """
    response = invoke_method('create_node', request)
    node_id = json.loads(response.data)['id']
    response.autocorrect_location_header = False
    response.headers.add_header('Location', node_id)
    response.status_code = httplib.CREATED
    return response
Beispiel #5
0
def create_container(request):
    """
    Invoke create_container method and patch response.

    @return: Response object with newly created container name in Location.
    """
    response = invoke_method('create_container', request)
    container_id = json.loads(response.data)['name']
    response.autocorrect_location_header = False
    response.headers.add_header('Location', container_id)
    response.status_code = httplib.CREATED
    return response
def create_node(request):
    """
    Invoke create_node method and patch response.

    @return: Response object with newly created node ID in Location.
    """
    response = invoke_method('create_node', request)
    node_id = json.loads(response.data)['id']
    response.autocorrect_location_header = False
    response.headers.add_header('Location', node_id)
    response.status_code = httplib.CREATED
    return response
Beispiel #7
0
    def _get_json(self, data):
        """

        @param data:
        @type data:
        @return:
        @rtype:
        @raise: MalformedJsonError
        """
        try:
            json_data = json.loads(data)
        except (ValueError, TypeError), e:
            raise MalformedJSONError(detail=str(e))
Beispiel #8
0
    def _get_json(self, data):
        """

        @param data:
        @type data:
        @return:
        @rtype:
        @raise: MalformedJsonError
        """
        try:
            json_data = json.loads(data)
        except (ValueError, TypeError), e:
            raise MalformedJSONError(detail=str(e))
def update_balancer(request):
    json_data = json.loads(request.data)
    json_data['loadbalancer_id'] = request.args['loadbalancer_id']
    return invoke_method('update_balancer', request,
                         data=json.dumps(json_data))
Beispiel #10
0
 def to_json(self, obj_list):
     data = [json.loads(self.object_entry.to_json(obj)) for obj in obj_list]
     return json.dumps(data)
Beispiel #11
0
def list_members(request):
    json_data = json.loads(request.data)
    json_data['loadbalancer_id'] = request.args['lb_id']
    return invoke_method('balancer_list_members',
                         request,
                         data=json.dumps(json_data))
Beispiel #12
0
def create_member(request):
    json_data = json.loads(request.data)
    json_data['loadbalancer_id'] = request.args['lb_id']
    return invoke_method('balancer_attach_member',
                         request,
                         data=json.dumps(json_data))
Beispiel #13
0
def update_balancer(request):
    json_data = json.loads(request.data)
    json_data['loadbalancer_id'] = request.args['loadbalancer_id']
    return invoke_method('update_balancer',
                         request,
                         data=json.dumps(json_data))
Beispiel #14
0
def update_record(request):
    json_data = json.loads(request.data)
    json_data['zone_id'] = request.args['zone_id']
    json_data['record_id'] = request.args['record_id']
    return invoke_method('update_record', request, data=json.dumps(json_data))
def create_member(request):
    json_data = json.loads(request.data)
    json_data['loadbalancer_id'] = request.args['lb_id']
    return invoke_method('balancer_attach_member', request,
                         data=json.dumps(json_data))
Beispiel #16
0
 def to_json(self, obj_list):
     data = [json.loads(self.object_entry.to_json(obj)) for obj in obj_list]
     return json.dumps(data)
Beispiel #17
0
def update_record(request):
    json_data = json.loads(request.data)
    json_data['zone_id'] = request.args['zone_id']
    json_data['record_id'] = request.args['record_id']
    return invoke_method('update_record', request, data=json.dumps(json_data))
def list_members(request):
    json_data = json.loads(request.data)
    json_data['loadbalancer_id'] = request.args['lb_id']
    return invoke_method('balancer_list_members', request,
                         data=json.dumps(json_data))