Last active
March 7, 2017 14:43
-
-
Save Cyreex/f9af89a04374b198d2155ba114dc0c54 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var promise, requestPromise, | |
i, | |
networks = [], | |
deferred = $.Deferred(), vmNet; | |
var virtualNetworks = data.vmNetworks; | |
var networkId = data.network; | |
if (networkId && virtualNetworks && virtualNetworks.length > 0) { | |
for (i = 0; i < virtualNetworks.length; i++) { | |
if (virtualNetworks[i].id === networkId) { | |
vmNet = virtualNetworks[i]; | |
break; | |
} | |
} | |
} | |
networks.push(vmNet.name); | |
promise = ajax.createVMInstanceFromTemplate({ | |
subscriptionId: data.subscriptionId, | |
templateId: data.templateId, | |
osType: data.osType, | |
name: data.name, | |
adminAccount: data.userName, | |
password: data.password, | |
productKey: data.productKey, | |
sshKey: data.sshKey, | |
networks: networks, | |
shielded: data.shielded, | |
vmShieldingDataId: data.vmShieldingDataId | |
}); | |
promise | |
.done(function(result) { | |
global.VMExtension.Utilities.addVMPlaceholder(result.virtualMachine); | |
deferred.resolve(result); | |
}) | |
.fail(function(result) { | |
deferred.reject(result); | |
}); | |
return deferred.promise(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment