org.jclouds.ec2.domain.Volume.toBuilder()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(106)

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

Volume.toBuilder介绍

暂无

代码示例

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

public void testCreateVolumeFromSnapshotInAvailabilityZoneEuSetsCorrectEndpoint() {
 String region = "eu-west-1";
 
 Builder<HttpRequest, HttpResponse> builder = ImmutableMap.<HttpRequest, HttpResponse>builder();
 builder.put(describeRegionsRequest, describeRegionsResponse);
 builder.putAll(describeAvailabilityZonesRequestResponse);
 builder.put(
    formSigner.filter(HttpRequest.builder()
        .method("POST")
        .endpoint("https://ec2." + region + ".amazonaws.com/")
        .addHeader("Host", "ec2." + region + ".amazonaws.com")
        .addFormParam("Action", "CreateVolume")
        .addFormParam("AvailabilityZone", "eu-west-1a")
        .addFormParam("Size", "1")
        .addFormParam("SnapshotId", "snap-8b7ffbdd")
        .build()),
     HttpResponse.builder()
         .statusCode(200)
         .payload(payloadFromResource("/created_volume.xml")).build());
 
 ElasticBlockStoreApi client = requestsSendResponses(builder.build()).getElasticBlockStoreApi().get();
 assertEquals(client.createVolumeFromSnapshotInAvailabilityZone(region + "a", 1, "snap-8b7ffbdd"), creating.toBuilder().region(region).build());
}

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

public void testCreateVolumeFromSnapshotInAvailabilityZoneEuSetsCorrectEndpoint() {
   String region = "eu-west-1";
   
   Builder<HttpRequest, HttpResponse> builder = ImmutableMap.<HttpRequest, HttpResponse>builder();
   builder.put(describeRegionsRequest, describeRegionsResponse);
   builder.putAll(describeAvailabilityZonesRequestResponse);
   builder.put(
      formSigner.filter(HttpRequest.builder()
                     .method("POST")
                     .endpoint("https://ec2." + region + ".amazonaws.com/")
                     .addHeader("Host", "ec2." + region + ".amazonaws.com")
                     .addFormParam("Action", "CreateVolume")
                     .addFormParam("AvailabilityZone", "eu-west-1a")
                     .addFormParam("Size", "1")
                     .addFormParam("SnapshotId", "snap-8b7ffbdd").build()),
      HttpResponse.builder()
            .statusCode(200)
            .payload(payloadFromResource("/created_volume.xml")).build());
   
   ElasticBlockStoreClient client = requestsSendResponses(builder.build()).getElasticBlockStoreServices();

   assertEquals(client.createVolumeFromSnapshotInAvailabilityZone(region + "a", 1, "snap-8b7ffbdd"), creating.toBuilder().region(region).build());
  }
}

相关文章