ConfigurationSet configurationSet = new ConfigurationSet(); String type=ConfigurationSetTypes.LINUXPROVISIONINGCONFIGURATION; if(!vm.getOs().equals("")) if(vm.getOs().toLowerCase().contains("win")) type=ConfigurationSetTypes.WINDOWSPROVISIONINGCONFIGURATION; configurationSet.setConfigurationSetType(type); configurationSet.setDisableSshPasswordAuthentication(true); configurationSet.setComputerName(vmName); configurationSet.setAdminPassword(adminUserPassword); configurationSet.setUserName(adminUserName); configurationSet.setUserPassword(adminUserPassword); configurationSet.setAdminUserName(adminUserName); configurationSet.setEnableAutomaticUpdates(true); configurationSet.setHostName(vmName+".cloudapp.net"); configurationSetList.add(configurationSet); keyPair.setFingerprint(getFingerprint(vmName)); keyPair.setPath("/home/"+adminUserName+"/.ssh/authorized_keys"); //TODO: update for windows configurationSet.setSshSettings(ssh);
private ConfigurationSet createConfigNetwork(){ ConfigurationSet networkConfigset = new ConfigurationSet(); networkConfigset.setConfigurationSetType(ConfigurationSetTypes.NETWORKCONFIGURATION); // Define endpoints ArrayList<InputEndpoint> enpoints = new ArrayList<InputEndpoint>(); networkConfigset.setInputEndpoints(enpoints); InputEndpoint sshPort = new InputEndpoint(); enpoints.add(sshPort); sshPort.setPort(22); sshPort.setLocalPort(22); sshPort.setName("ssh"); sshPort.setProtocol(InputEndpointTransportProtocol.TCP); return networkConfigset; }
for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(configurationSetsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ConfigurationSet").size(); i1 = i1 + 1) { org.w3c.dom.Element configurationSetsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(configurationSetsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ConfigurationSet").get(i1)); ConfigurationSet configurationSetInstance = new ConfigurationSet(); result.getConfigurationSets().add(configurationSetInstance); String configurationSetTypeInstance; configurationSetTypeInstance = configurationSetTypeElement.getTextContent(); configurationSetInstance.setConfigurationSetType(configurationSetTypeInstance); org.w3c.dom.Element inputEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(inputEndpointsSequenceElement, "http://schemas.microsoft.com/windowsazure", "InputEndpoint").get(i2)); InputEndpoint inputEndpointInstance = new InputEndpoint(); configurationSetInstance.getInputEndpoints().add(inputEndpointInstance); for (int i4 = 0; i4 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(subnetNamesSequenceElement, "http://schemas.microsoft.com/windowsazure", "SubnetName").size(); i4 = i4 + 1) { org.w3c.dom.Element subnetNamesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(subnetNamesSequenceElement, "http://schemas.microsoft.com/windowsazure", "SubnetName").get(i4)); configurationSetInstance.getSubnetNames().add(subnetNamesElement.getTextContent()); String staticVirtualNetworkIPAddressInstance; staticVirtualNetworkIPAddressInstance = staticVirtualNetworkIPAddressElement.getTextContent(); configurationSetInstance.setStaticVirtualNetworkIPAddress(staticVirtualNetworkIPAddressInstance); String computerNameInstance; computerNameInstance = computerNameElement.getTextContent(); configurationSetInstance.setComputerName(computerNameInstance); String adminPasswordInstance; adminPasswordInstance = adminPasswordElement.getTextContent(); configurationSetInstance.setAdminPassword(adminPasswordInstance);
for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(configurationSetsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ConfigurationSet").size(); i1 = i1 + 1) { org.w3c.dom.Element configurationSetsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(configurationSetsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ConfigurationSet").get(i1)); ConfigurationSet configurationSetInstance = new ConfigurationSet(); result.getConfigurationSets().add(configurationSetInstance); String configurationSetTypeInstance; configurationSetTypeInstance = configurationSetTypeElement.getTextContent(); configurationSetInstance.setConfigurationSetType(configurationSetTypeInstance); org.w3c.dom.Element inputEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(inputEndpointsSequenceElement, "http://schemas.microsoft.com/windowsazure", "InputEndpoint").get(i2)); InputEndpoint inputEndpointInstance = new InputEndpoint(); configurationSetInstance.getInputEndpoints().add(inputEndpointInstance); for (int i4 = 0; i4 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(subnetNamesSequenceElement, "http://schemas.microsoft.com/windowsazure", "SubnetName").size(); i4 = i4 + 1) { org.w3c.dom.Element subnetNamesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(subnetNamesSequenceElement, "http://schemas.microsoft.com/windowsazure", "SubnetName").get(i4)); configurationSetInstance.getSubnetNames().add(subnetNamesElement.getTextContent()); String staticVirtualNetworkIPAddressInstance; staticVirtualNetworkIPAddressInstance = staticVirtualNetworkIPAddressElement.getTextContent(); configurationSetInstance.setStaticVirtualNetworkIPAddress(staticVirtualNetworkIPAddressInstance); org.w3c.dom.Element publicIPsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(publicIPsSequenceElement, "http://schemas.microsoft.com/windowsazure", "PublicIP").get(i5)); ConfigurationSet.PublicIP publicIPInstance = new ConfigurationSet.PublicIP(); configurationSetInstance.getPublicIPs().add(publicIPInstance); org.w3c.dom.Element networkInterfacesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(networkInterfacesSequenceElement, "http://schemas.microsoft.com/windowsazure", "NetworkInterface").get(i6)); NetworkInterface networkInterfaceInstance = new NetworkInterface(); configurationSetInstance.getNetworkInterfaces().add(networkInterfaceInstance);
for (int i10 = 0; i10 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(configurationSetsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ConfigurationSet").size(); i10 = i10 + 1) { org.w3c.dom.Element configurationSetsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(configurationSetsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ConfigurationSet").get(i10)); ConfigurationSet configurationSetInstance = new ConfigurationSet(); roleInstance.getConfigurationSets().add(configurationSetInstance); String configurationSetTypeInstance; configurationSetTypeInstance = configurationSetTypeElement.getTextContent(); configurationSetInstance.setConfigurationSetType(configurationSetTypeInstance); org.w3c.dom.Element inputEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(inputEndpointsSequenceElement, "http://schemas.microsoft.com/windowsazure", "InputEndpoint").get(i11)); InputEndpoint inputEndpointInstance = new InputEndpoint(); configurationSetInstance.getInputEndpoints().add(inputEndpointInstance); for (int i13 = 0; i13 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(subnetNamesSequenceElement, "http://schemas.microsoft.com/windowsazure", "SubnetName").size(); i13 = i13 + 1) { org.w3c.dom.Element subnetNamesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(subnetNamesSequenceElement, "http://schemas.microsoft.com/windowsazure", "SubnetName").get(i13)); configurationSetInstance.getSubnetNames().add(subnetNamesElement.getTextContent()); String staticVirtualNetworkIPAddressInstance; staticVirtualNetworkIPAddressInstance = staticVirtualNetworkIPAddressElement.getTextContent(); configurationSetInstance.setStaticVirtualNetworkIPAddress(staticVirtualNetworkIPAddressInstance); String computerNameInstance; computerNameInstance = computerNameElement.getTextContent(); configurationSetInstance.setComputerName(computerNameInstance); String adminPasswordInstance; adminPasswordInstance = adminPasswordElement.getTextContent(); configurationSetInstance.setAdminPassword(adminPasswordInstance);
for (int i10 = 0; i10 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(configurationSetsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ConfigurationSet").size(); i10 = i10 + 1) { org.w3c.dom.Element configurationSetsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(configurationSetsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ConfigurationSet").get(i10)); ConfigurationSet configurationSetInstance = new ConfigurationSet(); roleInstance.getConfigurationSets().add(configurationSetInstance); String configurationSetTypeInstance; configurationSetTypeInstance = configurationSetTypeElement.getTextContent(); configurationSetInstance.setConfigurationSetType(configurationSetTypeInstance); org.w3c.dom.Element inputEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(inputEndpointsSequenceElement, "http://schemas.microsoft.com/windowsazure", "InputEndpoint").get(i11)); InputEndpoint inputEndpointInstance = new InputEndpoint(); configurationSetInstance.getInputEndpoints().add(inputEndpointInstance); for (int i13 = 0; i13 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(subnetNamesSequenceElement, "http://schemas.microsoft.com/windowsazure", "SubnetName").size(); i13 = i13 + 1) { org.w3c.dom.Element subnetNamesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(subnetNamesSequenceElement, "http://schemas.microsoft.com/windowsazure", "SubnetName").get(i13)); configurationSetInstance.getSubnetNames().add(subnetNamesElement.getTextContent()); String staticVirtualNetworkIPAddressInstance; staticVirtualNetworkIPAddressInstance = staticVirtualNetworkIPAddressElement.getTextContent(); configurationSetInstance.setStaticVirtualNetworkIPAddress(staticVirtualNetworkIPAddressInstance); String computerNameInstance; computerNameInstance = computerNameElement.getTextContent(); configurationSetInstance.setComputerName(computerNameInstance); String adminPasswordInstance; adminPasswordInstance = adminPasswordElement.getTextContent(); configurationSetInstance.setAdminPassword(adminPasswordInstance);
for (int i14 = 0; i14 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(configurationSetsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ConfigurationSet").size(); i14 = i14 + 1) { org.w3c.dom.Element configurationSetsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(configurationSetsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ConfigurationSet").get(i14)); ConfigurationSet configurationSetInstance = new ConfigurationSet(); roleInstance.getConfigurationSets().add(configurationSetInstance); String configurationSetTypeInstance; configurationSetTypeInstance = configurationSetTypeElement.getTextContent(); configurationSetInstance.setConfigurationSetType(configurationSetTypeInstance); org.w3c.dom.Element inputEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(inputEndpointsSequenceElement, "http://schemas.microsoft.com/windowsazure", "InputEndpoint").get(i15)); InputEndpoint inputEndpointInstance = new InputEndpoint(); configurationSetInstance.getInputEndpoints().add(inputEndpointInstance); for (int i17 = 0; i17 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(subnetNamesSequenceElement, "http://schemas.microsoft.com/windowsazure", "SubnetName").size(); i17 = i17 + 1) { org.w3c.dom.Element subnetNamesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(subnetNamesSequenceElement, "http://schemas.microsoft.com/windowsazure", "SubnetName").get(i17)); configurationSetInstance.getSubnetNames().add(subnetNamesElement.getTextContent()); String staticVirtualNetworkIPAddressInstance; staticVirtualNetworkIPAddressInstance = staticVirtualNetworkIPAddressElement.getTextContent(); configurationSetInstance.setStaticVirtualNetworkIPAddress(staticVirtualNetworkIPAddressInstance); org.w3c.dom.Element publicIPsElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(publicIPsSequenceElement2, "http://schemas.microsoft.com/windowsazure", "PublicIP").get(i18)); ConfigurationSet.PublicIP publicIPInstance2 = new ConfigurationSet.PublicIP(); configurationSetInstance.getPublicIPs().add(publicIPInstance2); org.w3c.dom.Element networkInterfacesElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(networkInterfacesSequenceElement2, "http://schemas.microsoft.com/windowsazure", "NetworkInterface").get(i19)); NetworkInterface networkInterfaceInstance2 = new NetworkInterface(); configurationSetInstance.getNetworkInterfaces().add(networkInterfaceInstance2);
for (int i15 = 0; i15 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(configurationSetsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ConfigurationSet").size(); i15 = i15 + 1) { org.w3c.dom.Element configurationSetsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(configurationSetsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ConfigurationSet").get(i15)); ConfigurationSet configurationSetInstance = new ConfigurationSet(); roleInstance.getConfigurationSets().add(configurationSetInstance); String configurationSetTypeInstance; configurationSetTypeInstance = configurationSetTypeElement.getTextContent(); configurationSetInstance.setConfigurationSetType(configurationSetTypeInstance); org.w3c.dom.Element inputEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(inputEndpointsSequenceElement, "http://schemas.microsoft.com/windowsazure", "InputEndpoint").get(i16)); InputEndpoint inputEndpointInstance = new InputEndpoint(); configurationSetInstance.getInputEndpoints().add(inputEndpointInstance); for (int i18 = 0; i18 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(subnetNamesSequenceElement, "http://schemas.microsoft.com/windowsazure", "SubnetName").size(); i18 = i18 + 1) { org.w3c.dom.Element subnetNamesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(subnetNamesSequenceElement, "http://schemas.microsoft.com/windowsazure", "SubnetName").get(i18)); configurationSetInstance.getSubnetNames().add(subnetNamesElement.getTextContent()); String staticVirtualNetworkIPAddressInstance; staticVirtualNetworkIPAddressInstance = staticVirtualNetworkIPAddressElement.getTextContent(); configurationSetInstance.setStaticVirtualNetworkIPAddress(staticVirtualNetworkIPAddressInstance); org.w3c.dom.Element publicIPsElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(publicIPsSequenceElement2, "http://schemas.microsoft.com/windowsazure", "PublicIP").get(i19)); ConfigurationSet.PublicIP publicIPInstance2 = new ConfigurationSet.PublicIP(); configurationSetInstance.getPublicIPs().add(publicIPInstance2); org.w3c.dom.Element networkInterfacesElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(networkInterfacesSequenceElement2, "http://schemas.microsoft.com/windowsazure", "NetworkInterface").get(i20)); NetworkInterface networkInterfaceInstance2 = new NetworkInterface(); configurationSetInstance.getNetworkInterfaces().add(networkInterfaceInstance2);
for (int i11 = 0; i11 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(configurationSetsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ConfigurationSet").size(); i11 = i11 + 1) { org.w3c.dom.Element configurationSetsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(configurationSetsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ConfigurationSet").get(i11)); ConfigurationSet configurationSetInstance = new ConfigurationSet(); roleInstance.getConfigurationSets().add(configurationSetInstance); String configurationSetTypeInstance; configurationSetTypeInstance = configurationSetTypeElement.getTextContent(); configurationSetInstance.setConfigurationSetType(configurationSetTypeInstance); org.w3c.dom.Element inputEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(inputEndpointsSequenceElement, "http://schemas.microsoft.com/windowsazure", "InputEndpoint").get(i12)); InputEndpoint inputEndpointInstance = new InputEndpoint(); configurationSetInstance.getInputEndpoints().add(inputEndpointInstance); for (int i14 = 0; i14 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(subnetNamesSequenceElement, "http://schemas.microsoft.com/windowsazure", "SubnetName").size(); i14 = i14 + 1) { org.w3c.dom.Element subnetNamesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(subnetNamesSequenceElement, "http://schemas.microsoft.com/windowsazure", "SubnetName").get(i14)); configurationSetInstance.getSubnetNames().add(subnetNamesElement.getTextContent()); String staticVirtualNetworkIPAddressInstance; staticVirtualNetworkIPAddressInstance = staticVirtualNetworkIPAddressElement.getTextContent(); configurationSetInstance.setStaticVirtualNetworkIPAddress(staticVirtualNetworkIPAddressInstance); String computerNameInstance; computerNameInstance = computerNameElement.getTextContent(); configurationSetInstance.setComputerName(computerNameInstance); String adminPasswordInstance; adminPasswordInstance = adminPasswordElement.getTextContent(); configurationSetInstance.setAdminPassword(adminPasswordInstance);
for (int i14 = 0; i14 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(configurationSetsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ConfigurationSet").size(); i14 = i14 + 1) { org.w3c.dom.Element configurationSetsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(configurationSetsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ConfigurationSet").get(i14)); ConfigurationSet configurationSetInstance = new ConfigurationSet(); roleInstance.getConfigurationSets().add(configurationSetInstance); String configurationSetTypeInstance; configurationSetTypeInstance = configurationSetTypeElement.getTextContent(); configurationSetInstance.setConfigurationSetType(configurationSetTypeInstance); org.w3c.dom.Element inputEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(inputEndpointsSequenceElement, "http://schemas.microsoft.com/windowsazure", "InputEndpoint").get(i15)); InputEndpoint inputEndpointInstance = new InputEndpoint(); configurationSetInstance.getInputEndpoints().add(inputEndpointInstance); for (int i17 = 0; i17 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(subnetNamesSequenceElement, "http://schemas.microsoft.com/windowsazure", "SubnetName").size(); i17 = i17 + 1) { org.w3c.dom.Element subnetNamesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(subnetNamesSequenceElement, "http://schemas.microsoft.com/windowsazure", "SubnetName").get(i17)); configurationSetInstance.getSubnetNames().add(subnetNamesElement.getTextContent()); String staticVirtualNetworkIPAddressInstance; staticVirtualNetworkIPAddressInstance = staticVirtualNetworkIPAddressElement.getTextContent(); configurationSetInstance.setStaticVirtualNetworkIPAddress(staticVirtualNetworkIPAddressInstance); org.w3c.dom.Element publicIPsElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(publicIPsSequenceElement2, "http://schemas.microsoft.com/windowsazure", "PublicIP").get(i18)); ConfigurationSet.PublicIP publicIPInstance2 = new ConfigurationSet.PublicIP(); configurationSetInstance.getPublicIPs().add(publicIPInstance2); org.w3c.dom.Element networkInterfacesElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(networkInterfacesSequenceElement2, "http://schemas.microsoft.com/windowsazure", "NetworkInterface").get(i19)); NetworkInterface networkInterfaceInstance2 = new NetworkInterface(); configurationSetInstance.getNetworkInterfaces().add(networkInterfaceInstance2);