This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.handler = (event, context, callback) => { | |
const response = { | |
statusCode: 301, | |
headers: { | |
Location: 'https://google.com', | |
} | |
}; | |
return callback(null, response); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
bucket=$1 | |
set -e | |
echo "Removing all versions from $bucket" | |
versions=`aws s3api list-object-versions --bucket $bucket |jq '.Versions'` | |
markers=`aws s3api list-object-versions --bucket $bucket |jq '.DeleteMarkers'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Joins path segments. Preserves initial "/" and resolves ".." and "." | |
// Does not support using ".." to go above/outside the root. | |
// This means that join("foo", "../../bar") will not resolve to "../bar" | |
function join(/* path segments */) { | |
// Split the inputs into a list of path commands. | |
var parts = []; | |
for (var i = 0, l = arguments.length; i < l; i++) { | |
parts = parts.concat(arguments[i].split("/")); | |
} | |
// Interpret the path commands to get the new resolved path. |