Skip to content

Commit 9d1c5ff

Browse files
TPT-1936: Added documentation for object/volume.py (#272)
## 📝 Description Added documentation for `object/volume.py` ## ✔️ How to Test `pytest test` Ticket: TPT-1936
1 parent 8a08c5f commit 9d1c5ff

1 file changed

Lines changed: 35 additions & 1 deletion

File tree

linode_api4/objects/volume.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33

44

55
class Volume(Base):
6+
"""
7+
A single Block Storage Volume. Block Storage Volumes are persistent storage devices
8+
that can be attached to a Compute Instance and used to store any type of data.
9+
10+
API Documentation: https://www.linode.com/docs/api/volumes/#volume-view
11+
"""
12+
613
api_endpoint = "/volumes/{id}"
714

815
properties = {
@@ -22,7 +29,17 @@ class Volume(Base):
2229

2330
def attach(self, to_linode, config=None):
2431
"""
25-
Attaches this Volume to the given Linode
32+
Attaches this Volume to the given Linode.
33+
34+
API Documentation: https://www.linode.com/docs/api/volumes/#volume-attach
35+
36+
:param to_linode: The ID or object of the Linode to attach the volume to.
37+
:type to_linode: Union[Instance, int]
38+
39+
:param config: The ID or object of the Linode Config to include this Volume in.
40+
Must belong to the Linode referenced by linode_id.
41+
If not given, the last booted Config will be chosen.
42+
:type config: Union[Config, int]
2643
"""
2744
result = self._client.post(
2845
"{}/attach".format(Volume.api_endpoint),
@@ -50,6 +67,11 @@ def attach(self, to_linode, config=None):
5067
def detach(self):
5168
"""
5269
Detaches this Volume if it is attached
70+
71+
API Documentation: https://www.linode.com/docs/api/volumes/#volume-detach
72+
73+
:returns: Returns true if operation was successful
74+
:rtype: bool
5375
"""
5476
self._client.post("{}/detach".format(Volume.api_endpoint), model=self)
5577

@@ -58,6 +80,14 @@ def detach(self):
5880
def resize(self, size):
5981
"""
6082
Resizes this Volume
83+
84+
API Documentation: https://www.linode.com/docs/api/volumes/#volume-resize
85+
86+
:param size: The Volume’s size, in GiB.
87+
:type size: int
88+
89+
:returns: Returns true if operation was successful
90+
:rtype: bool
6191
"""
6292
result = self._client.post(
6393
"{}/resize".format(Volume.api_endpoint),
@@ -73,9 +103,13 @@ def clone(self, label):
73103
"""
74104
Clones this volume to a new volume in the same region with the given label
75105
106+
API Documentation: https://www.linode.com/docs/api/volumes/#volume-clone
107+
76108
:param label: The label for the new volume.
109+
:type label: str
77110
78111
:returns: The new volume object.
112+
:rtype: Volume
79113
"""
80114
result = self._client.post(
81115
"{}/clone".format(Volume.api_endpoint),

0 commit comments

Comments
 (0)