nsone.records

Object representing a single DNS record in a zone of a specific type.

Note

Answers to a record (the answers kwarg) should be passed as one of the following four structures, depending on how advanced the configuration for the answer needs to be:

  1. A single string that is coerced to a single answer with no other fields e.g. meta. For example: “1.1.1.1”
  2. A list of single strings that is coerced to several answers with no other fields e.g. meta. For example: [“1.1.1.1”, “2.2.2.2”]
  3. A list of lists. In this case there will be as many answers as are in the outer list, and the answers themselves are used verbatim from the inner list (e.g. may have MX style [10, ‘1.1.1.1]), but no other fields e.g. meta. You must use this form for MX records, and if there is only one answer it still must be wrapped in an outer list.
  4. A list of dicts. In this case it expects the full rest model and passes it along unchanged. You must use this form for any advanced record config like meta data or data feeds.
# Example of an advanced answer configuration (list of dicts)
record = yield zone.add_A('record',
                           [{'answer': ['1.1.1.1'],
                             'meta': {
                                 'up': False
                                 }
                             },
                            {'answer': ['9.9.9.9'],
                             'meta': {
                                 'up': True
                                 }
                             }],
                           filters=[{'up': {}}])
class nsone.records.Record(parentZone, domain, type)

Bases: object

High level object representing a Record

Create a new high level Record

Parameters:
  • parentZone (nsone.zones.Zone) – the high level Zone parent object
  • domain (str) – full domain name this record represents. if the domain does not end with the zone name, it is appended.
  • type (str) – The DNS record type (A, MX, etc)
addAnswers(answers, callback=None, errback=None, **kwargs)

Add answers to the record.

Parameters:answers – answers structure. See the class note on answer format.
create(callback=None, errback=None, **kwargs)

Create new record. Pass a list of keywords and their values to config. For the list of keywords available for zone configuration, see nsone.rest.records.Records.INT_FIELDS, nsone.rest.records.Records.PASSTHRU_FIELDS, nsone.rest.records.Records.BOOL_FIELDS

delete(callback=None, errback=None)

Delete the record from the zone, including all advanced configuration, meta data, etc.

load(callback=None, errback=None, reload=False)

Load record data from the API.

qps(callback=None, errback=None)

Return the current QPS for this record

Return type:dict
Returns:QPS information
reload(callback=None, errback=None)

Reload record data from the API.

update(callback=None, errback=None, **kwargs)

Update record configuration. Pass list of keywords and their values to update. For the list of keywords available for zone configuration, see nsone.rest.records.Records.INT_FIELDS, nsone.rest.records.Records.PASSTHRU_FIELDS, nsone.rest.records.Records.BOOL_FIELDS

usage(callback=None, errback=None, **kwargs)

Return the current usage information for this record

Return type:dict
Returns:usage information
exception nsone.records.RecordException

Bases: exceptions.Exception