Files
enm-cli/lib/components/TopologyBrowser/commands/sync.js
Vyacheslav.Sviridov 1fb7a6f81b first commit
2022-05-13 18:13:36 +06:00

30 lines
774 B
JavaScript

const colors = require('colors')
const requestWrapper = require('../../util/requestWrapper')
async function sync(fdn) {
const meContextFind = fdn.match(/(NetworkElement|MeContext)=([\w-]+),?/)
if (!meContextFind) {
console.log('No sync object in FDN!'.yellow)
return
}
const actionUrl = `${this.objectUrl}v1/perform-mo-action/NetworkElement=${meContextFind[2]},CmFunction=1?actionName=sync`
const axiosConfig = {
method: 'post',
url: actionUrl,
headers: {
'Content-Type': 'application/json'
},
}
const response = await requestWrapper(axiosConfig, 'Initiate Node Sync...')
if (response.status === 200) {
console.log(`
${response.data.body.bold}
${response.data.title.green}
`)
}
}
module.exports = sync