com.amazonaws.services.elasticloadbalancingv2.AmazonElasticLoadBalancingClient Java Examples

The following examples show how to use com.amazonaws.services.elasticloadbalancingv2.AmazonElasticLoadBalancingClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResourceTaggingManager.java    From pacbot with Apache License 2.0 6 votes vote down vote up
/**
 * get the value of pacman tag from app elb
 * @param resourceId
 * @param clientMap
 * @return
 */
private String getAppElbPacManTagValue(String resourceId, Map<String, Object> clientMap) {

    try{
        AmazonElasticLoadBalancingClient client = (AmazonElasticLoadBalancingClient) clientMap.get(PacmanSdkConstants.CLIENT);
        com.amazonaws.services.elasticloadbalancingv2.model.DescribeTagsRequest describeTagsRequest =   new com.amazonaws.services.elasticloadbalancingv2.model.DescribeTagsRequest();
        describeTagsRequest.withResourceArns(resourceId);
        com.amazonaws.services.elasticloadbalancingv2.model.DescribeTagsResult describeTagsResult = client.describeTags(describeTagsRequest);
        List<com.amazonaws.services.elasticloadbalancingv2.model.TagDescription> descriptions = describeTagsResult.getTagDescriptions();
        com.amazonaws.services.elasticloadbalancingv2.model.Tag tag=null;
        Optional<com.amazonaws.services.elasticloadbalancingv2.model.Tag> optional=null;;
        if(descriptions!=null && descriptions.size()>0){
             optional = descriptions.get(0).getTags().stream()
            .filter(obj -> obj.getKey().equals(CommonUtils.getPropValue(PacmanSdkConstants.PACMAN_AUTO_FIX_TAG_NAME))).findAny();
        }
        if (optional.isPresent()) {
            tag = optional.get();
        } else {
            return null;
        }
        return tag.getValue();
    }catch (Exception e) {
        logger.error("error whiel getting pacman tag valye for " + resourceId,e);
        return null;
    }
}
 
Example #2
Source File: ApplicationLoadBalancer.java    From Baragon with Apache License 2.0 5 votes vote down vote up
@Inject
public ApplicationLoadBalancer(Optional<ElbConfiguration> configuration,
                               BaragonExceptionNotifier exceptionNotifier,
                               BaragonLoadBalancerDatastore loadBalancerDatastore,
                               BaragonKnownAgentsDatastore knownAgentsDatastore,
                               @Named(BaragonServiceModule.BARAGON_AWS_ELB_CLIENT_V2) AmazonElasticLoadBalancingClient elbClient) {
  super(configuration, exceptionNotifier, loadBalancerDatastore, knownAgentsDatastore);
  this.elbClient = elbClient;
}