Jump to: navigation, search

Difference between revisions of "Designate/Blueprints/Recordset Record API Redesign"

(Create a Recordset (POST))
(Create a Recordset (POST))
Line 93: Line 93:
 
'''Major Change'''
 
'''Major Change'''
  
In this redesign, when a RecordSet POST is sent, the code will query the database looking for an existing record for the zone that has the same name and type. If one is NOT found, then a new RecordSet is created. If one IS found, then the data from the request is added as a new record to the existing RecordSet.
+
In this redesign, when a RecordSet POST is sent, the code will query the database looking for an existing RecordSet for the zone that has the same name and type. If one is NOT found, then a new RecordSet is created. If one IS found, then the data from the request is added as a new record to the existing RecordSet. If the ttl differs, an error will NOT be sent. The ttl with the lower value will be kept and the other will be discarded.

Revision as of 18:57, 2 May 2014

WIP

Overview

Gerrit Patch []
Launchpad Blueprint [1]

This blueprint proposes to eliminate the Records resource and only keep the RecordSets resource.

The API for recordsets and records is too complicated. Currently, a user is forced to create a recordset before creating a record. This leads to a confusing user experience.Users will create, update and delete recordsets. When the user creates a recordset the code will determine if it should be a new recordset or a record under an existing recordset. However, the record will no longer be accessible as a separate resource; only as part of the recordset.

The concept of a Resource Record Set is defined in RFC 2181, Section 5. To summarize, it says, each DNS Resource Record (RR) has four parts: label, class, type and data. Any records that have all four equal, should be rejected as duplicates. However, it is possible for most record types to exist with the same label, class and type, but with different data. Such a group of records is defined to be a Resource Record Set (RRSet). A query for a specific label, class and type, should always return all records in the associated RRSet. It further states that all RRs in a RRSet should have the same ttl.

API Resource

Current API

/zones/zone{id}/recordsets/recordset{id}/records/record{id}

New API

/zones/zone{id}/recordsets/recordset{id}

API Details: Create / List / Patch / Put / Delete Recordset

Verb Resource Description
GET /zones/zone{id}/recordsets Returns all recordsets for a zone
GET /zones/zone{id}/recordsets/recordset{id} Returns a specific recordset for a zone
POST /zones/zone{id}/recordsets Creates a new recordset or adds a new record to an existing recordset
PUT /zones/zone{id}/recordsets/recordset{id} Replaces all records in a recordset with the records specified in the message body
PATCH /zones/zone{id}/recordsets/recordset{id} Adds the records specified in the message body to a recordset
DELETE /zones/zone{id}/recordsets/recordset{id} Delete the recordset and all records associated with it.

List Recordset(s) (GET)

When no id is specified all recordsets for the specified zone are returned. No body is provided in the request. When a recordset id is provided, only that recordset is returned. No body is provided in the request

Response

 {
   "recordset" : [
     {
       "created_at" : "2014-04-29T19:34:21.819615",
       "version" : 1,
       "zone_id" : "766d7605-4c48-41fa-a9de-76692ed8051c",
       "links" : {
           "self" : "http://192.168.33.8:9001/v2/zones/766d7605-4c48-41fa-a9de-76692ed8051c/recordsets/06c3a2de-4e23-4143-98ab-6bf6d41ded26"
       },
       "ttl" : 3600,
       "updated_at" : null,
       "description" : null,
       "type" : "A",
       "id" : "06c3a2de-4e23-4143-98ab-6bf6d41ded26",
       "name" : "example.com.",
       "data" : {
           "192.0.1.2",
           "192.0.1.3"
         },
       {
         "created_at" : "2014-04-29T22:04:41.000000",
         "version" : 1,
         "zone_id":"766d7605-4c48-41fa-a9de-76692ed8051c",
         "links":{
           "self":"http://192.168.33.8:9001/v2/zones/766d7605-4c48-41fa-a9de-76692ed8051c/recordsets/e862ddb2-58ee-431a-a3b5-6881a5e26465"
          },
           "ttl":null,
           "updated_at":null,
           "description":null,
           "type":"CNAME",
           "id":"e862ddb2-58ee-431a-a3b5-6881a5e26465",
           "name":"www.example.com.",
           "data":"example.com."
           }
       ],
       "links" : {
           "self" : "http://192.168.33.8:9001/v2/zones/766d7605-4c48-41fa-a9de-76692ed8051c/recordsets/"
       }
 }

Create a Recordset (POST)

When a new Recordset is created, the caller must supply the name, type and data, which varies depending on the type.

Major Change

In this redesign, when a RecordSet POST is sent, the code will query the database looking for an existing RecordSet for the zone that has the same name and type. If one is NOT found, then a new RecordSet is created. If one IS found, then the data from the request is added as a new record to the existing RecordSet. If the ttl differs, an error will NOT be sent. The ttl with the lower value will be kept and the other will be discarded.