use of com.microsoft.azure.SubResource in project azure-sdk-for-java by Azure.
the class LoadBalancerImpl method beforeCreating.
@Override
protected void beforeCreating() {
// Account for the newly created public IPs
for (Entry<String, String> pipFrontendAssociation : this.creatablePIPKeys.entrySet()) {
PublicIPAddress pip = (PublicIPAddress) this.createdResource(pipFrontendAssociation.getKey());
if (pip != null) {
withExistingPublicIPAddress(pip.id(), pipFrontendAssociation.getValue());
}
}
this.creatablePIPKeys.clear();
// Reset and update probes
List<ProbeInner> innerProbes = innersFromWrappers(this.httpProbes.values());
innerProbes = innersFromWrappers(this.tcpProbes.values(), innerProbes);
if (innerProbes == null) {
innerProbes = new ArrayList<>();
}
this.inner().withProbes(innerProbes);
// Reset and update backends
List<BackendAddressPoolInner> innerBackends = innersFromWrappers(this.backends.values());
if (null == innerBackends) {
innerBackends = new ArrayList<>();
}
this.inner().withBackendAddressPools(innerBackends);
// Reset and update frontends
List<FrontendIPConfigurationInner> innerFrontends = innersFromWrappers(this.frontends.values());
if (null == innerFrontends) {
innerFrontends = new ArrayList<>();
}
this.inner().withFrontendIPConfigurations(innerFrontends);
// Reset and update inbound NAT rules
List<InboundNatRuleInner> innerNatRules = innersFromWrappers(this.inboundNatRules.values());
if (null == innerNatRules) {
innerNatRules = new ArrayList<>();
}
this.inner().withInboundNatRules(innerNatRules);
for (LoadBalancerInboundNatRule natRule : this.inboundNatRules.values()) {
// Clear deleted frontend references
SubResource ref = natRule.inner().frontendIPConfiguration();
if (ref != null && !this.frontends().containsKey(ResourceUtils.nameFromResourceId(ref.id()))) {
natRule.inner().withFrontendIPConfiguration(null);
}
}
// Reset and update inbound NAT pools
List<InboundNatPoolInner> innerNatPools = innersFromWrappers(this.inboundNatPools.values());
if (null == innerNatPools) {
innerNatPools = new ArrayList<>();
}
this.inner().withInboundNatPools(innerNatPools);
for (LoadBalancerInboundNatPool natPool : this.inboundNatPools.values()) {
// Clear deleted frontend references
SubResource ref = natPool.inner().frontendIPConfiguration();
if (ref != null && !this.frontends().containsKey(ResourceUtils.nameFromResourceId(ref.id()))) {
natPool.inner().withFrontendIPConfiguration(null);
}
}
// Reset and update load balancing rules
List<LoadBalancingRuleInner> innerRules = innersFromWrappers(this.loadBalancingRules.values());
if (innerRules == null) {
innerRules = new ArrayList<>();
}
this.inner().withLoadBalancingRules(innerRules);
for (LoadBalancingRule lbRule : this.loadBalancingRules.values()) {
SubResource ref;
// Clear deleted frontend references
ref = lbRule.inner().frontendIPConfiguration();
if (ref != null && !this.frontends().containsKey(ResourceUtils.nameFromResourceId(ref.id()))) {
lbRule.inner().withFrontendIPConfiguration(null);
}
// Clear deleted backend references
ref = lbRule.inner().backendAddressPool();
if (ref != null && !this.backends().containsKey(ResourceUtils.nameFromResourceId(ref.id()))) {
lbRule.inner().withBackendAddressPool(null);
}
// Clear deleted probe references
ref = lbRule.inner().probe();
if (ref != null && !this.httpProbes().containsKey(ResourceUtils.nameFromResourceId(ref.id())) && !this.tcpProbes().containsKey(ResourceUtils.nameFromResourceId(ref.id()))) {
lbRule.inner().withProbe(null);
}
}
}
use of com.microsoft.azure.SubResource in project azure-sdk-for-java by Azure.
the class LoadBalancerInboundNatPoolImpl method withFrontend.
@Override
public LoadBalancerInboundNatPoolImpl withFrontend(String frontendName) {
SubResource frontendRef = new SubResource().withId(this.parent().futureResourceId() + "/frontendIPConfigurations/" + frontendName);
this.inner().withFrontendIPConfiguration(frontendRef);
return this;
}
use of com.microsoft.azure.SubResource in project azure-sdk-for-java by Azure.
the class LoadBalancerFrontendImpl method inboundNatPools.
@Override
public Map<String, LoadBalancerInboundNatPool> inboundNatPools() {
final Map<String, LoadBalancerInboundNatPool> pools = new TreeMap<>();
if (this.inner().inboundNatPools() != null) {
for (SubResource innerRef : this.inner().inboundNatPools()) {
String name = ResourceUtils.nameFromResourceId(innerRef.id());
LoadBalancerInboundNatPool pool = this.parent().inboundNatPools().get(name);
if (pool != null) {
pools.put(name, pool);
}
}
}
return Collections.unmodifiableMap(pools);
}
use of com.microsoft.azure.SubResource in project azure-sdk-for-java by Azure.
the class ApplicationGatewayListenerImpl method withSslCertificate.
@Override
public ApplicationGatewayListenerImpl withSslCertificate(String name) {
SubResource certRef = new SubResource().withId(this.parent().futureResourceId() + "/sslCertificates/" + name);
this.inner().withSslCertificate(certRef);
return this;
}
use of com.microsoft.azure.SubResource in project azure-sdk-for-java by Azure.
the class ApplicationGatewayListenerImpl method withFrontendPort.
// Withers
@Override
public ApplicationGatewayListenerImpl withFrontendPort(String name) {
SubResource portRef = new SubResource().withId(this.parent().futureResourceId() + "/frontendPorts/" + name);
this.inner().withFrontendPort(portRef);
return this;
}
Aggregations