Skip to content

Commit

Permalink
Merge pull request #300 from shakenfist/extended-dns-apis
Browse files Browse the repository at this point in the history
Expose network hosted DNS APIs.
  • Loading branch information
mikalstill authored Oct 22, 2024
2 parents b0a2ce5 + 52ed534 commit 6c25293
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions shakenfist_client/apiclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,9 +925,33 @@ def unroute_network_address(self, network_ref, address):
'The API server version you are talking to does not support '
'routing addresses.')

r = self._request_url(
self._request_url(
'DELETE', '/networks/' + network_ref + '/route' + '/' + address)
return r.json()

def update_network_dns_entry(self, network_ref, name, value):
if not self.check_capability('extra-dns-entries'):
raise IncapableException(
'The API server version you are talking to does not support '
'managing extra DNS entries.')

self._request_url(
'POST', '/networks/' + network_ref + '/dns',
data={
'name': name,
'value': value
})

def delete_network_dns_entry(self, network_ref, name):
if not self.check_capability('extra-dns-entries'):
raise IncapableException(
'The API server version you are talking to does not support '
'managing extra DNS entries.')

self._request_url(
'DELETE', '/networks/' + network_ref + '/dns',
data={
'name': name
})

def get_node(self, node):
if not self.check_capability('node-get'):
Expand Down

0 comments on commit 6c25293

Please sign in to comment.