Search in sources :

Example 1 with ApplicationGatewayBackendHttpConfiguration

use of com.microsoft.azure.management.network.ApplicationGatewayBackendHttpConfiguration in project azure-sdk-for-java by Azure.

the class Utils method print.

/**
     * Print an application gateway.
     * @param resource an application gateway
     */
public static void print(ApplicationGateway resource) {
    StringBuilder info = new StringBuilder();
    info.append("Application gateway: ").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\tSKU: ").append(resource.sku().toString()).append("\n\tOperational state: ").append(resource.operationalState()).append("\n\tInternet-facing? ").append(resource.isPublic()).append("\n\tInternal? ").append(resource.isPrivate()).append("\n\tDefault private IP address: ").append(resource.privateIPAddress()).append("\n\tPrivate IP address allocation method: ").append(resource.privateIPAllocationMethod()).append("\n\tDisabled SSL protocols: ").append(resource.disabledSslProtocols().toString());
    // Show IP configs
    Map<String, ApplicationGatewayIPConfiguration> ipConfigs = resource.ipConfigurations();
    info.append("\n\tIP configurations: ").append(ipConfigs.size());
    for (ApplicationGatewayIPConfiguration ipConfig : ipConfigs.values()) {
        info.append("\n\t\tName: ").append(ipConfig.name()).append("\n\t\t\tNetwork id: ").append(ipConfig.networkId()).append("\n\t\t\tSubnet name: ").append(ipConfig.subnetName());
    }
    // Show frontends
    Map<String, ApplicationGatewayFrontend> frontends = resource.frontends();
    info.append("\n\tFrontends: ").append(frontends.size());
    for (ApplicationGatewayFrontend frontend : frontends.values()) {
        info.append("\n\t\tName: ").append(frontend.name()).append("\n\t\t\tPublic? ").append(frontend.isPublic());
        if (frontend.isPublic()) {
            // Show public frontend info
            info.append("\n\t\t\tPublic IP address ID: ").append(frontend.publicIPAddressId());
        }
        if (frontend.isPrivate()) {
            // Show private frontend info
            info.append("\n\t\t\tPrivate IP address: ").append(frontend.privateIPAddress()).append("\n\t\t\tPrivate IP allocation method: ").append(frontend.privateIPAllocationMethod()).append("\n\t\t\tSubnet name: ").append(frontend.subnetName()).append("\n\t\t\tVirtual network ID: ").append(frontend.networkId());
        }
    }
    // Show backends
    Map<String, ApplicationGatewayBackend> backends = resource.backends();
    info.append("\n\tBackends: ").append(backends.size());
    for (ApplicationGatewayBackend backend : backends.values()) {
        info.append("\n\t\tName: ").append(backend.name()).append("\n\t\t\tAssociated NIC IP configuration IDs: ").append(backend.backendNicIPConfigurationNames().keySet());
        // Show addresses
        Collection<ApplicationGatewayBackendAddress> addresses = backend.addresses();
        info.append("\n\t\t\tAddresses: ").append(addresses.size());
        for (ApplicationGatewayBackendAddress address : addresses) {
            info.append("\n\t\t\t\tFQDN: ").append(address.fqdn()).append("\n\t\t\t\tIP: ").append(address.ipAddress());
        }
    }
    // Show backend HTTP configurations
    Map<String, ApplicationGatewayBackendHttpConfiguration> httpConfigs = resource.backendHttpConfigurations();
    info.append("\n\tHTTP Configurations: ").append(httpConfigs.size());
    for (ApplicationGatewayBackendHttpConfiguration httpConfig : httpConfigs.values()) {
        info.append("\n\t\tName: ").append(httpConfig.name()).append("\n\t\t\tCookie based affinity: ").append(httpConfig.cookieBasedAffinity()).append("\n\t\t\tPort: ").append(httpConfig.port()).append("\n\t\t\tRequest timeout in seconds: ").append(httpConfig.requestTimeout()).append("\n\t\t\tProtocol: ").append(httpConfig.protocol());
        ApplicationGatewayProbe probe = httpConfig.probe();
        if (probe != null) {
            info.append("\n\t\tProbe: " + probe.name());
        }
    }
    // Show SSL certificates
    Map<String, ApplicationGatewaySslCertificate> sslCerts = resource.sslCertificates();
    info.append("\n\tSSL certificates: ").append(sslCerts.size());
    for (ApplicationGatewaySslCertificate cert : sslCerts.values()) {
        info.append("\n\t\tName: ").append(cert.name()).append("\n\t\t\tCert data: ").append(cert.publicData());
    }
    // Show HTTP listeners
    Map<String, ApplicationGatewayListener> listeners = resource.listeners();
    info.append("\n\tHTTP listeners: ").append(listeners.size());
    for (ApplicationGatewayListener listener : listeners.values()) {
        info.append("\n\t\tName: ").append(listener.name()).append("\n\t\t\tHost name: ").append(listener.hostName()).append("\n\t\t\tServer name indication required? ").append(listener.requiresServerNameIndication()).append("\n\t\t\tAssociated frontend name: ").append(listener.frontend().name()).append("\n\t\t\tFrontend port name: ").append(listener.frontendPortName()).append("\n\t\t\tFrontend port number: ").append(listener.frontendPortNumber()).append("\n\t\t\tProtocol: ").append(listener.protocol().toString());
        if (listener.sslCertificate() != null) {
            info.append("\n\t\t\tAssociated SSL certificate: ").append(listener.sslCertificate().name());
        }
    }
    // Show probes
    Map<String, ApplicationGatewayProbe> probes = resource.probes();
    info.append("\n\tProbes: ").append(probes.size());
    for (ApplicationGatewayProbe probe : probes.values()) {
        info.append("\n\t\tName: ").append(probe.name()).append("\n\t\tProtocol:").append(probe.protocol().toString()).append("\n\t\tInterval in seconds: ").append(probe.timeBetweenProbesInSeconds()).append("\n\t\tRetries: ").append(probe.retriesBeforeUnhealthy()).append("\n\t\tTimeout: ").append(probe.timeoutInSeconds()).append("\n\t\tHost: ").append(probe.host());
    }
    // Show request routing rules
    Map<String, ApplicationGatewayRequestRoutingRule> rules = resource.requestRoutingRules();
    info.append("\n\tRequest routing rules: ").append(rules.size());
    for (ApplicationGatewayRequestRoutingRule rule : rules.values()) {
        info.append("\n\t\tName: ").append(rule.name()).append("\n\t\t\tType: ").append(rule.ruleType()).append("\n\t\t\tPublic IP address ID: ").append(rule.publicIPAddressId()).append("\n\t\t\tHost name: ").append(rule.hostName()).append("\n\t\t\tServer name indication required? ").append(rule.requiresServerNameIndication()).append("\n\t\t\tFrontend port: ").append(rule.frontendPort()).append("\n\t\t\tFrontend protocol: ").append(rule.frontendProtocol().toString()).append("\n\t\t\tBackend port: ").append(rule.backendPort()).append("\n\t\t\tCookie based affinity enabled? ").append(rule.cookieBasedAffinity());
        // Show backend addresses
        Collection<ApplicationGatewayBackendAddress> addresses = rule.backendAddresses();
        info.append("\n\t\t\tBackend addresses: ").append(addresses.size());
        for (ApplicationGatewayBackendAddress address : addresses) {
            info.append("\n\t\t\t\t").append(address.fqdn()).append(" [").append(address.ipAddress()).append("]");
        }
        // Show SSL cert
        info.append("\n\t\t\tSSL certificate name: ");
        ApplicationGatewaySslCertificate cert = rule.sslCertificate();
        if (cert == null) {
            info.append("(None)");
        } else {
            info.append(cert.name());
        }
        // Show backend
        info.append("\n\t\t\tAssociated backend address pool: ");
        ApplicationGatewayBackend backend = rule.backend();
        if (backend == null) {
            info.append("(None)");
        } else {
            info.append(backend.name());
        }
        // Show backend HTTP settings config
        info.append("\n\t\t\tAssociated backend HTTP settings configuration: ");
        ApplicationGatewayBackendHttpConfiguration config = rule.backendHttpConfiguration();
        if (config == null) {
            info.append("(None)");
        } else {
            info.append(config.name());
        }
        // Show frontend listener
        info.append("\n\t\t\tAssociated frontend listener: ");
        ApplicationGatewayListener listener = rule.listener();
        if (listener == null) {
            info.append("(None)");
        } else {
            info.append(config.name());
        }
    }
    System.out.println(info.toString());
}
Also used : ApplicationGatewayBackend(com.microsoft.azure.management.network.ApplicationGatewayBackend) ApplicationGatewayRequestRoutingRule(com.microsoft.azure.management.network.ApplicationGatewayRequestRoutingRule) ApplicationGatewayProbe(com.microsoft.azure.management.network.ApplicationGatewayProbe) ConnectionString(com.microsoft.azure.management.appservice.ConnectionString) ApplicationGatewayBackendAddress(com.microsoft.azure.management.network.ApplicationGatewayBackendAddress) ApplicationGatewaySslCertificate(com.microsoft.azure.management.network.ApplicationGatewaySslCertificate) ApplicationGatewayIPConfiguration(com.microsoft.azure.management.network.ApplicationGatewayIPConfiguration) ApplicationGatewayListener(com.microsoft.azure.management.network.ApplicationGatewayListener) ApplicationGatewayFrontend(com.microsoft.azure.management.network.ApplicationGatewayFrontend) ApplicationGatewayBackendHttpConfiguration(com.microsoft.azure.management.network.ApplicationGatewayBackendHttpConfiguration)

