You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow DNS record(s) to be updated:
- Allow a single DNS record to be updated. This will only allow the content of the DNS record to be updated when no other DNS records with the same name, expiry time and type exists.
- Allow all DNS records to be replaced at once.
Fixes#36
Signed-off-by: Roald Nefs <info@roaldnefs.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,10 +4,12 @@ All notable changes in **python-transip** are documented below.
4
4
## [Unreleased]
5
5
### Added
6
6
- This `CHANGELOG.md` file to be able to list all notable changes for each version of **python-transip**.
7
-
- The `transip.v6.objects.ApiTestService` service to allow calling the test resource to make sure everything is working.
8
-
- The `transip.v6.objects.InvoiceItemService` service to allow listing all invoice items on a `transip.v6.objects.Invoice` object.
9
-
- The `transip.mixins.ObjectUpdateMixin` mixin to allow calling `update()` on API object directly.
10
-
- Allow an invoice to be written to a PDF file by calling the `pdf()` method on a `transip.v6.objects.Invoice` object.
11
-
- The `transip.v6.objects.ProductService` service to allow listing all products as a `transip.v6.objects.Product` object.
7
+
- The `transip.TransIP.api_test` service to allow calling the test resource to make sure everything is working.
8
+
- The option to list all invoices attached to your TransIP account from the `transip.TransIP.invoices` service.
9
+
- The option to save an invoice as PDF file from `transip.v6.objects.Invoice` object.
10
+
- The option to list all products available in TransIP from the `transip.TransIP.products` service.
11
+
- The option to update a single SSH key from `transip.v6.objects.SshKey` object.
12
+
- The option to update the content of a single DNS record from the `transip.v6.objects.Domain.dns` service, as well as from the `transip.v6.objects.DnsEntry` object.
13
+
- The option to replace all existing DNS records of a single domain at once from the `transip.v6.objects.Domain.dns` service.
Copy file name to clipboardExpand all lines: README.md
+52Lines changed: 52 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,6 +47,8 @@
47
47
-[The **DnsEntry** class](#the-dnsentry-class)
48
48
-[List all DNS entries for a domain](#list-all-dns-entries-for-a-domain)
49
49
-[Add a new single DNS entry to a domain](#add-a-new-single-dns-entry-to-a-domain)
50
+
-[Update single DNS entry](#update-single-dns-entry)
51
+
-[Update all DNS entries for a domain](#update-all-dns-entries-for-a-domain)
50
52
-[Remove a DNS entry from a domain](#remove-a-dns-entry-from-a-domain)
51
53
-[VPS](#vps)
52
54
-[HA-IP](#ha-ip)
@@ -524,6 +526,7 @@ The **DnsEntry** class makes the following attributes available:
524
526
The class has the following methods:
525
527
526
528
-**delete()** will delete the DNS-record from the domain.
529
+
-**update()** will send the updated attributes to the TransIP API. This can only be used when updating the **content** attribute of a DnsEntry and when there aren't any other DNS records with the same **name**, **expire** and **type** attributes.
527
530
528
531
#### List all DNS entries for a domain
529
532
Retrieve the DNS records of a single domain registered in your TransIP account by calling **dns.list()** on a **transip.v6.objects.Domain** object. This will return a list of **transip.v6.objects.DnsEntry** objects.
@@ -565,6 +568,55 @@ dns_entry_data = {
565
568
domain.delete(dns_entry_data)
566
569
```
567
570
571
+
#### Update single DNS entry
572
+
Update a single DNS record of a domain by calling **dns.update(_data_)** on a **transip.v6.objects.Domain** object. The **data** keyword argument a dictionary containing the **name**, **expire**, **type** and **content** attributes.
573
+
574
+
This can only be used when updating the **content** attribute of a DNS entry and when there aren't any other DNS records with the same **name**, **expire** and **type** attributes.
575
+
576
+
For example:
577
+
```python
578
+
import transip
579
+
# Initialize a client using the TransIP demo token.
# Dictionary containing the information for a single updated DNS record.
585
+
dns_entry_data = {
586
+
"name": "www",
587
+
"expire": 86400,
588
+
"type": "A",
589
+
"content": "127.0.0.2"# The update content.
590
+
}
591
+
# Update the content of a single DNS record.
592
+
domain.update(dns_entry_data)
593
+
```
594
+
595
+
#### Update all DNS entries for a domain
596
+
Update all DNS records of a single domain registered in your TransIP account at once by calling **dns.replace()** on a **transip.v6.objects.Domain** object.
597
+
598
+
**Note:** This will wipe all existing DNS records with the provided records.
599
+
600
+
For example:
601
+
```python
602
+
import transip
603
+
# Initialize a client using the TransIP demo token.
if record.name =='localhost'and record.type =='A':
614
+
record.content ='127.0.0.1'
615
+
616
+
# Replace all the records with the updated ones
617
+
domain.dns.replace(records)
618
+
```
619
+
568
620
#### Remove a DNS entry from a domain
569
621
Delete an existing DNS record from a domain by calling **dns.delete(_data_)** on a **transip.v6.objects.Domain** object. The **data** keyword argument a dictionary containing the **name**, **expire**, **type** and **content** attributes.
0 commit comments