diff --git a/PyPowerStore/protection.py b/PyPowerStore/protection.py index 11463b5..a2a7acc 100644 --- a/PyPowerStore/protection.py +++ b/PyPowerStore/protection.py @@ -20,7 +20,7 @@ # Snapshot Rule SNAPSHOT_RULE_DETAILS_QUERY = { "select": "id,name,interval,days_of_week,time_of_day,desired_retention," - "policies(id,name)", + "is_secure,policies(id,name)", } # Replication Rule REPLICATION_RULE_DETAILS_QUERY = { @@ -113,6 +113,7 @@ def create_volume_snapshot( description=None, performance_policy_id=None, expiration_timestamp=None, + is_secure=None, ): """Create a snapshot of a volume. @@ -135,6 +136,9 @@ def create_volume_snapshot( '12:31:9999T23:59:59.999Z' to set an expiration to never expire. :type expiration_timestamp: str + :param is_secure: (optional) Indicates whether the snapshot is a + secure snapshot. + :type is_secure: bool :return: Volume snapshot details. :rtype: dict """ @@ -144,6 +148,7 @@ def create_volume_snapshot( description=description, performance_policy_id=performance_policy_id, expiration_timestamp=expiration_timestamp, + is_secure=is_secure, ) response = self.rest_client.request( constants.POST, @@ -156,6 +161,7 @@ def create_volume_snapshot( def modify_volume_snapshot( self, snapshot_id, name=None, description=None, expiration_timestamp=None, + is_secure=None, ): """Modify a snapshot of a volume. @@ -172,6 +178,10 @@ def modify_volume_snapshot( the maximum timestamp value of '12:31:9999T23:59:59.999Z' to set an expiration to never expire. + :param is_secure: (optional) Indicates whether the snapshot is a + secure snapshot. Once set to True, this is a one-way + operation and cannot be reverted. + :type is_secure: bool :return: Volume snapshot details. :rtype: dict """ @@ -180,6 +190,7 @@ def modify_volume_snapshot( name=name, description=description, expiration_timestamp=expiration_timestamp, + is_secure=is_secure, ) self.rest_client.request( constants.PATCH, @@ -236,6 +247,7 @@ def get_volume_group_snapshot_details(self, snapshot_id): def create_volume_group_snapshot( self, volume_group_id, name=None, description=None, expiration_timestamp=None, + is_secure=None, ): """Create a snapshot of a volume group. @@ -256,6 +268,9 @@ def create_volume_group_snapshot( yyyy-MM-dd'T'HH:mm:ss.SSSZ. By default, expiration time will not be set. :type expiration_timestamp: str + :param is_secure: (optional) Indicates whether the snapshot is a + secure snapshot. + :type is_secure: bool :return: Volume Group snapshot details. :rtype: dict """ @@ -264,6 +279,7 @@ def create_volume_group_snapshot( name=name, description=description, expiration_timestamp=expiration_timestamp, + is_secure=is_secure, ) response = self.rest_client.request( constants.POST, @@ -278,6 +294,7 @@ def create_volume_group_snapshot( def modify_volume_group_snapshot( self, snapshot_id, name=None, description=None, expiration_timestamp=None, + is_secure=None, ): """Modify a snapshot of a volume group. @@ -296,6 +313,10 @@ def modify_volume_group_snapshot( is yyyy-MM-dd'T'HH:mm:ssZ or yyyy-MM-dd'T'HH:mm:ss.SSSZ. By default, expiration time will not be set. + :param is_secure: (optional) Indicates whether the snapshot is a + secure snapshot. Once set to True, this is a one-way + operation and cannot be reverted. + :type is_secure: bool :return: Volume snapshot details. :rtype: dict """ @@ -304,6 +325,7 @@ def modify_volume_group_snapshot( name=name, description=description, expiration_timestamp=expiration_timestamp, + is_secure=is_secure, ) self.rest_client.request( constants.PATCH, @@ -386,6 +408,7 @@ def get_snapshot_rule_details(self, snapshot_rule_id): def create_snapshot_rule_by_interval( self, name, desired_retention, interval, days_of_week=None, + is_secure=None, ): """Create a new snapshot rule to take snapshots with time interval between. @@ -407,6 +430,9 @@ def create_snapshot_rule_by_interval( should be applied. Applies only for rules where the interval parameter is set. :type days_of_week: list[str] + :param is_secure: (optional) Indicates whether snapshots created by + this rule will be secure snapshots. + :type is_secure: bool :return: Snapshot rule details. :rtype: dict """ @@ -416,10 +442,12 @@ def create_snapshot_rule_by_interval( desired_retention=desired_retention, interval=interval, days_of_week=days_of_week, + is_secure=is_secure, ) def create_snapshot_rule_by_time_of_day( self, name, desired_retention, time_of_day, days_of_week=None, + is_secure=None, ): """Create a new snapshot rule to take daily snapshots at the specified time of day. @@ -439,6 +467,9 @@ def create_snapshot_rule_by_time_of_day( should be applied. Applies only for rules where the time_of_day parameter is set. :type days_of_week: list[str] + :param is_secure: (optional) Indicates whether snapshots created by + this rule will be secure snapshots. + :type is_secure: bool :return: Snapshot rule details. :rtype: dict """ @@ -448,6 +479,7 @@ def create_snapshot_rule_by_time_of_day( desired_retention=desired_retention, time_of_day=time_of_day, days_of_week=days_of_week, + is_secure=is_secure, ) def _create_snapshot_rule(self, **kwargs): @@ -474,6 +506,7 @@ def modify_snapshot_rule( interval=None, time_of_day=None, days_of_week=None, + is_secure=None, ): """Modify a snapshot rule. If the rule is associated with a policy that is currently applied to a storage resource, the modified rule is @@ -503,6 +536,9 @@ def modify_snapshot_rule( should be applied. Applies only for rules where the time_of_day parameter is set. :type days_of_week: list[str] + :param is_secure: (optional) Indicates whether snapshots created by + this rule will be secure snapshots. + :type is_secure: bool :return: Snapshot rule details. :rtype: dict """ @@ -513,6 +549,7 @@ def modify_snapshot_rule( interval=interval, time_of_day=time_of_day, days_of_week=days_of_week, + is_secure=is_secure, ) self.rest_client.request( constants.PATCH, @@ -1444,6 +1481,7 @@ def _prepare_create_modify_snapshot_payload(**kwargs): "description", "performance_policy_id", "expiration_timestamp", + "is_secure", ): if kwargs.get(argname) is not None: payload[argname] = kwargs[argname] @@ -1464,6 +1502,7 @@ def _prepare_create_modify_snapshot_rule_payload(**kwargs): "interval", "time_of_day", "days_of_week", + "is_secure", ): if kwargs.get(argname) is not None: payload[argname] = kwargs[argname] diff --git a/PyPowerStore/utils/constants.py b/PyPowerStore/utils/constants.py index 935fd5f..b70a7a8 100644 --- a/PyPowerStore/utils/constants.py +++ b/PyPowerStore/utils/constants.py @@ -165,7 +165,7 @@ "creator_type, filesystem_type_l10n," "access_policy_l10n, locking_policy_l10n," "folder_rename_policy_l10n, access_type_l10n," - "creator_type_l10n,nas_server(name,id)," + "creator_type_l10n,is_secure,nas_server(name,id)," "protection_policy(name,id)", } @@ -191,7 +191,7 @@ "file_events_publishing_mode," "file_events_publishing_mode_l10n," "config_type, config_type_l10n,flr_attributes," - "host_io_size,host_io_size_l10n", + "is_secure,host_io_size,host_io_size_l10n", } FILESYSTEM_PRIME = [