Example 2 with ApplicationGatewayBackendHttpConfiguration

use of com.microsoft.azure.management.network.ApplicationGatewayBackendHttpConfiguration in project azure-sdk-for-java by Azure.

the class ApplicationGatewayImpl method beforeCreating.

@Override
protected void beforeCreating() {
    // Process created PIPs
    for (Entry<String, String> frontendPipPair : this.creatablePipsByFrontend.entrySet()) {
        Resource createdPip = this.createdResource(frontendPipPair.getValue());
        this.updateFrontend(frontendPipPair.getKey()).withExistingPublicIPAddress(createdPip.id());
    }
    this.creatablePipsByFrontend.clear();
    // Reset and update IP configs
    ensureDefaultIPConfig();
    this.inner().withGatewayIPConfigurations(innersFromWrappers(this.ipConfigs.values()));
    // Reset and update frontends
    this.inner().withFrontendIPConfigurations(innersFromWrappers(this.frontends.values()));
    // Reset and update probes
    this.inner().withProbes(innersFromWrappers(this.probes.values()));
    // Reset and update backends
    this.inner().withBackendAddressPools(innersFromWrappers(this.backends.values()));
    // Reset and update backend HTTP settings configs
    this.inner().withBackendHttpSettingsCollection(innersFromWrappers(this.backendHttpConfigs.values()));
    for (ApplicationGatewayBackendHttpConfiguration config : this.backendHttpConfigs.values()) {
        SubResource ref;
        // Clear deleted probe references
        ref = config.inner().probe();
        if (ref != null && !this.probes().containsKey(ResourceUtils.nameFromResourceId(ref.id()))) {
            config.inner().withProbe(null);
        }
    }
    // Reset and update HTTP listeners
    this.inner().withHttpListeners(innersFromWrappers(this.listeners.values()));
    for (ApplicationGatewayListener listener : this.listeners.values()) {
        SubResource ref;
        // Clear deleted frontend references
        ref = listener.inner().frontendIPConfiguration();
        if (ref != null && !this.frontends().containsKey(ResourceUtils.nameFromResourceId(ref.id()))) {
            listener.inner().withFrontendIPConfiguration(null);
        }
        // Clear deleted frontend port references
        ref = listener.inner().frontendPort();
        if (ref != null && !this.frontendPorts().containsKey(ResourceUtils.nameFromResourceId(ref.id()))) {
            listener.inner().withFrontendPort(null);
        }
        // Clear deleted SSL certificate references
        ref = listener.inner().sslCertificate();
        if (ref != null && !this.sslCertificates().containsKey(ResourceUtils.nameFromResourceId(ref.id()))) {
            listener.inner().withSslCertificate(null);
        }
    }
    // Reset and update request routing rules
    this.inner().withRequestRoutingRules(innersFromWrappers(this.rules.values()));
    for (ApplicationGatewayRequestRoutingRule rule : this.rules.values()) {
        SubResource ref;
        // Clear deleted backends
        ref = rule.inner().backendAddressPool();
        if (ref != null && !this.backends().containsKey(ResourceUtils.nameFromResourceId(ref.id()))) {
            rule.inner().withBackendAddressPool(null);
        }
        // Clear deleted backend HTTP configs
        ref = rule.inner().backendHttpSettings();
        if (ref != null && !this.backendHttpConfigurations().containsKey(ResourceUtils.nameFromResourceId(ref.id()))) {
            rule.inner().withBackendHttpSettings(null);
        }
        // Clear deleted frontend HTTP listeners
        ref = rule.inner().httpListener();
        if (ref != null && !this.listeners().containsKey(ResourceUtils.nameFromResourceId(ref.id()))) {
            rule.inner().withHttpListener(null);
        }
    }
    // Reset and update SSL certs
    this.inner().withSslCertificates(innersFromWrappers(this.sslCerts.values()));
}
Also used : SubResource(com.microsoft.azure.SubResource) SubResource(com.microsoft.azure.SubResource) Resource(com.microsoft.azure.management.resources.fluentcore.arm.models.Resource) ApplicationGatewayRequestRoutingRule(com.microsoft.azure.management.network.ApplicationGatewayRequestRoutingRule) ApplicationGatewayBackendHttpConfiguration(com.microsoft.azure.management.network.ApplicationGatewayBackendHttpConfiguration) ApplicationGatewayListener(com.microsoft.azure.management.network.ApplicationGatewayListener)

