Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ SolusVM JSON API Python Library<br />

:Info: See <http://docs.solusvm.com/v2/Default.htm#Developer/Admin-Api/Admin-Api.htm> for API implementation.<br />
:Author: Benton Snyder <introspectr3@gmail.com><br />
:Contributor: Timh Bergstroem <timh.bergstrom@gmail.com><br />
:Website: Noumenal Designs <http://www.noumenaldesigns.com><br />
:Date: $Date: 2013-08-15 22:27:40 -0600 (Thurs, 15 Aug 2013) $<br />
:Revision: $Revision: 0021 $<br />
:Description: Python library for interfacing with SolusVM <http://www.solusvm.com><br />
:Changes: Updated to include new functionality; changeMemory, changeHardDiskSize
and included the new change harddrive functionality in changePlan according to
https://documentation.solusvm.com/display/DOCS/v1.16#v1.16-1.16.09

37 changes: 35 additions & 2 deletions solusvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
=====================================================
:Info: See <http://docs.solusvm.com/v2/Default.htm#Developer/Admin-Api/Admin-Api.htm> for API implementation.
:Author: Benton Snyder <introspectr3@gmail.com>
:Contributor: Timh Bergstroem <timh.bergstrom@gmail.com>
:Website: Noumenal Designs <http://www.noumenaldesigns.com>
:Date: $Date: 2013-08-15 22:27:40 -0600 (Thurs, 15 Aug 2013) $
:Revision: $Revision: 0021 $
:Description: Python library for interfacing with SolusVM <http://www.solusvm.com>
:Changes: Updated to include new functionality; changeMemory, changeHardDisk and included the new functionality in changePlan
"""
import requests

Expand Down Expand Up @@ -376,7 +378,7 @@ def toggleSerialConsole(self, vserverid, access=None, time=None):
}
return self.sQuery(**data)

def changePlan(self, vserverid, plan):
def changePlan(self, vserverid, plan, change_hdd=False):
"""Changes specified virtual server's plan.
http://docs.solusvm.com/v2/Content/Developer/Admin-Api/Virtual-Server-Functions/Change-Plan.htm

Expand All @@ -387,7 +389,8 @@ def changePlan(self, vserverid, plan):
data = {
'action': 'vserver-change',
'vserverid': vserverid,
'plan':plan
'plan': plan,
'changehdd': change_hdd
}
return self.sQuery(**data)

Expand All @@ -406,6 +409,36 @@ def changeOwner(self, vserverid, clientid):
}
return self.sQuery(**data)

def changeMemory(self, vserverid, memory):
"""Changes specified virtual server's RAM.
https://documentation.solusvm.com/display/DOCS/Change+Memory

:param vserverid: id of virtual server
:param memory: new memory in MB
:returns: json formatted string
"""
data = {
'action': 'vserver-change-memory',
'vserverid': vserverid,
'memory': memory
}
return self.sQuery(**data)

def changeHardDiskSize(self, vserverid, hdd):
"""Changes specified virtual server's HDD size.
https://documentation.solusvm.com/display/DOCS/Change+Hard+Disk+Size

:param vserverid: id of virtual server
:param hdd: new harddisk size in GB
:returns: json formatted string
"""
data = {
'action': 'vserver-change-hdd',
'vserverid': vserverid,
'hdd': hdd
}
return self.sQuery(**data)

def changeBootOrder(self, vserverid, bootorder):
"""Changes specified virtual server's boot order.
http://docs.solusvm.com/v2/Content/Developer/Admin-Api/Virtual-Server-Functions/Boot-Order.htm
Expand Down