本文整理汇总了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);
}));
}
示例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");
}
示例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;
}
示例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);
}
}
}
示例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);
}
示例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());
}
示例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;
}
示例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();
}
示例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();
}