5

I've setup an API gateway integration for S3 that calls the ListBucket endpoint. This returns XML like

<?xml version="1.0" encoding="UTF-8"?>
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
  <Name>bucketname</Name>
  <Prefix/>
  <Marker/>
  <MaxKeys>1000</MaxKeys>
  <IsTruncated>false</IsTruncated>
  <Contents>
    <Key>foldername</Key>
    <LastModified>2020-05-28T09:56:21.000Z</LastModified>
    <Size>0</Size>
    <StorageClass>STANDARD</StorageClass>
  </Contents>
  <Contents>
    <Key>times/sporting.json</Key>
    <LastModified>2020-06-02T09:57:23.000Z</LastModified>
    <Size>14</Size>
    <Owner>
      <ID>ID</ID>
      <DisplayName>ACCOUNT-NAME</DisplayName>
    </Owner>
    <StorageClass>STANDARD</StorageClass>
  </Contents>
  <Contents>
    <Key>key/test.json</Key>
    <LastModified>2020-05-28T11:02:17.000Z</LastModified>
    <Size>16</Size>
    <StorageClass>STANDARD</StorageClass>
  </Contents>
</ListBucketResult>

Is there a way using VTL mapping templates to turn this response into JSON? The XML seems to be returned as a string and none of the JSONPath directives return anything like $inputRoot['?xml'] or$inputRoot.ListBucketResult`

Tom
  • 1,546
  • 2
  • 20
  • 42

0 Answers0