MCPcopy
hub / github.com/aquasecurity/cloudsploit / setData

Function setData

helpers/google/index.js:426–454  ·  view source on GitHub ↗
(collection, dataToAdd, postCall, parent, serviceInfo)

Source from the content-addressed store, hash-verified

424}
425
426function setData(collection, dataToAdd, postCall, parent, serviceInfo) {
427 console.log(`[PLUGINCHECK] ${JSON.stringify(serviceInfo, null, 2)}`);
428 if (!serviceInfo.maxLimit || !collection.data || (serviceInfo.maxLimit && collection.data && collection.data.length < serviceInfo.maxLimit)) {
429 if (postCall && !!parent) {
430 if (dataToAdd && dataToAdd.length) {
431 dataToAdd.map(item => {
432 item.parent = parent;
433 return item;
434 });
435 } else if (Object.keys(dataToAdd) && Object.keys(dataToAdd).length) {
436 dataToAdd.parent = parent;
437 }
438 }
439 if (dataToAdd.constructor.name === 'Array') {
440 if (Array.isArray(collection.data)) {
441 collection.data = collection.data.concat(dataToAdd);
442 } else {
443 collection.data = dataToAdd;
444 }
445 } else if (dataToAdd.constructor.name === 'Object' && Object.keys(dataToAdd).length) {
446 if (Array.isArray(collection.data)) {
447 collection.data.push(dataToAdd);
448 } else {
449 collection.data = [dataToAdd];
450 }
451 }
452 }
453 return collection;
454}
455
456function remediateOrgPolicy(config, constraintName, policyType, policyValue, resource, remediation_file, putCall, pluginName, callback) {
457

Callers 1

executorCbFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected