Skip to content

Commit cc3d1e1

Browse files
author
Elias Nygren
committed
add IPv6 documentation
1 parent 9a0c990 commit cc3d1e1

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

docs/IP-address-mixin.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
```python
44
class IPManager():
55
"""
6-
Functions for managing IP-addresses.
6+
Functions for managing IP-addresses.
77
Intended to be used as a mixin for CloudManager.
88
"""
99
```
@@ -34,15 +34,15 @@ def get_IPs(self):
3434
```
3535

3636
```python
37-
def attach_IP(self, server):
37+
def attach_IP(self, server, family="IPv4"):
3838
"""
3939
Attach a new (random) IP_address to the given server (object or UUID)
4040
"""
41-
```
41+
```
4242
```python
4343
def modify_IP(self, IP_addr, ptr_record):
4444
"""
45-
Modify an IP address' ptr-record (Reverse DNS).
45+
Modify an IP address' ptr-record (Reverse DNS).
4646
Accepts an IP_address instance (object) or its address (string).
4747
"""
4848
```
@@ -53,4 +53,4 @@ def release_IP(self, IP_addr):
5353
Destroy an IP_address. Returns an empty object.
5454
Accepts an IP_address instance (object) or its address (string).
5555
"""
56-
```
56+
```

docs/IP-address.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
Attributes:
88
access -- "public" or "private"
99
address -- the IP address (string)
10+
family -- "IPv4" or "IPv6"
1011
ptr_record -- the reverse DNS name (string)
1112
server -- the UUID of the server this IP is attached to (string)
1213
```
1314

14-
The only updateable attribute is the `ptr_record`.
15-
`ptr_record` and `server` are present only if /server/uuid endpoint was used.
15+
The only updateable attribute is the `ptr_record`.
16+
`ptr_record` and `server` are not present if /server/uuid endpoint was used.
1617

1718
## List / Get
1819

@@ -31,13 +32,20 @@ The new IP-address must be attached to a server and has a random address.
3132

3233
```python
3334

34-
# param: server uuid or a Server object
35+
# params: server uuid or a Server object and family, for which default is IPv4
3536
manager.attach_IP(server_uuid)
37+
manager.attach_IP(server_uuid, "IPv4")
38+
manager.attach_IP(server_uuid, "IPv6")
3639
manager.attach_IP(Server)
40+
manager.attach_IP(Server, "IPv4")
41+
manager.attach_IP(Server, "IPv6")
42+
3743

3844
# or use Server instance
3945
server = manager.get_server(uuid)
40-
server.add_IP()
46+
server.add_IP() # default is IPv4
47+
server.add_IP("IPv4")
48+
server.add_IP("IPv6")
4149

4250
```
4351

@@ -60,4 +68,4 @@ ip.save()
6068
ip = manager.get_IP("185.20.31.125")
6169
ip.destroy()
6270

63-
```
71+
```

upcloud/ip_address.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __reset(self, access, address, family="IPv4", ptr_record=None, server=None):
3232
self._address = address
3333
self._family = family
3434

35-
# Present when populated from /server/uuid endpoint
35+
# Present when not populated from /server/uuid endpoint
3636
self._server_uuid = server
3737
self.ptr = ptr_record
3838

0 commit comments

Comments
 (0)