Example 3 with ApplicationGatewayBackendHttpConfiguration

use of com.microsoft.azure.management.network.ApplicationGatewayBackendHttpConfiguration in project azure-sdk-for-java by Azure.

the class TestApplicationGateway method printAppGateway.

// Print app gateway info
static void printAppGateway(ApplicationGateway resource) {
    StringBuilder info = new StringBuilder();
    info.append("Application gateway: ").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\tSKU: ").append(resource.sku().toString()).append("\n\tOperational state: ").append(resource.operationalState()).append("\n\tInternet-facing? ").append(resource.isPublic()).append("\n\tInternal? ").append(resource.isPrivate()).append("\n\tDefault private IP address: ").append(resource.privateIPAddress()).append("\n\tPrivate IP address allocation method: ").append(resource.privateIPAllocationMethod()).append("\n\tDisabled SSL protocols: ").append(resource.disabledSslProtocols().toString());
    // Show IP configs
    Map<String, ApplicationGatewayIPConfiguration> ipConfigs = resource.ipConfigurations();
    info.append("\n\tIP configurations: ").append(ipConfigs.size());
    for (ApplicationGatewayIPConfiguration ipConfig : ipConfigs.values()) {
        info.append("\n\t\tName: ").append(ipConfig.name()).append("\n\t\t\tNetwork id: ").append(ipConfig.networkId()).append("\n\t\t\tSubnet name: ").append(ipConfig.subnetName());
    }
    // Show frontends
    Map<String, ApplicationGatewayFrontend> frontends = resource.frontends();
    info.append("\n\tFrontends: ").append(frontends.size());
    for (ApplicationGatewayFrontend frontend : frontends.values()) {
        info.append("\n\t\tName: ").append(frontend.name()).append("\n\t\t\tPublic? ").append(frontend.isPublic());
        if (frontend.isPublic()) {
            // Show public frontend info
            info.append("\n\t\t\tPublic IP address ID: ").append(frontend.publicIPAddressId());
        }
        if (frontend.isPrivate()) {
            // Show private frontend info
            info.append("\n\t\t\tPrivate IP address: ").append(frontend.privateIPAddress()).append("\n\t\t\tPrivate IP allocation method: ").append(frontend.privateIPAllocationMethod()).append("\n\t\t\tSubnet name: ").append(frontend.subnetName()).append("\n\t\t\tVirtual network ID: ").append(frontend.networkId());
        }
    }
    // Show backends
    Map<String, ApplicationGatewayBackend> backends = resource.backends();
    info.append("\n\tBackends: ").append(backends.size());
    for (ApplicationGatewayBackend backend : backends.values()) {
        info.append("\n\t\tName: ").append(backend.name()).append("\n\t\t\tAssociated NIC IP configuration IDs: ").append(backend.backendNicIPConfigurationNames().keySet());
        // Show addresses
        Collection<ApplicationGatewayBackendAddress> addresses = backend.addresses();
        info.append("\n\t\t\tAddresses: ").append(addresses.size());
        for (ApplicationGatewayBackendAddress address : addresses) {
            info.append("\n\t\t\t\tFQDN: ").append(address.fqdn()).append("\n\t\t\t\tIP: ").append(address.ipAddress());
        }
    }
    // Show backend HTTP configurations
    Map<String, ApplicationGatewayBackendHttpConfiguration> httpConfigs = resource.backendHttpConfigurations();
    info.append("\n\tHTTP Configurations: ").append(httpConfigs.size());
    for (ApplicationGatewayBackendHttpConfiguration httpConfig : httpConfigs.values()) {
        info.append("\n\t\tName: ").append(httpConfig.name()).append("\n\t\t\tCookie based affinity: ").append(httpConfig.cookieBasedAffinity()).append("\n\t\t\tPort: ").append(httpConfig.port()).append("\n\t\t\tRequest timeout in seconds: ").append(httpConfig.requestTimeout()).append("\n\t\t\tProtocol: ").append(httpConfig.protocol());
        if (httpConfig.probe() != null) {
            info.append("\n\t\t\tProbe: " + httpConfig.probe().name());
        }
    }
    // Show SSL certificates
    Map<String, ApplicationGatewaySslCertificate> sslCerts = resource.sslCertificates();
    info.append("\n\tSSL certificates: ").append(sslCerts.size());
    for (ApplicationGatewaySslCertificate cert : sslCerts.values()) {
        info.append("\n\t\tName: ").append(cert.name()).append("\n\t\t\tCert data: ").append(cert.publicData());
    }
    // Show HTTP listeners
    Map<String, ApplicationGatewayListener> listeners = resource.listeners();
    info.append("\n\tHTTP listeners: ").append(listeners.size());
    for (ApplicationGatewayListener listener : listeners.values()) {
        info.append("\n\t\tName: ").append(listener.name()).append("\n\t\t\tHost name: ").append(listener.hostName()).append("\n\t\t\tServer name indication required? ").append(listener.requiresServerNameIndication()).append("\n\t\t\tAssociated frontend name: ").append(listener.frontend().name()).append("\n\t\t\tFrontend port name: ").append(listener.frontendPortName()).append("\n\t\t\tFrontend port number: ").append(listener.frontendPortNumber()).append("\n\t\t\tProtocol: ").append(listener.protocol().toString());
        if (listener.sslCertificate() != null) {
            info.append("\n\t\t\tAssociated SSL certificate: ").append(listener.sslCertificate().name());
        }
    }
    // Show probes
    Map<String, ApplicationGatewayProbe> probes = resource.probes();
    info.append("\n\tProbes: ").append(probes.size());
    for (ApplicationGatewayProbe probe : probes.values()) {
        info.append("\n\t\tName: ").append(probe.name()).append("\n\t\tProtocol:").append(probe.protocol().toString()).append("\n\t\tInterval in seconds: ").append(probe.timeBetweenProbesInSeconds()).append("\n\t\tRetries: ").append(probe.retriesBeforeUnhealthy()).append("\n\t\tTimeout: ").append(probe.timeoutInSeconds()).append("\n\t\tHost: ").append(probe.host());
    }
    // Show request routing rules
    Map<String, ApplicationGatewayRequestRoutingRule> rules = resource.requestRoutingRules();
    info.append("\n\tRequest routing rules: ").append(rules.size());
    for (ApplicationGatewayRequestRoutingRule rule : rules.values()) {
        info.append("\n\t\tName: ").append(rule.name()).append("\n\t\t\tType: ").append(rule.ruleType()).append("\n\t\t\tPublic IP address ID: ").append(rule.publicIPAddressId()).append("\n\t\t\tHost name: ").append(rule.hostName()).append("\n\t\t\tServer name indication required? ").append(rule.requiresServerNameIndication()).append("\n\t\t\tFrontend port: ").append(rule.frontendPort()).append("\n\t\t\tFrontend protocol: ").append(rule.frontendProtocol().toString()).append("\n\t\t\tBackend port: ").append(rule.backendPort()).append("\n\t\t\tCookie based affinity enabled? ").append(rule.cookieBasedAffinity());
        // Show backend addresses
        Collection<ApplicationGatewayBackendAddress> addresses = rule.backendAddresses();
        info.append("\n\t\t\tBackend addresses: ").append(addresses.size());
        for (ApplicationGatewayBackendAddress address : addresses) {
            info.append("\n\t\t\t\t").append(address.fqdn()).append(" [").append(address.ipAddress()).append("]");
        }
        // Show SSL cert
        info.append("\n\t\t\tSSL certificate name: ");
        ApplicationGatewaySslCertificate cert = rule.sslCertificate();
        if (cert == null) {
            info.append("(None)");
        } else {
            info.append(cert.name());
        }
        // Show backend
        info.append("\n\t\t\tAssociated backend address pool: ");
        ApplicationGatewayBackend backend = rule.backend();
        if (backend == null) {
            info.append("(None)");
        } else {
            info.append(backend.name());
        }
        // Show backend HTTP settings config
        info.append("\n\t\t\tAssociated backend HTTP settings configuration: ");
        ApplicationGatewayBackendHttpConfiguration config = rule.backendHttpConfiguration();
        if (config == null) {
            info.append("(None)");
        } else {
            info.append(config.name());
        }
        // Show frontend listener
        info.append("\n\t\t\tAssociated frontend listener: ");
        ApplicationGatewayListener listener = rule.listener();
        if (listener == null) {
            info.append("(None)");
        } else {
            info.append(config.name());
        }
    }
    System.out.println(info.toString());
}
Also used : ApplicationGatewayBackend(com.microsoft.azure.management.network.ApplicationGatewayBackend) ApplicationGatewayRequestRoutingRule(com.microsoft.azure.management.network.ApplicationGatewayRequestRoutingRule) ApplicationGatewayProbe(com.microsoft.azure.management.network.ApplicationGatewayProbe) ApplicationGatewayBackendAddress(com.microsoft.azure.management.network.ApplicationGatewayBackendAddress) ApplicationGatewaySslCertificate(com.microsoft.azure.management.network.ApplicationGatewaySslCertificate) ApplicationGatewayIPConfiguration(com.microsoft.azure.management.network.ApplicationGatewayIPConfiguration) ApplicationGatewayListener(com.microsoft.azure.management.network.ApplicationGatewayListener) ApplicationGatewayFrontend(com.microsoft.azure.management.network.ApplicationGatewayFrontend) ApplicationGatewayBackendHttpConfiguration(com.microsoft.azure.management.network.ApplicationGatewayBackendHttpConfiguration)

