Skip to content

Commit c26d1bc

Browse files
Added documentation for objects/domain.py. (#264)
## 📝 Description Added documentation for `objects/domain.py`. ## ✔️ How to Test `pytest test` Ticket: TPT-1924
1 parent 5c09cde commit c26d1bc

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

linode_api4/objects/domain.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33

44

55
class DomainRecord(DerivedBase):
6+
"""
7+
A single record on a Domain.
8+
9+
API Documentation: https://www.linode.com/docs/api/domains/#domain-record-view
10+
"""
11+
612
api_endpoint = "/domains/{domain_id}/records/{id}"
713
derived_url_path = "records"
814
parent_id_name = "domain_id"
@@ -26,6 +32,14 @@ class DomainRecord(DerivedBase):
2632

2733

2834
class Domain(Base):
35+
"""
36+
A single Domain that you have registered in Linode’s DNS Manager.
37+
Linode is not a registrar, and in order for this Domain record to work
38+
you must own the domain and point your registrar at Linode’s nameservers.
39+
40+
API Documentation: https://www.linode.com/docs/api/domains/#domain-view
41+
"""
42+
2943
api_endpoint = "/domains/{id}"
3044
properties = {
3145
"id": Property(identifier=True),
@@ -46,6 +60,25 @@ class Domain(Base):
4660
}
4761

4862
def record_create(self, record_type, **kwargs):
63+
"""
64+
Adds a new Domain Record to the zonefile this Domain represents.
65+
Each domain can have up to 12,000 active records.
66+
67+
API Documentation: https://www.linode.com/docs/api/domains/#domain-record-create
68+
69+
:param record_type: The type of Record this is in the DNS system. Can be one of:
70+
A, AAAA, NS, MX, CNAME, TXT, SRV, PTR, CAA.
71+
:type: record_type: str
72+
73+
:param kwargs: Additional optional parameters for creating a domain record. Valid parameters
74+
are: name, target, priority, weight, port, service, protocol, ttl_sec. Descriptions
75+
of these parameters can be found in the API Documentation above.
76+
:type: record_type: dict
77+
78+
:returns: The newly created Domain Record
79+
:rtype: DomainRecord
80+
"""
81+
4982
params = {
5083
"type": record_type,
5184
}
@@ -65,20 +98,58 @@ def record_create(self, record_type, **kwargs):
6598
return zr
6699

67100
def zone_file_view(self):
101+
"""
102+
Returns the zone file for the last rendered zone for the specified domain.
103+
104+
API Documentation: https://www.linode.com/docs/api/domains/#domain-zone-file-view
105+
106+
:returns: The zone file for the last rendered zone for the specified domain in the form
107+
of a list of the lines of the zone file.
108+
:rtype: List[str]
109+
"""
110+
68111
result = self._client.get(
69112
"{}/zone-file".format(self.api_endpoint), model=self
70113
)
71114

72115
return result["zone_file"]
73116

74117
def clone(self, domain: str):
118+
"""
119+
Clones a Domain and all associated DNS records from a Domain that is registered in Linode’s DNS manager.
120+
121+
API Documentation: https://www.linode.com/docs/api/domains/#domain-clone
122+
123+
:param domain: The new domain for the clone. Domain labels cannot be longer
124+
than 63 characters and must conform to RFC1035. Domains must be
125+
unique on Linode’s platform, including across different Linode
126+
accounts; there cannot be two Domains representing the same domain.
127+
:type: domain: str
128+
"""
75129
params = {"domain": domain}
76130

77131
self._client.post(
78132
"{}/clone".format(self.api_endpoint), model=self, data=params
79133
)
80134

81135
def domain_import(self, domain, remote_nameserver):
136+
"""
137+
Imports a domain zone from a remote nameserver. Your nameserver must
138+
allow zone transfers (AXFR) from the following IPs:
139+
- 96.126.114.97
140+
- 96.126.114.98
141+
- 2600:3c00::5e
142+
= 2600:3c00::5f
143+
144+
API Documentation: https://www.linode.com/docs/api/domains/#domain-import
145+
146+
:param domain: The domain to import.
147+
:type: domain: str
148+
149+
:param remote_nameserver: The remote nameserver that allows zone transfers (AXFR).
150+
:type: remote_nameserver: str
151+
"""
152+
82153
params = {
83154
"domain": domain.domain if isinstance(domain, Domain) else domain,
84155
"remote_nameserver": remote_nameserver,

0 commit comments

Comments
 (0)