Skip to content

Commit db20c46

Browse files
author
Zach Olstein
committed
Version 1.14.1
Adds support for managing offload targets. New APIs: - connect_nfs_offload(self, name, **kwargs): Connect an nfs offload target. Requires the use of REST API 1.14 or later. - disconnect_nfs_offload(self, name): Disconnect an offload target. Requires the use of REST API 1.14 or later. - list_offload(self, **kwargs): Return a list of dictionaries describing connected offload targets. Requires the use of REST API 1.14 or later. - list_nfs_offload(self, **kwargs): Return a list of dictionaries describing connected nfs offload targets. Requires the use of REST API 1.14 or later. - get_offload(self, name, **kwargs): Return a dictionary desribing connected offload targets. Requires the use of REST API 1.14 or later. - get_nfs_offload(self, name, **kwargs): Return a dictionary describing connected nfs offload targets. Requires the use of REST API 1.14 or later.
1 parent 0e6c703 commit db20c46

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

purestorage/purestorage.py

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,109 @@ def set_hgroup(self, hgroup, **kwargs):
11161116
return self._request("PUT", "hgroup/{0}".format(hgroup), kwargs)
11171117

11181118
#
1119+
# Offload management methods
1120+
#
1121+
1122+
def connect_nfs_offload(self, name, **kwargs):
1123+
"""Connect an nfs offload target.
1124+
1125+
:param name: Name of nfs offload target to be connected.
1126+
:type name: str
1127+
:param \*\*kwargs: See the REST API Guide on your array for the
1128+
documentation on the request:
1129+
**POST nfs_offload/{}**
1130+
:type \*\*kwargs: optional
1131+
1132+
:returns: A dictionary describing the nfs target.
1133+
:rtype: ResponseDict
1134+
1135+
"""
1136+
return self._request("POST", "nfs_offload/{0}".format(name), kwargs)
1137+
1138+
def disconnect_nfs_offload(self, name):
1139+
"""Disconnect an offload target.
1140+
1141+
:param name: Name of offload target to be disconnected.
1142+
:type name: str
1143+
1144+
:returns: A dictionary describing the target.
1145+
:rtype: ResponseDict
1146+
1147+
"""
1148+
return self._request("DELETE", "nfs_offload/{0}".format(name))
1149+
1150+
def list_offload(self, **kwargs):
1151+
"""Return a list of dictionaries describing connected offload targets.
1152+
1153+
:param \*\*kwargs: See the REST API Guide on your array for the
1154+
documentation on the request:
1155+
**GET offload**
1156+
:type \*\*kwargs: optional
1157+
1158+
:returns: A list of dictionaries describing offload connections.
1159+
:rtype: ResponseList
1160+
1161+
"""
1162+
return self._request("GET", "offload", kwargs)
1163+
1164+
def list_nfs_offload(self, **kwargs):
1165+
"""Return a list of dictionaries describing connected nfs offload targets.
1166+
1167+
:param \*\*kwargs: See the REST API Guide on your array for the
1168+
documentation on the request:
1169+
**GET nfs_offload**
1170+
:type \*\*kwargs: optional
1171+
1172+
:returns: A list of dictionaries describing NFS offload connections.
1173+
:rtype: ResponseList
1174+
1175+
"""
1176+
return self._request("GET", "nfs_offload", kwargs)
1177+
1178+
def get_offload(self, name, **kwargs):
1179+
"""Return a dictionary describing the connected offload target.
1180+
1181+
:param offload: Name of offload target to get information about.
1182+
:type offload: str
1183+
:param \*\*kwargs: See the REST API Guide on your array for the
1184+
documentation on the request:
1185+
**GET offload/::offload**
1186+
:type \*\*kwargs: optional
1187+
1188+
:returns: A dictionary describing offload connections.
1189+
:rtype: ResponseDict
1190+
1191+
"""
1192+
# Unbox if a list to accommodate a bug in REST 1.14
1193+
result = self._request("GET", "offload/{0}".format(name), kwargs)
1194+
if isinstance(result, list):
1195+
headers = result.headers
1196+
result = ResponseDict(result[0])
1197+
result.headers = headers
1198+
return result
1199+
1200+
def get_nfs_offload(self, name, **kwargs):
1201+
"""Return a dictionary describing the connected nfs offload target.
1202+
1203+
:param offload: Name of NFS offload target to get information about.
1204+
:type offload: str
1205+
:param \*\*kwargs: See the REST API Guide on your array for the
1206+
documentation on the request:
1207+
**GET nfs_offload/::offload**
1208+
:type \*\*kwargs: optional
1209+
1210+
:returns: A dictionary describing nfs offload connections.
1211+
:rtype: ResponseDict
1212+
1213+
"""
1214+
# Unbox if a list to accommodate a bug in REST 1.14
1215+
result = self._request("GET", "nfs_offload/{0}".format(name), kwargs)
1216+
if isinstance(result, list):
1217+
headers = result.headers
1218+
result = ResponseDict(result[0])
1219+
result.headers = headers
1220+
return result
1221+
#
11191222
# Network management methods
11201223
#
11211224

0 commit comments

Comments
 (0)