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


Java Subnet.getSubnetId方法代码示例

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


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

示例1: createSubnetState

import com.amazonaws.services.ec2.model.Subnet; //导入方法依赖的package包/类
/**
 * Create SubnetState representing AWS Subnet instance.
 */
private void createSubnetState(Subnet subnet, AWSNetworkContext context, AWSNetworkStage next) {
    SubnetState subnetState = new SubnetState();
    subnetState.id = subnet.getSubnetId();
    subnetState.name = subnet.getSubnetId();
    subnetState.subnetCIDR = subnet.getCidrBlock();
    subnetState.networkLink = context.network.documentSelfLink;
    subnetState.tenantLinks = context.network.tenantLinks;

    sendRequest(
            Operation.createPost(this.getHost(), SubnetService.FACTORY_LINK)
                    .setBody(subnetState)
                    .setCompletion((o, e) -> {
                        if (e != null) {
                            handleStages(context, e);
                            return;
                        }
                        handleStages(context, next);
                    }));
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:23,代码来源:AWSNetworkService.java

示例2: SubnetDTO

import com.amazonaws.services.ec2.model.Subnet; //导入方法依赖的package包/类
public SubnetDTO(final Subnet subnet) {
    this.subnetId = subnet.getSubnetId();
    this.vpcId = subnet.getVpcId();
    this.state = subnet.getState();
    this.availabilityZone = subnet.getAvailabilityZone();
    this.cidrBlock = subnet.getCidrBlock();

    this.tags.addAll(
        subnet.getTags()
            .stream()
            .map(TagDTO::new)
            .collect(Collectors.toList()));

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

示例3: mapSubnetToSubnetState

import com.amazonaws.services.ec2.model.Subnet; //导入方法依赖的package包/类
/**
 * NOTE: Keep in mind that subnetState.networkLink is not set and it should be updated once
 * valid NetworkState.documentSelfLink is available.
 */
public static SubnetState mapSubnetToSubnetState(Subnet subnet, List<String> tenantLinks,
        String regionId, String parentComputeLink, String endpointLink) {
    if (subnet == null) {
        throw new IllegalArgumentException(
                "Cannot map Subnet to subnet state for null instance");
    }
    SubnetState subnetState = new SubnetState();
    subnetState.id = subnet.getSubnetId();
    subnetState.name = subnet.getSubnetId();
    subnetState.subnetCIDR = subnet.getCidrBlock();
    subnetState.supportPublicIpAddress = subnet.isMapPublicIpOnLaunch();
    subnetState.defaultForZone = subnet.isDefaultForAz();
    subnetState.zoneId = subnet.getAvailabilityZone();
    subnetState.tenantLinks = tenantLinks;
    subnetState.endpointLink = endpointLink;
    if (subnetState.endpointLinks == null) {
        subnetState.endpointLinks = new HashSet<>();
    }
    subnetState.endpointLinks.add(endpointLink);
    subnetState.computeHostLink = parentComputeLink;
    subnetState.customProperties = new HashMap<>();
    subnetState.regionId = regionId;

    if (!subnet.getTags().isEmpty()) {

        // The name of the subnet state is the value of the AWS_TAG_NAME tag
        String nameTag = getTagValue(subnet.getTags(), AWS_TAG_NAME);
        if (!StringUtil.isNullOrEmpty(nameTag)) {
            subnetState.name = nameTag;
        }
    }
    return subnetState;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:38,代码来源:AWSNetworkUtils.java

示例4: visitSubnetForInstancesAndSecGroups

import com.amazonaws.services.ec2.model.Subnet; //导入方法依赖的package包/类
private void visitSubnetForInstancesAndSecGroups(VPCDiagramBuilder vpcDiagramBuilder, Subnet subnet) throws CfnAssistException {
	String subnetId = subnet.getSubnetId();
	logger.debug("visit subnet (for sec groups) " + subnetId); 
	for(Instance instance : facade.getInstancesFor(subnetId)) {
		for(GroupIdentifier groupId : instance.getSecurityGroups()) {
			logger.debug("visit securitygroup " + groupId.getGroupId() + " for instance " + instance.getInstanceId());

			SecurityGroup group = facade.getSecurityGroupDetailsById(groupId.getGroupId());
			vpcDiagramBuilder.addSecurityGroup(group, subnetId);
			vpcDiagramBuilder.associateInstanceWithSecGroup(instance.getInstanceId(), group);
			visitInboundSecGroupPerms(vpcDiagramBuilder, group, subnetId);
			visitOutboundSecGroupPerms(vpcDiagramBuilder, group, subnetId);
		}
	}		
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:16,代码来源:VPCVisitor.java

示例5: visitSubnet

import com.amazonaws.services.ec2.model.Subnet; //导入方法依赖的package包/类
private void visitSubnet(VPCDiagramBuilder parent, Subnet subnet) throws CfnAssistException {
	SubnetDiagramBuilder subnetDiagram = factory.createSubnetDiagramBuilder(parent, subnet);
	
	String subnetId = subnet.getSubnetId();
	logger.debug("visit subnet " + subnetId);

	List<Instance> instances = facade.getInstancesFor(subnetId);
	for(Instance instance : instances) {
		visit(subnetDiagram, instance);
	}
	parent.add(subnetId, subnetDiagram);	
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:13,代码来源:VPCVisitor.java

示例6: formSubnetLabel

import com.amazonaws.services.ec2.model.Subnet; //导入方法依赖的package包/类
public static String formSubnetLabel(Subnet subnet, String tagName) {
	String name = subnet.getSubnetId();
	if (!tagName.isEmpty()) {
		name = tagName;
	} 
	return String.format("%s [%s]\n(%s)", name, subnet.getSubnetId(), subnet.getCidrBlock());
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:8,代码来源:SubnetDiagramBuilder.java

示例7: addDiagramFor

import com.amazonaws.services.ec2.model.Subnet; //导入方法依赖的package包/类
public ChildDiagram addDiagramFor(Subnet subnet) throws CfnAssistException {
	String subnetName = AmazonVPCFacade.getNameFromTags(subnet.getTags());
	String subnetLabel = formSubnetLabel(subnet, subnetName);
	String subnetId = subnet.getSubnetId();	
	
	ChildDiagram childDiagram = parentDiagram.createSubDiagram(subnetId, subnetLabel);		
	childDiagrams.put(subnetId,childDiagram);
	
	return childDiagram;
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:11,代码来源:SubnetDiagrams.java

示例8: getSubnetId

import com.amazonaws.services.ec2.model.Subnet; //导入方法依赖的package包/类
public static String getSubnetId(AmazonEC2Client ec2Client) {
    Subnet subnet = null;
    for (Subnet aux : ec2Client.describeSubnets().getSubnets()) {
        System.out.println();
        if (aux.getState().equals("available") && aux.getAvailabilityZone().startsWith("eu-west-1")) {
            subnet = aux;
            break;
        }
    }
    Assert.assertNotNull("Subnet not null", subnet);
    return subnet.getSubnetId();
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:13,代码来源:EC2Utils.java

示例9: SubnetDiagramBuilder

import com.amazonaws.services.ec2.model.Subnet; //导入方法依赖的package包/类
public SubnetDiagramBuilder(NetworkChildDiagram networkChildDiagram, SecurityChildDiagram securityDiagram, Subnet subnet) {
	instanceNames = new HashMap<String, String>();
	this.networkChildDiagram = networkChildDiagram;
	this.securityChildDiagram = securityDiagram;
	this.id = subnet.getSubnetId();
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:7,代码来源:SubnetDiagramBuilder.java


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