Repository: Accenture/sfmc-devtools (js)

Issue:
[FEATURE] enhance readability of dataExtension retention policy
the retention type should be directly readable as a value instead of having to understand the combination of values.


**DataRetentionPeriodUnitOfMeasure:**

| ID | Name | Comment |
| --- | --- | --- |
| 1 | Minutes | not selectable in UI - to be tested! |
| 2 | Hours | not selectable in UI - to be tested! |
| 3 | Days | |
| 4 | Weeks | |
| 5 | Months | |
| 6 | Years | |

**RetainUntil:**
Currently that's in US datetime format but you can only set days to begin with. Should be converted into the more universal YYYY-MM-DD format!

_samples:_

**none:**
```
// before:
{
    "RowBasedRetention": false,
    "ResetRetentionPeriodOnImport": false,
    "DeleteAtEndOfRetentionPeriod": false,
    "RetainUntil": "",
}

// after
{
    "c__retentionType": "none",
}
```

**allRecordsAndDataextension**:
```
// before:
{
    "DataRetentionPeriodLength": 6,
    "DataRetentionPeriodUnitOfMeasure": 3,
    "RowBasedRetention": false,
    "ResetRetentionPeriodOnImport": false,
    "DeleteAtEndOfRetentionPeriod": false,
    "RetainUntil": "5/9/2024 12:00:00 AM",
}

// after
{
    "c__retentionType": "allRecordsAndDataextension",
    "DataRetentionPeriodLength": 6,
    "c__dataRetentionPeriodUnitOfMeasure": 'Days',
//  "RowBasedRetention": false,
    "ResetRetentionPeriodOnImport": false,
//  "DeleteAtEndOfRetentionPeriod": false,
    "c__retainUntil": "2024-05-09",
}
```

**individialRecords:**
```
// before
{
    "DataRetentionPeriodLength": 6,
    "DataRetentionPeriodUnitOfMeasure": 3,
    "RowBasedRetention": true,
    "ResetRetentionPeriodOnImport": false,
    "DeleteAtEndOfRetentionPeriod": false,
    "RetainUntil": "",
}

// after
{
    "c__retentionType": "individialRecords",
    "DataRetentionPeriodLength": 6,
    "c__DataRetentionPeriodUnitOfMeasure": 'Days',
//    "RowBasedRetention": true,
    "ResetRetentionPeriodOnImport": false,
//    "DeleteAtEndOfRetentionPeriod": false,
//    "RetainUntil": "",
}
```

**allRecords:**
```
// before
{
    "DataRetentionPeriodLength": 6,
    "DataRetentionPeriodUnitOfMeasure": 3,
    "RowBasedRetention": false,
    "ResetRetentionPeriodOnImport": false,
    "DeleteAtEndOfRetentionPeriod": true,
    "RetainUntil": "5/9/2024 12:00:00 AM",
}

// after
{
    "c__retentionType": "allRecords",
    "DataRetentionPeriodLength": 6,
    "c__DataRetentionPeriodUnitOfMeasure": 'Days',
//    "RowBasedRetention": false,
    "ResetRetentionPeriodOnImport": false,
//    "DeleteAtEndOfRetentionPeriod": true,
    "c__retainUntil": "2024-05-09",
}
```

**allRecords and resetOnImport:** (like allRecords!)
```
{
    "c__retentionType": "allRecords",
    "DataRetentionPeriodLength": 6,
    "c__DataRetentionPeriodUnitOfMeasure": 'Days',
//    "RowBasedRetention": false,
    "ResetRetentionPeriodOnImport": true,
//    "DeleteAtEndOfRetentionPeriod": true,
    "c__retainUntil": "2024-05-09",
}
```


Pull request:
Feature/1292 enhance readability of dataextension retention policy
# PR details

## What changes did you make? (Give an overview)

- closes #1292 

## Further details (optional)

...

## Checklist

- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] test scripts updated
- [ ] Wiki updated (if applicable)


Patch:
diff --git a/lib/metadataTypes/DataExtension.js b/lib/metadataTypes/DataExtension.js
index c6eabb63..68a2261f 100644
--- a/lib/metadataTypes/DataExtension.js
+++ b/lib/metadataTypes/DataExtension.js
@@ -950,6 +950,52 @@ class DataExtension extends MetadataType {
         delete metadata.CreatedDate;
         delete metadata.ModifiedDate;
 
+        // Retention policy
+        if (
+            metadata.RowBasedRetention === false &&
+            metadata.DeleteAtEndOfRetentionPeriod === false &&
+            metadata.RetainUntil === ''
+        ) {
+            // Note: RetainUntil expected to NOT have a value
+            metadata.c__retentionPolicy = 'none';
+            delete metadata.RetainUntil;
+            delete metadata.ResetRetentionPeriodOnImport;
+        } else if (
+            metadata.RowBasedRetention === false &&
+            metadata.DeleteAtEndOfRetentionPeriod === false
+        ) {
+            // Note: RetainUntil expected to have a value
+            metadata.c__retentionPolicy = 'allRecordsAndDataextension';
+        } else if (
+            metadata.RowBasedRetention === false &&
+            metadata.DeleteAtEndOfRetentionPeriod === true
+        ) {
+            // Note: RetainUntil expected to have a value
+            metadata.c__retentionPolicy = 'allRecords';
+        } else if (
+            metadata.RowBasedRetention === true &&
+            metadata.DeleteAtEndOfRetentionPeriod === false
+        ) {
+            // Note: RetainUntil expected to NOT have a value
+            metadata.c__retentionPolicy = 'individialRecords';
+            delete metadata.RetainUntil;
+        }
+        delete metadata.RowBasedRetention;
+        delete metadata.DeleteAtEndOfRetentionPeriod;
+
+        if (metadata.RetainUntil) {
+            const retainUntil = new Date(metadata.RetainUntil);
+            metadata.c__retainUntil = `${retainUntil.getFullYear()}-${retainUntil.getMonth() + 1}-${retainUntil.getDate()}`;
+        }
+        delete metadata.RetainUntil;
+        if (metadata.DataRetentionPeriodUnitOfMeasure) {
+            metadata.c__dataRetentionPeriodUnitOfMeasure = Util.inverseGet(
+                this.definition.dataRetentionPeriodUnitOfMeasureMapping,
+                metadata.DataRetentionPeriodUnitOfMeasure
+            );
+            delete metadata.DataRetentionPeriodUnitOfMeasure;
+        }
+
         return metadata;
     }
 
@@ -1095,6 +1141,55 @@ class DataExtension extends MetadataType {
             metadata.SendableSubscriberField.Name = 'Subscriber Key';
         }
 
+        // Retention policy
+        switch (metadata.c__retentionPolicy) {
+            case 'none': {
+                metadata.RowBasedRetention = false;
+                metadata.DeleteAtEndOfRetentionPeriod = false;
+                metadata.ResetRetentionPeriodOnImport = false;
+                break;
+            }
+            case 'allRecordsAndDataextension': {
+                metadata.RowBasedRetention = false;
+                metadata.DeleteAtEndOfRetentionPeriod = false;
+                break;
+            }
+            case 'allRecords': {
+                metadata.RowBasedRetention = false;
+                metadata.DeleteAtEndOfRetentionPeriod = true;
+                break;
+            }
+            case 'individialRecords': {
+                metadata.RowBasedRetention = true;
+                metadata.DeleteAtEndOfRetentionPeriod = false;
+                break;
+            }
+            default: {
+                Util.logger.debug(
+                    ` - dataExtension '${
+                        metadata[this.definition.nameField]
+                    }': Unknown retention policy: ${metadata.c__retentionPolicy}`
+                );
+            }
+        }
+        delete metadata.c__retentionPolicy;
+
+        if (metadata.c__retainUntil) {
+            const retainUntil = new Date(metadata.c__retainUntil);
+            metadata.RetainUntil = `${retainUntil.getMonth() + 1}/${retainUntil.getDate()}/${retainUntil.getFullYear()} 12:00:00 AM`;
+            delete metadata.c__retainUntil;
+        } else {
+            metadata.RetainUntil = '';
+        }
+
+        if (metadata.c__dataRetentionPeriodUnitOfMeasure) {
+            metadata.DataRetentionPeriodUnitOfMeasure =
+                this.definition.dataRetentionPeriodUnitOfMeasureMapping[
+                    metadata.c__dataRetentionPeriodUnitOfMeasure
+                ];
+            delete metadata.c__dataRetentionPeriodUnitOfMeasure;
+        }
+
         return metadata;
     }
 
