Authored by qinchao

内购开关功能

package com.monitor.cmdb.ctrl;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.autoscaling.AmazonAutoScaling;
import com.amazonaws.services.autoscaling.AmazonAutoScalingClient;
import com.amazonaws.services.elasticloadbalancingv2.model.SetSecurityGroupsRequest;
import com.yoho.ops.cmdb.aws.AwsClientFactory;
import com.yoho.ops.cmdb.aws.lb.AwsApplicationLoadBalanceFetcher;
import com.yoho.ops.cmdb.domain.BaseResponse;
import com.yoho.ops.cmdb.models.LoadBalance;
... ... @@ -22,8 +27,9 @@ import java.util.List;
public class NwtmCtrl {
@Autowired
private AwsApplicationLoadBalanceFetcher awsApplicationLoadBalanceFetcher;
/*@Autowired
AWSClientComp awsClientComp;*/
@Autowired
private AwsClientFactory awsClientFactory;
//运行外网访问的安全组id
private String YOHO_ELB_ID="XXXXX";
... ... @@ -82,11 +88,12 @@ public class NwtmCtrl {
resetFlag=true;
}
}
/* if(resetFlag){
AmazonAutoScaling client = new AmazonAutoScalingClient(awsClientComp.getAWSCredentials());
client.setRegion(awsClientComp.getRegion(Regions.CN_NORTH_1));
if(resetFlag){
SetSecurityGroupsRequest request=new SetSecurityGroupsRequest();
}*/
request.setSecurityGroups(securityGroups);
awsClientFactory.getALBClient().setSecurityGroups(request);
}
return new BaseResponse();
}
}
... ...