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


Java SecurityGroup.getGroupName方法代码示例

本文整理汇总了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;
}
 
开发者ID:code4innerpeace,项目名称:AWSConfig,代码行数:27,代码来源:NonCompliantSecurityGroups.java

示例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();
}
 
开发者ID:zalando-stups,项目名称:fullstop,代码行数:27,代码来源:SecurityGroupsCheckerImpl.java

示例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);
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:8,代码来源:AmazonVPCFacade.java


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