mirror of https://github.com/apache/jclouds.git
JCLOUDS-1452: Switch to B2 v2 API
Some cleanups but no major changes: https://www.backblaze.com/blog/backblaze-b2-api-version-2-beta-is-now-open/
This commit is contained in:
parent
d621edd79f
commit
ce163f3498
|
@ -30,7 +30,7 @@ import org.jclouds.rest.annotations.RequestFilters;
|
|||
public interface AuthorizationApi {
|
||||
@Named("b2_authorize_account")
|
||||
@GET
|
||||
@Path("/b2api/v1/b2_authorize_account")
|
||||
@Path("/b2api/v2/b2_authorize_account")
|
||||
@RequestFilters(BasicAuthentication.class)
|
||||
@Consumes(APPLICATION_JSON)
|
||||
Authorization authorizeAccount();
|
||||
|
|
|
@ -46,14 +46,14 @@ import org.jclouds.rest.binders.BindToJsonPayload;
|
|||
public interface BucketApi {
|
||||
@Named("b2_create_bucket")
|
||||
@POST
|
||||
@Path("/b2api/v1/b2_create_bucket")
|
||||
@Path("/b2api/v2/b2_create_bucket")
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
@PayloadParams(keys = {"accountId"}, values = {"{jclouds.identity}"})
|
||||
Bucket createBucket(@PayloadParam("bucketName") String bucketName, @PayloadParam("bucketType") BucketType bucketType);
|
||||
|
||||
@Named("b2_delete_bucket")
|
||||
@POST
|
||||
@Path("/b2api/v1/b2_delete_bucket")
|
||||
@Path("/b2api/v2/b2_delete_bucket")
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
@PayloadParams(keys = {"accountId"}, values = {"{jclouds.identity}"})
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
|
@ -61,14 +61,14 @@ public interface BucketApi {
|
|||
|
||||
@Named("b2_update_bucket")
|
||||
@POST
|
||||
@Path("/b2api/v1/b2_update_bucket")
|
||||
@Path("/b2api/v2/b2_update_bucket")
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
@PayloadParams(keys = {"accountId"}, values = {"{jclouds.identity}"})
|
||||
Bucket updateBucket(@PayloadParam("bucketId") String bucketId, @PayloadParam("bucketType") BucketType bucketType);
|
||||
|
||||
@Named("b2_list_buckets")
|
||||
@POST
|
||||
@Path("/b2api/v1/b2_list_buckets")
|
||||
@Path("/b2api/v2/b2_list_buckets")
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
@PayloadParams(keys = {"accountId"}, values = {"{jclouds.identity}"})
|
||||
BucketList listBuckets();
|
||||
|
|
|
@ -51,7 +51,7 @@ import org.jclouds.rest.binders.BindToJsonPayload;
|
|||
public interface MultipartApi {
|
||||
@Named("b2_start_large_file")
|
||||
@POST
|
||||
@Path("/b2api/v1/b2_start_large_file")
|
||||
@Path("/b2api/v2/b2_start_large_file")
|
||||
@RequestFilters(RequestAuthorization.class)
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
@Produces(APPLICATION_JSON)
|
||||
|
@ -59,7 +59,7 @@ public interface MultipartApi {
|
|||
|
||||
@Named("b2_cancel_large_file")
|
||||
@POST
|
||||
@Path("/b2api/v1/b2_cancel_large_file")
|
||||
@Path("/b2api/v2/b2_cancel_large_file")
|
||||
@RequestFilters(RequestAuthorization.class)
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
@Produces(APPLICATION_JSON)
|
||||
|
@ -67,7 +67,7 @@ public interface MultipartApi {
|
|||
|
||||
@Named("b2_finish_large_file")
|
||||
@POST
|
||||
@Path("/b2api/v1/b2_finish_large_file")
|
||||
@Path("/b2api/v2/b2_finish_large_file")
|
||||
@RequestFilters(RequestAuthorization.class)
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
@Produces(APPLICATION_JSON)
|
||||
|
@ -75,7 +75,7 @@ public interface MultipartApi {
|
|||
|
||||
@Named("b2_get_upload_part_url")
|
||||
@POST
|
||||
@Path("/b2api/v1/b2_get_upload_part_url")
|
||||
@Path("/b2api/v2/b2_get_upload_part_url")
|
||||
@RequestFilters(RequestAuthorization.class)
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
@Produces(APPLICATION_JSON)
|
||||
|
@ -88,7 +88,7 @@ public interface MultipartApi {
|
|||
|
||||
@Named("b2_list_parts")
|
||||
@POST
|
||||
@Path("/b2api/v1/b2_list_parts")
|
||||
@Path("/b2api/v2/b2_list_parts")
|
||||
@RequestFilters(RequestAuthorization.class)
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
@Produces(APPLICATION_JSON)
|
||||
|
@ -96,7 +96,7 @@ public interface MultipartApi {
|
|||
|
||||
@Named("b2_list_unfinished_large_files")
|
||||
@POST
|
||||
@Path("/b2api/v1/b2_list_unfinished_large_files")
|
||||
@Path("/b2api/v2/b2_list_unfinished_large_files")
|
||||
@RequestFilters(RequestAuthorization.class)
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
@Produces(APPLICATION_JSON)
|
||||
|
|
|
@ -56,7 +56,7 @@ import org.jclouds.rest.binders.BindToJsonPayload;
|
|||
public interface ObjectApi {
|
||||
@Named("b2_get_upload_url")
|
||||
@POST
|
||||
@Path("/b2api/v1/b2_get_upload_url")
|
||||
@Path("/b2api/v2/b2_get_upload_url")
|
||||
@RequestFilters(RequestAuthorization.class)
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
@Consumes(APPLICATION_JSON)
|
||||
|
@ -71,7 +71,7 @@ public interface ObjectApi {
|
|||
|
||||
@Named("b2_delete_file_version")
|
||||
@POST
|
||||
@Path("/b2api/v1/b2_delete_file_version")
|
||||
@Path("/b2api/v2/b2_delete_file_version")
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
@RequestFilters(RequestAuthorization.class)
|
||||
@Consumes(APPLICATION_JSON)
|
||||
|
@ -80,7 +80,7 @@ public interface ObjectApi {
|
|||
|
||||
@Named("b2_get_file_info")
|
||||
@POST
|
||||
@Path("/b2api/v1/b2_get_file_info")
|
||||
@Path("/b2api/v2/b2_get_file_info")
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
@RequestFilters(RequestAuthorization.class)
|
||||
@Consumes(APPLICATION_JSON)
|
||||
|
@ -90,7 +90,7 @@ public interface ObjectApi {
|
|||
|
||||
@Named("b2_download_file_by_id")
|
||||
@GET
|
||||
@Path("/b2api/v1/b2_download_file_by_id")
|
||||
@Path("/b2api/v2/b2_download_file_by_id")
|
||||
@RequestFilters(RequestAuthorizationDownload.class)
|
||||
@ResponseParser(ParseB2ObjectFromResponse.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
|
@ -98,7 +98,7 @@ public interface ObjectApi {
|
|||
|
||||
@Named("b2_download_file_by_id")
|
||||
@GET
|
||||
@Path("/b2api/v1/b2_download_file_by_id")
|
||||
@Path("/b2api/v2/b2_download_file_by_id")
|
||||
@RequestFilters(RequestAuthorizationDownload.class)
|
||||
@ResponseParser(ParseB2ObjectFromResponse.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
|
@ -123,7 +123,7 @@ public interface ObjectApi {
|
|||
@Deprecated
|
||||
@Named("b2_list_file_names")
|
||||
@GET
|
||||
@Path("/b2api/v1/b2_list_file_names")
|
||||
@Path("/b2api/v2/b2_list_file_names")
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
@RequestFilters(RequestAuthorization.class)
|
||||
@Consumes(APPLICATION_JSON)
|
||||
|
@ -132,7 +132,7 @@ public interface ObjectApi {
|
|||
|
||||
@Named("b2_list_file_names")
|
||||
@GET
|
||||
@Path("/b2api/v1/b2_list_file_names")
|
||||
@Path("/b2api/v2/b2_list_file_names")
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
@RequestFilters(RequestAuthorization.class)
|
||||
@Consumes(APPLICATION_JSON)
|
||||
|
@ -142,7 +142,7 @@ public interface ObjectApi {
|
|||
@Deprecated
|
||||
@Named("b2_list_file_versions")
|
||||
@GET
|
||||
@Path("/b2api/v1/b2_list_file_versions")
|
||||
@Path("/b2api/v2/b2_list_file_versions")
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
@RequestFilters(RequestAuthorization.class)
|
||||
@Consumes(APPLICATION_JSON)
|
||||
|
@ -151,7 +151,7 @@ public interface ObjectApi {
|
|||
|
||||
@Named("b2_list_file_versions")
|
||||
@GET
|
||||
@Path("/b2api/v1/b2_list_file_versions")
|
||||
@Path("/b2api/v2/b2_list_file_versions")
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
@RequestFilters(RequestAuthorization.class)
|
||||
@Consumes(APPLICATION_JSON)
|
||||
|
@ -160,7 +160,7 @@ public interface ObjectApi {
|
|||
|
||||
@Named("b2_hide_file")
|
||||
@POST
|
||||
@Path("/b2api/v1/b2_hide_file")
|
||||
@Path("/b2api/v2/b2_hide_file")
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
@RequestFilters(RequestAuthorization.class)
|
||||
@Consumes(APPLICATION_JSON)
|
||||
|
|
|
@ -54,12 +54,12 @@ public final class B2RetryHandler extends BackoffLimitedRetryHandler implements
|
|||
|
||||
// B2 requires retrying on a different storage node for uploads
|
||||
String path = request.getEndpoint().getPath();
|
||||
if (path.startsWith("/b2api/v1/b2_upload_file")) {
|
||||
if (path.startsWith("/b2api/v2/b2_upload_file")) {
|
||||
String bucketId = path.split("/")[4];
|
||||
UploadUrlResponse uploadUrl = api.getObjectApi().getUploadUrl(bucketId);
|
||||
builder.endpoint(uploadUrl.uploadUrl())
|
||||
.replaceHeader(HttpHeaders.AUTHORIZATION, uploadUrl.authorizationToken());
|
||||
} else if (path.startsWith("/b2api/v1/b2_upload_part")) {
|
||||
} else if (path.startsWith("/b2api/v2/b2_upload_part")) {
|
||||
String fileId = path.split("/")[4];
|
||||
GetUploadPartResponse uploadUrl = api.getMultipartApi().getUploadPartUrl(fileId);
|
||||
builder.endpoint(uploadUrl.uploadUrl())
|
||||
|
|
|
@ -65,7 +65,7 @@ final class B2TestUtils {
|
|||
static void assertAuthentication(MockWebServer server) {
|
||||
assertThat(server.getRequestCount()).isGreaterThanOrEqualTo(1);
|
||||
try {
|
||||
assertThat(server.takeRequest().getRequestLine()).isEqualTo("GET /b2api/v1/b2_authorize_account HTTP/1.1");
|
||||
assertThat(server.takeRequest().getRequestLine()).isEqualTo("GET /b2api/v2/b2_authorize_account HTTP/1.1");
|
||||
} catch (InterruptedException e) {
|
||||
throw Throwables.propagate(e);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public final class BucketApiMockTest {
|
|||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_create_bucket", "/create_bucket_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_create_bucket", "/create_bucket_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public final class BucketApiMockTest {
|
|||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_delete_bucket", "/delete_bucket_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_delete_bucket", "/delete_bucket_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public final class BucketApiMockTest {
|
|||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_delete_bucket", "/delete_bucket_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_delete_bucket", "/delete_bucket_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public final class BucketApiMockTest {
|
|||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_update_bucket", "/update_bucket_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_update_bucket", "/update_bucket_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public final class BucketApiMockTest {
|
|||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_list_buckets", "/list_buckets_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_list_buckets", "/list_buckets_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ public final class MultipartApiMockTest {
|
|||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_start_large_file", "/start_large_file_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_start_large_file", "/start_large_file_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public final class MultipartApiMockTest {
|
|||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_cancel_large_file", "/cancel_large_file_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_cancel_large_file", "/cancel_large_file_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public final class MultipartApiMockTest {
|
|||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_finish_large_file", "/finish_large_file_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_finish_large_file", "/finish_large_file_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -143,11 +143,11 @@ public final class MultipartApiMockTest {
|
|||
GetUploadPartResponse response = api.getUploadPartUrl(FILE_ID);
|
||||
assertThat(response.authorizationToken()).isEqualTo(AUTHORIZATION_TOKEN);
|
||||
assertThat(response.fileId()).isEqualTo(FILE_ID);
|
||||
assertThat(response.uploadUrl()).isEqualTo(URI.create("https://pod-000-1016-09.backblaze.com/b2api/v1/b2_upload_part/4_ze73ede9c9c8412db49f60715_f100b4e93fbae6252_d20150824_m224353_c900_v8881000_t0001/0037"));
|
||||
assertThat(response.uploadUrl()).isEqualTo(URI.create("https://pod-000-1016-09.backblaze.com/b2api/v2/b2_upload_part/4_ze73ede9c9c8412db49f60715_f100b4e93fbae6252_d20150824_m224353_c900_v8881000_t0001/0037"));
|
||||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_get_upload_part_url", "/get_upload_part_url_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_get_upload_part_url", "/get_upload_part_url_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ public final class MultipartApiMockTest {
|
|||
|
||||
try {
|
||||
MultipartApi api = api(server.getUrl("/").toString(), "b2").getMultipartApi();
|
||||
GetUploadPartResponse uploadPart = GetUploadPartResponse.create(FILE_ID, server.getUrl("/b2api/v1/b2_upload_part/4a48fe8875c6214145260818/c001_v0001007_t0042").toURI(), AUTHORIZATION_TOKEN);
|
||||
GetUploadPartResponse uploadPart = GetUploadPartResponse.create(FILE_ID, server.getUrl("/b2api/v2/b2_upload_part/4a48fe8875c6214145260818/c001_v0001007_t0042").toURI(), AUTHORIZATION_TOKEN);
|
||||
long contentLength = 100 * 1000 * 1000;
|
||||
Payload payload = Payloads.newByteSourcePayload(TestUtils.randomByteSource().slice(0, contentLength));
|
||||
payload.getContentMetadata().setContentLength(contentLength);
|
||||
|
@ -170,7 +170,7 @@ public final class MultipartApiMockTest {
|
|||
assertThat(response.partNumber()).isEqualTo(1);
|
||||
|
||||
assertThat(server.getRequestCount()).isEqualTo(1);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_upload_part/4a48fe8875c6214145260818/c001_v0001007_t0042");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_upload_part/4a48fe8875c6214145260818/c001_v0001007_t0042");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ public final class MultipartApiMockTest {
|
|||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_list_parts", "/list_parts_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_list_parts", "/list_parts_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ public final class MultipartApiMockTest {
|
|||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_list_unfinished_large_files", "/list_unfinished_large_files_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_list_unfinished_large_files", "/list_unfinished_large_files_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
|
|
@ -69,12 +69,12 @@ public final class ObjectApiMockTest {
|
|||
ObjectApi api = api(server.getUrl("/").toString(), "b2").getObjectApi();
|
||||
UploadUrlResponse response = api.getUploadUrl(BUCKET_ID);
|
||||
assertThat(response.bucketId()).isEqualTo(BUCKET_ID);
|
||||
assertThat(response.uploadUrl()).isEqualTo(URI.create("https://pod-000-1005-03.backblaze.com/b2api/v1/b2_upload_file?cvt=c001_v0001005_t0027&bucket=4a48fe8875c6214145260818"));
|
||||
assertThat(response.uploadUrl()).isEqualTo(URI.create("https://pod-000-1005-03.backblaze.com/b2api/v2/b2_upload_file?cvt=c001_v0001005_t0027&bucket=4a48fe8875c6214145260818"));
|
||||
assertThat(response.authorizationToken()).isEqualTo("2_20151009170037_f504a0f39a0f4e657337e624_9754dde94359bd7b8f1445c8f4cc1a231a33f714_upld");
|
||||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_get_upload_url", "/get_upload_url_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_get_upload_url", "/get_upload_url_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public final class ObjectApiMockTest {
|
|||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_get_upload_url", "/get_upload_url_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_get_upload_url", "/get_upload_url_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public final class ObjectApiMockTest {
|
|||
ObjectApi api = api(server.getUrl("/").toString(), "b2").getObjectApi();
|
||||
String accountId = "d522aa47a10f";
|
||||
|
||||
UploadUrlResponse uploadUrl = UploadUrlResponse.create(BUCKET_ID, server.getUrl("/b2api/v1/b2_upload_file/4a48fe8875c6214145260818/c001_v0001007_t0042").toURI(), "FAKE-AUTHORIZATION-TOKEN");
|
||||
UploadUrlResponse uploadUrl = UploadUrlResponse.create(BUCKET_ID, server.getUrl("/b2api/v2/b2_upload_file/4a48fe8875c6214145260818/c001_v0001007_t0042").toURI(), "FAKE-AUTHORIZATION-TOKEN");
|
||||
Payload payload = Payloads.newStringPayload(PAYLOAD);
|
||||
payload.getContentMetadata().setContentType(CONTENT_TYPE);
|
||||
UploadFileResponse response = api.uploadFile(uploadUrl, FILE_NAME, SHA1, FILE_INFO, payload);
|
||||
|
@ -125,7 +125,7 @@ public final class ObjectApiMockTest {
|
|||
assertThat(response.fileInfo()).isEqualTo(FILE_INFO);
|
||||
|
||||
assertThat(server.getRequestCount()).isEqualTo(1);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_upload_file/4a48fe8875c6214145260818/c001_v0001007_t0042");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_upload_file/4a48fe8875c6214145260818/c001_v0001007_t0042");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ public final class ObjectApiMockTest {
|
|||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_delete_file_version", "/delete_object_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_delete_file_version", "/delete_object_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ public final class ObjectApiMockTest {
|
|||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_delete_file_version", "/delete_object_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_delete_file_version", "/delete_object_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ public final class ObjectApiMockTest {
|
|||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_get_file_info", "/get_file_info_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_get_file_info", "/get_file_info_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ public final class ObjectApiMockTest {
|
|||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_get_file_info", "/get_file_info_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_get_file_info", "/get_file_info_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -248,11 +248,11 @@ public final class ObjectApiMockTest {
|
|||
|
||||
RecordedRequest request = server.takeRequest();
|
||||
assertThat(request.getMethod()).isEqualTo("GET");
|
||||
assertThat(request.getPath()).isEqualTo("/b2api/v1/b2_authorize_account");
|
||||
assertThat(request.getPath()).isEqualTo("/b2api/v2/b2_authorize_account");
|
||||
|
||||
request = server.takeRequest();
|
||||
assertThat(request.getMethod()).isEqualTo("GET");
|
||||
assertThat(request.getPath()).isEqualTo("/b2api/v1/b2_download_file_by_id?fileId=4_h4a48fe8875c6214145260818_f000000000000472a_d20140104_m032022_c001_v0000123_t0104");
|
||||
assertThat(request.getPath()).isEqualTo("/b2api/v2/b2_download_file_by_id?fileId=4_h4a48fe8875c6214145260818_f000000000000472a_d20140104_m032022_c001_v0000123_t0104");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -280,11 +280,11 @@ public final class ObjectApiMockTest {
|
|||
|
||||
RecordedRequest request = server.takeRequest();
|
||||
assertThat(request.getMethod()).isEqualTo("GET");
|
||||
assertThat(request.getPath()).isEqualTo("/b2api/v1/b2_authorize_account");
|
||||
assertThat(request.getPath()).isEqualTo("/b2api/v2/b2_authorize_account");
|
||||
|
||||
request = server.takeRequest();
|
||||
assertThat(request.getMethod()).isEqualTo("GET");
|
||||
assertThat(request.getPath()).isEqualTo("/b2api/v1/b2_download_file_by_id?fileId=4_h4a48fe8875c6214145260818_f000000000000472a_d20140104_m032022_c001_v0000123_t0104");
|
||||
assertThat(request.getPath()).isEqualTo("/b2api/v2/b2_download_file_by_id?fileId=4_h4a48fe8875c6214145260818_f000000000000472a_d20140104_m032022_c001_v0000123_t0104");
|
||||
assertThat(request.getHeaders()).contains("Range: bytes=42-69");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
|
@ -321,7 +321,7 @@ public final class ObjectApiMockTest {
|
|||
|
||||
RecordedRequest request = server.takeRequest();
|
||||
assertThat(request.getMethod()).isEqualTo("GET");
|
||||
assertThat(request.getPath()).isEqualTo("/b2api/v1/b2_authorize_account");
|
||||
assertThat(request.getPath()).isEqualTo("/b2api/v2/b2_authorize_account");
|
||||
|
||||
request = server.takeRequest();
|
||||
assertThat(request.getMethod()).isEqualTo("GET");
|
||||
|
@ -361,7 +361,7 @@ public final class ObjectApiMockTest {
|
|||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_list_file_names", "/list_file_names_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_list_file_names", "/list_file_names_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ public final class ObjectApiMockTest {
|
|||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_list_file_versions", "/list_file_versions_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_list_file_versions", "/list_file_versions_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ public final class ObjectApiMockTest {
|
|||
|
||||
assertThat(server.getRequestCount()).isEqualTo(2);
|
||||
assertAuthentication(server);
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v1/b2_hide_file", "/hide_file_request.json");
|
||||
assertRequest(server.takeRequest(), "POST", "/b2api/v2/b2_hide_file", "/hide_file_request.json");
|
||||
} finally {
|
||||
server.shutdown();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"authorizationToken": "3_20160409004829_42b8f80ba60fb4323dcaad98_ec81302316fccc2260201cbf17813247f312cf3b_000_uplg",
|
||||
"fileId": "4_za71f544e781e6891531b001a_f200ec353a2184825_d20160409_m004829_c000_v0001016_t0028",
|
||||
"uploadUrl": "https://pod-000-1016-09.backblaze.com/b2api/v1/b2_upload_part/4_ze73ede9c9c8412db49f60715_f100b4e93fbae6252_d20150824_m224353_c900_v8881000_t0001/0037"
|
||||
"uploadUrl": "https://pod-000-1016-09.backblaze.com/b2api/v2/b2_upload_part/4_ze73ede9c9c8412db49f60715_f100b4e93fbae6252_d20150824_m224353_c900_v8881000_t0001/0037"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"bucketId" : "4a48fe8875c6214145260818",
|
||||
"uploadUrl" : "https://pod-000-1005-03.backblaze.com/b2api/v1/b2_upload_file?cvt=c001_v0001005_t0027&bucket=4a48fe8875c6214145260818",
|
||||
"uploadUrl" : "https://pod-000-1005-03.backblaze.com/b2api/v2/b2_upload_file?cvt=c001_v0001005_t0027&bucket=4a48fe8875c6214145260818",
|
||||
"authorizationToken" : "2_20151009170037_f504a0f39a0f4e657337e624_9754dde94359bd7b8f1445c8f4cc1a231a33f714_upld"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue