'Add or modify dns entry.'

@wsgi.Controller.api_version('2.1', MAX_PROXY_API_SUPPORT_VERSION)
@extensions.expected_errors(501)
@validation.schema(floating_ip_dns.dns_entry_update)
def update(self, req, domain_id, id, body):

    context = req.environ['nova.context']
    context.can(fid_policies.BASE_POLICY_NAME)
    domain = _unquote_domain(domain_id)
    name = id
    entry = body['dns_entry']
    address = entry['ip']
    dns_type = entry['dns_type']
    try:
        entries = self.network_api.get_dns_entries_by_name(context, name, domain)
        if (not entries):
            self.network_api.add_dns_entry(context, address, name, dns_type, domain)
        else:
            self.network_api.modify_dns_entry(context, name, address, domain)
    except NotImplementedError:
        common.raise_feature_not_supported()
    return _translate_dns_entry_view({'ip': address, 'name': name, 'type': dns_type, 'domain': domain})
