• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Vpc类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.amazonaws.services.ec2.model.Vpc的典型用法代码示例。如果您正苦于以下问题:Java Vpc类的具体用法?Java Vpc怎么用?Java Vpc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Vpc类属于com.amazonaws.services.ec2.model包,在下文中一共展示了Vpc类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createSecurityGroupOnDefaultVPC

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
private static String createSecurityGroupOnDefaultVPC(AWSInstanceContext aws) {
    String vpcId = null;
    // get the subnet cidr (if any)
    String subnetCidr = null;
    // in case subnet will be obtained from the default vpc, the security group should
    // as well be created there
    Vpc defaultVPC = getDefaultVPC(aws);
    if (defaultVPC != null) {
        vpcId = defaultVPC.getVpcId();
        subnetCidr = defaultVPC.getCidrBlock();
    }

    // no subnet or no vpc is not an option...
    if (subnetCidr == null || vpcId == null) {
        throw new AmazonServiceException("default VPC not found");
    }

    return new AWSSecurityGroupClient(aws.amazonEC2Client)
            .createDefaultSecurityGroupWithDefaultRules(defaultVPC);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:21,代码来源:AWSUtils.java


示例2: createDefaultSecurityGroupWithDefaultRules

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
public String createDefaultSecurityGroupWithDefaultRules(Vpc vpc) {
    String groupId;
    try {
        groupId = createDefaultSecurityGroup(vpc.getVpcId());
        addIngressRules(groupId,
                getDefaultRules(vpc.getCidrBlock()));
    } catch (AmazonServiceException t) {
        if (t.getMessage().contains(
                DEFAULT_SECURITY_GROUP_NAME)) {
            groupId = getSecurityGroup(DEFAULT_SECURITY_GROUP_NAME,
                    vpc.getVpcId()).getGroupId();
        } else {
            throw t;
        }
    }
    return groupId;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:18,代码来源:AWSSecurityGroupClient.java


示例3: VpcDTO

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
public VpcDTO(final Vpc vpc) {
    this.vpcId = vpc.getVpcId();
    this.cidrBlock = vpc.getCidrBlock();
    this.state = vpc.getState();
    this.tags.addAll(
        vpc.getTags()
            .stream()
            .map(TagDTO::new)
            .collect(Collectors.toList()));

    this.name = vpc.getTags()
        .stream()
        .filter(t -> t.getKey().equals("Name"))
        .findFirst()
        .map(Tag::getValue)
        .orElse("n/a");
}
 
开发者ID:kylesm,项目名称:vpcviewer,代码行数:18,代码来源:VpcDTO.java


示例4: getVpcInRegion

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
@Override
@Cacheable(value = CachingConfiguration.VPC_CACHE, key = "#vpcId", condition = "#bypassCache == false")
public Vpc getVpcInRegion(final String vpcId, final String region, boolean bypassCache) {
    Preconditions.checkArgument(StringUtils.isNotBlank(vpcId), "vpcId may not be null or blank");
    Preconditions.checkArgument(StringUtils.isNotBlank(region), "region may not be null or blank");

    LOG.info("Retrieving VPC {} in region {} ({})", vpcId, region, bypassCache);
    DescribeVpcsRequest request = new DescribeVpcsRequest()
        .withVpcIds(vpcId);
    DescribeVpcsResult result = getClientForRegion(region).describeVpcs(request);

    List<Vpc> results = result.getVpcs();

    if (results.size() != 1) {
        throw new IllegalArgumentException("Did not get expected result");
    }

    return results.get(0);
}
 
开发者ID:kylesm,项目名称:vpcviewer,代码行数:20,代码来源:VpcServiceImpl.java


示例5: findNonOverLappingCIDR

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
protected String findNonOverLappingCIDR(AuthenticatedContext ac, CloudStack stack) {
    AwsNetworkView awsNetworkView = new AwsNetworkView(stack.getNetwork());
    String region = ac.getCloudContext().getLocation().getRegion().value();
    AmazonEC2Client ec2Client = awsClient.createAccess(new AwsCredentialView(ac.getCloudCredential()), region);

    DescribeVpcsRequest vpcRequest = new DescribeVpcsRequest().withVpcIds(awsNetworkView.getExistingVPC());
    Vpc vpc = ec2Client.describeVpcs(vpcRequest).getVpcs().get(0);
    String vpcCidr = vpc.getCidrBlock();
    LOGGER.info("Subnet cidr is empty, find a non-overlapping subnet for VPC cidr: {}", vpcCidr);

    DescribeSubnetsRequest request = new DescribeSubnetsRequest().withFilters(new Filter("vpc-id", singletonList(awsNetworkView.getExistingVPC())));
    List<Subnet> awsSubnets = ec2Client.describeSubnets(request).getSubnets();
    List<String> subnetCidrs = awsSubnets.stream().map(Subnet::getCidrBlock).collect(Collectors.toList());
    LOGGER.info("The selected VPCs: {}, has the following subnets: {}", vpc.getVpcId(), subnetCidrs.stream().collect(Collectors.joining(",")));

    return calculateSubnet(ac.getCloudContext().getName(), vpc, subnetCidrs);
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:18,代码来源:AwsResourceConnector.java


示例6: calculateSubnet

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
private String calculateSubnet(String stackName, Vpc vpc, List<String> subnetCidrs) {
    SubnetInfo vpcInfo = new SubnetUtils(vpc.getCidrBlock()).getInfo();
    String[] cidrParts = vpcInfo.getCidrSignature().split("/");
    int netmask = Integer.parseInt(cidrParts[cidrParts.length - 1]);
    int netmaskBits = CIDR_PREFIX - netmask;
    if (netmaskBits <= 0) {
        throw new CloudConnectorException("The selected VPC has to be in a bigger CIDR range than /24");
    }
    int numberOfSubnets = Double.valueOf(Math.pow(2, netmaskBits)).intValue();
    int targetSubnet = 0;
    if (stackName != null) {
        byte[] b = stackName.getBytes(Charset.forName("UTF-8"));
        for (byte ascii : b) {
            targetSubnet += ascii;
        }
    }
    targetSubnet = Long.valueOf(targetSubnet % numberOfSubnets).intValue();
    String cidr = getSubnetCidrInRange(vpc, subnetCidrs, targetSubnet, numberOfSubnets);
    if (cidr == null) {
        cidr = getSubnetCidrInRange(vpc, subnetCidrs, 0, targetSubnet);
    }
    if (cidr == null) {
        throw new CloudConnectorException("Cannot find non-overlapping CIDR range");
    }
    return cidr;
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:27,代码来源:AwsResourceConnector.java


示例7: getCopyOfVpc

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
public Vpc getCopyOfVpc(ProjectAndEnv projectAndEnv) {
	if (idCache.containsKey(projectAndEnv)) {
		String vpcId = idCache.get(projectAndEnv);
		logger.info(String.format("Cache hit for %s, found VPC ID %s", projectAndEnv, vpcId));		
		return getVpcById(vpcId);
	} else 
	{
		logger.info(String.format("Checking for TAGs %s:%s and %s:%s to find VPC", AwsFacade.PROJECT_TAG, 
				projectAndEnv.getProject(), AwsFacade.ENVIRONMENT_TAG, projectAndEnv.getEnv()));
		Vpc result = findVpcUsingProjectAndEnv(projectAndEnv);
		if (result==null) {	
			logger.error("Could not find VPC for " + projectAndEnv);
		} else {
			idCache.put(projectAndEnv, result.getVpcId());
		}
		return result;
	}	
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:19,代码来源:VpcRepository.java


示例8: findVpcUsingProjectAndEnv

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
private Vpc findVpcUsingProjectAndEnv(ProjectAndEnv key) {
	List<Vpc> vpcs = cloudClient.describeVpcs();

	for(Vpc vpc : vpcs) {
		String vpcId = vpc.getVpcId();
		String possibleProject = getTagByName(vpc, AwsFacade.PROJECT_TAG);
		if (key.getProject().equals(possibleProject)) {	
			logger.debug(String.format("Found Possible VPC with %s:%s ID is %s", AwsFacade.PROJECT_TAG, possibleProject, vpcId));
			String possibleEnv = getTagByName(vpc, AwsFacade.ENVIRONMENT_TAG);
			logger.debug(String.format("Found Possible VPC with %s:%s ID is %s", AwsFacade.ENVIRONMENT_TAG, possibleEnv, vpcId));
			if (key.getEnv().equals(possibleEnv)) {
				logger.info("Matched tags, vpc id is " + vpcId);
				return vpc;
			}
		}
	}
	return null;
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:19,代码来源:VpcRepository.java


示例9: initAllTags

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
public void initAllTags(String vpcId, ProjectAndEnv projectAndEnv) throws CannotFindVpcException {	
	Vpc vpc = getVpcById(vpcId);
	if (vpc==null) {
		throw new CannotFindVpcException(vpcId);
	}
	logger.info("Initialise tags for VPC " + vpcId);
	List<Tag> tags = new LinkedList<Tag>();	
	Tag indexTag = new Tag(AwsFacade.INDEX_TAG, "0");
	Tag projectTag = new Tag(AwsFacade.PROJECT_TAG, projectAndEnv.getProject());
	Tag envTag = new Tag(AwsFacade.ENVIRONMENT_TAG, projectAndEnv.getEnv());
	tags.add(indexTag);
	tags.add(projectTag);
	tags.add(envTag);
	
	setTags(vpcId, tags);	
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:17,代码来源:VpcRepository.java


示例10: applyTemplate

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
private StackNameAndId applyTemplate(File file, ProjectAndEnv projAndEnv, Collection<Parameter> userParameters,
                                    Tagging tagging) throws CfnAssistException, IOException, InterruptedException {
    logger.info(format("Applying template %s for %s", file.getAbsoluteFile(), projAndEnv));
    Vpc vpcForEnv = findVpcForEnv(projAndEnv);
    List<TemplateParameter> declaredParameters = validateTemplate(file);

    List<PopulatesParameters> populators = new LinkedList<>();
    populators.add(new CfnBuiltInParams(vpcForEnv.getVpcId()));
    populators.add(new AutoDiscoverParams(file, vpcRepository, cfnRepository));
    populators.add(new EnvVarParams());
    ParameterFactory parameterFactory = new ParameterFactory(populators);

    if (projAndEnv.hasComment()) {
        tagging.setCommentTag(projAndEnv.getComment());
    }

    String contents = loadFileContents(file);

    if (isUpdate(file)) {
        logger.info("Request to update a stack, filename is " + file.getAbsolutePath());
        return updateStack(projAndEnv, userParameters, declaredParameters, contents, parameterFactory);
    } else {
        return createStack(file, projAndEnv, userParameters, declaredParameters, contents, parameterFactory,tagging);
    }
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:26,代码来源:AwsFacade.java


示例11: addTitle

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
private void addTitle(Vpc vpc, Diagram diagram) {
	String title = vpc.getVpcId();
	List<Tag> tags = vpc.getTags();
	String name = AmazonVPCFacade.getNameFromTags(tags);
	if (!name.isEmpty()) {
		title = title + String.format(" (%s)", name);
	}
	String project = AmazonVPCFacade.getValueFromTag(tags, AwsFacade.PROJECT_TAG);
	if (!project.isEmpty()) {
		title = title + String.format(" PROJECT=%s", project);
	}
	String env = AmazonVPCFacade.getValueFromTag(tags, AwsFacade.ENVIRONMENT_TAG);
	if (!env.isEmpty()) {
		title = title + String.format(" ENV=%s", env);
	}
	diagram.addTitle(title);
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:18,代码来源:VPCDiagramBuilder.java


示例12: setUpdateExpectations

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
protected StackNameAndId setUpdateExpectations(String stackName, String filename,
                                               List<TemplateParameter> templateParameters,
                                               Collection<Parameter> parameters)
        throws CfnAssistException, InterruptedException, IOException {
    String stackId = "stackId";
    Stack stack = new Stack().withStackId(stackId);
    StackNameAndId stackNameAndId = new StackNameAndId(stackName, stackId);

    String contents = EnvironmentSetupForTests.loadFile(filename);
    EasyMock.expect(vpcRepository.getCopyOfVpc(projectAndEnv)).andReturn(new Vpc().withVpcId(VPC_ID));
    EasyMock.expect(cfnRepository.validateStackTemplate(contents)).andReturn(templateParameters);

    EasyMock.expect(cfnRepository.updateStack(contents, parameters, monitor, stackName)).andReturn(stackNameAndId);
    EasyMock.expect(monitor.waitForUpdateFinished(stackNameAndId)).andReturn(StackStatus.UPDATE_COMPLETE.toString());
    EasyMock.expect(cfnRepository.updateSuccess(stackNameAndId)).andReturn(stack);
    EasyMock.expect(cloudRepository.getZones()).andReturn(zones);
    return stackNameAndId;
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:19,代码来源:UpdateStackExpectations.java


示例13: testUploadArtifactsToS3AndAutopopulateAsParameters

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
@Test
public void testUploadArtifactsToS3AndAutopopulateAsParameters() {		
			
	Main main = new Main(CLIArgBuilder.createSubnetStackWithArtifactUpload(BUILD_NUMBER, testName));
	int result = main.parse();
	deletesStacks.ifPresent("CfnAssist9987TestsubnetWithS3Param");
	
	assertEquals("deploy failed", 0, result);
	
	Vpc vpcId = vpcRepository.getCopyOfVpc(projectAndEnv);
	List<Subnet> subnets = EnvironmentSetupForTests.getSubnetFors(ec2Client, vpcId);
	assertEquals(1, subnets.size());
	List<Tag> tags = subnets.get(0).getTags();

	List<Tag> expectedTags = new LinkedList<>();
	expectedTags.add(new Tag().withKey("urlATag").withValue(EnvironmentSetupForTests.S3_PREFIX+"/"+KEY_A));
	expectedTags.add(new Tag().withKey("urlBTag").withValue(EnvironmentSetupForTests.S3_PREFIX+"/"+KEY_B));
	assertTrue(tags.containsAll(expectedTags));
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:20,代码来源:TestCommandLineS3Operations.java


示例14: shouldThrowOnCreateWhenStackExistsAndNotRolledBack

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
@Test
public void shouldThrowOnCreateWhenStackExistsAndNotRolledBack() throws IOException, CfnAssistException, InterruptedException  {
	String stackName = "CfnAssistTestsimpleStack";
	String filename = FilesForTesting.SIMPLE_STACK;
	String contents = EnvironmentSetupForTests.loadFile(filename);
	String stackId = "stackId";
	StackNameAndId stackNameAndId = new StackNameAndId(stackName, stackId);
	List<TemplateParameter> templateParameters = new LinkedList<>();
	
	EasyMock.expect(vpcRepository.getCopyOfVpc(projectAndEnv)).andReturn(new Vpc().withVpcId(VPC_ID));
	EasyMock.expect(cfnRepository.validateStackTemplate(contents)).andReturn(templateParameters);
	// stack in rolled back status so delete it
	EasyMock.expect(cfnRepository.getStackStatus(stackName)).andReturn(CREATE_COMP_STATUS);	
	EasyMock.expect(cfnRepository.getStackNameAndId(stackName)).andReturn(stackNameAndId);
	
	replayAll();
	try {
		aws.applyTemplate(filename, projectAndEnv);
	}
	catch(DuplicateStackException expected) {
		// expected 
	}

	verifyAll();
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:26,代码来源:TestAwsFacadeCreatesStacks.java


示例15: SetCreateExpectations

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
private StackNameAndId SetCreateExpectations(String stackName, String contents,
                                                List<TemplateParameter> templateParameters,
                                                Collection<Parameter> creationParameters, String comment, Collection<Output> outputs,
                                                Map<String, AvailabilityZone> zones)
		throws CfnAssistException, InterruptedException {
	StackNameAndId stackNameAndId = new StackNameAndId(stackName, "stackId");
	Stack stack = new Stack().withStackId("stackId");
	if (outputs.size()>0) {
		stack.setOutputs(outputs);
	}
	
	EasyMock.expect(vpcRepository.getCopyOfVpc(projectAndEnv)).andReturn(new Vpc().withVpcId(VPC_ID));
	EasyMock.expect(cfnRepository.validateStackTemplate(contents)).andReturn(templateParameters);
	EasyMock.expect(cfnRepository.getStackStatus(stackName)).andReturn("");
       Tagging tagging = new Tagging();
       tagging.setCommentTag(comment);
	EasyMock.expect(cfnRepository.createStack(projectAndEnv, contents, stackName, creationParameters, monitor, tagging)).
		andReturn(stackNameAndId);
       EasyMock.expect(cloudRepository.getZones()).andReturn(zones);
	EasyMock.expect(monitor.waitForCreateFinished(stackNameAndId)).andReturn(CREATE_COMP_STATUS);
	EasyMock.expect(identityProvider.getUserId()).andReturn(user);
	CFNAssistNotification notification = new CFNAssistNotification(stackName, CREATE_COMP_STATUS, user);
	EasyMock.expect(notificationSender.sendNotification(notification)).andReturn("sendMessageID");
	EasyMock.expect(cfnRepository.createSuccess(stackNameAndId)).andReturn(stack);
	return stackNameAndId;
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:27,代码来源:TestAwsFacadeCreatesStacks.java


示例16: shouldGetVpcByProjectAndEnvironmentTags

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
@Test
public void shouldGetVpcByProjectAndEnvironmentTags() {
	List<Vpc> vpcs = new LinkedList<>();

	List<Tag> tags = EnvironmentSetupForTests.createExpectedEc2Tags(projectAndEnv,"");
	vpcs.add(new Vpc().withVpcId("firstWrongId"));
	vpcs.add(new Vpc().withVpcId("correctId").withTags(tags));
	List<Tag>  wrongTags = EnvironmentSetupForTests.createExpectedEc2Tags(EnvironmentSetupForTests.getAltProjectAndEnv(), "");
	vpcs.add(new Vpc().withVpcId("wrongId").withTags(wrongTags));
	EasyMock.expect(cloudClient.describeVpcs()).andReturn(vpcs);

	replayAll();
	Vpc result = repository.getCopyOfVpc(projectAndEnv);
	assertEquals("correctId", result.getVpcId());
	verifyAll();
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:17,代码来源:TestVpcRepository.java


示例17: shouldMatchVpcAndFindDetlaIndexTag

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
@Test
public void shouldMatchVpcAndFindDetlaIndexTag() throws CannotFindVpcException {
	List<Vpc> vpcs = new LinkedList<>();
	
	List<Tag> matchingTags = EnvironmentSetupForTests.createExpectedEc2Tags(projectAndEnv,"");
	matchingTags.add(EnvironmentSetupForTests.createEc2Tag("CFN_ASSIST_DELTA","004422"));
	List<Tag>  wrongTags = EnvironmentSetupForTests.createExpectedEc2Tags(EnvironmentSetupForTests.getAltProjectAndEnv(), "");
	wrongTags.add(EnvironmentSetupForTests.createEc2Tag("CFN_ASSIST_DELTA","005555"));
	
	vpcs.add(new Vpc().withVpcId("correctId").withTags(matchingTags));
	vpcs.add(new Vpc().withVpcId("firstWrongId").withTags(wrongTags));
	
	EasyMock.expect(cloudClient.describeVpcs()).andReturn(vpcs);
			
	replayAll();
	String result = repository.getVpcIndexTag(projectAndEnv);
	assertEquals("004422", result);
	verifyAll();
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:20,代码来源:TestVpcRepository.java


示例18: shouldTestSomething

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
@Test
public void shouldTestSomething() throws CannotFindVpcException {
	List<Vpc> vpcs = new LinkedList<>();
	
	List<Tag> matchingTags = EnvironmentSetupForTests.createExpectedEc2Tags(projectAndEnv,"");
	matchingTags.add(EnvironmentSetupForTests.createEc2Tag("tagName","correctValue"));
	List<Tag>  wrongTags = EnvironmentSetupForTests.createExpectedEc2Tags(EnvironmentSetupForTests.getAltProjectAndEnv(), "");
	wrongTags.add(EnvironmentSetupForTests.createEc2Tag("tagName","wrongValue"));
	
	vpcs.add(new Vpc().withVpcId("correctId").withTags(matchingTags));
	vpcs.add(new Vpc().withVpcId("firstWrongId").withTags(wrongTags));
	
	EasyMock.expect(cloudClient.describeVpcs()).andReturn(vpcs);
			
	replayAll();
	String result = repository.getVpcTag("tagName", projectAndEnv);
	assertEquals(result, "correctValue");
	verifyAll();
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:20,代码来源:TestVpcRepository.java


示例19: shouldTestSomegthing

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
@Test
public void shouldTestSomegthing() throws CannotFindVpcException {
	List<Tag> expectedTags = new LinkedList<>();
	expectedTags.add(EnvironmentSetupForTests.createEc2Tag("CFN_ASSIST_DELTA", "0"));
	expectedTags.add(EnvironmentSetupForTests.createEc2Tag("CFN_ASSIST_PROJECT", "CfnAssist"));
	expectedTags.add(EnvironmentSetupForTests.createEc2Tag("CFN_ASSIST_ENV", "Test"));
		
	EasyMock.expect(cloudClient.describeVpc("vpcID11")).andReturn(new Vpc().withCidrBlock("cidrBlock"));
	List<String> resources = new LinkedList<>();
	resources.add("vpcID11");
	cloudClient.addTagsToResources(resources, expectedTags);
	EasyMock.expectLastCall();
	
	replayAll();
	repository.initAllTags("vpcID11", projectAndEnv);
	verifyAll();
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:18,代码来源:TestVpcRepository.java


示例20: shouldTestSetCfnDeltaIndex

import com.amazonaws.services.ec2.model.Vpc; //导入依赖的package包/类
@Test
public void shouldTestSetCfnDeltaIndex() throws CannotFindVpcException {
	List<Vpc> vpcs = new LinkedList<>();
	List<Tag> initialTags = EnvironmentSetupForTests.createExpectedEc2Tags(projectAndEnv,"");
	initialTags.add(EnvironmentSetupForTests.createEc2Tag("CFN_ASSIST_DELTA","initialValue"));
	
	vpcs.add(new Vpc().withVpcId("correctId").withTags(initialTags));
	EasyMock.expect(cloudClient.describeVpcs()).andReturn(vpcs);
	
	List<String> resources = new LinkedList<>();
	resources.add("correctId");
	List<Tag> tags = new LinkedList<>();
	tags.add(EnvironmentSetupForTests.createEc2Tag("CFN_ASSIST_DELTA","newIndexValue"));
	cloudClient.addTagsToResources(resources, tags);
	EasyMock.expectLastCall();
	
	replayAll();
	repository.setVpcIndexTag(projectAndEnv, "newIndexValue");
	verifyAll();
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:21,代码来源:TestVpcRepository.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HttpHeader类代码示例发布时间:2022-05-22
下一篇:
Java SignerIdentifier类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap