gpt4 book ai didi

org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName类的使用及代码示例

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

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

ZoneAndName介绍

[英]Helpful when looking for resources by zone and name
[中]按区域和名称查找资源时很有用

代码示例

代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-nova

@Override
  public boolean apply(String zone) {
   AtomicReference<ZoneAndName> securityGroupInZoneRef = Atomics.newReference(ZoneAndName.fromZoneAndName(zone, groupName));
   return returnSecurityGroupExistsInZone.apply(securityGroupInZoneRef);
  }
};

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

public static ZoneAndName fromZoneAndName(String zoneId, String name) {
 return new ZoneAndName(zoneId, name);
}

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

@Override
public boolean equals(Object o) {
 if (this == o)
   return true;
 if (o == null || getClass() != o.getClass())
   return false;
 ZoneSecurityGroupNameAndPorts that = ZoneSecurityGroupNameAndPorts.class.cast(o);
 return super.equals(that) && equal(this.ports, that.ports);
}

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

@Override
  public boolean apply(ZoneAndName input) {
   // new nodes can have the zone as their location, existing nodes, the parent is the
   // location
   return all(computeService.listNodesDetailsMatching(Predicates.<ComputeMetadata> or(locationId(input.getZone()),
        parentLocationId(input.getZone()))), and(inGroup(input.getName()), TERMINATED));
  }
}

代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-nova

public boolean apply(AtomicReference<ZoneAndName> securityGroupInZoneRef) {
   checkNotNull(securityGroupInZoneRef, "securityGroupRef");
   final ZoneAndName securityGroupInZone = checkNotNull(securityGroupInZoneRef.get(), "securityGroupInZone");

   Optional<? extends SecurityGroupApi> api = novaApi.getSecurityGroupExtensionForZone(securityGroupInZone.getZone());
   checkArgument(api.isPresent(), "Security groups are required, but the extension is not available!");

   logger.trace("looking for security group %s", securityGroupInZone.slashEncode());
   try {
     SecurityGroup returnVal = Iterables.find(api.get().list(), new Predicate<SecurityGroup>() {

      @Override
      public boolean apply(SecurityGroup input) {
        return input.getName().equals(securityGroupInZone.getName());
      }

     });
     securityGroupInZoneRef.set(new SecurityGroupInZone(returnVal, securityGroupInZone.getZone()));
     return true;
   } catch (ResourceNotFoundException e) {
     return false;
   } catch (NoSuchElementException e) {
     return false;
   }
  }
}

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

public void testUpdateReferenceWhenSecurityGroupListContainsGroupName() throws Exception {
 HttpRequest list = HttpRequest.builder().method("GET").endpoint(
      URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-security-groups")).headers(
      ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token",
          authToken).build()).build();
 HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
      payloadFromResource("/securitygroup_list.json")).build();
 NovaApi apiWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
      responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, list,
      listResponse);
 FindSecurityGroupWithNameAndReturnTrue predicate = new FindSecurityGroupWithNameAndReturnTrue(
      apiWhenSecurityGroupsExist);
 AtomicReference<ZoneAndName> securityGroupInZoneRef = Atomics.newReference(ZoneAndName
      .fromZoneAndName("az-1.region-a.geo-1", "name1"));
 // we can find it
 assertTrue(predicate.apply(securityGroupInZoneRef));
 // the reference is now up to date, and includes the actual group found.
 assertEquals(securityGroupInZoneRef.get().toString(), new SecurityGroupInZone(Iterables
      .getOnlyElement(new ParseSecurityGroupListTest().expected()), "az-1.region-a.geo-1").toString());
}

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

@Override
  public ToStringHelper string() {
   return super.string().add("ports", ports);
  }
}

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

@Override
public String apply(ZoneAndName input) {
  return input.getName();
}

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

public String slashEncode() {
 return slashEncodeZoneAndName(zoneId, name);
}

代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-nova

@Override
public String apply(ZoneAndName input) {
  return input.getZone();
}

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

@Override
public int hashCode() {
 return Objects.hashCode(super.hashCode(), ports);
}

代码示例来源:origin: org.jclouds.api/openstack-nova

@Override
  public boolean apply(ZoneAndName input) {
   // new nodes can have the zone as their location, existing nodes, the parent is the
   // location
   return all(computeService.listNodesDetailsMatching(Predicates.<ComputeMetadata> or(locationId(input.getZone()),
        parentLocationId(input.getZone()))), and(inGroup(input.getName()), TERMINATED));
  }
}

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

public boolean apply(AtomicReference<ZoneAndName> securityGroupInZoneRef) {
   checkNotNull(securityGroupInZoneRef, "securityGroupRef");
   final ZoneAndName securityGroupInZone = checkNotNull(securityGroupInZoneRef.get(), "securityGroupInZone");

   Optional<? extends SecurityGroupApi> api = novaApi.getSecurityGroupExtensionForZone(securityGroupInZone.getZone());
   checkArgument(api.isPresent(), "Security groups are required, but the extension is not available!");

   logger.trace("looking for security group %s", securityGroupInZone.slashEncode());
   try {
     SecurityGroup returnVal = Iterables.find(api.get().list(), new Predicate<SecurityGroup>() {

      @Override
      public boolean apply(SecurityGroup input) {
        return input.getName().equals(securityGroupInZone.getName());
      }

     });
     securityGroupInZoneRef.set(new SecurityGroupInZone(returnVal, securityGroupInZone.getZone()));
     return true;
   } catch (ResourceNotFoundException e) {
     return false;
   } catch (NoSuchElementException e) {
     return false;
   }
  }
}

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

@Override
public String toString() {
 return string().toString();
}

代码示例来源:origin: org.jclouds.api/openstack-nova

@Override
public String apply(ZoneAndName input) {
  return input.getName();
}

代码示例来源:origin: org.jclouds.api/openstack-nova

public String slashEncode() {
 return slashEncodeZoneAndName(zoneId, name);
}

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

@Override
public String apply(ZoneAndName input) {
  return input.getZone();
}

代码示例来源:origin: org.jclouds.api/openstack-nova

@Override
public int hashCode() {
 return Objects.hashCode(super.hashCode(), ports);
}

代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-nova

private void cleanupOrphanedKeyPairsInZone(Set<String> groups, String zoneId) {
 Optional<? extends KeyPairApi> keyPairApi = novaApi.getKeyPairExtensionForZone(zoneId);
 if (keyPairApi.isPresent()) {
   for (String group : groups) {
    for (KeyPair pair : keyPairApi.get().list().filter(nameMatches(namingConvention.create().containsGroup(group)))) {
      ZoneAndName zoneAndName = ZoneAndName.fromZoneAndName(zoneId, pair.getName());
      logger.debug(">> deleting keypair(%s)", zoneAndName);
      keyPairApi.get().delete(pair.getName());
      // TODO: test this clear happens
      keyPairCache.invalidate(zoneAndName);
      logger.debug("<< deleted keypair(%s)", zoneAndName);
    }
    keyPairCache.invalidate(ZoneAndName.fromZoneAndName(zoneId,
         namingConvention.create().sharedNameForGroup(group)));
   }
 }
}

代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-nova

@Override
  public boolean apply(ZoneAndName input) {
   // new nodes can have the zone as their location, existing nodes, the parent is the
   // location
   return all(computeService.listNodesDetailsMatching(Predicates.<ComputeMetadata> or(locationId(input.getZone()),
        parentLocationId(input.getZone()))), and(inGroup(input.getName()), TERMINATED));
  }
}

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