Skip to content

Conversation

@ShreyasSinha
Copy link

  1. Adding model classes for List request and response.
  2. Implemented List for Multipart Upload.

Refer: #3348

@product-auto-label product-auto-label bot added size: l Pull request size is large. api: storage Issues related to the googleapis/java-storage API. labels Oct 22, 2025
@ShreyasSinha ShreyasSinha marked this pull request as ready for review October 22, 2025 18:32
@ShreyasSinha ShreyasSinha requested a review from a team as a code owner October 22, 2025 18:32
@ShreyasSinha ShreyasSinha requested a review from a team as a code owner October 22, 2025 20:01
public ListPartsResponse listParts(ListPartsRequest request) throws IOException {

return retrier.run(
Retrying.alwaysRetry(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be options.getRetryAlgorithmManager().idempotent().

Retrying.alwaysRetry() is for tests.

}

/** A builder for {@link ListPartsRequest}. */
public static class Builder {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public static class Builder {
@BetaApi
public static final class Builder {

private String owner;

@JacksonXmlProperty(localName = "StorageClass")
private String storageClass;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be StorageClass instead of String?

private boolean isTruncated;

@JacksonXmlProperty(localName = "Owner")
private String owner;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be Acl.Entity instead of String?

.add("storageClass", storageClass)
.add("parts", parts)
.toString();
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this need a builder?

}

/** A builder for {@link Part}. */
public static final class Builder {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public static final class Builder {
@BetaApi
public static final class Builder {

public final class Part {

@JacksonXmlProperty(localName = "PartNumber")
private int partNumber;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why int here, but Integer in ListPartsResponse? Can we use primitives everywhere?

private long size;

@JacksonXmlProperty(localName = "LastModified")
private String lastModified;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be an OffsetDateTime?

Comment on lines 387 to 403
String xmlResponse =
"<?xml version='1.0' encoding='UTF-8'?>\n"
+ "<ListPartsResult>\n"
+ " <Bucket>test-bucket</Bucket>\n"
+ " <Key>test-key</Key>\n"
+ " <UploadId>test-upload-id</UploadId>\n"
+ " <PartNumberMarker>0</PartNumberMarker>\n"
+ " <NextPartNumberMarker>1</NextPartNumberMarker>\n"
+ " <MaxParts>1</MaxParts>\n"
+ " <IsTruncated>false</IsTruncated>\n"
+ " <Part>\n"
+ " <PartNumber>1</PartNumber>\n"
+ " <ETag>\"etag\"</ETag>\n"
+ " <Size>123</Size>\n"
+ " <LastModified>2024-05-08T17:50:00.000Z</LastModified>\n"
+ " </Part>\n"
+ "</ListPartsResult>";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably be replaced once ListPartsResponse has a builder

@Test
public void sendListPartsRequest_success() throws Exception {
HttpRequestHandler handler =
req -> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should perform some request validation to ensure the proper request is being sent to the server. something like only return ok when the bucket, key and uploadId match expected. otherwise 404 or 400 with a message.

@product-auto-label product-auto-label bot added size: xl Pull request size is extra large. and removed size: l Pull request size is large. labels Oct 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the googleapis/java-storage API. size: xl Pull request size is extra large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants