.withRegion(template.getLocation()) .withExistingResourceGroup(template.getResourceGroupName()) .withLeafDomainLabel(azureAgent.getNodeName()) ).apply(); } catch (Exception e) {
@Override public VirtualMachineImpl withAvailabilityZone(AvailabilityZoneId zoneId) { if (isInCreateMode()) { // Note: Zone is not updatable as of now, so this is available only during definition time. // Service return `ResourceAvailabilityZonesCannotBeModified` upon attempt to append a new // zone or remove one. Trying to remove the last one means attempt to change resource from // zonal to regional, which is not supported. // // though not updatable, still adding above 'isInCreateMode' check just as a reminder to // take special handling of 'implicitPipCreatable' when avail zone update is supported. // if (this.inner().zones() == null) { this.inner().withZones(new ArrayList<String>()); } this.inner().zones().add(zoneId.toString()); // zone aware VM can be attached to only zone aware public IP. // if (this.implicitPipCreatable != null) { this.implicitPipCreatable.withAvailabilityZone(zoneId); } } return this; }
@Override public VirtualMachineImpl withAvailabilityZone(AvailabilityZoneId zoneId) { if (isInCreateMode()) { // Note: Zone is not updatable as of now, so this is available only during definition time. // Service return `ResourceAvailabilityZonesCannotBeModified` upon attempt to append a new // zone or remove one. Trying to remove the last one means attempt to change resource from // zonal to regional, which is not supported. // // though not updatable, still adding above 'isInCreateMode' check just as a reminder to // take special handling of 'implicitPipCreatable' when avail zone update is supported. // if (this.inner().zones() == null) { this.inner().withZones(new ArrayList<String>()); } this.inner().zones().add(zoneId.toString()); // zone aware VM can be attached to only zone aware public IP. // if (this.implicitPipCreatable != null) { this.implicitPipCreatable.withAvailabilityZone(zoneId); } } return this; }
@Override public VirtualMachineImpl withNewPrimaryPublicIPAddress(String leafDnsLabel) { PublicIPAddress.DefinitionStages.WithGroup definitionWithGroup = this.networkManager.publicIPAddresses() .define(this.namer.randomName("pip", 15)) .withRegion(this.regionName()); PublicIPAddress.DefinitionStages.WithCreate definitionAfterGroup; if (this.creatableGroup != null) { definitionAfterGroup = definitionWithGroup.withNewResourceGroup(this.creatableGroup); } else { definitionAfterGroup = definitionWithGroup.withExistingResourceGroup(this.resourceGroupName()); } this.implicitPipCreatable = definitionAfterGroup.withLeafDomainLabel(leafDnsLabel); // Create NIC with creatable PIP // Creatable<NetworkInterface> nicCreatable = this.nicDefinitionWithCreate .withNewPrimaryPublicIPAddress(this.implicitPipCreatable); this.creatablePrimaryNetworkInterfaceKey = this.addDependency(nicCreatable); return this; }
@Override public VirtualMachineImpl withNewPrimaryPublicIPAddress(String leafDnsLabel) { PublicIPAddress.DefinitionStages.WithGroup definitionWithGroup = this.networkManager.publicIPAddresses() .define(this.namer.randomName("pip", 15)) .withRegion(this.regionName()); PublicIPAddress.DefinitionStages.WithCreate definitionAfterGroup; if (this.creatableGroup != null) { definitionAfterGroup = definitionWithGroup.withNewResourceGroup(this.creatableGroup); } else { definitionAfterGroup = definitionWithGroup.withExistingResourceGroup(this.resourceGroupName()); } this.implicitPipCreatable = definitionAfterGroup.withLeafDomainLabel(leafDnsLabel); // Create NIC with creatable PIP // Creatable<NetworkInterface> nicCreatable = this.nicDefinitionWithCreate .withNewPrimaryPublicIPAddress(this.implicitPipCreatable); this.creatablePrimaryNetworkInterfaceKey = this.addDependency(nicCreatable); return this; }
LoadBalancerImpl withNewPublicIPAddress(String dnsLeafLabel, String frontendName) { PublicIPAddress.DefinitionStages.WithGroup precreatablePIP = manager().publicIPAddresses().define(dnsLeafLabel) .withRegion(this.regionName()); Creatable<PublicIPAddress> creatablePip; if (super.creatableGroup == null) { creatablePip = precreatablePIP.withExistingResourceGroup(this.resourceGroupName()).withLeafDomainLabel(dnsLeafLabel); } else { creatablePip = precreatablePIP.withNewResourceGroup(super.creatableGroup).withLeafDomainLabel(dnsLeafLabel); } return withNewPublicIPAddress(creatablePip, frontendName); }
private Creatable<PublicIPAddress> prepareCreatablePublicIP(String name, String leafDnsLabel) { PublicIPAddress.DefinitionStages.WithGroup definitionWithGroup = this.networkManager.publicIPAddresses() .define(name) .withRegion(this.parent().regionName()); PublicIPAddress.DefinitionStages.WithCreate definitionAfterGroup; if (this.parent().newGroup() != null) { definitionAfterGroup = definitionWithGroup.withNewResourceGroup(this.parent().newGroup()); } else { definitionAfterGroup = definitionWithGroup.withExistingResourceGroup(this.parent().resourceGroupName()); } return definitionAfterGroup.withLeafDomainLabel(leafDnsLabel); }
LoadBalancerImpl withNewPublicIPAddress(String dnsLeafLabel, String frontendName) { PublicIPAddress.DefinitionStages.WithGroup precreatablePIP = manager().publicIPAddresses().define(dnsLeafLabel) .withRegion(this.regionName()); Creatable<PublicIPAddress> creatablePip; if (super.creatableGroup == null) { creatablePip = precreatablePIP.withExistingResourceGroup(this.resourceGroupName()).withLeafDomainLabel(dnsLeafLabel); } else { creatablePip = precreatablePIP.withNewResourceGroup(super.creatableGroup).withLeafDomainLabel(dnsLeafLabel); } return withNewPublicIPAddress(creatablePip, frontendName); }
private Creatable<PublicIPAddress> prepareCreatablePublicIP(String name, String leafDnsLabel) { PublicIPAddress.DefinitionStages.WithGroup definitionWithGroup = this.networkManager.publicIPAddresses() .define(name) .withRegion(this.parent().regionName()); PublicIPAddress.DefinitionStages.WithCreate definitionAfterGroup; if (this.parent().newGroup() != null) { definitionAfterGroup = definitionWithGroup.withNewResourceGroup(this.parent().newGroup()); } else { definitionAfterGroup = definitionWithGroup.withExistingResourceGroup(this.parent().resourceGroupName()); } return definitionAfterGroup.withLeafDomainLabel(leafDnsLabel); }