diff --git a/lib/metadataTypes/Event.js b/lib/metadataTypes/Event.js
index f0a0f415..8de56b1b 100644
--- a/lib/metadataTypes/Event.js
+++ b/lib/metadataTypes/Event.js
@@ -26,8 +26,8 @@ import cache from '../util/cache.js';
 class Event extends MetadataType {
     /**
      * Retrieves Metadata of Event Definition.
-     * Endpoint /interaction/v1/EventDefinitions return all Event Definitions with all details.
-     * Currently it is not needed to loop over Imports with endpoint /interaction/v1/EventDefinitions/{id}
+     * Endpoint /interaction/v1/eventDefinitions return all Event Definitions with all details.
+     * Currently it is not needed to loop over Imports with endpoint /interaction/v1/eventDefinitions/{id}
      *
      * @param {string} retrieveDir Directory where retrieved metadata directory will be saved
      * @param {void | string[]} [_] unused parameter
@@ -39,7 +39,7 @@ class Event extends MetadataType {
         Util.logBeta(this.definition.type);
         return super.retrieveREST(
             retrieveDir,
-            `/interaction/v1/EventDefinitions${
+            `/interaction/v1/eventDefinitions${
                 key ? '/key:' + encodeURIComponent(key) : ''
             }?extras=all`,
             null,
@@ -53,7 +53,7 @@ class Event extends MetadataType {
      * @returns {Promise.<MetadataTypeMapObj>} Promise of metadata
      */
     static retrieveForCache() {
-        return super.retrieveREST(null, '/interaction/v1/EventDefinitions/');
+        return super.retrieveREST(null, '/interaction/v1/eventDefinitions/');
     }
 
     /**
@@ -67,7 +67,7 @@ class Event extends MetadataType {
     static async retrieveAsTemplate(templateDir, name, templateVariables) {
         Util.logBeta(this.definition.type);
         const res = await this.client.rest.get(
-            '/interaction/v1/EventDefinitions?name=' + encodeURIComponent(name)
+            '/interaction/v1/eventDefinitions?name=' + encodeURIComponent(name)
         );
         const event = res.items.filter((item) => item.name === name);
         try {
@@ -162,7 +162,7 @@ class Event extends MetadataType {
      * @returns {Promise} Promise
      */
     static create(metadata) {
-        return super.createREST(metadata, '/interaction/v1/EventDefinitions/');
+        return super.createREST(metadata, '/interaction/v1/eventDefinitions/');
     }
 
     /**
@@ -174,7 +174,7 @@ class Event extends MetadataType {
     static async update(metadataEntry) {
         return super.updateREST(
             metadataEntry,
-            '/interaction/v1/EventDefinitions/' + metadataEntry.id,
+            '/interaction/v1/eventDefinitions/' + metadataEntry.id,
             'put'
         );
     }
diff --git a/lib/metadataTypes/definitions/DataExtension.definition.js b/lib/metadataTypes/definitions/DataExtension.definition.js
index 064f5fb5..f6e2bb6c 100644
--- a/lib/metadataTypes/definitions/DataExtension.definition.js
+++ b/lib/metadataTypes/definitions/DataExtension.definition.js
@@ -86,6 +86,12 @@ export default {
         SMSSubscriptionLog: null, // CustomerKey cannot be retrieved
         TriggeredSendDataExtension: ['SubscriberKey', 'EmailAddress'],
     },
+    dataRetentionPeriodUnitOfMeasureMapping: {
+        Days: 3,
+        Weeks: 4,
+        Months: 5,
+        Years: 6,
+    },
     hasExtended: false,
     idField: 'ObjectID',
     keyIsFixed: false,
@@ -284,5 +290,14 @@ export default {
         r__dataExtensionTemplate_Name: {
             skipValidation: true,
         },
+        c__retentionPolicy: {
+            skipValidation: true,
+        },
+        c__retainUntil: {
+            skipValidation: true,
+        },
+        c__dataRetentionPeriodUnitOfMeasure: {
+            skipValidation: true,
+        },
     },
 };
diff --git a/test/resources/9999999/interaction/v1/EventDefinitions/get-response.json b/test/resources/9999999/interaction/v1/eventDefinitions/get-response.json
similarity index 100%
rename from test/resources/9999999/interaction/v1/EventDefinitions/get-response.json
rename to test/resources/9999999/interaction/v1/eventDefinitions/get-response.json
diff --git a/types/mcdev.d.js b/types/mcdev.d.js
index 15a4e934..b60364ce 100644
--- a/types/mcdev.d.js
+++ b/types/mcdev.d.js
@@ -115,12 +115,15 @@
  * @property {string} [r__dataExtensionTemplate_Name] name of optionally associated DE template
  * @property {object} [Template] -
  * @property {string} [Template.CustomerKey] key of optionally associated DE teplate
- * @property {string} [RetainUntil] ?
- * @property {any} [DataRetentionPeriodLength] ?
- * @property {any} [DataRetentionPeriodUnitOfMeasure] ?
- * @property {any} [RowBasedRetention] ?
- * @property {any} [ResetRetentionPeriodOnImport] ?
- * @property {any} [DeleteAtEndOfRetentionPeriod] ?
+ * @property {string} RetainUntil empty string or US date + 12:00:00 AM
+ * @property {string} c__retainUntil YYYY-MM-DD
+ * @property {'none'|'allRecordsAndDataextension'|'allRecords'|'individialRecords'} [c__retentionPolicy] readable name of retention policy
+ * @property {number} [DataRetentionPeriodLength] number of days/weeks/months/years before retention kicks in
+ * @property {number} [DataRetentionPeriodUnitOfMeasure] 3:Days, 4:Weeks, 5:Months, 6:Years
+ * @property {string} [c__dataRetentionPeriodUnitOfMeasure] 3:Days, 4:Weeks, 5:Months, 6:Years
+ * @property {boolean} [RowBasedRetention] true for retention policy individialRecords
+ * @property {boolean} ResetRetentionPeriodOnImport ?
+ * @property {boolean} [DeleteAtEndOfRetentionPeriod] true for retention policy allRecords
  */
 /**
  * @typedef {Object.<string, DataExtensionItem>} DataExtensionMap


Test patch:
diff --git a/test/mockRoot/deploy/testInstance/_ParentBU_/dataExtension/testExisting_dataExtensionShared.dataExtension-meta.json b/test/mockRoot/deploy/testInstance/_ParentBU_/dataExtension/testExisting_dataExtensionShared.dataExtension-meta.json
index 9af73620..2314d37a 100644
--- a/test/mockRoot/deploy/testInstance/_ParentBU_/dataExtension/testExisting_dataExtensionShared.dataExtension-meta.json
+++ b/test/mockRoot/deploy/testInstance/_ParentBU_/dataExtension/testExisting_dataExtensionShared.dataExtension-meta.json
@@ -7,11 +7,7 @@
     "SendableDataExtensionField": { "Name": "ContactKey" },
     "SendableSubscriberField": { "Name": "Subscriber Key" },
     "DataRetentionPeriodLength": 6,
-    "DataRetentionPeriodUnitOfMeasure": 5,
-    "RowBasedRetention": true,
     "ResetRetentionPeriodOnImport": false,
-    "DeleteAtEndOfRetentionPeriod": false,
-    "RetainUntil": "",
     "Fields": [
         {
             "Name": "FirstName",
@@ -54,6 +50,9 @@
             "FieldType": "Text"
         }
     ],
+    "c__dataRetentionPeriodUnitOfMeasure": "Days",
+    "c__retainUntil": "2024-5-9",
+    "c__retentionPolicy": "allRecords",
     "r__folder_ContentType": "shared_dataextension",
     "r__folder_Path": "Shared Items/Shared Data Extensions"
 }
diff --git a/test/mockRoot/deploy/testInstance/_ParentBU_/dataExtension/testNew_dataExtensionShared.dataExtension-meta.json b/test/mockRoot/deploy/testInstance/_ParentBU_/dataExtension/testNew_dataExtensionShared.dataExtension-meta.json
index daf504e7..8770af6d 100644
--- a/test/mockRoot/deploy/testInstance/_ParentBU_/dataExtension/testNew_dataExtensionShared.dataExtension-meta.json
+++ b/test/mockRoot/deploy/testInstance/_ParentBU_/dataExtension/testNew_dataExtensionShared.dataExtension-meta.json
@@ -4,10 +4,6 @@
     "Description": "",
     "IsSendable": false,
     "IsTestable": false,
-    "RowBasedRetention": false,
-    "ResetRetentionPeriodOnImport": false,
-    "DeleteAtEndOfRetentionPeriod": false,
-    "RetainUntil": "",
     "Fields": [
         {
             "Name": "testField",
@@ -18,6 +14,7 @@
             "FieldType": "Text"
         }
     ],
+    "c__retentionPolicy": "none",
     "r__folder_ContentType": "shared_dataextension",
     "r__folder_Path": "Shared Items/Shared Data Extensions"
 }
diff --git a/test/mockRoot/deploy/testInstance/testBU/dataExtension/testExisting_dataExtension.dataExtension-meta.json b/test/mockRoot/deploy/testInstance/testBU/dataExtension/testExisting_dataExtension.dataExtension-meta.json
index ccd84027..7e78e646 100644
--- a/test/mockRoot/deploy/testInstance/testBU/dataExtension/testExisting_dataExtension.dataExtension-meta.json
+++ b/test/mockRoot/deploy/testInstance/testBU/dataExtension/testExisting_dataExtension.dataExtension-meta.json
@@ -7,11 +7,7 @@
     "SendableDataExtensionField": { "Name": "ContactKey" },
     "SendableSubscriberField": { "Name": "Subscriber Key" },
     "DataRetentionPeriodLength": 6,
-    "DataRetentionPeriodUnitOfMeasure": 5,
-    "RowBasedRetention": true,
     "ResetRetentionPeriodOnImport": false,
-    "DeleteAtEndOfRetentionPeriod": false,
-    "RetainUntil": "",
     "Fields": [
         {
             "Name": "FirstName",
@@ -55,6 +51,9 @@
             "FieldType": "Text"
         }
     ],
+    "c__dataRetentionPeriodUnitOfMeasure": "Days",
+    "c__retainUntil": "2024-5-9",
+    "c__retentionPolicy": "allRecords",
     "r__folder_ContentType": "dataextension",
     "r__folder_Path": "Data Extensions"
 }
diff --git a/test/mockRoot/deploy/testInstance/testBU/dataExtension/testNew_dataExtension.dataExtension-meta.json b/test/mockRoot/deploy/testInstance/testBU/dataExtension/testNew_dataExtension.dataExtension-meta.json
index a4e4ef7a..5701a0f7 100644
--- a/test/mockRoot/deploy/testInstance/testBU/dataExtension/testNew_dataExtension.dataExtension-meta.json
+++ b/test/mockRoot/deploy/testInstance/testBU/dataExtension/testNew_dataExtension.dataExtension-meta.json
@@ -4,10 +4,6 @@
     "Description": "",
     "IsSendable": false,
     "IsTestable": false,
-    "RowBasedRetention": false,
-    "ResetRetentionPeriodOnImport": false,
-    "DeleteAtEndOfRetentionPeriod": false,
-    "RetainUntil": "",
     "Fields": [
         {
             "Name": "testField",
@@ -18,6 +14,7 @@
             "FieldType": "Text"
         }
     ],
+    "c__retentionPolicy": "none",
     "r__folder_ContentType": "dataextension",
     "r__folder_Path": "Data Extensions"
 }
diff --git a/test/resources/1111111/dataExtension/create-expected.json b/test/resources/1111111/dataExtension/create-expected.json
index 222e4602..9aad7ca0 100644
--- a/test/resources/1111111/dataExtension/create-expected.json
+++ b/test/resources/1111111/dataExtension/create-expected.json
@@ -1,7 +1,9 @@
 {
     "CustomerKey": "testNew_dataExtensionShared",
-    "DeleteAtEndOfRetentionPeriod": false,
+    "Name": "testNew_dataExtensionShared",
     "Description": "",
+    "IsSendable": false,
+    "IsTestable": false,
     "Fields": [
         {
             "DefaultValue": "",
@@ -12,12 +14,7 @@
             "Name": "testField"
         }
     ],
-    "IsSendable": false,
-    "IsTestable": false,
-    "Name": "testNew_dataExtensionShared",
-    "ResetRetentionPeriodOnImport": false,
-    "RetainUntil": "",
-    "RowBasedRetention": false,
+    "c__retentionPolicy": "none",
     "r__folder_ContentType": "shared_dataextension",
     "r__folder_Path": "Shared Items/Shared Data Extensions"
 }
diff --git a/test/resources/1111111/dataExtension/retrieve-expected.json b/test/resources/1111111/dataExtension/retrieve-expected.json
index f64ad16d..d1575590 100644
--- a/test/resources/1111111/dataExtension/retrieve-expected.json
+++ b/test/resources/1111111/dataExtension/retrieve-expected.json
@@ -1,8 +1,6 @@
 {
     "CustomerKey": "testExisting_dataExtensionShared",
     "DataRetentionPeriodLength": 6,
-    "DataRetentionPeriodUnitOfMeasure": 5,
-    "DeleteAtEndOfRetentionPeriod": false,
     "Description": "bla bla",
     "Fields": [
         {
@@ -42,14 +40,14 @@
     "IsTestable": true,
     "Name": "testExisting_dataExtensionShared",
     "ResetRetentionPeriodOnImport": false,
-    "RetainUntil": "",
-    "RowBasedRetention": true,
     "SendableDataExtensionField": {
         "Name": "ContactKey"
     },
     "SendableSubscriberField": {
         "Name": "Subscriber Key"
     },
+    "c__dataRetentionPeriodUnitOfMeasure": "Months",
+    "c__retentionPolicy": "individialRecords",
     "r__folder_ContentType": "shared_dataextension",
     "r__folder_Path": "Shared Items/Shared Data Extensions"
 }
diff --git a/test/resources/1111111/dataExtension/update-expected.json b/test/resources/1111111/dataExtension/update-expected.json
index bd074f2a..8f9c83f8 100644
--- a/test/resources/1111111/dataExtension/update-expected.json
+++ b/test/resources/1111111/dataExtension/update-expected.json
@@ -1,7 +1,11 @@
 {
     "CustomerKey": "testExisting_dataExtensionShared",
-    "DeleteAtEndOfRetentionPeriod": false,
+    "Name": "testExisting_dataExtensionShared",
     "Description": "Container for my test emails",
+    "IsSendable": false,
+    "IsTestable": false,
+    "DataRetentionPeriodLength": 6,
+    "ResetRetentionPeriodOnImport": false,
     "Fields": [
         {
             "DefaultValue": "",
@@ -44,12 +48,8 @@
             "Name": "newField"
         }
     ],
-    "IsSendable": false,
-    "IsTestable": false,
-    "Name": "testExisting_dataExtensionShared",
-    "ResetRetentionPeriodOnImport": false,
-    "RetainUntil": "",
-    "RowBasedRetention": true,
+    "c__dataRetentionPeriodUnitOfMeasure": "Months",
+    "c__retentionPolicy": "individialRecords",
     "r__folder_ContentType": "shared_dataextension",
     "r__folder_Path": "Shared Items/Shared Data Extensions"
 }
diff --git a/test/resources/1111111/dataExtension/update-response.xml b/test/resources/1111111/dataExtension/update-response.xml
index f2122b7e..7016a65d 100644
--- a/test/resources/1111111/dataExtension/update-response.xml
+++ b/test/resources/1111111/dataExtension/update-response.xml
@@ -31,9 +31,11 @@
                     <Description>Container for my test emails</Description>
                     <IsSendable>false</IsSendable>
                     <IsTestable>false</IsTestable>
+                    <DataRetentionPeriodLength>6</DataRetentionPeriodLength>
+                    <DataRetentionPeriodUnitOfMeasure>5</DataRetentionPeriodUnitOfMeasure>
                     <RowBasedRetention>false</RowBasedRetention>
                     <ResetRetentionPeriodOnImport>false</ResetRetentionPeriodOnImport>
-                    <DeleteAtEndOfRetentionPeriod>false</DeleteAtEndOfRetentionPeriod>
+                    <DeleteAtEndOfRetentionPeriod>true</DeleteAtEndOfRetentionPeriod>
                     <RetainUntil />
                     <Fields>
                         <Field>
diff --git a/test/resources/9999999/dataExtension/build-expected.json b/test/resources/9999999/dataExtension/build-expected.json
index 21d43fdb..d54b9bbf 100644
--- a/test/resources/9999999/dataExtension/build-expected.json
+++ b/test/resources/9999999/dataExtension/build-expected.json
@@ -7,11 +7,7 @@
     "SendableDataExtensionField": { "Name": "ContactKey" },
     "SendableSubscriberField": { "Name": "Subscriber Key" },
     "DataRetentionPeriodLength": 6,
-    "DataRetentionPeriodUnitOfMeasure": 5,
-    "RowBasedRetention": true,
     "ResetRetentionPeriodOnImport": false,
-    "DeleteAtEndOfRetentionPeriod": false,
-    "RetainUntil": "",
     "Fields": [
         {
             "Name": "FirstName",
@@ -62,6 +58,9 @@
             "FieldType": "Number"
         }
     ],
+    "c__dataRetentionPeriodUnitOfMeasure": "Months",
+    "c__retainUntil": "2024-5-9",
+    "c__retentionPolicy": "allRecords",
     "r__folder_ContentType": "dataextension",
     "r__folder_Path": "Data Extensions"
 }
diff --git a/test/resources/9999999/dataExtension/create-expected.json b/test/resources/9999999/dataExtension/create-expected.json
index a4e4ef7a..5701a0f7 100644
--- a/test/resources/9999999/dataExtension/create-expected.json
+++ b/test/resources/9999999/dataExtension/create-expected.json
@@ -4,10 +4,6 @@
     "Description": "",
     "IsSendable": false,
     "IsTestable": false,
-    "RowBasedRetention": false,
-    "ResetRetentionPeriodOnImport": false,
-    "DeleteAtEndOfRetentionPeriod": false,
-    "RetainUntil": "",
     "Fields": [
         {
             "Name": "testField",
@@ -18,6 +14,7 @@
             "FieldType": "Text"
         }
     ],
+    "c__retentionPolicy": "none",
     "r__folder_ContentType": "dataextension",
     "r__folder_Path": "Data Extensions"
 }
diff --git a/test/resources/9999999/dataExtension/retrieve-Name=testExisting_dataExtension-response.xml b/test/resources/9999999/dataExtension/retrieve-Name=testExisting_dataExtension-response.xml
index e7cf0d2e..d2f4ace4 100644
--- a/test/resources/9999999/dataExtension/retrieve-Name=testExisting_dataExtension-response.xml
+++ b/test/resources/9999999/dataExtension/retrieve-Name=testExisting_dataExtension-response.xml
@@ -41,12 +41,12 @@
                 </SendableSubscriberField>
                 <DataRetentionPeriodLength>6</DataRetentionPeriodLength>
                 <DataRetentionPeriodUnitOfMeasure>5</DataRetentionPeriodUnitOfMeasure>
-                <RowBasedRetention>true</RowBasedRetention>
+                <RowBasedRetention>false</RowBasedRetention>
                 <ResetRetentionPeriodOnImport>false</ResetRetentionPeriodOnImport>
-                <DeleteAtEndOfRetentionPeriod>false</DeleteAtEndOfRetentionPeriod>
-                <RetainUntil />
+                <DeleteAtEndOfRetentionPeriod>true</DeleteAtEndOfRetentionPeriod>
+                <RetainUntil>5/9/2024 12:00:00 AM</RetainUntil>
                 <CategoryID>2</CategoryID>
             </Results>
         </RetrieveResponseMsg>
     </soap:Body>
-</soap:Envelope>
\ No newline at end of file
+</soap:Envelope>
diff --git a/test/resources/9999999/dataExtension/retrieve-expected.json b/test/resources/9999999/dataExtension/retrieve-expected.json
index c8c945cc..4049fe48 100644
--- a/test/resources/9999999/dataExtension/retrieve-expected.json
+++ b/test/resources/9999999/dataExtension/retrieve-expected.json
@@ -7,11 +7,7 @@
     "SendableDataExtensionField": { "Name": "ContactKey" },
     "SendableSubscriberField": { "Name": "Subscriber Key" },
     "DataRetentionPeriodLength": 6,
-    "DataRetentionPeriodUnitOfMeasure": 5,
-    "RowBasedRetention": true,
     "ResetRetentionPeriodOnImport": false,
-    "DeleteAtEndOfRetentionPeriod": false,
-    "RetainUntil": "",
     "Fields": [
         {
             "Name": "FirstName",
@@ -62,6 +58,9 @@
             "FieldType": "Number"
         }
     ],
+    "c__dataRetentionPeriodUnitOfMeasure": "Months",
+    "c__retainUntil": "2024-5-9",
+    "c__retentionPolicy": "allRecords",
     "r__folder_ContentType": "dataextension",
     "r__folder_Path": "Data Extensions"
 }
diff --git a/test/resources/9999999/dataExtension/retrieve-response.xml b/test/resources/9999999/dataExtension/retrieve-response.xml
index e7cf0d2e..d2f4ace4 100644
--- a/test/resources/9999999/dataExtension/retrieve-response.xml
+++ b/test/resources/9999999/dataExtension/retrieve-response.xml
@@ -41,12 +41,12 @@
                 </SendableSubscriberField>
                 <DataRetentionPeriodLength>6</DataRetentionPeriodLength>
                 <DataRetentionPeriodUnitOfMeasure>5</DataRetentionPeriodUnitOfMeasure>
-                <RowBasedRetention>true</RowBasedRetention>
+                <RowBasedRetention>false</RowBasedRetention>
                 <ResetRetentionPeriodOnImport>false</ResetRetentionPeriodOnImport>
-                <DeleteAtEndOfRetentionPeriod>false</DeleteAtEndOfRetentionPeriod>
-                <RetainUntil />
+                <DeleteAtEndOfRetentionPeriod>true</DeleteAtEndOfRetentionPeriod>
+                <RetainUntil>5/9/2024 12:00:00 AM</RetainUntil>
                 <CategoryID>2</CategoryID>
             </Results>
         </RetrieveResponseMsg>
     </soap:Body>
-</soap:Envelope>
\ No newline at end of file
+</soap:Envelope>
diff --git a/test/resources/9999999/dataExtension/template-expected.json b/test/resources/9999999/dataExtension/template-expected.json
index c2513cfa..439050ea 100644
--- a/test/resources/9999999/dataExtension/template-expected.json
+++ b/test/resources/9999999/dataExtension/template-expected.json
@@ -7,11 +7,7 @@
     "SendableDataExtensionField": { "Name": "ContactKey" },
     "SendableSubscriberField": { "Name": "Subscriber Key" },
     "DataRetentionPeriodLength": 6,
-    "DataRetentionPeriodUnitOfMeasure": 5,
-    "RowBasedRetention": true,
     "ResetRetentionPeriodOnImport": false,
-    "DeleteAtEndOfRetentionPeriod": false,
-    "RetainUntil": "",
     "Fields": [
         {
             "Name": "FirstName",
@@ -62,6 +58,9 @@
             "FieldType": "Number"
         }
     ],
+    "c__dataRetentionPeriodUnitOfMeasure": "Months",
+    "c__retainUntil": "2024-5-9",
+    "c__retentionPolicy": "allRecords",
     "r__folder_ContentType": "dataextension",
     "r__folder_Path": "Data Extensions"
 }
diff --git a/test/resources/9999999/dataExtension/update-expected.json b/test/resources/9999999/dataExtension/update-expected.json
index 7106168c..51b60374 100644
--- a/test/resources/9999999/dataExtension/update-expected.json
+++ b/test/resources/9999999/dataExtension/update-expected.json
@@ -4,10 +4,8 @@
     "Description": "Container for my test emails",
     "IsSendable": false,
     "IsTestable": false,
-    "RowBasedRetention": true,
+    "DataRetentionPeriodLength": 6,
     "ResetRetentionPeriodOnImport": false,
-    "DeleteAtEndOfRetentionPeriod": false,
-    "RetainUntil": "",
     "Fields": [
         {
             "Name": "FirstName",
@@ -66,6 +64,9 @@
             "FieldType": "Text"
         }
     ],
+    "c__dataRetentionPeriodUnitOfMeasure": "Months",
+    "c__retainUntil": "2024-5-9",
+    "c__retentionPolicy": "allRecords",
     "r__folder_ContentType": "dataextension",
     "r__folder_Path": "Data Extensions"
 }
diff --git a/test/resources/9999999/dataExtension/update-response.xml b/test/resources/9999999/dataExtension/update-response.xml
index dd30fc28..f08b0078 100644
--- a/test/resources/9999999/dataExtension/update-response.xml
+++ b/test/resources/9999999/dataExtension/update-response.xml
@@ -31,10 +31,12 @@
                     <Description>Container for my test emails</Description>
                     <IsSendable>false</IsSendable>
                     <IsTestable>false</IsTestable>
+                    <DataRetentionPeriodLength>6</DataRetentionPeriodLength>
+                    <DataRetentionPeriodUnitOfMeasure>5</DataRetentionPeriodUnitOfMeasure>
                     <RowBasedRetention>false</RowBasedRetention>
                     <ResetRetentionPeriodOnImport>false</ResetRetentionPeriodOnImport>
-                    <DeleteAtEndOfRetentionPeriod>false</DeleteAtEndOfRetentionPeriod>
-                    <RetainUntil />
+                    <DeleteAtEndOfRetentionPeriod>true</DeleteAtEndOfRetentionPeriod>
+                    <RetainUntil>5/9/2024 12:00:00 AM</RetainUntil>
                     <Fields>
                         <Field>
                             <PartnerKey xsi:nil="true" />
@@ -54,4 +56,4 @@
             <OverallStatus>OK</OverallStatus>
         </UpdateResponse>
     </soap:Body>
-</soap:Envelope>
\ No newline at end of file
+</soap:Envelope>