List of usage examples for com.amazonaws.services.elasticloadbalancing.model LoadBalancerDescription getSourceSecurityGroup
public SourceSecurityGroup getSourceSecurityGroup()
The security group for the load balancer, which you can use as part of your inbound rules for your registered instances.
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(", "); }/*from w w w . java2s .co 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.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 o m*/ 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; }