Commit 9f2eb743 authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent 47ab20de
......@@ -105,11 +105,12 @@ async function getAllIps() {
let url = generateUrl(foundDc, 'GetPurchasedIpAddresses')
let d = await doRequest(url, auth)
masterIp = await getIp()
let arr = []
d = d.Value
for (let i = 0; i < d.length; i++) {
arr.push(d[i])
if (d[i].Value !== masterIp)
arr.push(d[i])
}
return arr
......@@ -117,7 +118,7 @@ async function getAllIps() {
async function deleteAllIps() {
masterIp=await getIp()
masterIp = await getIp()
let ips = await getAllIps(foundDc)
for (let i = 0; i < ips.length; i++) {
if (ips[i].Value !== masterIp) {
......@@ -132,7 +133,7 @@ async function deleteAllIps() {
}
async function attachedToServer( resourceId) {
async function attachedToServer(resourceId) {
let url = generateUrl(foundDc, 'SetEnqueueAssociateIpAddress')
let body = auth
......@@ -145,7 +146,7 @@ async function attachedToServer( resourceId) {
}
async function unAttachedToServer( resourceId) {
async function unAttachedToServer(resourceId) {
let url = generateUrl(foundDc, 'SetEnqueueDeassociateIpAddress')
let body = auth
......@@ -158,7 +159,7 @@ async function unAttachedToServer( resourceId) {
}
async function attachedToServerByIp( ip) {
async function attachedToServerByIp(ip) {
let ips = await getAllIps(foundDc)
for (let i = 0; i < ips.length; i++) {
......@@ -175,9 +176,9 @@ async function attachedToServerByIp( ip) {
}
async function RemovedByIp( ip) {
async function RemovedByIp(ip) {
let ips = await getAllIps(foundDc)
masterIp=await getIp()
masterIp = await getIp()
for (let i = 0; i < ips.length; i++) {
if (ips[i].Value === ip && ip !== masterIp) {
await deleteIp(foundDc, ips[i].ResourceId)
......@@ -203,8 +204,6 @@ async function deleteIp(id) {
}
async function doRequest(url, body) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment