2017-03-24 20:50:42 -07:00
|
|
|
/**
|
|
|
|
* Builds a privacyCompliancePolicy map with default / unset values for non null properties
|
|
|
|
*/
|
|
|
|
export const createPrivacyCompliancePolicy = () => {
|
|
|
|
const policy = {
|
|
|
|
// default to first item in compliance types list
|
2017-03-29 18:51:26 -07:00
|
|
|
complianceType: 'AUTO_PURGE',
|
2017-03-24 20:50:42 -07:00
|
|
|
compliancePurgeEntities: []
|
|
|
|
};
|
|
|
|
|
|
|
|
// Ensure we deep clone map to prevent mutation from consumers
|
|
|
|
return JSON.parse(JSON.stringify(policy));
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Builds a securitySpecification map with default / unset values for non null properties as per avro schema
|
|
|
|
* @param {number} id
|
|
|
|
*/
|
|
|
|
export const createSecuritySpecification = id => {
|
|
|
|
const classification = [
|
|
|
|
'highlyConfidential', 'confidential', 'limitedDistribution', 'mustBeEncrypted', 'mustBeMasked'
|
|
|
|
].reduce((classification, classifier) => {
|
|
|
|
classification[classifier] = [];
|
|
|
|
return classification;
|
|
|
|
}, {});
|
|
|
|
const securitySpecification = {
|
|
|
|
classification,
|
|
|
|
datasetId: id,
|
|
|
|
geographicAffinity: {affinity: ''},
|
|
|
|
recordOwnerType: '',
|
|
|
|
retentionPolicy: {retentionType: ''}
|
|
|
|
};
|
|
|
|
|
|
|
|
return JSON.parse(JSON.stringify(securitySpecification));
|
2017-03-29 18:51:26 -07:00
|
|
|
};
|