@Override public ApplicationGatewayImpl withNewPublicIPAddress(Creatable<PublicIPAddress> creatable) { final String name = ensureDefaultPublicFrontend().name(); this.creatablePipsByFrontend.put(name, this.addDependency(creatable)); return this; }
@Override public Map<String, ApplicationGatewayBackendHealth> checkBackendHealth() { return this.checkBackendHealthAsync().toBlocking().last(); }
private ApplicationGatewayIPConfigurationImpl ensureDefaultIPConfig() { ApplicationGatewayIPConfigurationImpl ipConfig = (ApplicationGatewayIPConfigurationImpl) defaultIPConfiguration(); if (ipConfig == null) { String name = SdkContext.randomResourceName("ipcfg", 11); ipConfig = this.defineIPConfiguration(name); ipConfig.attach(); } return ipConfig; }
protected ApplicationGatewayFrontendImpl ensureDefaultPublicFrontend() { ApplicationGatewayFrontendImpl frontend = (ApplicationGatewayFrontendImpl) defaultPublicFrontend(); if (frontend != null) { return frontend; } else { String name = SdkContext.randomResourceName("frontend", 14); frontend = this.defineFrontend(name); frontend.attach(); this.defaultPublicFrontend = frontend; return frontend; } }
Resource createdPip = this.<Resource>taskResult(frontendPipPair.getValue()); this.updateFrontend(frontendPipPair.getKey()).withExistingPublicIPAddress(createdPip.id()); ensureDefaultIPConfig(); this.inner().withGatewayIPConfigurations(innersFromWrappers(this.ipConfigs.values())); this.inner().withFrontendIPConfigurations(innersFromWrappers(this.frontends.values())); this.inner().withProbes(innersFromWrappers(this.probes.values())); this.inner().withAuthenticationCertificates(innersFromWrappers(this.authCertificates.values())); this.inner().withBackendAddressPools(innersFromWrappers(this.backends.values())); this.inner().withSslCertificates(innersFromWrappers(this.sslCerts.values())); this.inner().withUrlPathMaps(innersFromWrappers(this.urlPathMaps.values())); this.inner().withBackendHttpSettingsCollection(innersFromWrappers(this.backendConfigs.values())); for (ApplicationGatewayBackendHttpConfiguration config : this.backendConfigs.values()) { SubResource ref; if (ref != null && !this.probes().containsKey(ResourceUtils.nameFromResourceId(ref.id()))) { config.inner().withProbe(null); this.inner().withRedirectConfigurations(innersFromWrappers(this.redirectConfigs.values())); for (ApplicationGatewayRedirectConfiguration redirect : this.redirectConfigs.values()) { SubResource ref;
@Override protected Observable<ApplicationGatewayInner> createInner() { final ApplicationGatewayFrontendImpl defaultPublicFrontend = (ApplicationGatewayFrontendImpl) defaultPublicFrontend(); final Observable<Resource> pipObservable; if (defaultPublicFrontend != null && defaultPublicFrontend.publicIPAddressId() == null) { pipObservable = Utils.<PublicIPAddress>rootResource(ensureDefaultPipDefinition() .createAsync()).map(new Func1<PublicIPAddress, Resource>() { @Override final ApplicationGatewayIPConfigurationImpl defaultIPConfig = ensureDefaultIPConfig(); final ApplicationGatewayFrontendImpl defaultPrivateFrontend = (ApplicationGatewayFrontendImpl) defaultPrivateFrontend(); final Observable<Resource> networkObservable; if (defaultIPConfig.subnetName() != null) { useSubnetFromIPConfigForFrontend(defaultIPConfig, defaultPrivateFrontend); networkObservable = Utils.<Network>rootResource(ensureDefaultNetworkDefinition() .createAsync()).map(new Func1<Network, Resource>() { @Override final ApplicationGatewaysInner innerCollection = this.manager().inner().applicationGateways(); return Observable.merge(networkObservable, pipObservable) .defaultIfEmpty(null)
@Override public ApplicationGatewayBackend backend() { if (this.inner.backendAddressPool() == null) { return null; } String backendName = ResourceUtils.nameFromResourceId(this.inner.backendAddressPool().id()); return this.appGateway.backends().get(backendName); }
protected ApplicationGatewayFrontendImpl ensureDefaultPrivateFrontend() { ApplicationGatewayFrontendImpl frontend = (ApplicationGatewayFrontendImpl) defaultPrivateFrontend(); if (frontend != null) { return frontend; } else { String name = SdkContext.randomResourceName("frontend", 14); frontend = this.defineFrontend(name); frontend.attach(); this.defaultPrivateFrontend = frontend; return frontend; } }
@Override public ApplicationGatewayBackendHttpConfigurationImpl withAuthenticationCertificateFromBase64(String base64Data) { if (base64Data == null) { return this; } String certName = null; for (ApplicationGatewayAuthenticationCertificate cert : this.parent().authenticationCertificates().values()) { if (cert.data().contentEquals(base64Data)) { certName = cert.name(); break; } } // If matching cert reference not found, create a new one if (certName == null) { certName = SdkContext.randomResourceName("cert", 20); this.parent().defineAuthenticationCertificate(certName) .fromBase64(base64Data) .attach(); } return this.withAuthenticationCertificate(certName).withHttps(); }
@Override public ApplicationGatewayBackendHttpConfigurationImpl backendHttpConfiguration() { SubResource configRef = this.inner().backendHttpSettings(); if (configRef != null) { String configName = ResourceUtils.nameFromResourceId(configRef.id()); return (ApplicationGatewayBackendHttpConfigurationImpl) this.parent().backendHttpConfigurations().get(configName); } else { return null; } }
@Override protected ApplicationGatewayImpl wrapModel(String name) { ApplicationGatewayInner inner = new ApplicationGatewayInner(); return new ApplicationGatewayImpl(name, inner, this.manager()); }
@Override public String networkId() { SubResource subnetRef = defaultSubnetRef(); if (subnetRef == null) { return null; } else { return ResourceUtils.parentResourceIdFromResourceId(subnetRef.id()); } }
@Override public String privateIPAddress() { ApplicationGatewayFrontend frontend = defaultPrivateFrontend(); if (frontend == null) { return null; } else { return frontend.privateIPAddress(); } }
@Override public ApplicationGatewayIPConfigurationImpl updateDefaultIPConfiguration() { return (ApplicationGatewayIPConfigurationImpl) this.defaultIPConfiguration(); }
@Override public ApplicationGatewayFrontendImpl updatePublicFrontend() { return (ApplicationGatewayFrontendImpl) defaultPublicFrontend(); }
@Override public Map<String, ApplicationGatewayAuthenticationCertificate> authenticationCertificates() { Map<String, ApplicationGatewayAuthenticationCertificate> certs = new TreeMap<>(); if (this.inner().authenticationCertificates() == null) { return Collections.unmodifiableMap(certs); } else { for (SubResource ref : this.inner().authenticationCertificates()) { ApplicationGatewayAuthenticationCertificate cert = this.parent().authenticationCertificates().get(ResourceUtils.nameFromResourceId(ref.id())); if (cert != null) { certs.put(cert.name(), cert); } } } return Collections.unmodifiableMap(certs); }
Resource createdPip = this.<Resource>taskResult(frontendPipPair.getValue()); this.updateFrontend(frontendPipPair.getKey()).withExistingPublicIPAddress(createdPip.id()); ensureDefaultIPConfig(); this.inner().withGatewayIPConfigurations(innersFromWrappers(this.ipConfigs.values())); this.inner().withFrontendIPConfigurations(innersFromWrappers(this.frontends.values())); this.inner().withProbes(innersFromWrappers(this.probes.values())); this.inner().withAuthenticationCertificates(innersFromWrappers(this.authCertificates.values())); this.inner().withBackendAddressPools(innersFromWrappers(this.backends.values())); this.inner().withSslCertificates(innersFromWrappers(this.sslCerts.values())); this.inner().withUrlPathMaps(innersFromWrappers(this.urlPathMaps.values())); this.inner().withBackendHttpSettingsCollection(innersFromWrappers(this.backendConfigs.values())); for (ApplicationGatewayBackendHttpConfiguration config : this.backendConfigs.values()) { SubResource ref; if (ref != null && !this.probes().containsKey(ResourceUtils.nameFromResourceId(ref.id()))) { config.inner().withProbe(null); this.inner().withRedirectConfigurations(innersFromWrappers(this.redirectConfigs.values())); for (ApplicationGatewayRedirectConfiguration redirect : this.redirectConfigs.values()) { SubResource ref;
@Override protected Observable<ApplicationGatewayInner> createInner() { final ApplicationGatewayFrontendImpl defaultPublicFrontend = (ApplicationGatewayFrontendImpl) defaultPublicFrontend(); final Observable<Resource> pipObservable; if (defaultPublicFrontend != null && defaultPublicFrontend.publicIPAddressId() == null) { pipObservable = Utils.<PublicIPAddress>rootResource(ensureDefaultPipDefinition() .createAsync()).map(new Func1<PublicIPAddress, Resource>() { @Override final ApplicationGatewayIPConfigurationImpl defaultIPConfig = ensureDefaultIPConfig(); final ApplicationGatewayFrontendImpl defaultPrivateFrontend = (ApplicationGatewayFrontendImpl) defaultPrivateFrontend(); final Observable<Resource> networkObservable; if (defaultIPConfig.subnetName() != null) { useSubnetFromIPConfigForFrontend(defaultIPConfig, defaultPrivateFrontend); networkObservable = Utils.<Network>rootResource(ensureDefaultNetworkDefinition() .createAsync()).map(new Func1<Network, Resource>() { @Override final ApplicationGatewaysInner innerCollection = this.manager().inner().applicationGateways(); return Observable.merge(networkObservable, pipObservable) .defaultIfEmpty(null)
@Override public ApplicationGatewayBackend backend() { if (this.inner.backendAddressPool() == null) { return null; } String backendName = ResourceUtils.nameFromResourceId(this.inner.backendAddressPool().id()); return this.appGateway.backends().get(backendName); }
protected ApplicationGatewayFrontendImpl ensureDefaultPublicFrontend() { ApplicationGatewayFrontendImpl frontend = (ApplicationGatewayFrontendImpl) defaultPublicFrontend(); if (frontend != null) { return frontend; } else { String name = SdkContext.randomResourceName("frontend", 14); frontend = this.defineFrontend(name); frontend.attach(); this.defaultPublicFrontend = frontend; return frontend; } }