gpt4 book ai didi

org.jclouds.cloudstack.predicates.ZonePredicates.supportsSecurityGroups()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 23:25:31 29 4
gpt4 key购买 nike

本文整理了Java中org.jclouds.cloudstack.predicates.ZonePredicates.supportsSecurityGroups()方法的一些代码示例,展示了ZonePredicates.supportsSecurityGroups()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZonePredicates.supportsSecurityGroups()方法的具体详情如下:
包路径:org.jclouds.cloudstack.predicates.ZonePredicates
类名称:ZonePredicates
方法名:supportsSecurityGroups

ZonePredicates.supportsSecurityGroups介绍

暂无

代码示例

代码示例来源:origin: apache/jclouds

private void cleanupOrphanedSecurityGroupsInZone(Set<String> groups, String zoneId) {
 Zone zone = zoneIdToZone.get().getUnchecked(zoneId);
 if (supportsSecurityGroups().apply(zone)) {
   for (String group : groups) {
    for (SecurityGroup securityGroup : Iterables.filter(client.getSecurityGroupApi().listSecurityGroups(),
         SecurityGroupPredicates.nameMatches(namingConvention.create().containsGroup(group)))) {
      ZoneAndName zoneAndName = ZoneAndName.fromZoneAndName(zoneId, securityGroup.getName());
      logger.debug(">> deleting securityGroup(%s)", zoneAndName);
      client.getSecurityGroupApi().deleteSecurityGroup(securityGroup.getId());
      // TODO: test this clear happens
      securityGroupMap.invalidate(zoneAndName);
      logger.debug("<< deleted securityGroup(%s)", zoneAndName);
    }
   }
 }
}

代码示例来源:origin: apache/jclouds

@Test
public void testSupportsSecurityGroups() {
 assertTrue(supportsSecurityGroups().apply(
   Zone.builder().id("43").securityGroupsEnabled(true).build()
 ));
 assertFalse(supportsSecurityGroups().apply(
   Zone.builder().id("44").securityGroupsEnabled(false).build()
 ));
}

代码示例来源:origin: jclouds/legacy-jclouds

@Test
public void testSupportsSecurityGroups() {
 assertTrue(supportsSecurityGroups().apply(
   Zone.builder().id("43").securityGroupsEnabled(true).build()
 ));
 assertFalse(supportsSecurityGroups().apply(
   Zone.builder().id("44").securityGroupsEnabled(false).build()
 ));
}

代码示例来源:origin: apache/jclouds

@Override
public SecurityGroup apply(ZoneSecurityGroupNamePortsCidrs input) {
 checkNotNull(input, "input");
 String zoneId = input.getZone();
 Zone zone = zoneIdToZone.get().getUnchecked(zoneId);
 checkArgument(supportsSecurityGroups().apply(zone),
        "Security groups are required, but the zone %s does not support security groups", zoneId);
 logger.debug(">> creating securityGroup %s", input);
 try {
   SecurityGroup securityGroup = client.getSecurityGroupApi().createSecurityGroup(input.getName());
   logger.debug("<< created securityGroup(%s)", securityGroup);
   ImmutableSet<String> cidrs;
   if (!input.getCidrs().isEmpty()) {
    cidrs = ImmutableSet.copyOf(input.getCidrs());
   } else {
    cidrs = ImmutableSet.of("0.0.0.0/0");
   }
   for (int port : input.getPorts()) {
    authorizeGroupToItselfAndToTCPPortAndCidr(client, securityGroup, port, cidrs);
   }
   return securityGroup;
 } catch (IllegalStateException e) {
   logger.trace("<< trying to find securityGroup(%s): %s", input, e.getMessage());
   SecurityGroup group = client.getSecurityGroupApi().getSecurityGroupByName(input.getName());
   logger.debug("<< reused securityGroup(%s)", group.getId());
   return group;
 }
}

代码示例来源:origin: apache/jclouds

if (supportsSecurityGroups().apply(zone)) {
  List<Integer> inboundPorts = Ints.asList(templateOptions.getInboundPorts());

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com