<?xml version="1.0" encoding="UTF-8"?>
<HttpGatewayClientFlow>
  <Calls>
    <Call>
      <Name>ListItem</Name>
      <Method>GET</Method>
      <Url type="ConstantExpression">https://REPLACE_BY_YOUR_BUCKET.s3.REGION.amazonaws.com?list-type=2</Url>
      <PostAction>
        <NextStep type="ScriptExpression">if(keyToFetch != null){ &apos;ExtractItem&apos;;}else{&apos;&apos;;}</NextStep>
        <Variables>
          <Variable>
            <Name>resultList</Name>
            <Value type="ScriptExpression">JSON.parse(HttpClientFunctions.xmlToJson(responseContent)).ListBucketResult.Contents</Value>
          </Variable>
          <Variable>
            <Name>keyToFetch</Name>
            <Value type="ScriptExpression">if(Array.isArray(resultList)){resultList[counter].Key}else{if(resultList!=null){resultList.Key}else{null}}</Value>
          </Variable>
        </Variables>
        <Wait>0</Wait>
        <Validate>
          <ApplyRetryStrategy>false</ApplyRetryStrategy>
        </Validate>
        <SetMetadatas>
        </SetMetadatas>
      </PostAction>
      <Authentication>
        <PreemptiveAuthentication>false</PreemptiveAuthentication>
        <HttpAuthenticationHeaders>
        </HttpAuthenticationHeaders>
        <MetadataFromLoginResponse>
        </MetadataFromLoginResponse>
        <AuthFormFields>
        </AuthFormFields>
        <UsedGlobalAuthentication>true</UsedGlobalAuthentication>
      </Authentication>
      <Wait>0</Wait>
      <ValidReturnCodes type="ConstantExpression">200,201,202,204,205</ValidReturnCodes>
      <Headers>
      </Headers>
      <Timeout>90000</Timeout>
      <PostExtraParameters>
      </PostExtraParameters>
    </Call>
    <Call>
      <Name>ExtractItem</Name>
      <Method>GET</Method>
      <Url type="ScriptExpression">&apos;https://REPLACE_BY_YOUR_BUCKET.s3.REGION.amazonaws.com/&apos;+keyToFetch</Url>
      <PostAction>
        <CreateMessage>
          <Content type="ScriptExpression">HttpClientFunctions.xmlToJson(responseContent)</Content>
          <ResponseFileName type="ScriptExpression">keyToFetch</ResponseFileName>
          <SetMetadatas>
          </SetMetadatas>
          <ConnectedGateways>
          </ConnectedGateways>
          <UserMetadataTransferStrategy>transferSmallOnes</UserMetadataTransferStrategy>
        </CreateMessage>
        <NextStep type="ScriptExpression">if(keyToFetch != null){ &apos;ExtractItem&apos;;}else{&apos;&apos;;}</NextStep>
        <Variables>
          <Variable>
            <Name>counter</Name>
            <Value type="ScriptExpression">counter+1</Value>
          </Variable>
          <Variable>
            <Name>keyToFetch</Name>
            <Value type="ScriptExpression">if(Array.isArray(resultList)){resultList[counter].Key;}else{null;}</Value>
          </Variable>
        </Variables>
        <Wait>0</Wait>
        <Validate>
          <ApplyRetryStrategy>false</ApplyRetryStrategy>
        </Validate>
        <SetMetadatas>
        </SetMetadatas>
      </PostAction>
      <Authentication>
        <PreemptiveAuthentication>false</PreemptiveAuthentication>
        <HttpAuthenticationHeaders>
        </HttpAuthenticationHeaders>
        <MetadataFromLoginResponse>
        </MetadataFromLoginResponse>
        <AuthFormFields>
        </AuthFormFields>
        <UsedGlobalAuthentication>true</UsedGlobalAuthentication>
      </Authentication>
      <Wait>0</Wait>
      <ValidReturnCodes type="ConstantExpression">200,201,202,204,205</ValidReturnCodes>
      <Headers>
      </Headers>
      <Timeout>90000</Timeout>
      <PostExtraParameters>
      </PostExtraParameters>
    </Call>
  </Calls>
  <Session>
    <Authentication>
      <HttpAuthenticationType>AWS_SIGNATURE_V4</HttpAuthenticationType>
      <PreemptiveAuthentication>false</PreemptiveAuthentication>
      <HttpAuthenticationHeaders>
      </HttpAuthenticationHeaders>
      <MetadataFromLoginResponse>
      </MetadataFromLoginResponse>
      <AuthFormFields>
      </AuthFormFields>
      <UsedGlobalAuthentication>false</UsedGlobalAuthentication>
      <AwsCredentials>
        <AccessKey></AccessKey>
        <SecretKey></SecretKey>
        <Bucket></Bucket>
        <Region>
          <Name>EU_WEST_1</Name>
        </Region>
      </AwsCredentials>
    </Authentication>
  </Session>
  <ScriptLanguage>
    <Name>JS</Name>
  </ScriptLanguage>
  <Init>
    <Variables>
      <Variable>
        <Name>counter</Name>
        <Value type="ScriptExpression">0</Value>
      </Variable>
    </Variables>
    <FirstStep>ListItem</FirstStep>
  </Init>
</HttpGatewayClientFlow>
