Search in sources :

Example 1 with ApplicationGatewayFrontend

use of com.microsoft.azure.management.network.ApplicationGatewayFrontend 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 ApplicationGatewayFrontend

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

the class ApplicationGatewayImpl method withoutPublicFrontend.

@Override
public ApplicationGatewayImpl withoutPublicFrontend() {
    // Delete all public frontends
    List<String> toDelete = new ArrayList<>();
    for (ApplicationGatewayFrontend frontend : this.frontends.values()) {
        if (frontend.isPublic()) {
            toDelete.add(frontend.name());
        }
    }
    for (String frontendName : toDelete) {
        this.frontends.remove(frontendName);
    }
    this.defaultPublicFrontend = null;
    return this;
}
Also used : ApplicationGatewayFrontend(com.microsoft.azure.management.network.ApplicationGatewayFrontend) ArrayList(java.util.ArrayList)

Example 3 with ApplicationGatewayFrontend

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

the class ApplicationGatewayImpl method withoutPrivateFrontend.

@Override
public ApplicationGatewayImpl withoutPrivateFrontend() {
    // Delete all private frontends
    List<String> toDelete = new ArrayList<>();
    for (ApplicationGatewayFrontend frontend : this.frontends.values()) {
        if (frontend.isPrivate()) {
            toDelete.add(frontend.name());
        }
    }
    for (String frontendName : toDelete) {
        this.frontends.remove(frontendName);
    }
    this.defaultPrivateFrontend = null;
    return this;
}
Also used : ApplicationGatewayFrontend(com.microsoft.azure.management.network.ApplicationGatewayFrontend) ArrayList(java.util.ArrayList)

Example 4 with ApplicationGatewayFrontend

use of com.microsoft.azure.management.network.ApplicationGatewayFrontend 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

ApplicationGatewayFrontend (com.microsoft.azure.management.network.ApplicationGatewayFrontend)4 ApplicationGatewayBackend (com.microsoft.azure.management.network.ApplicationGatewayBackend)2 ApplicationGatewayBackendAddress (com.microsoft.azure.management.network.ApplicationGatewayBackendAddress)2 ApplicationGatewayBackendHttpConfiguration (com.microsoft.azure.management.network.ApplicationGatewayBackendHttpConfiguration)2 ApplicationGatewayIPConfiguration (com.microsoft.azure.management.network.ApplicationGatewayIPConfiguration)2 ApplicationGatewayListener (com.microsoft.azure.management.network.ApplicationGatewayListener)2 ApplicationGatewayProbe (com.microsoft.azure.management.network.ApplicationGatewayProbe)2 ApplicationGatewayRequestRoutingRule (com.microsoft.azure.management.network.ApplicationGatewayRequestRoutingRule)2 ApplicationGatewaySslCertificate (com.microsoft.azure.management.network.ApplicationGatewaySslCertificate)2 ArrayList (java.util.ArrayList)2 ConnectionString (com.microsoft.azure.management.appservice.ConnectionString)1