garage-admin-sdk-generator/example/javascript/short.js

18 lines
501 B
JavaScript
Raw Normal View History

2023-11-22 20:28:55 +00:00
const garage = require('garage_administration_api_v1garage_v0_9_0');
2022-11-13 13:24:06 +00:00
2023-11-22 20:28:55 +00:00
const api = new garage.ApiClient("http://127.0.0.1:3903/v1");
2022-11-13 13:24:06 +00:00
api.authentications['bearerAuth'].accessToken = "s3cr3t";
const [node, layout, key, bucket] = [
new garage.NodesApi(api),
new garage.LayoutApi(api),
new garage.KeyApi(api),
new garage.BucketApi(api),
];
2022-11-13 13:37:55 +00:00
node.getNodes().then((data) => {
console.log(`nodes: ${Object.values(data.knownNodes).map(n => n.hostname)}`)
}, (error) => {
console.error(error);
});