Skip to content

Commit b62d144

Browse files
committed
added functions for domain tags
1 parent 6ae04d7 commit b62d144

1 file changed

Lines changed: 90 additions & 2 deletions

File tree

vscale.py

Lines changed: 90 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,8 +770,8 @@ def delete_domain_record(token, domainid, recordid):
770770
return requests.delete("https://api.vscale.io/v1/domains/"+
771771
str(domainid)+"/records/"+str(recordid),
772772
headers={"Content-Type":
773-
"application/json;charset=UTF-8",
774-
"X-Token": token}
773+
"application/json;charset=UTF-8",
774+
"X-Token": token}
775775
)
776776

777777

@@ -790,3 +790,91 @@ def get_domain_record(token, domainid, recordid):
790790
str(domainid)+"/records/"+str(recordid),
791791
headers={"X-Token": token}
792792
)
793+
794+
795+
"""
796+
Function create_domain_tag performs a POST-request at
797+
https://api.vscale.io/v1/domains/tags/, creates a new domain tag.
798+
Token has to be provided as a str object.
799+
Tag name has to be provided as a str object.
800+
Domains to be added to the tag that is to be created can be
801+
provided as a list. This parameter is optional.
802+
"""
803+
804+
805+
def create_domain_tag(token, name, domains=None):
806+
data = {"name": name}
807+
if domains is not None:
808+
data["domains"] = str(domains)
809+
return requests.post("https://api.vscale.io/v1/domains/tags/",
810+
headers={"Content-Type":
811+
"application/json;charset=UTF-8",
812+
"X-Token": token},
813+
data=json.loads(data)
814+
)
815+
816+
817+
"""
818+
Function list_domain_tags performs a GET-request at
819+
https://api.vscale.io/v1/domains/tags/, returns list of domain tags.
820+
Token has to be provided as a str object.
821+
"""
822+
823+
824+
def list_domain_tags(token):
825+
return requests.get("https://api.vscale.io/v1/domains/tags",
826+
headers={"X-Token": token}
827+
)
828+
829+
830+
"""
831+
Function get_domain_tag_info performs a GET-request at
832+
https://api.vscale.io/v1/domains/tags/, returns info on
833+
the domain tag with a given tag id.
834+
Token has to be provided as a str object.
835+
Tag id has to be provided as a str object.
836+
"""
837+
838+
839+
def get_domain_tag_info(token, tagid):
840+
return requests.get("https://api.vscale.io/v1/domains/tags/"+str(tagid),
841+
headers={"X-Token": token}
842+
)
843+
844+
845+
"""
846+
Function update_domain_tag performs a PUT-request at
847+
https://api.vscale.io/v1/domains/tags/, updates info on
848+
the domain tag with a given tag id.
849+
Token has to be provided as a str object.
850+
Tag id has to be provided as a str object.
851+
Data has to be provided as a dict object.
852+
"""
853+
854+
855+
def update_domain_tag(token, tagid, data):
856+
return requests.put("https://api.vscale.io/v1/domains/tags"+
857+
str(tagid),
858+
headers={"Content-Type":
859+
"application/json;charset=UTF-8",
860+
"X-Token": token},
861+
data=json.loads(data)
862+
)
863+
864+
865+
"""
866+
Function delete_domain_tag performs a DELETE-request at
867+
https://api.vscale.io/v1/domains/tags/, deletes domain tag with a
868+
given tag id.
869+
Token has to be provided as a str object.
870+
Tag id has to be provided as a str object.
871+
"""
872+
873+
874+
def delete_domain_tag(token, tagid):
875+
return requests.delete("https://api.vscale.io/v1/domains/tags/"+
876+
str(tagid),
877+
headers={"Content-Type":
878+
"application/json;charset=UTF-8",
879+
"X-Token": token}
880+
)

0 commit comments

Comments
 (0)