Skip to content

Commit 6ae04d7

Browse files
committed
added functions for domain records
1 parent 4eefb39 commit 6ae04d7

1 file changed

Lines changed: 93 additions & 0 deletions

File tree

vscale.py

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,3 +697,96 @@ def delete_domain(token, domainid):
697697
"application/json;charset=UTF-8",
698698
"X-Token": token}
699699
)
700+
701+
702+
"""
703+
Function domain_records performs a GET-request at
704+
https://api.vscale.io/v1/domains/, returns list of records of the domain
705+
with a given domain id.
706+
Token has to be provided as a str object.
707+
Domain id has to be provided as a str object.
708+
"""
709+
710+
711+
def domain_records(token, domainid):
712+
return requests.get("https://api.vscale.io/v1/domains/"+str(domainid)+
713+
"/records/",
714+
headers={"X-Token": token}
715+
)
716+
717+
718+
"""
719+
Function set_domain_record performs a POST-request at
720+
https://api.vscale.io/v1/domains/, creates new resource record for
721+
the domain with a given domain id.
722+
Token has to be provided as a str object.
723+
Domain id has to be provided as a str object.
724+
Data has to be provided as a dict object.
725+
"""
726+
727+
728+
def set_domain_record(token, domainid, data):
729+
return requests.post("https://api.vscale.io/v1/domains/"+str(domainid)+
730+
"/records/",
731+
headers={"Content-Type":
732+
"application/json;charset=UTF-8",
733+
"X-Token": token},
734+
data=json.loads(data)
735+
)
736+
737+
738+
"""
739+
Function update_domain_record performs a PUT-request at
740+
https://api.vscale.io/v1/domains/, updates resource record with a given
741+
record id for the domain with a given domain id.
742+
Token has to be provided as a str object.
743+
Domain id has to be provided as a str object.
744+
Record id has to be provided as a str object.
745+
Data has to be provided as a dict object.
746+
"""
747+
748+
749+
def update_domain_record(token, domainid, recordid, data):
750+
return requests.put("https://api.vscale.io/v1/domains/"+str(domainid)+
751+
"/records/"+str(recordid),
752+
headers={"Content-Type":
753+
"application/json;charset=UTF-8",
754+
"X-Token": token},
755+
data=json.loads(data)
756+
)
757+
758+
759+
"""
760+
Function delete_domain_record performs a DELETE-request at
761+
https://api.vscale.io/v1/domains/, deletes resource record with a given
762+
record id for the domain with a given domain id.
763+
Token has to be provided as a str object.
764+
Domain id has to be provided as a str object.
765+
Record id has to be provided as a str object.
766+
"""
767+
768+
769+
def delete_domain_record(token, domainid, recordid):
770+
return requests.delete("https://api.vscale.io/v1/domains/"+
771+
str(domainid)+"/records/"+str(recordid),
772+
headers={"Content-Type":
773+
"application/json;charset=UTF-8",
774+
"X-Token": token}
775+
)
776+
777+
778+
"""
779+
Function get_domain_record performs a GET-request at
780+
https://api.vscale.io/v1/domains/, gets resource record with a given
781+
record id for the domain with a given domain id.
782+
Token has to be provided as a str object.
783+
Domain id has to be provided as a str object.
784+
Record id has to be provided as a str object.
785+
"""
786+
787+
788+
def get_domain_record(token, domainid, recordid):
789+
return requests.get("https://api.vscale.io/v1/domains/"+
790+
str(domainid)+"/records/"+str(recordid),
791+
headers={"X-Token": token}
792+
)

0 commit comments

Comments
 (0)