use of com.microsoft.azure.management.network.ApplicationGatewayIPConfiguration 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());
}
use of com.microsoft.azure.management.network.ApplicationGatewayIPConfiguration 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());
}
Aggregations