Skip to content

Implemented ORS List Blobs#11756

Closed
gapra-msft wants to merge 5 commits into
Azure:feature/storage/stg73from
gapra-msft:storage/orsListBlobs
Closed

Implemented ORS List Blobs#11756
gapra-msft wants to merge 5 commits into
Azure:feature/storage/stg73from
gapra-msft:storage/orsListBlobs

Conversation

@gapra-msft

Copy link
Copy Markdown
Member

No description provided.

Comment thread sdk/storage/azure-storage-blob/swagger/README.md Outdated
this.objectReplicationSourcePolicies = null;
if (blobItemInternal.getObjectReplicationMetadata() != null) {
this.objectReplicationSourcePolicies = new HashMap<>();
for (String orString : blobItemInternal.getObjectReplicationMetadata().keySet()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think CI will tell you this, but we should use entrySet instead of keySet so we don't have to index into the map

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

@gapra-msft gapra-msft marked this pull request as ready for review June 3, 2020 22:33

@alzimmermsft alzimmermsft left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need to add another parameter to the BlobRequestConditions model for ifTags? There will need to be a Swagger transform to remove the following from the $.parameters.IfTags.

"x-ms-parameter-grouping": {
    "name": "modified-access-conditions"
},

Comment on lines +292 to +295
String ifTags = null;
if (modifiedAccessConditions != null) {
ifTags = modifiedAccessConditions.getIfTags();
}

@alzimmermsft alzimmermsft Jun 3, 2020

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need to add another property to the BlobRequestConditions class?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This ifTags generated code stuff wasnt meant to be part of this PR but someone had already changed swagger so I havent implemented it yet. That will come in a future PR.

Bute you're right, I think we need to remove the grouping and add it to BlobRequestCondiitons like the other params.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For this PR, we want to just focus on the listBlobs changes

@kasobol-msft kasobol-msft left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment on lines +53 to +70
if (blobItemInternal.getObjectReplicationMetadata() != null) {
this.objectReplicationSourcePolicies = new HashMap<>();
for (Map.Entry<String, String> p : blobItemInternal.getObjectReplicationMetadata().entrySet()) {
String orString = p.getKey();
String str = orString.startsWith("or-") ? orString.substring(3) : orString;
String[] split = str.split("_");
String policyId = split[0];
String ruleId = split[1];
if (objectReplicationSourcePolicies.containsKey(policyId)) {
objectReplicationSourcePolicies.get(policyId)
.putRuleAndStatus(ruleId, p.getValue());
} else {
ObjectReplicationPolicy policy = new ObjectReplicationPolicy(policyId);
policy.putRuleAndStatus(ruleId, p.getValue());
objectReplicationSourcePolicies.put(policyId, policy);
}
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This needs to find new home. We need to decouple model from "implementation model" per APIView feedback.
Anyway, it's a good practice to NOT place such logic inside constructors. BlobItem should ideally be plain data structure and this logic should move to some "transformer/mapper".

@gapra-msft gapra-msft closed this Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants