From d6917ad19e20a57f0230f8bd10143481a4cebbc1 Mon Sep 17 00:00:00 2001 From: meenakshidembi691 <83949068+meenakshidembi691@users.noreply.github.com> Date: Fri, 14 May 2021 07:46:27 +0530 Subject: [PATCH] Added snapScheduleParameters in the modify method (#345) Added snapScheduleParameters in the modify method so that snap schedule can be edited via playbook Co-authored-by: Meenakshi Dembi --- storops/unity/resource/filesystem.py | 4 +++- storops_test/unity/resource/test_filesystem.py | 7 +++++++ .../unity/rest_data/storageResource/index.json | 11 +++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/storops/unity/resource/filesystem.py b/storops/unity/resource/filesystem.py index 3c884799..abc31923 100644 --- a/storops/unity/resource/filesystem.py +++ b/storops/unity/resource/filesystem.py @@ -80,7 +80,7 @@ def create(cls, cli, pool, nas_server, name, size, proto=None, def modify(self, size=None, is_thin=None, tiering_policy=None, user_cap=False, is_compression=None, access_policy=None, locking_policy=None, description=None, - cifs_fs_parameters=None): + cifs_fs_parameters=None, snap_schedule_parameters=None): sr = self.storage_resource if sr is None: raise ValueError('storage resource for filesystem {} not found.' @@ -103,6 +103,8 @@ def modify(self, size=None, is_thin=None, tiering_policy=None, params['cifsFsParameters'] = cifs_fs_parameters if description is not None: params['description'] = description + if snap_schedule_parameters: + params['snapScheduleParameters'] = snap_schedule_parameters if not params: return RestResponse('', self._cli) diff --git a/storops_test/unity/resource/test_filesystem.py b/storops_test/unity/resource/test_filesystem.py index d3cc8611..5119054d 100644 --- a/storops_test/unity/resource/test_filesystem.py +++ b/storops_test/unity/resource/test_filesystem.py @@ -245,6 +245,13 @@ def test_modify_success_empty_description(self): fs.modify(description='') assert_that(fs.description, equal_to('')) + @patch_rest + def test_modify_success_snap_schedule(self): + fs = UnityFileSystem(cli=t_rest(), _id='fs_22') + snap_schedule_parameters = {'snapSchedule': {'id': 'snapSch_1'}} + resp = fs.modify(snap_schedule_parameters=snap_schedule_parameters) + assert_that(resp.is_ok(), equal_to(True)) + @patch_rest def test_delete_filesystem_async(self): fs = UnityFileSystem(_id='fs_14', cli=t_rest()) diff --git a/storops_test/unity/rest_data/storageResource/index.json b/storops_test/unity/rest_data/storageResource/index.json index faaed511..fd8aa24c 100644 --- a/storops_test/unity/rest_data/storageResource/index.json +++ b/storops_test/unity/rest_data/storageResource/index.json @@ -348,6 +348,17 @@ }, "response": "size_too_small.json" }, + { + "url": "/api/instances/storageResource/res_22/action/modifyFilesystem?compact=True", + "body": { + "snapScheduleParameters": { + "snapSchedule": { + "id": "snapSch_1" + } + } + }, + "response": "empty.json" + }, { "url": "/api/types/storageResource/action/createFilesystem?compact=True", "body": {