@Override public Set<String> getVirtualMachineIds() { Set<String> vmIds = new HashSet<>(); Map<String, String> nicConfigs = this.backendNicIPConfigurationNames(); if (nicConfigs != null) { for (String nicId : nicConfigs.keySet()) { try { NetworkInterface nic = this.parent().manager().networkInterfaces().getById(nicId); if (nic == null || nic.virtualMachineId() == null) { continue; } else { vmIds.add(nic.virtualMachineId()); } } catch (CloudException | IllegalArgumentException e) { continue; } } } return vmIds; }
@Override public PublicIPAddress getPublicIPAddress() { final String pipId = this.publicIPAddressId(); if (pipId == null) { return null; } else { return this.parent().manager().publicIPAddresses().getById(pipId); } }
@Override public PublicIPAddress getPublicIPAddress() { final String pipId = this.publicIPAddressId(); if (pipId == null) { return null; } else { return this.parent().manager().publicIPAddresses().getById(pipId); } }
@Override public Set<String> getVirtualMachineIds() { Set<String> vmIds = new HashSet<>(); Map<String, String> nicConfigs = this.backendNicIPConfigurationNames(); if (nicConfigs != null) { for (String nicId : nicConfigs.keySet()) { try { NetworkInterface nic = this.parent().manager().networkInterfaces().getById(nicId); if (nic == null || nic.virtualMachineId() == null) { continue; } else { vmIds.add(nic.virtualMachineId()); } } catch (CloudException | IllegalArgumentException e) { continue; } } } return vmIds; }
@Override public Subnet getSubnet() { return this.parent().manager().getAssociatedSubnet(this.inner().subnet()); }
@Override public Subnet getSubnet() { return this.parent().manager().getAssociatedSubnet(this.inner().subnet()); }
@Override protected void afterCreating() { if (this.nicsInBackends != null) { List<Exception> nicExceptions = new ArrayList<>(); // Update the NICs to point to the backend pool for (Entry<String, String> nicInBackend : this.nicsInBackends.entrySet()) { String nicId = nicInBackend.getKey(); String backendName = nicInBackend.getValue(); try { NetworkInterface nic = this.manager().networkInterfaces().getById(nicId); NicIPConfiguration nicIP = nic.primaryIPConfiguration(); nic.update() .updateIPConfiguration(nicIP.name()) .withExistingLoadBalancerBackend(this, backendName) .parent() .apply(); } catch (Exception e) { nicExceptions.add(e); } } if (!nicExceptions.isEmpty()) { throw new CompositeException(nicExceptions); } this.nicsInBackends.clear(); this.refresh(); } }
@Override protected void afterCreating() { if (this.nicsInBackends != null) { List<Exception> nicExceptions = new ArrayList<>(); // Update the NICs to point to the backend pool for (Entry<String, String> nicInBackend : this.nicsInBackends.entrySet()) { String nicId = nicInBackend.getKey(); String backendName = nicInBackend.getValue(); try { NetworkInterface nic = this.manager().networkInterfaces().getById(nicId); NicIPConfiguration nicIP = nic.primaryIPConfiguration(); nic.update() .updateIPConfiguration(nicIP.name()) .withExistingLoadBalancerBackend(this, backendName) .parent() .apply(); } catch (Exception e) { nicExceptions.add(e); } } if (!nicExceptions.isEmpty()) { throw new CompositeException(nicExceptions); } this.nicsInBackends.clear(); this.refresh(); } }
@Override protected Observable<LoadBalancerInner> getInnerAsync() { return this.manager().inner().loadBalancers().getByResourceGroupAsync(this.resourceGroupName(), this.name()); }
@Override protected Observable<LoadBalancerInner> getInnerAsync() { return this.manager().inner().loadBalancers().getByResourceGroupAsync(this.resourceGroupName(), this.name()); }
@Override protected Observable<LoadBalancerInner> createInner() { return this.manager().inner().loadBalancers().createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()); }
@Override protected Observable<LoadBalancerInner> createInner() { return this.manager().inner().loadBalancers().createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()); }
@Override protected Observable<LoadBalancerInner> applyTagsToInnerAsync() { return this.manager().inner().loadBalancers().updateTagsAsync(resourceGroupName(), name(), inner().getTags()); }
@Override protected Observable<LoadBalancerInner> applyTagsToInnerAsync() { return this.manager().inner().loadBalancers().updateTagsAsync(resourceGroupName(), name(), inner().getTags()); }
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); }
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); }