Aggregations

ApplicationGatewayBackendHttpConfiguration (com.microsoft.azure.management.network.ApplicationGatewayBackendHttpConfiguration)3 ApplicationGatewayListener (com.microsoft.azure.management.network.ApplicationGatewayListener)3 ApplicationGatewayRequestRoutingRule (com.microsoft.azure.management.network.ApplicationGatewayRequestRoutingRule)3 ApplicationGatewayBackend (com.microsoft.azure.management.network.ApplicationGatewayBackend)2 ApplicationGatewayBackendAddress (com.microsoft.azure.management.network.ApplicationGatewayBackendAddress)2 ApplicationGatewayFrontend (com.microsoft.azure.management.network.ApplicationGatewayFrontend)2 ApplicationGatewayIPConfiguration (com.microsoft.azure.management.network.ApplicationGatewayIPConfiguration)2 ApplicationGatewayProbe (com.microsoft.azure.management.network.ApplicationGatewayProbe)2 ApplicationGatewaySslCertificate (com.microsoft.azure.management.network.ApplicationGatewaySslCertificate)2 SubResource (com.microsoft.azure.SubResource)1 ConnectionString (com.microsoft.azure.management.appservice.ConnectionString)1 Resource (com.microsoft.azure.management.resources.fluentcore.arm.models.Resource)1