com.microsoft.azure.management.network.PublicIPAddress Java Examples
The following examples show how to use
com.microsoft.azure.management.network.PublicIPAddress.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AzureVmPublicIpProvider.java From cloudbreak with Apache License 2.0 | 6 votes |
String getPublicIp(AzureClient azureClient, AzureUtils azureUtils, NetworkInterface networkInterface, String resourceGroup) { PublicIPAddress publicIpAddress = networkInterface.primaryIPConfiguration().getPublicIPAddress(); List<LoadBalancerBackend> backends = networkInterface.primaryIPConfiguration().listAssociatedLoadBalancerBackends(); List<LoadBalancerInboundNatRule> inboundNatRules = networkInterface.primaryIPConfiguration().listAssociatedLoadBalancerInboundNatRules(); String publicIp = null; if (!backends.isEmpty() || !inboundNatRules.isEmpty()) { publicIp = azureClient.getLoadBalancerIps(resourceGroup, azureUtils.getLoadBalancerId(resourceGroup)).get(0); } if (publicIpAddress != null && publicIpAddress.ipAddress() != null) { publicIp = publicIpAddress.ipAddress(); } return publicIp; }
Example #2
Source File: LoadBalancerImpl.java From azure-libraries-for-java with MIT License | 6 votes |
LoadBalancerImpl withNewPublicIPAddress(Creatable<PublicIPAddress> creatablePip, String frontendName) { String existingPipFrontendName = this.creatablePIPKeys.get(creatablePip.key()); if (frontendName == null) { if (existingPipFrontendName != null) { // Reuse frontend already associated with this PIP frontendName = existingPipFrontendName; } else { // Auto-named unique frontend frontendName = ensureUniqueFrontend().name(); } } if (existingPipFrontendName == null) { // No frontend associated with this PIP yet so create new association this.creatablePIPKeys.put(this.addDependency(creatablePip), frontendName); } else if (!existingPipFrontendName.equalsIgnoreCase(frontendName)) { // Existing PIP definition already in use but under a different frontend, so error throw new IllegalArgumentException("This public IP address definition is already associated with a frontend under a different name."); } return this; }
Example #3
Source File: VirtualMachineImpl.java From azure-libraries-for-java with MIT License | 6 votes |
@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; }
Example #4
Source File: PublicIPAddressImpl.java From azure-libraries-for-java with MIT License | 6 votes |
@Override public Observable<PublicIPAddress> createResourceAsync() { // Clean up empty DNS settings final PublicIPAddressDnsSettings dnsSettings = this.inner().dnsSettings(); if (dnsSettings != null) { if ((dnsSettings.domainNameLabel() == null || dnsSettings.domainNameLabel().isEmpty()) && (dnsSettings.fqdn() == null || dnsSettings.fqdn().isEmpty()) && (dnsSettings.reverseFqdn() == null || dnsSettings.reverseFqdn().isEmpty())) { this.inner().withDnsSettings(null); } } return this.manager().inner().publicIPAddresses().createOrUpdateAsync( this.resourceGroupName(), this.name(), this.inner()) .map(innerToFluentMap(this)); }
Example #5
Source File: NicIPConfigurationImpl.java From azure-libraries-for-java with MIT License | 6 votes |
/** * Get the SubResource instance representing a public IP that needs to be associated with the * IP configuration. * <p> * null will be returned if withoutPublicIP() is specified in the update fluent chain or user did't * opt for public IP in create fluent chain. In case of update chain, if withoutPublicIP(..) is * not specified then existing associated (if any) public IP will be returned. * @return public IP SubResource */ private PublicIPAddressInner publicIPToAssociate() { String pipId = null; if (this.removePrimaryPublicIPAssociation) { return null; } else if (this.creatablePublicIPKey != null) { pipId = ((PublicIPAddress) this.parent() .createdDependencyResource(this.creatablePublicIPKey)).id(); } else if (this.existingPublicIPAddressIdToAssociate != null) { pipId = this.existingPublicIPAddressIdToAssociate; } if (pipId != null) { return new PublicIPAddressInner().withId(pipId); } else if (!this.isInCreateMode) { return this.inner().publicIPAddress(); } else { return null; } }
Example #6
Source File: TestPublicIPAddress.java From azure-libraries-for-java with MIT License | 6 votes |
@Override public PublicIPAddress updateResource(PublicIPAddress resource) throws Exception { final String updatedDnsName = resource.leafDomainLabel() + "xx"; final int updatedIdleTimeout = 15; resource = resource.update() .withStaticIP() .withLeafDomainLabel(updatedDnsName) .withReverseFqdn(resource.leafDomainLabel() + "." + resource.region() + ".cloudapp.azure.com") .withIdleTimeoutInMinutes(updatedIdleTimeout) .withTag("tag1", "value1") .withTag("tag2", "value2") .apply(); Assert.assertTrue(resource.leafDomainLabel().equalsIgnoreCase(updatedDnsName)); Assert.assertTrue(resource.idleTimeoutInMinutes() == updatedIdleTimeout); Assert.assertEquals("value2", resource.tags().get("tag2")); resource.updateTags() .withoutTag("tag1") .withTag("tag3", "value3") .applyTags(); Assert.assertFalse(resource.tags().containsKey("tag1")); Assert.assertEquals("value3", resource.tags().get("tag3")); return resource; }
Example #7
Source File: Utils.java From azure-libraries-for-java with MIT License | 6 votes |
/** * Print public IP address. * * @param resource a public IP address */ public static void print(PublicIPAddress resource) { System.out.println(new StringBuilder().append("Public IP Address: ").append(resource.id()) .append("Name: ").append(resource.name()) .append("\n\tResource group: ").append(resource.resourceGroupName()) .append("\n\tRegion: ").append(resource.region()) .append("\n\tTags: ").append(resource.tags()) .append("\n\tIP Address: ").append(resource.ipAddress()) .append("\n\tLeaf domain label: ").append(resource.leafDomainLabel()) .append("\n\tFQDN: ").append(resource.fqdn()) .append("\n\tReverse FQDN: ").append(resource.reverseFqdn()) .append("\n\tIdle timeout (minutes): ").append(resource.idleTimeoutInMinutes()) .append("\n\tIP allocation method: ").append(resource.ipAllocationMethod()) .append("\n\tZones: ").append(resource.availabilityZones()) .toString()); }
Example #8
Source File: ApplicationGatewayFrontendImpl.java From azure-libraries-for-java with MIT License | 5 votes |
@Override public PublicIPAddress getPublicIPAddress() { final String pipId = this.publicIPAddressId(); if (pipId == null) { return null; } else { return this.parent().manager().publicIPAddresses().getById(pipId); } }
Example #9
Source File: AzureClient.java From cloudbreak with Apache License 2.0 | 5 votes |
public List<String> getLoadBalancerIps(String resourceGroupName, String loadBalancerName) { List<String> ipList = new ArrayList<>(); List<String> publicIpAddressIds = getLoadBalancer(resourceGroupName, loadBalancerName).publicIPAddressIds(); for (String publicIpAddressId : publicIpAddressIds) { PublicIPAddress publicIpAddress = getPublicIpAddressById(publicIpAddressId); ipList.add(publicIpAddress.ipAddress()); } return ipList; }
Example #10
Source File: TestLoadBalancer.java From azure-libraries-for-java with MIT License | 5 votes |
private static Map<String, PublicIPAddress> ensurePIPs(PublicIPAddresses pips) throws Exception { List<Creatable<PublicIPAddress>> creatablePips = new ArrayList<>(); for (int i = 0; i < PIP_NAMES.length; i++) { creatablePips.add(pips.define(PIP_NAMES[i]) .withRegion(REGION) .withNewResourceGroup(GROUP_NAME) .withLeafDomainLabel(PIP_NAMES[i])); } return pips.create(creatablePips); }
Example #11
Source File: VirtualMachineImpl.java From azure-libraries-for-java with MIT License | 5 votes |
@Override public VirtualMachineImpl withExistingPrimaryPublicIPAddress(PublicIPAddress publicIPAddress) { Creatable<NetworkInterface> nicCreatable = this.nicDefinitionWithCreate .withExistingPrimaryPublicIPAddress(publicIPAddress); this.creatablePrimaryNetworkInterfaceKey = this.addDependency(nicCreatable); return this; }
Example #12
Source File: VirtualMachineImpl.java From azure-libraries-for-java with MIT License | 5 votes |
@Override public VirtualMachineImpl withNewPrimaryPublicIPAddress(Creatable<PublicIPAddress> creatable) { Creatable<NetworkInterface> nicCreatable = this.nicDefinitionWithCreate .withNewPrimaryPublicIPAddress(creatable); this.creatablePrimaryNetworkInterfaceKey = this.addDependency(nicCreatable); return this; }
Example #13
Source File: TestPublicIPAddress.java From azure-libraries-for-java with MIT License | 5 votes |
@Override public PublicIPAddress createResource(PublicIPAddresses pips) throws Exception { final String newPipName = "pip" + this.testId; PublicIPAddress pip = pips.define(newPipName) .withRegion(Region.US_WEST) .withNewResourceGroup() .withDynamicIP() .withLeafDomainLabel(newPipName) .withIdleTimeoutInMinutes(10) .create(); return pip; }
Example #14
Source File: TestPublicIPAddress.java From azure-libraries-for-java with MIT License | 5 votes |
public static void printPIP(PublicIPAddress resource) { StringBuilder info = new StringBuilder().append("Public IP Address: ").append(resource.id()) .append("\n\tName: ").append(resource.name()) .append("\n\tResource group: ").append(resource.resourceGroupName()) .append("\n\tRegion: ").append(resource.region()) .append("\n\tTags: ").append(resource.tags()) .append("\n\tIP Address: ").append(resource.ipAddress()) .append("\n\tLeaf domain label: ").append(resource.leafDomainLabel()) .append("\n\tFQDN: ").append(resource.fqdn()) .append("\n\tReverse FQDN: ").append(resource.reverseFqdn()) .append("\n\tIdle timeout (minutes): ").append(resource.idleTimeoutInMinutes()) .append("\n\tIP allocation method: ").append(resource.ipAllocationMethod().toString()) .append("\n\tIP version: ").append(resource.version().toString()); // Show the associated load balancer if any info.append("\n\tLoad balancer association: "); if (resource.hasAssignedLoadBalancer()) { final LoadBalancerPublicFrontend frontend = resource.getAssignedLoadBalancerFrontend(); final LoadBalancer lb = frontend.parent(); info.append("\n\t\tLoad balancer ID: ").append(lb.id()) .append("\n\t\tFrontend name: ").append(frontend.name()); } else { info.append("(None)"); } // Show the associated NIC if any info.append("\n\tNetwork interface association: "); if (resource.hasAssignedNetworkInterface()) { final NicIPConfiguration nicIp = resource.getAssignedNetworkInterfaceIPConfiguration(); final NetworkInterface nic = nicIp.parent(); info.append("\n\t\tNetwork interface ID: ").append(nic.id()) .append("\n\t\tIP config name: ").append(nicIp.name()); } else { info.append("(None)"); } System.out.println(info.toString()); }
Example #15
Source File: TestApplicationGateway.java From azure-libraries-for-java with MIT License | 5 votes |
private static Map<String, PublicIPAddress> ensurePIPs(PublicIPAddresses pips) throws Exception { List<Creatable<PublicIPAddress>> creatablePips = new ArrayList<>(); for (int i = 0; i < PIP_NAMES.length; i++) { creatablePips.add( pips.define(PIP_NAMES[i]) .withRegion(REGION) .withNewResourceGroup(GROUP_NAME)); } return pips.create(creatablePips); }
Example #16
Source File: LoadBalancerInboundNatRuleImpl.java From azure-libraries-for-java with MIT License | 5 votes |
@Override public LoadBalancerInboundNatRuleImpl fromNewPublicIPAddress(Creatable<PublicIPAddress> pipDefinition) { String frontendName = SdkContext.randomResourceName("fe", 20); this.parent().withNewPublicIPAddress(pipDefinition, frontendName); this.fromFrontend(frontendName); return this; }
Example #17
Source File: PublicIpAddressInventoryCollector.java From pacbot with Apache License 2.0 | 5 votes |
public List<PublicIpAddressVH> fetchPublicIpAddressDetails(SubscriptionVH subscription, Map<String, Map<String, String>> tagMap) { List<PublicIpAddressVH> publicIpAddressList = new ArrayList<PublicIpAddressVH>(); Azure azure = azureCredentialProvider.getClient(subscription.getTenant(),subscription.getSubscriptionId()); PagedList<PublicIPAddress> publicIPAddresses = azure.publicIPAddresses().list(); for (PublicIPAddress publicIPAddress : publicIPAddresses) { PublicIpAddressVH publicIpAddressVH = new PublicIpAddressVH(); publicIpAddressVH.setId(publicIPAddress.id()); publicIpAddressVH.setName(publicIPAddress.name()); publicIpAddressVH.setResourceGroupName(publicIPAddress.resourceGroupName()); publicIpAddressVH.setType(publicIPAddress.type()); publicIpAddressVH .setTags(Util.tagsList(tagMap, publicIPAddress.resourceGroupName(), publicIPAddress.tags())); publicIpAddressVH.setSubscription(subscription.getSubscriptionId()); publicIpAddressVH.setSubscriptionName(subscription.getSubscriptionName()); publicIpAddressVH.setIdleTimeoutInMinutes(publicIPAddress.idleTimeoutInMinutes()); publicIpAddressVH.setFqdn(publicIPAddress.fqdn()); publicIpAddressVH.setIpAddress(publicIPAddress.ipAddress()); publicIpAddressVH.setKey(publicIPAddress.key()); publicIpAddressVH.setRegionName(publicIPAddress.regionName()); publicIpAddressVH.setReverseFqdn(publicIPAddress.reverseFqdn()); publicIpAddressVH.setVersion(publicIPAddress.version().toString()); publicIpAddressList.add(publicIpAddressVH); } log.info("Target Type : {} Total: {} ","PublicIPAddress",publicIpAddressList.size()); return publicIpAddressList; }
Example #18
Source File: NicIPConfigurationImpl.java From azure-libraries-for-java with MIT License | 5 votes |
@Override public PublicIPAddress getPublicIPAddress() { String id = publicIPAddressId(); if (id == null) { return null; } return this.networkManager.publicIPAddresses().getById(id); }
Example #19
Source File: NicIPConfigurationImpl.java From azure-libraries-for-java with MIT License | 5 votes |
@Override public NicIPConfigurationImpl withNewPublicIPAddress(Creatable<PublicIPAddress> creatable) { if (this.creatablePublicIPKey == null) { this.creatablePublicIPKey = creatable.key(); this.parent().addToCreatableDependencies(creatable); } return this; }
Example #20
Source File: NicIPConfigurationImpl.java From azure-libraries-for-java with MIT License | 5 votes |
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); }
Example #21
Source File: VirtualNetworkGatewayImpl.java From azure-libraries-for-java with MIT License | 5 votes |
private Creatable<PublicIPAddress> ensureDefaultPipDefinition() { if (this.creatablePip == null) { final String pipName = SdkContext.randomResourceName("pip", 9); this.creatablePip = this.manager().publicIPAddresses().define(pipName) .withRegion(this.regionName()) .withExistingResourceGroup(this.resourceGroupName()); } return this.creatablePip; }
Example #22
Source File: ApplicationGatewayListenerImpl.java From azure-libraries-for-java with MIT License | 5 votes |
@Override public PublicIPAddress getPublicIPAddress() { final String pipId = this.publicIPAddressId(); if (pipId == null) { return null; } else { return this.parent().manager().publicIPAddresses().getById(pipId); } }
Example #23
Source File: ApplicationGatewayImpl.java From azure-libraries-for-java with MIT License | 5 votes |
private Creatable<PublicIPAddress> ensureDefaultPipDefinition() { if (this.creatablePip == null) { final String pipName = SdkContext.randomResourceName("pip", 9); this.creatablePip = this.manager().publicIPAddresses().define(pipName) .withRegion(this.regionName()) .withExistingResourceGroup(this.resourceGroupName()); } return this.creatablePip; }
Example #24
Source File: LoadBalancerFrontendImpl.java From azure-libraries-for-java with MIT License | 5 votes |
@Override public PublicIPAddress getPublicIPAddress() { final String pipId = this.publicIPAddressId(); if (pipId == null) { return null; } else { return this.parent().manager().publicIPAddresses().getById(pipId); } }
Example #25
Source File: LoadBalancerImpl.java From azure-libraries-for-java with MIT License | 5 votes |
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); }
Example #26
Source File: ApplicationGatewayRequestRoutingRuleImpl.java From azure-libraries-for-java with MIT License | 4 votes |
@Override public PublicIPAddress getPublicIPAddress() { final String pipId = this.publicIPAddressId(); return (pipId != null) ? this.parent().manager().publicIPAddresses().getById(pipId) : null; }
Example #27
Source File: LoadBalancingRuleImpl.java From azure-libraries-for-java with MIT License | 4 votes |
@Override public LoadBalancingRuleImpl fromNewPublicIPAddress(Creatable<PublicIPAddress> pipDefinition) { String frontendName = SdkContext.randomResourceName("fe", 20); this.parent().withNewPublicIPAddress(pipDefinition, frontendName); return fromFrontend(frontendName); }
Example #28
Source File: VirtualMachineAvailabilityZoneOperationsTests.java From azure-libraries-for-java with MIT License | 4 votes |
@Test public void canCreateZonedVirtualMachineWithImplicitZoneForRelatedResources() throws Exception { final String pipDnsLabel = generateRandomResourceName("pip", 10); final String proxyGroupName = "plg1Test"; // Create a zoned virtual machine // VirtualMachine virtualMachine = computeManager.virtualMachines() .define(VMNAME) .withRegion(REGION) .withNewResourceGroup(RG_NAME) .withNewPrimaryNetwork("10.0.0.0/28") .withPrimaryPrivateIPAddressDynamic() .withNewPrimaryPublicIPAddress(pipDnsLabel) .withNewProximityPlacementGroup(proxyGroupName, ProximityPlacementGroupType.STANDARD) .withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS) .withRootUsername("Foo12") .withRootPassword("abc!@#F0orL") // Optionals .withAvailabilityZone(AvailabilityZoneId.ZONE_1) .withSize(VirtualMachineSizeTypes.STANDARD_D3_V2) .withOSDiskCaching(CachingTypes.READ_WRITE) // Create VM .create(); // Checks the zone assigned to the virtual machine // Assert.assertNotNull(virtualMachine.availabilityZones()); Assert.assertFalse(virtualMachine.availabilityZones().isEmpty()); Assert.assertTrue(virtualMachine.availabilityZones().contains(AvailabilityZoneId.ZONE_1)); //Check the proximity placement group information Assert.assertNotNull(virtualMachine.proximityPlacementGroup()); Assert.assertEquals(ProximityPlacementGroupType.STANDARD, virtualMachine.proximityPlacementGroup().proximityPlacementGroupType()); Assert.assertNotNull(virtualMachine.proximityPlacementGroup().virtualMachineIds()); Assert.assertTrue(virtualMachine.id().equalsIgnoreCase(virtualMachine.proximityPlacementGroup().virtualMachineIds().get(0))); // Checks the zone assigned to the implicitly created public IP address. // Implicitly created PIP will be BASIC // PublicIPAddress publicIPAddress = virtualMachine.getPrimaryPublicIPAddress(); Assert.assertNotNull(publicIPAddress.availabilityZones()); Assert.assertFalse(publicIPAddress.availabilityZones().isEmpty()); Assert.assertTrue(publicIPAddress.availabilityZones().contains(AvailabilityZoneId.ZONE_1)); // Checks the zone assigned to the implicitly created managed OS disk. // String osDiskId = virtualMachine.osDiskId(); // Only VM based on managed disk can have zone assigned Assert.assertNotNull(osDiskId); Assert.assertFalse(osDiskId.isEmpty()); Disk osDisk = computeManager.disks().getById(osDiskId); Assert.assertNotNull(osDisk); // Checks the zone assigned to the implicitly created managed OS disk. // Assert.assertNotNull(osDisk.availabilityZones()); Assert.assertFalse(osDisk.availabilityZones().isEmpty()); Assert.assertTrue(osDisk.availabilityZones().contains(AvailabilityZoneId.ZONE_1)); }
Example #29
Source File: VirtualNetworkGatewayIPConfigurationImpl.java From azure-libraries-for-java with MIT License | 4 votes |
@Override public VirtualNetworkGatewayIPConfigurationImpl withExistingPublicIPAddress(PublicIPAddress pip) { return this.withExistingPublicIPAddress(pip.id()); }
Example #30
Source File: ApplicationGatewayImpl.java From azure-libraries-for-java with MIT License | 4 votes |
@Override protected Observable<ApplicationGatewayInner> createInner() { // Determine if a default public frontend PIP should be created final ApplicationGatewayFrontendImpl defaultPublicFrontend = (ApplicationGatewayFrontendImpl) defaultPublicFrontend(); final Observable<Resource> pipObservable; if (defaultPublicFrontend != null && defaultPublicFrontend.publicIPAddressId() == null) { // If public frontend requested but no PIP specified, then create a default PIP pipObservable = Utils.<PublicIPAddress>rootResource(ensureDefaultPipDefinition() .createAsync()).map(new Func1<PublicIPAddress, Resource>() { @Override public Resource call(PublicIPAddress publicIPAddress) { defaultPublicFrontend.withExistingPublicIPAddress(publicIPAddress); return publicIPAddress; } }); } else { // If no public frontend requested, skip creating the PIP pipObservable = Observable.empty(); } // Determine if default VNet should be created final ApplicationGatewayIPConfigurationImpl defaultIPConfig = ensureDefaultIPConfig(); final ApplicationGatewayFrontendImpl defaultPrivateFrontend = (ApplicationGatewayFrontendImpl) defaultPrivateFrontend(); final Observable<Resource> networkObservable; if (defaultIPConfig.subnetName() != null) { // If default IP config already has a subnet assigned to it... if (defaultPrivateFrontend != null) { // ...and a private frontend is requested, then use the same vnet for the private frontend useSubnetFromIPConfigForFrontend(defaultIPConfig, defaultPrivateFrontend); } // ...and no need to create a default VNet networkObservable = Observable.empty(); // ...and don't create another VNet } else { // But if default IP config does not have a subnet specified, then create a default VNet networkObservable = Utils.<Network>rootResource(ensureDefaultNetworkDefinition() .createAsync()).map(new Func1<Network, Resource>() { @Override public Resource call(Network network) { //... and assign the created VNet to the default IP config defaultIPConfig.withExistingSubnet(network, DEFAULT); if (defaultPrivateFrontend != null) { // If a private frontend is also requested, then use the same VNet for the private frontend as for the IP config /* TODO: Not sure if the assumption of the same subnet for the frontend and the IP config will hold in * the future, but the existing ARM template for App Gateway for some reason uses the same subnet for the * IP config and the private frontend. Also, trying to use different subnets results in server error today saying they * have to be the same. This may need to be revisited in the future however, as this is somewhat inconsistent * with what the documentation says. */ useSubnetFromIPConfigForFrontend(defaultIPConfig, defaultPrivateFrontend); } return network; } }); } final ApplicationGatewaysInner innerCollection = this.manager().inner().applicationGateways(); return Observable.merge(networkObservable, pipObservable) .defaultIfEmpty(null) .last().flatMap(new Func1<Resource, Observable<ApplicationGatewayInner>>() { @Override public Observable<ApplicationGatewayInner> call(Resource resource) { return innerCollection.createOrUpdateAsync(resourceGroupName(), name(), inner()); } }); }