Skip to content

Commit e2e1d6a

Browse files
committed
Version 1.18.0
Adds support for Pure Storage FlashArray REST version 1.18. New APIs: - promote_volume(self, volume): Promote a volume. Requires use of REST API 1.18 or later. - demote_volume(self, volume): Demote a volume. Requires use of REST API 1.18 or later.
1 parent 9f367ab commit e2e1d6a

File tree

1 file changed

+39
-27
lines changed

1 file changed

+39
-27
lines changed

purestorage/purestorage.py

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from distutils.version import LooseVersion
1414

1515
# The current version of this library.
16-
VERSION = "1.17.0"
16+
VERSION = "1.18.0"
1717

1818

1919
class FlashArray(object):
@@ -89,6 +89,7 @@ class FlashArray(object):
8989
"""
9090

9191
supported_rest_versions = [
92+
"1.18",
9293
"1.17",
9394
"1.16",
9495
"1.15",
@@ -358,7 +359,7 @@ def set_eula(self, **kwargs):
358359
359360
:param \*\*kwargs: See the REST API Guide on your array for the
360361
documentation on the request:
361-
**PUT array/eula**
362+
**PUT eula**
362363
:returns: EULA agreement and a dictionary describing the EULA
363364
acceptance status on the array.
364365
:rtype: ResponseDict
@@ -730,6 +731,30 @@ def rename_volume(self, volume, name):
730731
"""
731732
return self.set_volume(volume, name=name)
732733

734+
def promote_volume(self, volume):
735+
"""Promote a volume
736+
:param volume: Name of volume to be promoted.
737+
:type volume: str
738+
739+
:returns: A dictionary mapping "name" to name and "promotion_status" to the
740+
volume's latest promotion status.
741+
:rtype: ResponseDict
742+
743+
"""
744+
return self.set_volume(volume, requested_promotion_state="promoted")
745+
746+
def demote_volume(self, volume):
747+
"""Demote a volume
748+
:param volume: Name of volume to be demoted.
749+
:type volume: str
750+
751+
:returns: A dictionary mapping "name" to name and "promotion_status" to the
752+
volume's latest promotion status.
753+
:rtype: ResponseDict
754+
755+
"""
756+
return self.set_volume(volume, requested_promotion_state="demoted")
757+
733758
def recover_volume(self, volume):
734759
"""Recover a volume that has been destroyed but not eradicated.
735760
@@ -1152,7 +1177,7 @@ def connect_nfs_offload(self, name, **kwargs):
11521177
:type name: str
11531178
:param \*\*kwargs: See the REST API Guide on your array for the
11541179
documentation on the request:
1155-
**POST nfs_offload/{}**
1180+
**POST offload/nfs/{}**
11561181
:type \*\*kwargs: optional
11571182
11581183
:returns: A dictionary describing the nfs target.
@@ -1168,7 +1193,7 @@ def connect_s3_offload(self, name, **kwargs):
11681193
:type name: str
11691194
:param \*\*kwargs: See the REST API Guide on your array for the
11701195
documentation on the request:
1171-
**POST s3_offload/{}**
1196+
**POST offload/s3/{}**
11721197
:type \*\*kwargs: optional
11731198
11741199
:returns: A dictionary describing the S3 target.
@@ -1248,7 +1273,7 @@ def list_nfs_offload(self, **kwargs):
12481273
12491274
:param \*\*kwargs: See the REST API Guide on your array for the
12501275
documentation on the request:
1251-
**GET nfs_offload**
1276+
**GET offload/nfs**
12521277
:type \*\*kwargs: optional
12531278
12541279
:returns: A list of dictionaries describing NFS offload connections.
@@ -1262,7 +1287,7 @@ def list_s3_offload(self, **kwargs):
12621287
12631288
:param \*\*kwargs: See the REST API Guide on your array for the
12641289
documentation on the request:
1265-
**GET s3_offload**
1290+
**GET offload/s3**
12661291
:type \*\*kwargs: optional
12671292
12681293
:returns: A list of dictionaries describing S3 offload connections.
@@ -1276,7 +1301,7 @@ def list_azure_offload(self, **kwargs):
12761301
12771302
:param \*\*kwargs: See the REST API Guide on your array for the
12781303
documentation on the request:
1279-
**GET azure_offload**
1304+
**GET offload/azure**
12801305
:type \*\*kwargs: optional
12811306
12821307
:returns: A list of dictionaries describing Azure Blob offload connections.
@@ -1314,7 +1339,7 @@ def get_nfs_offload(self, name, **kwargs):
13141339
:type offload: str
13151340
:param \*\*kwargs: See the REST API Guide on your array for the
13161341
documentation on the request:
1317-
**GET nfs_offload/::offload**
1342+
**GET offload/nfs/::offload**
13181343
:type \*\*kwargs: optional
13191344
13201345
:returns: A dictionary describing the nfs offload connection.
@@ -1336,7 +1361,7 @@ def get_s3_offload(self, name, **kwargs):
13361361
:type offload: str
13371362
:param \*\*kwargs: See the REST API Guide on your array for the
13381363
documentation on the request:
1339-
**GET s3_offload/::offload**
1364+
**GET offload/s3/::offload**
13401365
:type \*\*kwargs: optional
13411366
13421367
:returns: A dictionary describing the S3 offload connection.
@@ -1352,7 +1377,7 @@ def get_azure_offload(self, name, **kwargs):
13521377
:type offload: str
13531378
:param \*\*kwargs: See the REST API Guide on your array for the
13541379
documentation on the request:
1355-
**GET azure_offload/::offload**
1380+
**GET offload/azure/::offload**
13561381
:type \*\*kwargs: optional
13571382
13581383
:returns: A dictionary describing the Azure Blob offload connection.
@@ -1394,10 +1419,6 @@ def get_network_interface(self, interface, **kwargs):
13941419
13951420
:param interface: Name of network interface to get information about.
13961421
:type interface: str
1397-
:param \*\*kwargs: See the REST API Guide on your array for the
1398-
documentation on the request:
1399-
**GET network/:network_component**
1400-
:type \*\*kwargs: optional
14011422
14021423
:returns: A dictionary describing the interface.
14031424
:rtype: ResponseDict
@@ -1408,11 +1429,6 @@ def get_network_interface(self, interface, **kwargs):
14081429
def list_network_interfaces(self, **kwargs):
14091430
"""Get a list of dictionaries describing network interfaces.
14101431
1411-
:param \*\*kwargs: See the REST API Guide on your array for the
1412-
documentation on the request:
1413-
**GET network**
1414-
:type \*\*kwargs: optional
1415-
14161432
:returns: A list of dictionaries describing each network interface.
14171433
:rtype: ResponseList
14181434
@@ -3511,10 +3527,6 @@ def get_kmip(self, name, **kwargs):
35113527
35123528
:param name: The name of the KMIP config to operate on.
35133529
:type name: string
3514-
:param \*\*kwargs: See the REST API Guide on your array for the
3515-
documentation on the request:
3516-
**GET kmip/:kmip**
3517-
:type \*\*kwargs: optional
35183530
35193531
:returns: A list of dictionaries containing the requested kmip configuration.
35203532
:rtype: ResponseList
@@ -3748,6 +3760,8 @@ def get_app_node(self, app_name, **kwargs):
37483760
def schedule_maintenance_window(self, **kwargs):
37493761
"""Schedule a maintenance window and return a dictionary describing it.
37503762
3763+
:param name: Name of the maintenance window to be scheduled.
3764+
:type name: str
37513765
:param \*\*kwargs: See the REST API Guide on your array for the
37523766
documentation on the request:
37533767
**POST maintenance_window**
@@ -3763,10 +3777,8 @@ def schedule_maintenance_window(self, **kwargs):
37633777
def unschedule_maintenance_window(self, **kwargs):
37643778
"""Unschedule a maintenance window and return a dictionary describing it.
37653779
3766-
param \*\*kwargs: See the REST API Guide on your array for the
3767-
documentation on the request:
3768-
**DELETE maintenance_window**
3769-
:type \*\*kwargs: optional
3780+
:param name: Name of the maintenance window to be unscheduled.
3781+
:type name: str
37703782
37713783
:returns: A dictionary describing the unscheduled maintenance window.
37723784
:rtype: ResponseDict

0 commit comments

Comments
 (0)