当前位置: 首页>>代码示例>>Java>>正文


Java LoadBalancerDescription.setInstances方法代码示例

本文整理汇总了Java中com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription.setInstances方法的典型用法代码示例。如果您正苦于以下问题:Java LoadBalancerDescription.setInstances方法的具体用法?Java LoadBalancerDescription.setInstances怎么用?Java LoadBalancerDescription.setInstances使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription的用法示例。


在下文中一共展示了LoadBalancerDescription.setInstances方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: makeLoadBalancerDescription

import com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription; //导入方法依赖的package包/类
/**
 * Test helper - makes a fake LB description.
 */
private LoadBalancerDescription makeLoadBalancerDescription(String elbName, String... instanceIds)
{
  LoadBalancerDescription loadBalancerDescription = new LoadBalancerDescription();
  loadBalancerDescription.setLoadBalancerName(elbName);
  List<Instance> instances = new ArrayList<Instance>();
  if (instanceIds != null)
  {
    for (String instanceId : instanceIds)
    {
      Instance instance = new Instance();
      instance.setInstanceId(instanceId);
      instances.add(instance);
    }
  }
  loadBalancerDescription.setInstances(instances);
  return loadBalancerDescription;
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:21,代码来源:ElbInstanceGoneProgressCheckerTest.java

示例2: addAndAssociate

import com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription; //导入方法依赖的package包/类
private void addAndAssociate(LoadBalancerDescription elb) {
	loadBalancers.add(elb);	
	// instances
	Collection<com.amazonaws.services.elasticloadbalancing.model.Instance> list = new LinkedList<>();
	for(Instance i : instances) {
		list.add(new com.amazonaws.services.elasticloadbalancing.model.Instance().withInstanceId(i.getInstanceId()));
	}
	elb.setInstances(list);
	// subnets
	List<String> subnetIds = new LinkedList<>();
	for(Subnet s : subnets) {
		subnetIds.add(s.getSubnetId());
	}
	elb.setSubnets(subnetIds);
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:16,代码来源:VpcTestBuilder.java

示例3: setUp

import com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription; //导入方法依赖的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


注:本文中的com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription.setInstances方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。