MCPcopy Index your code
hub / github.com/scality/cloudserver / getXml

Method getXml

tests/unit/helpers.js:492–515  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

490 this.AccessControlList.push(grant);
491 }
492 getXml() {
493 const xml = [];
494
495 function _pushChildren(obj) {
496 Object.keys(obj).forEach(element => {
497 if (obj[element] !== undefined && element !== 'Type') {
498 xml.push(`<${element}>${obj[element]}</${element}>`);
499 }
500 });
501 }
502 xml.push('<AccessControlPolicy xmlns=' +
503 '"http://s3.amazonaws.com/doc/2006-03-01/">', '<Owner>');
504 _pushChildren(this.Owner);
505 xml.push('</Owner>', '<AccessControlList>');
506 this.AccessControlList.forEach(grant => {
507 xml.push('<Grant>', `<Grantee xsi:type="${grant.Grantee.Type}">`);
508 _pushChildren(grant.Grantee);
509 xml.push('</Grantee>',
510 `<Permission>${grant.Permission}</Permission>`,
511 '</Grant>');
512 });
513 xml.push('</AccessControlList>', '</AccessControlPolicy>');
514 return xml.join('');
515 }
516}
517
518function createRequestContext(apiMethod, request) {

Callers

nothing calls this directly

Calls 1

_pushChildrenFunction · 0.85

Tested by

no test coverage detected