-
Notifications
You must be signed in to change notification settings - Fork 0
/
newPurge.js
40 lines (32 loc) · 1.2 KB
/
newPurge.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require('./getUrl2').start(function(purge) {
// do stuff with the object defined in the other module
console.log(purge); // make sure data is received
var PurgerFactory = require('./node_modules/akamai-ccu-purge/index'); // this is the directory where the index.js of the node module was installed
// area where I placed the authentication tokens
var config = {
clientToken: '',
clientSecret: '',
accessToken: '',
host: '',
queue: ''
};
// area where urls are placed. More than one can be listed with comma separated values, currently prompted for file url
var objects = [
purge
];
// Go for it!
var Purger = PurgerFactory.create(config);
Purger.purgeObjects(objects, function(err, res) {
console.log('------------------------');
console.log('Purge Result:', res.body);
console.log('------------------------');
Purger.checkPurgeStatus(res.body.progressUri, function(err, res) {
console.log('Purge Status', res.body);
console.log('------------------------');
Purger.checkQueueLength(function(err, res) {
console.log('Queue Length', res.body);
console.log('------------------------');
});
});
});
});