本文整理了Java中org.jclouds.ec2.domain.Volume.getId()
方法的一些代码示例,展示了Volume.getId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Volume.getId()
方法的具体详情如下:
包路径:org.jclouds.ec2.domain.Volume
类名称:Volume
方法名:getId
暂无
代码示例来源:origin: org.jclouds.api/ec2
public boolean apply(Volume volume) {
logger.trace("looking for status on volume %s", volume.getId());
volume = Iterables.getOnlyElement(client.describeVolumesInRegion(volume.getRegion(), volume
.getId()));
logger.trace("%s: looking for status %s: currently: %s", volume, Volume.Status.AVAILABLE,
volume.getStatus());
return volume.getStatus() == Volume.Status.AVAILABLE;
}
代码示例来源:origin: jclouds/legacy-jclouds
public boolean apply(Volume volume) {
logger.trace("looking for status on volume %s", volume.getId());
volume = Iterables.getOnlyElement(client.describeVolumesInRegion(volume.getRegion(), volume
.getId()));
logger.trace("%s: looking for status %s: currently: %s", volume, Volume.Status.AVAILABLE,
volume.getStatus());
return volume.getStatus() == Volume.Status.AVAILABLE;
}
代码示例来源:origin: com.amysta.jclouds.api/ec2
public boolean apply(Volume volume) {
logger.trace("looking for status on volume %s", volume.getId());
volume = Iterables.getOnlyElement(client.describeVolumesInRegion(volume.getRegion(), volume
.getId()));
logger.trace("%s: looking for status %s: currently: %s", volume, Volume.Status.AVAILABLE,
volume.getStatus());
return volume.getStatus() == Volume.Status.AVAILABLE;
}
代码示例来源:origin: org.apache.jclouds.api/ec2
public boolean apply(Volume volume) {
logger.trace("looking for status on volume %s", volume.getId());
volume = Iterables.getOnlyElement(client.describeVolumesInRegion(volume.getRegion(), volume
.getId()));
logger.trace("%s: looking for status %s: currently: %s", volume, Volume.Status.AVAILABLE,
volume.getStatus());
return volume.getStatus() == Volume.Status.AVAILABLE;
}
代码示例来源:origin: jclouds/legacy-jclouds
@Test
void testCreateVolumeInAvailabilityZone() {
Volume expected = client.createVolumeInAvailabilityZone(defaultZone, 1);
assertNotNull(expected);
assertEquals(expected.getAvailabilityZone(), defaultZone);
this.volumeId = expected.getId();
Set<Volume> result = Sets.newLinkedHashSet(client.describeVolumesInRegion(defaultRegion, expected.getId()));
assertNotNull(result);
assertEquals(result.size(), 1);
Volume volume = result.iterator().next();
assertEquals(volume.getId(), expected.getId());
}
代码示例来源:origin: apache/jclouds
public boolean apply(Volume volume) {
logger.trace("looking for status on volume %s", volume.getId());
volume = Iterables.getOnlyElement(client.describeVolumesInRegion(volume.getRegion(), volume
.getId()));
logger.trace("%s: looking for status %s: currently: %s", volume, Volume.Status.AVAILABLE,
volume.getStatus());
return volume.getStatus() == Volume.Status.AVAILABLE;
}
代码示例来源:origin: apache/jclouds
@Test
void testDescribeVolumes() {
String region = defaultRegion;
SortedSet<Volume> allResults = Sets.newTreeSet(client.describeVolumesInRegion(region));
assertNotNull(allResults);
assertFalse(allResults.isEmpty());
Volume volume = allResults.last();
SortedSet<Volume> result = Sets.newTreeSet(client.describeVolumesInRegion(region, volume.getId()));
assertNotNull(result);
Volume compare = result.last();
assertEquals(compare, volume);
}
代码示例来源:origin: apache/jclouds
@Test(expectedExceptions = AWSResponseException.class)
void testDescribeVolumesWithInvalidFilter() {
String region = defaultRegion;
SortedSet<Volume> allResults = Sets.newTreeSet(client.describeVolumesInRegion(region));
assertNotNull(allResults);
assertFalse(allResults.isEmpty());
Volume volume = allResults.last();
client.describeVolumesInRegionWithFilter(region,
ImmutableMultimap.<String, String>builder()
.put("invalid-filter", volume.getId()).build());
}
代码示例来源:origin: apache/jclouds
@Test
void testDescribeVolumesWithFilter() {
String region = defaultRegion;
SortedSet<Volume> allResults = Sets.newTreeSet(client.describeVolumesInRegion(region));
assertNotNull(allResults);
assertFalse(allResults.isEmpty());
Volume volume = allResults.last();
SortedSet<Volume> result = Sets.newTreeSet(client.describeVolumesInRegionWithFilter(region,
ImmutableMultimap.<String, String>builder()
.put("volume-id", volume.getId()).build()));
assertNotNull(result);
Volume compare = result.last();
assertEquals(compare, volume);
}
代码示例来源:origin: apache/jclouds
@Test
void testCreateVolumeInAvailabilityZone() {
Volume expected = client.createVolumeInAvailabilityZone(defaultZone,
withSize(1));
assertNotNull(expected);
assertEquals(expected.getAvailabilityZone(), defaultZone);
this.volumeId = expected.getId();
Set<Volume> result = Sets.newLinkedHashSet(client.describeVolumesInRegion(defaultRegion, expected.getId()));
assertNotNull(result);
assertEquals(result.size(), 1);
Volume volume = result.iterator().next();
assertEquals(volume.getId(), expected.getId());
assertEquals(volume.getVolumeType(), expected.getVolumeType());
}
代码示例来源:origin: jclouds/legacy-jclouds
@Test
void testDescribeVolumes() {
for (String region : ec2Client.getConfiguredRegions()) {
SortedSet<Volume> allResults = Sets.newTreeSet(client.describeVolumesInRegion(region));
assertNotNull(allResults);
if (allResults.size() >= 1) {
Volume volume = allResults.last();
SortedSet<Volume> result = Sets.newTreeSet(client.describeVolumesInRegion(region, volume.getId()));
assertNotNull(result);
Volume compare = result.last();
assertEquals(compare, volume);
}
}
}
代码示例来源:origin: apache/jclouds
@Test(dependsOnMethods = "testCreateSnapshotInRegion")
void testCreateVolumeFromSnapshotInAvailabilityZone() {
Volume volume = client.createVolumeFromSnapshotInAvailabilityZone(defaultZone, snapshot.getId());
assertNotNull(volume);
Predicate<Volume> availabile = retry(new VolumeAvailable(client), 600, 10, SECONDS);
assert availabile.apply(volume);
Volume result = Iterables.getOnlyElement(client.describeVolumesInRegion(defaultRegion, volume.getId()));
assertEquals(volume.getId(), result.getId());
assertEquals(volume.getSnapshotId(), snapshot.getId());
assertEquals(volume.getAvailabilityZone(), defaultZone);
assertEquals(result.getStatus(), Volume.Status.AVAILABLE);
client.deleteVolumeInRegion(defaultRegion, result.getId());
}
代码示例来源:origin: apache/jclouds
@Test
void testCreateVolumeInAvailabilityZoneWithVolumeType() {
Volume expected = client.createVolumeInAvailabilityZone(defaultZone,
volumeType("gp2"), withSize(1));
assertNotNull(expected);
assertEquals(expected.getAvailabilityZone(), defaultZone);
assertEquals(expected.getVolumeType(), "gp2");
Set<Volume> result = Sets.newLinkedHashSet(client.describeVolumesInRegion(defaultRegion, expected.getId()));
assertNotNull(result);
assertEquals(result.size(), 1);
Volume volume = result.iterator().next();
assertEquals(volume.getId(), expected.getId());
assertEquals(volume.getVolumeType(), expected.getVolumeType());
client.deleteVolumeInRegion(volume.getRegion(), volume.getId());
}
代码示例来源:origin: jclouds/legacy-jclouds
@Test(enabled = false, dependsOnMethods = "testCreateRunningInstance")
void testCreateAndAttachVolume() {
volume = client.getElasticBlockStoreServices().createVolumeInAvailabilityZone(instance.getAvailabilityZone(),
VOLUME_SIZE);
System.out.printf("%d: %s awaiting volume to become available%n", System.currentTimeMillis(), volume.getId());
assert volumeTester.apply(volume);
Attachment attachment = client.getElasticBlockStoreServices().attachVolumeInRegion(instance.getRegion(),
volume.getId(), instance.getId(), "/dev/sdh");
System.out.printf("%d: %s awaiting attachment to complete%n", System.currentTimeMillis(), attachment.getId());
assert attachTester.apply(attachment);
System.out.printf("%d: %s attachment complete%n", System.currentTimeMillis(), attachment.getId());
}
代码示例来源:origin: apache/jclouds
@Test(enabled = false, dependsOnMethods = "testCreateRunningInstance")
void testCreateAndAttachVolume() {
volume = client.getElasticBlockStoreApi().get().createVolumeInAvailabilityZone(instance.getAvailabilityZone(),
VOLUME_SIZE);
System.out.printf("%d: %s awaiting volume to become available%n", System.currentTimeMillis(), volume.getId());
assert volumeTester.apply(volume);
Attachment attachment = client.getElasticBlockStoreApi().get().attachVolumeInRegion(instance.getRegion(),
volume.getId(), instance.getId(), "/dev/sdh");
System.out.printf("%d: %s awaiting attachment to complete%n", System.currentTimeMillis(), attachment.getId());
assert attachTester.apply(attachment);
System.out.printf("%d: %s attachment complete%n", System.currentTimeMillis(), attachment.getId());
}
代码示例来源:origin: jclouds/legacy-jclouds
@Test(dependsOnMethods = "testCreateSnapshotInRegion")
void testCreateVolumeFromSnapshotInAvailabilityZone() {
Volume volume = client.createVolumeFromSnapshotInAvailabilityZone(defaultZone, snapshot.getId());
assertNotNull(volume);
Predicate<Volume> availabile = retry(new VolumeAvailable(client), 600, 10, SECONDS);
assert availabile.apply(volume);
Volume result = Iterables.getOnlyElement(client.describeVolumesInRegion(snapshot.getRegion(), volume.getId()));
assertEquals(volume.getId(), result.getId());
assertEquals(volume.getSnapshotId(), snapshot.getId());
assertEquals(volume.getAvailabilityZone(), defaultZone);
assertEquals(result.getStatus(), Volume.Status.AVAILABLE);
client.deleteVolumeInRegion(snapshot.getRegion(), volume.getId());
}
代码示例来源:origin: jclouds/legacy-jclouds
@Test(dependsOnMethods = "testCreateSnapshotInRegion")
void testCreateVolumeFromSnapshotInAvailabilityZoneWithSize() {
Volume volume = client.createVolumeFromSnapshotInAvailabilityZone(defaultZone, 2, snapshot.getId());
assertNotNull(volume);
Predicate<Volume> availabile = retry(new VolumeAvailable(client), 600, 10, SECONDS);
assert availabile.apply(volume);
Volume result = Iterables.getOnlyElement(client.describeVolumesInRegion(snapshot.getRegion(), volume.getId()));
assertEquals(volume.getId(), result.getId());
assertEquals(volume.getSnapshotId(), snapshot.getId());
assertEquals(volume.getAvailabilityZone(), defaultZone);
assertEquals(volume.getSize(), 2);
assertEquals(result.getStatus(), Volume.Status.AVAILABLE);
client.deleteVolumeInRegion(snapshot.getRegion(), volume.getId());
}
代码示例来源:origin: apache/jclouds
@Test(dependsOnMethods = "testCreateVolumeFromSnapshotInAvailabilityZoneWithOptions")
void testCreateVolumeFromSnapshotInAvailabilityZoneWithSize() {
Volume volume = client.createVolumeFromSnapshotInAvailabilityZone(defaultZone, 2, snapshot.getId());
assertNotNull(volume);
Predicate<Volume> availabile = retry(new VolumeAvailable(client), 600, 10, SECONDS);
assert availabile.apply(volume);
Volume result = Iterables.getOnlyElement(client.describeVolumesInRegion(defaultRegion, volume.getId()));
assertEquals(volume.getId(), result.getId());
assertEquals(volume.getSnapshotId(), snapshot.getId());
assertEquals(volume.getAvailabilityZone(), defaultZone);
assertEquals(volume.getSize(), 2);
assertEquals(result.getStatus(), Volume.Status.AVAILABLE);
client.deleteVolumeInRegion(defaultRegion, result.getId());
}
代码示例来源:origin: apache/jclouds
@Test(dependsOnMethods = "testCreateVolumeFromSnapshotInAvailabilityZone")
void testCreateVolumeFromSnapshotInAvailabilityZoneWithOptions() {
Volume volume = client.createVolumeInAvailabilityZone(defaultZone,
fromSnapshotId(snapshot.getId()));
assertNotNull(volume);
Predicate<Volume> availabile = retry(new VolumeAvailable(client), 600, 10, SECONDS);
assert availabile.apply(volume);
Volume result = Iterables.getOnlyElement(client.describeVolumesInRegion(defaultRegion, volume.getId()));
assertEquals(volume.getId(), result.getId());
assertEquals(volume.getSnapshotId(), snapshot.getId());
assertEquals(volume.getAvailabilityZone(), defaultZone);
assertEquals(result.getStatus(), Volume.Status.AVAILABLE);
client.deleteVolumeInRegion(defaultRegion, result.getId());
}
代码示例来源:origin: apache/jclouds
public void testFilterVolumesWhenResponseIs2xx() {
HttpResponse filterResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/describe_volumes_single.xml", "text/xml")).build();
EC2Api apiWhenExist = requestsSendResponses(describeRegionsRequest, describeRegionsResponse, filterVolumes, filterResponse);
Volume volume = getOnlyElement(apiWhenExist.getElasticBlockStoreApi().get().describeVolumesInRegionWithFilter("us-east-1",
ImmutableMultimap.<String, String>builder()
.put("snapshot-id", "snap-536d1b3a")
.build()));
assertEquals(volume.getId(), "vol-4282672b");
}
内容来源于网络,如有侵权,请联系作者删除!