This file contains hidden or 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
const fetch = require('node-fetch'); | |
const MAX_RETRIES = 5 | |
const fetchWithRetry = (origResolve, origReject, attemptCount) => { | |
attemptCount = attemptCount ? attemptCount : 0 | |
const url = process.argv[2] | |
if(!url){ | |
console.log('no url passed in') | |
return | |
} |
This file contains hidden or 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
const fetch = require('node-fetch'); | |
const MAX_RETRIES = 5 | |
const fetchWithRetry = (origResolve, origReject, attemptCount) => { | |
attemptCount = attemptCount ? attemptCount : 0 | |
const url = process.argv[2] | |
if(!url){ | |
console.log('no url passed in') | |
return | |
} |
This file contains hidden or 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
` | |
Full listing of the s3 bucket: | |
list object called, NextContinuationToken = undefined | |
list object called, NextContinuationToken = 1/zWHq7hcIXgEXP1fSQwT6tEKnFNpuSb9rItEbpAw6l22CP0xXd5GDxqQStbll0GEYlh800/xNMQ= | |
list object called, NextContinuationToken = 1Ib26WeZTX20jv8zPs1SDM6W8RRebspox7mEZYqmMcHo8ioUTvFrRHB4o/SIchY2x+n5y9QKuLYA= | |
list object called, NextContinuationToken = 1t1T3Va5FoliWTVMtb/PEPtgPRLCwF0+jDYzuuW867aAyc0eUlfBOoyFEbvw/ma+ylA1BvH+0uLo= | |
list object called, NextContinuationToken = 112Rj6oLqL+fZ/U8oaP63dfX9cFS//LW6+D2/c28vYE8QRATfBn3SW+LBhWdUKPB+TFy27Wmd1vE= | |
done, resolving final result | |
resolving for NextContinuationToken 112Rj6oLqL+fZ/U8oaP63dfX9cFS//LW6+D2/c28vYE8QRATfBn3SW+LBhWdUKPB+TFy27Wmd1vE= | |
resolving for NextContinuationToken 1t1T3Va5FoliWTVMtb/PEPtgPRLCwF0+jDYzuuW867aAyc0eUlfBOoyFEbvw/ma+ylA1BvH+0uLo= |
This file contains hidden or 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
/* | |
Example of a Promise chain. | |
As each Promise is resolved, the resolved value is passed | |
to the next Promise in the chain. | |
*/ | |
a().then( (resultFromA) => { | |
b(resultFromA).then( (resultFromB) => { | |
c(resultFromB).then( (resultFromC) => { | |
d( (resultFromC).then( |
This file contains hidden or 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
const params = {key: 'value'} | |
const successCallback = () => {console.log('success'}) | |
const failureCallback = () => {console.log('failure'}) | |
// callback pattern | |
doSomething(params, successCallback, failureCallback) | |
//Promise pattern | |
doSomething(params).then(successCallback).catch(failureCallback) |
This file contains hidden or 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
const AWS = require('aws-sdk'); | |
const route53 = new AWS.Route53({ | |
apiVersion: '2013-04-01' | |
}) | |
const MAX_RETRIES = 4 | |
const RETRY_INTERVAL = 1000 | |
const getChange = (prevAttemptCount, origResolve, origReject) => { |
This file contains hidden or 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
const AWS = require('aws-sdk'); | |
const s3 = new AWS.S3({ apiVersion: '2006-03-01', region: 'us-east-1' }); | |
/** | |
Recursive method to list all the objects in an S3 bucket which may be paginated. | |
**/ | |
const listObjects = ( | |
resultList, // This is the list of combined results from all calls. | |
NextContinuationToken // Tells S3 to get the next page of results. |