1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00
Files
github-octodns/octodns/source/base.py
Kian-Meng Ang 04b7bf0ac2 Fix typos
2022-05-29 13:16:01 +08:00

54 lines
1.8 KiB
Python

#
#
#
from __future__ import absolute_import, division, print_function, \
unicode_literals
class BaseSource(object):
SUPPORTS_MULTIVALUE_PTR = False
SUPPORTS_POOL_VALUE_STATUS = False
SUPPORTS_ROOT_NS = False
def __init__(self, id):
self.id = id
if not getattr(self, 'log', False):
raise NotImplementedError('Abstract base class, log property '
'missing')
if not hasattr(self, 'SUPPORTS_GEO'):
raise NotImplementedError('Abstract base class, SUPPORTS_GEO '
'property missing')
if not hasattr(self, 'SUPPORTS'):
raise NotImplementedError('Abstract base class, SUPPORTS '
'property missing')
@property
def SUPPORTS_DYNAMIC(self):
return False
def populate(self, zone, target=False, lenient=False):
'''
Loads all records the provider knows about for the provided zone
When `target` is True the populate call is being made to load the
current state of the provider.
When `lenient` is True the populate call may skip record validation and
do a "best effort" load of data. That will allow through some common,
but not best practices stuff that we otherwise would reject. E.g. no
trailing . or missing escapes for ;.
When target is True (loading current state) this method should return
True if the zone exists or False if it does not.
'''
raise NotImplementedError('Abstract base class, populate method '
'missing')
def supports(self, record):
return record._type in self.SUPPORTS
def __repr__(self):
return self.__class__.__name__