List of usage examples for com.amazonaws.services.elasticloadbalancing.model LoadBalancerDescription getDNSName
public String getDNSName()
The DNS name of the load balancer.
From source file:com.haskins.cloudtrailviewer.dialog.resourcedetail.detailpanels.ElbDetail.java
License:Open Source License
private void buildUI(DescribeLoadBalancersResult detail) { JTabbedPane tabs = new JTabbedPane(); tabs.add("Load Balancer", primaryScrollPane); final JTable healthCheckTable = new JTable(healthCheckTableModel); JScrollPane healthCheckScrollPane = new JScrollPane(healthCheckTable); tabs.add("Health Check", healthCheckScrollPane); final JTable listenersTable = new JTable(listenersTableModel); JScrollPane listenersScrollPane = new JScrollPane(listenersTable); tabs.add("Listeners", listenersScrollPane); this.add(tabs, BorderLayout.CENTER); List<LoadBalancerDescription> elbs = detail.getLoadBalancerDescriptions(); if (!elbs.isEmpty()) { LoadBalancerDescription elb = elbs.get(0); if (!elb.getAvailabilityZones().isEmpty()) { StringBuilder azs = new StringBuilder(); for (String az : elb.getAvailabilityZones()) { azs.append(az).append(", "); }/*ww w . j ava2 s. c o m*/ primaryTableModel.addRow(new Object[] { "Availability Zones", azs.toString() }); } if (elb.getCanonicalHostedZoneName() != null) { primaryTableModel .addRow(new Object[] { "Canonical Hosted Zone name", elb.getCanonicalHostedZoneName() }); } if (elb.getCanonicalHostedZoneNameID() != null) { primaryTableModel.addRow( new Object[] { "Canonical Hosted Zone name Id", elb.getCanonicalHostedZoneNameID() }); } if (elb.getCreatedTime() != null) { primaryTableModel.addRow(new Object[] { "Created", elb.getCreatedTime() }); } if (elb.getDNSName() != null) { primaryTableModel.addRow(new Object[] { "DNS Name", elb.getDNSName() }); } if (!elb.getInstances().isEmpty()) { StringBuilder instances = new StringBuilder(); for (Instance instance : elb.getInstances()) { instances.append(instance.getInstanceId()).append(", "); } primaryTableModel.addRow(new Object[] { "Instances", instances.toString() }); } if (elb.getLoadBalancerName() != null) { primaryTableModel.addRow(new Object[] { "Load Balander Name", elb.getLoadBalancerName() }); } if (elb.getScheme() != null) { primaryTableModel.addRow(new Object[] { "Scheme", elb.getScheme() }); } if (!elb.getSecurityGroups().isEmpty()) { StringBuilder sgs = new StringBuilder(); for (String sg : elb.getSecurityGroups()) { sgs.append(sg).append(", "); } primaryTableModel.addRow(new Object[] { "Security Groups", sgs.toString() }); } if (elb.getSourceSecurityGroup() != null) { primaryTableModel.addRow( new Object[] { "Source Security Group", elb.getSourceSecurityGroup().getGroupName() }); } if (!elb.getSubnets().isEmpty()) { StringBuilder subnets = new StringBuilder(); for (String subnet : elb.getSubnets()) { subnets.append(subnet).append(", "); } primaryTableModel.addRow(new Object[] { "Subnets", subnets.toString() }); } if (elb.getVPCId() != null) { primaryTableModel.addRow(new Object[] { "VPC Id", elb.getVPCId() }); } /** * Health Check */ healthCheckTableModel.addColumn("Property"); healthCheckTableModel.addColumn("Value"); HealthCheck healthCheck = elb.getHealthCheck(); if (healthCheck.getHealthyThreshold() != null) { healthCheckTableModel.addRow(new Object[] { "Threshold", healthCheck.getHealthyThreshold() }); } if (healthCheck.getInterval() != null) { healthCheckTableModel.addRow(new Object[] { "Interval", healthCheck.getInterval() }); } if (healthCheck.getTarget() != null) { healthCheckTableModel.addRow(new Object[] { "Target", healthCheck.getTarget() }); } if (healthCheck.getTimeout() != null) { healthCheckTableModel.addRow(new Object[] { "Timeout", healthCheck.getTimeout() }); } if (healthCheck.getUnhealthyThreshold() != null) { healthCheckTableModel .addRow(new Object[] { "Unhealth Threshold", healthCheck.getUnhealthyThreshold() }); } /** * Listeners */ listenersTableModel.addColumn("Instance Port"); listenersTableModel.addColumn("Instance Protocol"); listenersTableModel.addColumn("Load Balancer Port"); listenersTableModel.addColumn("Load Balancer Protocol"); listenersTableModel.addColumn("SSL Certificate Id"); List<ListenerDescription> listenerDescriptions = elb.getListenerDescriptions(); for (ListenerDescription description : listenerDescriptions) { Listener listener = description.getListener(); String ssl = ""; if (listener.getSSLCertificateId() != null) { ssl = listener.getSSLCertificateId(); } listenersTableModel .addRow(new Object[] { listener.getInstancePort(), listener.getInstanceProtocol(), listener.getLoadBalancerPort(), listener.getProtocol(), ssl }); } } }
From source file:com.kixeye.chassis.bootstrap.aws.ServerInstanceContext.java
License:Apache License
private void initExhibitor() { LOGGER.info("Initializing exhibitor info..."); List<LoadBalancerDescription> loadBalancers = AwsUtils.findLoadBalancers(amazonElasticLoadBalancing, new ZookeeperElbFilter(environment)); if (loadBalancers.size() == 0) { LOGGER.info("No Zookeeper ELBs for environment " + environment); return;/* ww w . j a v a 2 s . c om*/ } else if (loadBalancers.size() != 1) { throw new BootstrapException("Found multiple Zookeeper ELBs for environment " + environment); } LoadBalancerDescription loadBalancer = loadBalancers.get(0); ListenerDescription exhibitorListenerDescription = getExhibitorListenerDescription(loadBalancer); this.exhibitorHost = loadBalancer.getDNSName(); this.exhibitorPort = exhibitorListenerDescription.getListener().getLoadBalancerPort(); LOGGER.info("Initialized exhibitor info with: exhibitorHost: {}, exhibitorPort: {}", exhibitorHost, exhibitorPort); }
From source file:com.zotoh.cloudapi.aws.ElasticLoadBalancer.java
License:Open Source License
private LoadBalancer toELB(LoadBalancerDescription desc) { LoadBalancer b = null;/*from w w w . j a v a 2 s . c om*/ if (desc != null) { ProviderContext x = _svc.getCloud().getContext(); b = new LoadBalancer(); b.setCreationTimestamp(desc.getCreatedTime().getTime()); b.setProviderRegionId(x.getRegionId()); b.setAddressType(LoadBalancerAddressType.DNS); b.setCurrentState(LoadBalancerState.ACTIVE); b.setProviderOwnerId(x.getAccountNumber()); b.setName(desc.getLoadBalancerName()); b.setDescription(b.getName()); b.setProviderLoadBalancerId(b.getName()); b.setAddress(desc.getDNSName()); // zones { List<String> lst = desc.getAvailabilityZones(); if (!isNil(lst)) { b.setProviderDataCenterIds(lst.toArray(new String[0])); } } // servers { List<Instance> lst = desc.getInstances(); List<String> s = LT(); if (!isNil(lst)) for (int i = 0; i < lst.size(); ++i) { s.add(lst.get(i).getInstanceId()); } b.setProviderServerIds(s.toArray(new String[0])); } // listeners/ports { List<ListenerDescription> lst = desc.getListenerDescriptions(); List<LbListener> rc = LT(); int[] pports; if (lst != null) for (int i = 0; i < lst.size(); ++i) { rc.add(toLis(lst.get(i))); } b.setListeners(rc.toArray(new LbListener[0])); pports = new int[rc.size()]; for (int i = 0; i < pports.length; ++i) { pports[i] = rc.get(i).getPublicPort(); } b.setPublicPorts(pports); } // unsupported desc.getHealthCheck(); desc.getPolicies(); desc.getSourceSecurityGroup(); desc.getCanonicalHostedZoneName(); } return b; }
From source file:fr.xebia.demo.amazon.aws.PetclinicInfrastructureEnforcer.java
License:Apache License
void createTomcatMySqlInfrastructure(String applicationId, String rootContext, String warUrl, String healthCheckUri, Distribution... distributions) { String dbInstanceIdentifier = applicationId; String dbName = applicationId; String jdbcUsername = applicationId; String jdbcPassword = applicationId; DBInstance dbInstance = createMySqlDatabaseInstanceIfNotExists(dbInstanceIdentifier, dbName, jdbcUsername, jdbcPassword);/*from w ww .ja v a2s . co m*/ dbInstance = awaitForDbInstanceCreation(dbInstance); LOGGER.info("MySQL instance: {}", dbInstance); List<Instance> tomcatInstances = createTomcatServers(dbInstance, applicationId, jdbcUsername, jdbcPassword, warUrl, rootContext, distributions); LOGGER.info("EC2 instances: {}", tomcatInstances); LoadBalancerDescription loadBalancerDescription = createOrUpdateElasticLoadBalancer(healthCheckUri, applicationId); LOGGER.info("Load Balancer DNS name: {}", loadBalancerDescription.getDNSName()); // PRINT INFRASTRUCTURE LOGGER.info("DATABASE"); LOGGER.info("========"); String jdbcUrl = "jdbc:mysql://" + dbInstance.getEndpoint().getAddress() + ":" + dbInstance.getEndpoint().getPort() + "/" + dbInstance.getDBName(); LOGGER.info("jdbc.url= {}", jdbcUrl); LOGGER.info("jdbc.username= {}", jdbcUsername); LOGGER.info("jdbc.password= {}", jdbcPassword); LOGGER.info(""); LOGGER.info("TOMCAT SERVERS"); LOGGER.info("=============="); tomcatInstances = awaitForEc2Instances(tomcatInstances); for (Instance instance : tomcatInstances) { LOGGER.info("http://{}:8080", instance.getPublicDnsName(), rootContext); } LOGGER.info("LOAD BALANCER"); LOGGER.info("============="); LOGGER.info("http://{}{}", loadBalancerDescription.getDNSName(), rootContext); }
From source file:fr.xebia.workshop.infrastructureascode.AmazonAwsPetclinicInfrastructureEnforcer.java
License:Apache License
void createTomcatMySqlInfrastructure(String applicationId, String rootContext, String warUrl, String healthCheckUri, Distribution... distributions) { String dbInstanceIdentifier = applicationId; String dbName = applicationId; String jdbcUsername = applicationId; String jdbcPassword = applicationId; DBInstance dbInstance = createMySqlDatabaseInstanceIfNotExists(dbInstanceIdentifier, dbName, jdbcUsername, jdbcPassword);//ww w . jav a 2s . c om dbInstance = awaitForDbInstanceCreation(dbInstance); logger.info("MySQL instance: " + dbInstance); List<Instance> tomcatInstances = createTomcatServers(dbInstance, applicationId, jdbcUsername, jdbcPassword, warUrl, rootContext, distributions); logger.info("EC2 instances: " + tomcatInstances); LoadBalancerDescription loadBalancerDescription = createOrUpdateElasticLoadBalancer(healthCheckUri, applicationId); logger.info("Load Balancer DNS name: " + loadBalancerDescription.getDNSName()); // PRINT INFRASTRUCTURE System.out.println("DATABASE"); System.out.println("========"); String jdbcUrl = "jdbc:mysql://" + dbInstance.getEndpoint().getAddress() + ":" + dbInstance.getEndpoint().getPort() + "/" + dbInstance.getDBName(); System.out.println("jdbc.url= " + jdbcUrl); System.out.println("jdbc.username= " + jdbcUsername); System.out.println("jdbc.password= " + jdbcPassword); System.out.println(); System.out.println("TOMCAT SERVERS"); System.out.println("=============="); tomcatInstances = awaitForEc2Instances(tomcatInstances); for (Instance instance : tomcatInstances) { System.out.println("http://" + instance.getPublicDnsName() + ":8080" + rootContext); } System.out.println("LOAD BALANCER"); System.out.println("============="); System.out.println("http://" + loadBalancerDescription.getDNSName() + rootContext); }
From source file:tools.descartes.bungee.cloud.aws.AWSImpl.java
License:Apache License
LoadBalancerDescription getLoadBalancerForHostName(String hostName) { LoadBalancerDescription balancer = null; DescribeLoadBalancersResult describeLoadBalancers = elasticLB.describeLoadBalancers(); List<LoadBalancerDescription> loadBalancerDescriptions = describeLoadBalancers .getLoadBalancerDescriptions(); for (LoadBalancerDescription loadBalancerDescription : loadBalancerDescriptions) { if (loadBalancerDescription.getDNSName().equalsIgnoreCase(hostName)) { balancer = loadBalancerDescription; }/* ww w. jav a 2 s.c om*/ } return balancer; }