/** * Initializes a new instance of the VirtualMachineCreateParameters class. * */ public VirtualMachineCreateParameters() { this.setConfigurationSets(new LazyArrayList<ConfigurationSet>()); this.setDataVirtualHardDisks(new LazyArrayList<DataVirtualHardDisk>()); this.setResourceExtensionReferences(new LazyArrayList<ResourceExtensionReference>()); }
if (parameters.getConfigurationSets() != null) { for (ConfigurationSet configurationSetsParameterItem : parameters.getConfigurationSets()) { if (configurationSetsParameterItem.getDomainJoin() != null) { if (configurationSetsParameterItem.getDomainJoin().getCredentials() != null) { if (parameters.getRoleName() == null) { throw new NullPointerException("parameters.RoleName"); roleNameElement.appendChild(requestDoc.createTextNode(parameters.getRoleName())); persistentVMRoleElement.appendChild(roleNameElement); if (parameters.getConfigurationSets() != null) { Element configurationSetsSequenceElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "ConfigurationSets"); for (ConfigurationSet configurationSetsItem : parameters.getConfigurationSets()) { Element configurationSetElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "ConfigurationSet"); configurationSetsSequenceElement.appendChild(configurationSetElement); if (parameters.getAvailabilitySetName() != null) { Element availabilitySetNameElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "AvailabilitySetName"); availabilitySetNameElement.appendChild(requestDoc.createTextNode(parameters.getAvailabilitySetName())); persistentVMRoleElement.appendChild(availabilitySetNameElement); if (parameters.getResourceExtensionReferences() != null) { Element resourceExtensionReferencesSequenceElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "ResourceExtensionReferences"); for (ResourceExtensionReference resourceExtensionReferencesItem : parameters.getResourceExtensionReferences()) { Element resourceExtensionReferenceElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "ResourceExtensionReference"); resourceExtensionReferencesSequenceElement.appendChild(resourceExtensionReferenceElement); if (parameters.getVMImageName() != null) {
VirtualMachineCreateParameters createParameters=new VirtualMachineCreateParameters(); ArrayList<ConfigurationSet> configurationSets = new ArrayList<ConfigurationSet>(); createParameters.setConfigurationSets(configurationSets); createParameters.setOSVirtualHardDisk(createOSVHD(vm, vm.getGroupName(),vm.getGroupName())); createParameters.setProvisionGuestAgent(true); createParameters.setRoleSize(VirtualMachineRoleSize.SMALL); createParameters.setRoleName(a.getName()); configurationSets.add(createConfigOS(a.getName(),vm)); configurationSets.add(createConfigNetwork());
if (parameters.getConfigurationSets() != null) { for (ConfigurationSet configurationSetsParameterItem : parameters.getConfigurationSets()) { if (configurationSetsParameterItem.getAdditionalUnattendContent() != null) { if (configurationSetsParameterItem.getAdditionalUnattendContent().getUnattendPasses() != null) { if (parameters.getRoleName() == null) { throw new NullPointerException("parameters.RoleName"); roleNameElement.appendChild(requestDoc.createTextNode(parameters.getRoleName())); persistentVMRoleElement.appendChild(roleNameElement); if (parameters.getConfigurationSets() != null) { if (parameters.getConfigurationSets() instanceof LazyCollection == false || ((LazyCollection) parameters.getConfigurationSets()).isInitialized()) { Element configurationSetsSequenceElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "ConfigurationSets"); for (ConfigurationSet configurationSetsItem : parameters.getConfigurationSets()) { Element configurationSetElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "ConfigurationSet"); configurationSetsSequenceElement.appendChild(configurationSetElement); if (parameters.getResourceExtensionReferences() != null) { if (parameters.getResourceExtensionReferences() instanceof LazyCollection == false || ((LazyCollection) parameters.getResourceExtensionReferences()).isInitialized()) { Element resourceExtensionReferencesSequenceElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "ResourceExtensionReferences"); for (ResourceExtensionReference resourceExtensionReferencesItem : parameters.getResourceExtensionReferences()) { Element resourceExtensionReferenceElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "ResourceExtensionReference"); resourceExtensionReferencesSequenceElement.appendChild(resourceExtensionReferenceElement); if (parameters.getVMImageName() != null) { Element vMImageNameElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "VMImageName"); vMImageNameElement.appendChild(requestDoc.createTextNode(parameters.getVMImageName())); persistentVMRoleElement.appendChild(vMImageNameElement);