Forum Discussion

dinesh_v's avatar
dinesh_v
Novice I
4 years ago

Do we have any direct method to fetch the protection

Do we have any direct method to fetch the protection group name by using the volume name with python ? We have CLI command purevol list **** --protect . However I couldn't locate python API method to get the similar info.
  • Are you using the *pypureclient* package or *purestorage* This is my testing snippets `from pypureclient import flasharray` `client = flasharray.Client('10.21.xx.xx',` `private_key_file='/Users/amazouz/.ssh/adam.pem',` `private_key_password='xxx',` `username='pureuser',` `client_id='3xxxxx',` `key_id='xxxxxxx',` `issuer='python')` `pgname = client.get_protection_groups_volumes(member_names='VOL_NAME')` `print(pgname.items.next())`
  • hi dinesh.v You can use this `client.get_protection_groups_volumes(member_names='VOL_NAME')` Respond `{'group': {'name': 'PGROUP_NAME'}, 'member': {'name': 'VOL_NAME'}}`
  • Thanks for the response Adam... I tried and seeing the following error, ```AttributeError: 'FlashArray' object has no attribute 'get_protection_groups_volumes'``` I tired with get_pgroups_volumes as well and the same is the error.
  • dinesh.v can you iterate through the object `pgname = client.get_protection_groups_volumes(member_names='VOL_NAME')` `print(pgname.items.next())`
  • Hi Adam, Looks like the get_protection_groups_volumes itself is not an available function in the flasharray module. I am getting the same error . ```AttributeError: 'FlashArray' object has no attribute 'get_protection_groups_volumes'```
  • Great and thanks a lot for your help amazouz. It worked and i was able to fulfill the requirement.