示例#1
0
    def __init__(self, *args, **kwargs):
        super(LongTermBackupRetentionPolicyAction, self).__init__(
            BackupRetentionPolicyHelper.LONG_TERM_SQL_OPERATIONS, *args,
            **kwargs)

        self.backup_type = BackupRetentionPolicyHelper.LongTermBackupType[
            self.data.get('backup-type')]
        retention_period = self.data['retention-period']
        retention_period_units = RetentionPeriod.Units[
            self.data['retention-period-units']]
        self.iso8601_duration = RetentionPeriod.iso8601_duration(
            retention_period, retention_period_units)
示例#2
0
 def test_iso8601_duration_days(self):
     duration = RetentionPeriod.iso8601_duration(23,
                                                 RetentionPeriod.Units.days)
     self.assertEqual(duration, "P23D")
示例#3
0
 def test_iso8601_duration_months(self):
     duration = RetentionPeriod.iso8601_duration(
         7, RetentionPeriod.Units.months)
     self.assertEqual(duration, "P7M")
示例#4
0
 def test_iso8601_duration_years(self):
     duration = RetentionPeriod.iso8601_duration(
         3, RetentionPeriod.Units.years)
     self.assertEqual(duration, "P3Y")
示例#5
0
 def test_iso8601_duration_weeks(self):
     duration = RetentionPeriod.iso8601_duration(
         12, RetentionPeriod.Units.weeks)
     self.assertEqual(duration, "P12W")