本文整理汇总了Java中com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult类的典型用法代码示例。如果您正苦于以下问题:Java DescribeLoadBalancersResult类的具体用法?Java DescribeLoadBalancersResult怎么用?Java DescribeLoadBalancersResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DescribeLoadBalancersResult类属于com.amazonaws.services.elasticloadbalancing.model包,在下文中一共展示了DescribeLoadBalancersResult类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testGetElbDnsName
import com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult; //导入依赖的package包/类
@Test
public void testGetElbDnsName() {
final LoadBalancerDescription description = new LoadBalancerDescription();
description.setDNSName("testDnsName");
final List<LoadBalancerDescription> descriptions = new ArrayList<>();
descriptions.add(description);
final DescribeLoadBalancersResult result = mock(DescribeLoadBalancersResult.class);
when(result.getLoadBalancerDescriptions()).thenReturn(descriptions);
when(amazonElbClient.describeLoadBalancers(any(DescribeLoadBalancersRequest.class))).thenReturn(result);
final String elbName = "testElbName";
assertThat(awsHelperService.getElbDnsName(elbName), equalTo(description.getDNSName()));
final ArgumentCaptor<DescribeLoadBalancersRequest> argumentCaptor = ArgumentCaptor.forClass(DescribeLoadBalancersRequest.class);
verify(amazonElbClient).describeLoadBalancers(argumentCaptor.capture());
assertThat(argumentCaptor.getValue().getLoadBalancerNames().get(0), equalTo(elbName));
}
开发者ID:shinesolutions,项目名称:aem-orchestrator,代码行数:21,代码来源:AwsHelperServiceTest.java
示例2: makeDescribeLoadBalancersResult
import com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult; //导入依赖的package包/类
/**
* Test helper - makes describe result with one or more named LBs.
*/
private DescribeLoadBalancersResult makeDescribeLoadBalancersResult(String... loadBalancerNames)
{
DescribeLoadBalancersResult result = new DescribeLoadBalancersResult();
if (ArrayUtils.isNotEmpty(loadBalancerNames))
{
List<LoadBalancerDescription> list = new ArrayList<LoadBalancerDescription>();
for (String loadBalancerName : loadBalancerNames)
{
LoadBalancerDescription loadBalancerDescription = new LoadBalancerDescription();
loadBalancerDescription.setLoadBalancerName(loadBalancerName);
list.add(loadBalancerDescription);
}
result.setLoadBalancerDescriptions(list);
}
return result;
}
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:20,代码来源:ElbClientTest.java
示例3: getAwsLoadBalancer
import com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult; //导入依赖的package包/类
private LoadBalancerDescription getAwsLoadBalancer(String name) {
DescribeLoadBalancersRequest describeRequest = new DescribeLoadBalancersRequest()
.withLoadBalancerNames(name);
DescribeLoadBalancersResult describeResult = null;
try {
describeResult = this.client.describeLoadBalancers(describeRequest);
} catch (Exception e) {
this.host.log("Exception describing load balancers with name '%s': %s", name,
e.toString());
}
Collection<LoadBalancerDescription> lbs =
describeResult != null ? describeResult.getLoadBalancerDescriptions() : null;
if (lbs == null || lbs.isEmpty()) {
return null;
}
if (lbs.size() > 1) {
throw new IllegalStateException(
"More than one load balancers found with name '" + name + "'.");
}
return lbs.iterator().next();
}
开发者ID:vmware,项目名称:photon-model,代码行数:25,代码来源:AWSLoadBalancerServiceTest.java
示例4: getLoadBalancerDNS
import com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult; //导入依赖的package包/类
public static String getLoadBalancerDNS(String name) {
if (name == null || name.trim().length() == 0)
throw new RuntimeException(
"The name of the load balancer cannot be empty!");
connect();
ArrayList<String> names = new ArrayList<String>();
names.add(name);
DescribeLoadBalancersRequest req = new DescribeLoadBalancersRequest(
names);
DescribeLoadBalancersResult res = client.describeLoadBalancers(req);
List<LoadBalancerDescription> descs = res.getLoadBalancerDescriptions();
if (descs.size() == 0 || descs.get(0) == null)
return null;
return descs.get(0).getDNSName();
}
开发者ID:rickdesantis,项目名称:cloud-runner,代码行数:20,代码来源:ElasticLoadBalancing.java
示例5: describeLoadBalancer
import com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult; //导入依赖的package包/类
public LoadBalancerDescription describeLoadBalancer(AwsProcessClient awsProcessClient, String loadBalancerName) {
// 単一ロードバランサの参照
DescribeLoadBalancersRequest request = new DescribeLoadBalancersRequest();
request.withLoadBalancerNames(loadBalancerName);
DescribeLoadBalancersResult result = awsProcessClient.getElbClient().describeLoadBalancers(request);
List<LoadBalancerDescription> descriptions = result.getLoadBalancerDescriptions();
// API実行結果チェック
if (descriptions.size() == 0) {
// アドレスが存在しない場合
throw new AutoException("EPROCESS-000131", loadBalancerName);
} else if (descriptions.size() > 1) {
// アドレスを複数参照できた場合
AutoException exception = new AutoException("EPROCESS-000132", loadBalancerName);
exception.addDetailInfo("result=" + descriptions);
throw exception;
}
return descriptions.get(0);
}
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:22,代码来源:AwsCommonProcess.java
示例6: getElb
import com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult; //导入依赖的package包/类
@GET
@NoAuth
@Path("/{elbName}")
public LoadBalancerDescription getElb(@PathParam("elbName") String elbName) {
if (config.isPresent()) {
try {
DescribeLoadBalancersRequest request = new DescribeLoadBalancersRequest(Arrays.asList(elbName));
DescribeLoadBalancersResult result = elbClient.describeLoadBalancers(request);
for (LoadBalancerDescription elb : result.getLoadBalancerDescriptions()) {
if (elb.getLoadBalancerName().equals(elbName)) {
return elb;
}
}
} catch (AmazonClientException e) {
throw new BaragonWebException(String.format("AWS Client Error: %s", e));
}
throw new BaragonNotFoundException(String.format("ELB with name %s not found", elbName));
} else {
throw new BaragonWebException("ElbSync and related actions are not currently enabled");
}
}
开发者ID:HubSpot,项目名称:Baragon,代码行数:22,代码来源:ElbResource.java
示例7: describeLoadBalancer
import com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult; //导入依赖的package包/类
/**
* Returns a description of the named ELB.
*/
public LoadBalancerDescription describeLoadBalancer(String elbName)
{
LOGGER.debug("describeLoadBalancers(elbName: " + elbName + ")");
if (StringUtils.isBlank(elbName))
{
throw new IllegalArgumentException("Blank elbName");
}
StopWatch stopWatch = new StopWatch();
try
{
stopWatch.start();
DescribeLoadBalancersRequest request = new DescribeLoadBalancersRequest();
request.setLoadBalancerNames(Arrays.asList(elbName));
DescribeLoadBalancersResult result = awsElbClient.describeLoadBalancers(request);
if (result == null || CollectionUtils.isEmpty(result.getLoadBalancerDescriptions()))
{
throw new RuntimeException("ELB '" + elbName + "' was not found");
}
else if (result.getLoadBalancerDescriptions().size() > 1)
{
LOGGER.warn("Expected 1 ELB description for elb name '" + elbName + "', found "
+ result.getLoadBalancerDescriptions().size());
}
return result.getLoadBalancerDescriptions().get(0);
}
finally
{
stopWatch.stop();
LOGGER.debug("describeLoadBalancers time elapsed " + stopWatch);
}
}
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:35,代码来源:ElbClient.java
示例8: getAWSLoadBalancer
import com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult; //导入依赖的package包/类
private DeferredResult<AWSLoadBalancerContext> getAWSLoadBalancer(
AWSLoadBalancerContext context) {
DescribeLoadBalancersRequest describeRequest = new DescribeLoadBalancersRequest()
.withLoadBalancerNames(context.loadBalancerStateExpanded.name);
String message =
"Describing AWS load balancer [" + context.loadBalancerStateExpanded.name + "].";
AWSDeferredResultAsyncHandler<DescribeLoadBalancersRequest, DescribeLoadBalancersResult> handler =
new AWSDeferredResultAsyncHandler<>(this, message);
context.client.describeLoadBalancersAsync(describeRequest, handler);
return handler.toDeferredResult().thenCompose(result -> {
List<com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription> lbs = result
.getLoadBalancerDescriptions();
if (lbs != null && !lbs.isEmpty() && lbs.size() == 1) {
context.registeredInstances = lbs.iterator().next().getInstances();
return DeferredResult.completed(context);
}
return DeferredResult.failed(new IllegalStateException(
"Unable to describe load balancer with name '"
+ context.loadBalancerStateExpanded.name + "' for update"));
});
}
开发者ID:vmware,项目名称:photon-model,代码行数:28,代码来源:AWSLoadBalancerService.java
示例9: getExternalResources
import com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult; //导入依赖的package包/类
@Override
protected DeferredResult<RemoteResourcesPage> getExternalResources(String nextPageLink) {
DescribeLoadBalancersRequest describeRequest = new DescribeLoadBalancersRequest()
.withPageSize(getQueryPageSize());
if (nextPageLink != null) {
describeRequest.setMarker(nextPageLink);
}
String msg =
"Getting AWS Load Balancers [" + this.request.original.resourceReference + "]";
AWSDeferredResultAsyncHandler<DescribeLoadBalancersRequest, DescribeLoadBalancersResult> asyncHandler =
new AWSDeferredResultAsyncHandler<>(this.service, msg);
this.amazonLoadBalancerClient.describeLoadBalancersAsync(describeRequest, asyncHandler);
return asyncHandler.toDeferredResult().thenApply(describeLoadBalancersResult -> {
RemoteResourcesPage page = new RemoteResourcesPage();
page.nextPageLink = describeLoadBalancersResult.getNextMarker();
describeLoadBalancersResult.getLoadBalancerDescriptions().forEach(
lbDescription -> page.resourcesPage
.put(lbDescription.getLoadBalancerName(), lbDescription));
return page;
});
}
开发者ID:vmware,项目名称:photon-model,代码行数:29,代码来源:AWSLoadBalancerEnumerationAdapterService.java
示例10: getLoadBalancerList
import com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult; //导入依赖的package包/类
public Collection<String> getLoadBalancerList(){
DescribeLoadBalancersResult loadBalancers = this.loadBalanceClient.describeLoadBalancers();
System.out.println(loadBalancers.toString());
Collection returnList = new ArrayList<String>();
List<LoadBalancerDescription> loadBalancerDescriptions = loadBalancers.getLoadBalancerDescriptions();
for( LoadBalancerDescription desc : loadBalancerDescriptions){
returnList.add(desc.getDNSName());
}
return returnList;
}
开发者ID:cheetah100,项目名称:gravity,代码行数:14,代码来源:AwsAutomationAction.java
示例11: describeMatchingElbListeners
import com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult; //导入依赖的package包/类
private List<ListenerDescription> describeMatchingElbListeners(String loadbalancerName, List<Integer> ports) {
DescribeLoadBalancersResult loadbalancer = awsElbClient.describeLoadBalancers(new DescribeLoadBalancersRequest().withLoadBalancerNames(loadbalancerName));
LoadBalancerDescription description = loadbalancer.getLoadBalancerDescriptions().get(0);
return description.getListenerDescriptions().stream()
.filter(d -> ports.contains(d.getListener().getLoadBalancerPort()))
.filter(d -> d.getListener().getProtocol().startsWith("HTTP"))
.collect(Collectors.toList());
}
开发者ID:msoute,项目名称:vertx-deploy-tools,代码行数:9,代码来源:AwsAutoScalingDeployUtils.java
示例12: describeLoadBalancers
import com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult; //导入依赖的package包/类
@Override
public List<AbstractResource<?>> describeLoadBalancers(Account account, Region region, DateTime dt) {
AmazonElasticLoadBalancing elb = findClient(account, region);
DescribeLoadBalancersRequest req = new DescribeLoadBalancersRequest();
log.debug("start describing elb for account:{} in region:{} via api", account.getId() + "=>" + account.getName(), region);
DescribeLoadBalancersResult res = elb.describeLoadBalancers(req);
return converter.toLoadBalancers(res.getLoadBalancerDescriptions(), account.getId(), region, dt);
}
开发者ID:veyronfei,项目名称:clouck,代码行数:11,代码来源:ElbWrapperImpl.java
示例13: describeLoadBalancers
import com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult; //导入依赖的package包/类
public List<LoadBalancerDescription> describeLoadBalancers() {
DescribeLoadBalancersRequest request = new DescribeLoadBalancersRequest();
DescribeLoadBalancersResult result = elbClient.describeLoadBalancers(request);
List<LoadBalancerDescription> descriptions = result.getLoadBalancerDescriptions();
logger.info(String.format("Found %s load balancers %s", descriptions.size(), descriptions));
return descriptions;
}
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:8,代码来源:LoadBalancerClient.java
示例14: getElb
import com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult; //导入依赖的package包/类
private Optional<LoadBalancerDescription> getElb(String elbName) {
DescribeLoadBalancersRequest request = new DescribeLoadBalancersRequest(Arrays.asList(elbName));
DescribeLoadBalancersResult result = elbClient.describeLoadBalancers(request);
if (!result.getLoadBalancerDescriptions().isEmpty()) {
return Optional.of(result.getLoadBalancerDescriptions().get(0));
} else {
return Optional.absent();
}
}
开发者ID:HubSpot,项目名称:Baragon,代码行数:10,代码来源:ClassicLoadBalancer.java
示例15: getElbDnsName
import com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult; //导入依赖的package包/类
/**
* Return the DNS name for a given AWS ELB group name
* @param elbName the ELB group name
* @return String DNS name
*/
public String getElbDnsName(String elbName) {
DescribeLoadBalancersResult result = amazonElbClient.describeLoadBalancers(new DescribeLoadBalancersRequest()
.withLoadBalancerNames(elbName));
return result.getLoadBalancerDescriptions().get(0).getDNSName();
}
开发者ID:shinesolutions,项目名称:aem-orchestrator,代码行数:11,代码来源:AwsHelperService.java
示例16: setupMock
import com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult; //导入依赖的package包/类
private void setupMock(DescribeLoadBalancersResult fakeResult)
{
when(mockELBClient.describeLoadBalancers(any(DescribeLoadBalancersRequest.class))).thenReturn(fakeResult);
}
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:5,代码来源:ElbClientTest.java
示例17: setUp
import com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.violationSinkMock = mock(ViolationSink.class);
this.clientProviderMock = mock(ClientProvider.class);
this.accountIdSupplierMock = mock(AccountIdSupplier.class);
this.jobsPropertiesMock = mock(JobsProperties.class);
this.portsChecker = mock(PortsChecker.class);
this.securityGroupsChecker = mock(SecurityGroupsChecker.class);
this.mockAwsELBClient = mock(AmazonElasticLoadBalancingClient.class);
this.mockAwsApplications = mock(AwsApplications.class);
this.mockViolationService = mock(ViolationService.class);
this.fetchTaupageYamlMock = mock(FetchTaupageYaml.class);
this.mockAmiDetailsProvider = mock(AmiDetailsProvider.class);
this.mockEC2InstanceProvider = mock(EC2InstanceProvider.class);
final Listener listener = new Listener("HTTPS", 80, 80);
final ListenerDescription listenerDescription = new ListenerDescription();
listenerDescription.setListener(listener);
final ArrayList<LoadBalancerDescription> elbs = newArrayList();
final ArrayList<TagDescription> tagDescriptions = newArrayList();
final LoadBalancerDescription publicELB = new LoadBalancerDescription();
publicELB.setScheme("internet-facing");
publicELB.setListenerDescriptions(newArrayList(listenerDescription));
publicELB.setCanonicalHostedZoneName("test.com");
publicELB.setInstances(asList(new Instance("i1"), new Instance("i2")));
publicELB.setLoadBalancerName("publicELB");
elbs.add(publicELB);
tagDescriptions.add(
new TagDescription()
.withLoadBalancerName("publicELB")
.withTags(newArrayList(
new Tag().withKey("someTag").withValue("someValue"))));
final LoadBalancerDescription privateELB = new LoadBalancerDescription();
privateELB.setScheme("internal");
privateELB.setCanonicalHostedZoneName("internal.org");
privateELB.setLoadBalancerName("privateELB");
elbs.add(privateELB);
for (int i = 1; i <= 20; i++) {
final String loadBalancerName = "kubeELB" + i;
final LoadBalancerDescription kubeELB = new LoadBalancerDescription();
kubeELB.setScheme("internet-facing");
kubeELB.setCanonicalHostedZoneName("test" + i + ".com");
kubeELB.setLoadBalancerName(loadBalancerName);
elbs.add(kubeELB);
tagDescriptions.add(
new TagDescription()
.withLoadBalancerName(loadBalancerName)
.withTags(newArrayList(
new Tag().withKey("someTag").withValue("someValue"),
new Tag().withKey("kubernetes.io/cluster/").withValue("owned"))));
}
mockDescribeELBResult = new DescribeLoadBalancersResult();
mockDescribeELBResult.setLoadBalancerDescriptions(elbs);
mockDescribeTagsResult = new DescribeTagsResult();
mockDescribeTagsResult.setTagDescriptions(tagDescriptions);
regions.add(REGION1);
when(clientProviderMock.getClient(any(), any(String.class), any(Region.class))).thenReturn(mockAwsELBClient);
when(mockEC2InstanceProvider.getById(anyString(), any(Region.class), anyString()))
.thenReturn(Optional.of(new com.amazonaws.services.ec2.model.Instance().withInstanceId("foo").withImageId("bar")));
when(mockAmiDetailsProvider.getAmiDetails(anyString(), any(Region.class), anyString()))
.thenReturn(ImmutableMap.of("ami_id", "bar"));
}
开发者ID:zalando-stups,项目名称:fullstop,代码行数:74,代码来源:FetchElasticLoadBalancersJobTest.java
示例18: describeELB
import com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult; //导入依赖的package包/类
public LoadBalancerDescription describeELB(String elbName) {
logger.info("describe elb, elbName={}", elbName);
DescribeLoadBalancersResult result = elb.describeLoadBalancers(new DescribeLoadBalancersRequest()
.withLoadBalancerNames(elbName));
return result.getLoadBalancerDescriptions().get(0);
}
开发者ID:neowu,项目名称:cmn-project,代码行数:7,代码来源:ElasticLoadBalancing.java
示例19: listELBs
import com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult; //导入依赖的package包/类
public List<LoadBalancerDescription> listELBs() {
logger.info("list all elbs");
DescribeLoadBalancersResult result = elb.describeLoadBalancers();
return result.getLoadBalancerDescriptions();
}
开发者ID:neowu,项目名称:cmn-project,代码行数:6,代码来源:ElasticLoadBalancing.java
注:本文中的com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论