Fully tested
This commit is contained in:
parent
3b905bd28e
commit
e9ecfccdb3
5 changed files with 43 additions and 27 deletions
|
|
@ -6,6 +6,8 @@ from .error import HappyError
|
|||
class ServiceMeta:
|
||||
|
||||
def __init__(self, _session, _svctype, _domain, _ttl, _id=None, _ownerid=None, _comment="", _mycomment="", _aliases=[], _tmp_hint_nb=0):
|
||||
self._session = _session
|
||||
|
||||
self._svctype = _svctype
|
||||
self._domain = _domain
|
||||
self._ttl = _ttl
|
||||
|
|
@ -42,22 +44,25 @@ class HService(ServiceMeta):
|
|||
return json.dumps(self._flat())
|
||||
|
||||
def _flat(self):
|
||||
return {
|
||||
d = {
|
||||
"_svctype": self._svctype,
|
||||
"_domain": self._domain,
|
||||
"_ttl": self._ttl,
|
||||
"_id": self._id,
|
||||
"_ownerid": self._ownerid,
|
||||
"_comment": self._comment,
|
||||
"_mycomment": self._mycomment,
|
||||
"_aliases": self._aliases,
|
||||
"_tmp_hint_nb": self._tmp_hint_nb,
|
||||
"Service": self.service,
|
||||
}
|
||||
if self._id is not None:
|
||||
d["_id"] = self._id
|
||||
if self._ownerid is not None:
|
||||
d["_ownerid"] = self._ownerid
|
||||
return d
|
||||
|
||||
def delete(self):
|
||||
r = self._session.session.delete(
|
||||
self.baseurl + "/api/domains/" + quote(self._domainid) + "/zone/" + quote(self._zoneid) + "/" + quote(self._domain) + "/services/" + quote(self._id),
|
||||
self._session.baseurl + "/api/domains/" + quote(self._domainid) + "/zone/" + quote(self._zoneid) + "/" + quote(self._domain) + "/services/" + quote(self._id),
|
||||
)
|
||||
|
||||
if r.status_code > 300:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue