class DispatchSRV(DNSDispatch): resource_name = 'srv' dtype = 'SRV' dgroup = 'dns' create_args = [ fqdn_argument('fqdn', dtype), # ~> (labmda, lambda) ttl_argument('ttl'), port_argument('port'), weight_argument('weight'), priority_argument('priority'), target_argument('target'), view_arguments('views'), description_argument('description'), comment_argument('comment') ] update_args = create_args + [ update_pk_argument('pk', dtype) ] delete_args = [ delete_pk_argument('pk', dtype) ] detail_args = [detail_pk_argument('pk', dtype)]
class DispatchTXT(DNSDispatch): resource_name = 'txt' dtype = 'TXT' dgroup = 'dns' create_args = [ fqdn_argument('fqdn', dtype), # ~> (labmda, lambda) ttl_argument('ttl'), target_argument('txt_data'), view_arguments('views'), description_argument('description'), comment_argument('comment') ] update_args = create_args + [update_pk_argument('pk', dtype)] delete_args = [delete_pk_argument('pk', dtype)] detail_args = [detail_pk_argument('pk', dtype)]
class DispatchMX(DNSDispatch): resource_name = 'mx' dtype = 'MX' dgroup = 'dns' create_args = [ fqdn_argument('fqdn', dtype), # ~> (labmda, lambda) ttl_argument('ttl'), priority_argument('priority'), target_argument('server'), view_arguments('views'), description_argument('description'), comment_argument('comment') ] update_args = create_args + [update_pk_argument('pk', dtype)] delete_args = [delete_pk_argument('pk', dtype)] detail_args = [detail_pk_argument('pk', dtype)]
class DispatchPTR(DNSDispatch): resource_name = 'ptr' dtype = 'PTR' dgroup = 'dns' create_args = [ ttl_argument('ttl'), ip_argument('ip_str', '4'), view_arguments('views'), target_argument('name'), description_argument('description'), comment_argument('comment') ] update_args = create_args + [ update_pk_argument('pk', dtype) ] delete_args = [ delete_pk_argument('pk', dtype) ] detail_args = [detail_pk_argument('pk', dtype)] def determine_ip_type(self, ip_str): if ip_str.find(':') > -1: ip_type = '6' else: ip_type = '4' # Default to 4 return ip_type def get_create_data(self, nas): data = super(DispatchPTR, self).get_create_data(nas) data['ip_type'] = self.determine_ip_type(data.get('ip_str', '')) return data def get_update_data(self, nas): data = super(DispatchPTR, self).get_update_data(nas) data['ip_type'] = self.determine_ip_type(data.get('ip_str', '')) return data