本文整理汇总了Java中com.amazonaws.services.ec2.model.SecurityGroup.getGroupName方法的典型用法代码示例。如果您正苦于以下问题:Java SecurityGroup.getGroupName方法的具体用法?Java SecurityGroup.getGroupName怎么用?Java SecurityGroup.getGroupName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.ec2.model.SecurityGroup
的用法示例。
在下文中一共展示了SecurityGroup.getGroupName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createEvaluations
import com.amazonaws.services.ec2.model.SecurityGroup; //导入方法依赖的package包/类
/**
* This method returns list of Evaluation objects.
* @param nonCompliantSecurityGroups
* @return List<Evaluation> returns list of Evaluation objects.
*/
private List<Evaluation> createEvaluations(List<SecurityGroup> nonCompliantSecurityGroups) {
List<Evaluation> evaluations = new ArrayList<>();
if ( nonCompliantSecurityGroups == null || nonCompliantSecurityGroups.size() > 0 ) {
for(SecurityGroup sg: nonCompliantSecurityGroups) {
String securityGroupName = sg.getGroupName();
Evaluation evaluation = new Evaluation();
evaluation.setComplianceResourceId(securityGroupName);
evaluation.setComplianceResourceType(COMPLIANCE_RESOURCE_TYPE);
evaluation.setComplianceType(ComplianceType.NON_COMPLIANT);
evaluation.setOrderingTimestamp(new Date());
evaluations.add(evaluation);
}
}
System.out.println("INFO : Number of evaluations : " + evaluations.size());
return evaluations;
}
示例2: check
import com.amazonaws.services.ec2.model.SecurityGroup; //导入方法依赖的package包/类
@Override
public Map<String, SecurityGroupCheckDetails> check(final Collection<String> groupIds, final String account, final Region region) {
final DescribeSecurityGroupsRequest describeSecurityGroupsRequest = new DescribeSecurityGroupsRequest();
describeSecurityGroupsRequest.setGroupIds(groupIds);
final AmazonEC2Client amazonEC2Client = clientProvider.getClient(
AmazonEC2Client.class,
account, region);
final DescribeSecurityGroupsResult describeSecurityGroupsResult = amazonEC2Client.describeSecurityGroups(
describeSecurityGroupsRequest);
final ImmutableMap.Builder<String, SecurityGroupCheckDetails> result = ImmutableMap.builder();
for (final SecurityGroup securityGroup : describeSecurityGroupsResult.getSecurityGroups()) {
final List<String> offendingRules = securityGroup.getIpPermissions().stream()
.filter(isOffending)
.map(Object::toString)
.collect(toList());
if (!offendingRules.isEmpty()) {
final SecurityGroupCheckDetails details = new SecurityGroupCheckDetails(
securityGroup.getGroupName(), ImmutableList.copyOf(offendingRules));
result.put(securityGroup.getGroupId(), details);
}
}
return result.build();
}
示例3: labelForSecGroup
import com.amazonaws.services.ec2.model.SecurityGroup; //导入方法依赖的package包/类
public static String labelForSecGroup(SecurityGroup group) {
String name = getNameFromTags(group.getTags());
if (name.isEmpty()) {
name = group.getGroupName();
}
return createLabelFromNameAndID(group.getGroupId(), name);
}