-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
30 lines (24 loc) · 780 Bytes
/
index.js
File metadata and controls
30 lines (24 loc) · 780 Bytes
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
import { S3Client, PutObjectCommand} from '@aws-sdk/client-s3';
import { getProducers } from "@telosnetwork/validator-checks";
const s3Client = new S3Client({ region: 'us-east-1'});
const run = async (bucketParams) => {
await s3Client.send(new PutObjectCommand(bucketParams));
console.log(
`Successfully uploaded object:${bucketParams.Bucket}/${bucketParams.Key}`
);
};
(async ()=> {
try{
const producerData = await getProducers();
const producerDataJson = JSON.stringify(producerData);
const bucketParams = {
Bucket: 'telos-producer-validation',
ContentType: 'application/json',
Key: `test-data-${Date.now()}`,
Body: producerDataJson
};
await run(bucketParams);
} catch(err) {
console.error(err);
}
})();