Skip to content

Commit

Permalink
Update Storage swagger (#4981)
Browse files Browse the repository at this point in the history
* Move Storage to official swagger files

There are no (meaningful) code changes except the attribute in
BlobHierarchyListSegment that I can't trace to the swagger

* Upgrade blobs swagger to 2019-02-02

Note that additional work will have to be done to patch our higher level code to
pass new parameters to existing APIs

* Fixes to Swagger generation and updating to use new protocol layer

* Fixed appendBlock content-type, added SpotBug exclusions for autogen code

* Update README.md

* Fixed incorrect exclude
  • Loading branch information
tg-msft authored and alzimmermsft committed Aug 15, 2019
1 parent ca83bd9 commit 99e76b4
Show file tree
Hide file tree
Showing 119 changed files with 27,676 additions and 11,046 deletions.
3 changes: 3 additions & 0 deletions eng/.docsettings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ known_content_issues:
- ['sdk/cosmos/changelog/README.md', '#3113']
- ['sdk/cosmos/microsoft-azure-cosmos-benchmark/README.md', '#3113']
- ['sdk/cosmos/README.md', '#3113']
- ['sdk/storage/azure-storage-blob/swagger/README.md', '#3113']
- ['sdk/storage/azure-storage-queue/swagger/README.md', '#3113']
- ['sdk/storage/azure-storage-file/swagger/README.md', '#3113']
package_indexing_exclusion_list:
- azure-loganalytics-sample
- azure-applicationinsights-query-sample
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
<Or>
<Class name="com.microsoft.azure.keyvault.authentication.KeyVaultCredentials"/>
<Class name="com.azure.storage.blob.implementation.AzureBlobStorageBuilder"/>
<Class name="com.azure.storage.file.implementation.AzureFileStorageBuilder"/>
<Class name="com.azure.storage.queue.implementation.AzureQueueStorageBuilder"/>
</Or>
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
</Match>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ public Mono<Response<AppendBlobItem>> create(BlobHTTPHeaders headers, Metadata m
accessConditions = (accessConditions == null) ? new BlobAccessConditions() : accessConditions;

return postProcessResponse(this.azureBlobStorage.appendBlobs().createWithRestResponseAsync(null,
null, 0, null, metadata, null, null,
null, null, headers, accessConditions.leaseAccessConditions(),
null, 0, null, metadata, null, null, null,
null, null, headers, accessConditions.leaseAccessConditions(), null,
accessConditions.modifiedAccessConditions(), Context.NONE))
.map(rb -> new SimpleResponse<>(rb, new AppendBlobItem(rb.deserializedHeaders())));
}
Expand Down Expand Up @@ -144,10 +144,10 @@ public Mono<Response<AppendBlobItem>> appendBlock(Flux<ByteBuf> data, long lengt
: appendBlobAccessConditions;

return postProcessResponse(this.azureBlobStorage.appendBlobs().appendBlockWithRestResponseAsync(
null, null, data, length, null, null,
null, null, data, length, null, null, null,
null, null, null, null,
appendBlobAccessConditions.leaseAccessConditions(),
appendBlobAccessConditions.appendPositionAccessConditions(),
appendBlobAccessConditions.appendPositionAccessConditions(), null,
appendBlobAccessConditions.modifiedAccessConditions(), Context.NONE))
.map(rb -> new SimpleResponse<>(rb, new AppendBlobItem(rb.deserializedHeaders())));
}
Expand Down Expand Up @@ -201,7 +201,7 @@ public Mono<Response<AppendBlobItem>> appendBlockFromUrl(URL sourceURL, BlobRang

return postProcessResponse(
this.azureBlobStorage.appendBlobs().appendBlockFromUrlWithRestResponseAsync(null, null,
sourceURL, 0, sourceRange.toString(), sourceContentMD5, null, null,
sourceURL, 0, sourceRange.toString(), sourceContentMD5, null, null, null, null,
destAccessConditions.leaseAccessConditions(),
destAccessConditions.appendPositionAccessConditions(),
destAccessConditions.modifiedAccessConditions(), sourceAccessConditions, Context.NONE))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.azure.storage.blob.implementation.AzureBlobStorageBuilder;
import com.azure.storage.blob.implementation.AzureBlobStorageImpl;
import com.azure.storage.blob.models.AccessTier;
import com.azure.storage.blob.models.AccessTierRequired;
import com.azure.storage.blob.models.BlobAccessConditions;
import com.azure.storage.blob.models.BlobHTTPHeaders;
import com.azure.storage.blob.models.BlobRange;
Expand Down Expand Up @@ -245,7 +246,7 @@ public Mono<Response<String>> startCopyFromURL(URL sourceURL, Metadata metadata,
.sourceIfNoneMatch(sourceModifiedAccessConditions.ifNoneMatch());

return postProcessResponse(this.azureBlobStorage.blobs().startCopyFromURLWithRestResponseAsync(
null, null, sourceURL, null, metadata, null, sourceConditions,
null, null, sourceURL, null, metadata, null, null, null, null, sourceConditions,
destAccessConditions.modifiedAccessConditions(), destAccessConditions.leaseAccessConditions(), Context.NONE))
.map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().copyId()));
}
Expand Down Expand Up @@ -340,7 +341,7 @@ public Mono<Response<String>> copyFromURL(URL copySource, Metadata metadata, Mod
.sourceIfNoneMatch(sourceModifiedAccessConditions.ifNoneMatch());

return postProcessResponse(this.azureBlobStorage.blobs().copyFromURLWithRestResponseAsync(
null, null, copySource, null, metadata, null, sourceConditions,
null, null, copySource, null, metadata, null, null, null, sourceConditions,
destAccessConditions.modifiedAccessConditions(), destAccessConditions.leaseAccessConditions(), Context.NONE))
.map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().copyId()));
}
Expand Down Expand Up @@ -413,7 +414,7 @@ Mono<DownloadAsyncResponse> download(BlobRange range, BlobAccessConditions acces
// TODO: range is BlobRange but expected as String
// TODO: figure out correct response
return postProcessResponse(this.azureBlobStorage.blobs().downloadWithRestResponseAsync(
null, null, snapshot, null, null, range.toHeaderValue(), getMD5,
null, null, snapshot, null, null, range.toHeaderValue(), getMD5, null,
null, null, null, null,
accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), Context.NONE))
// Convert the autorest response to a DownloadAsyncResponse, which enable reliable download.
Expand Down Expand Up @@ -691,7 +692,7 @@ public Mono<VoidResponse> setMetadata(Metadata metadata, BlobAccessConditions ac

return postProcessResponse(this.azureBlobStorage.blobs().setMetadataWithRestResponseAsync(
null, null, null, metadata, null, null,
null, null, accessConditions.leaseAccessConditions(),
null, null, accessConditions.leaseAccessConditions(), null,
accessConditions.modifiedAccessConditions(), Context.NONE))
.map(VoidResponse::new);
}
Expand Down Expand Up @@ -734,7 +735,7 @@ public Mono<Response<BlobAsyncClient>> createSnapshot(Metadata metadata, BlobAcc

return postProcessResponse(this.azureBlobStorage.blobs().createSnapshotWithRestResponseAsync(
null, null, null, metadata, null, null,
null, null, accessConditions.modifiedAccessConditions(),
null, null, null, accessConditions.modifiedAccessConditions(),
accessConditions.leaseAccessConditions(), Context.NONE))
.map(rb -> new SimpleResponse<>(rb, this.getSnapshotClient(rb.deserializedHeaders().snapshot())));
}
Expand Down Expand Up @@ -779,9 +780,10 @@ public Mono<VoidResponse> setTier(AccessTier tier) {
*/
public Mono<VoidResponse> setTier(AccessTier tier, LeaseAccessConditions leaseAccessConditions) {
Utility.assertNotNull("tier", tier);
AccessTierRequired accessTierRequired = AccessTierRequired.fromString(tier.toString());

return postProcessResponse(this.azureBlobStorage.blobs().setTierWithRestResponseAsync(
null, null, tier, null, null, leaseAccessConditions, Context.NONE))
null, null, accessTierRequired, null, null, null, leaseAccessConditions, Context.NONE))
.map(VoidResponse::new);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ public Mono<Response<BlockBlobItem>> upload(Flux<ByteBuf> data, long length, Blo
accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions;

return postProcessResponse(this.azureBlobStorage.blockBlobs().uploadWithRestResponseAsync(null,
null, data, length, null, metadata, null, null,
null, null, headers, accessConditions.leaseAccessConditions(),
null, data, length, null, metadata, null, null, null,
null, null, null, headers, accessConditions.leaseAccessConditions(), null,
accessConditions.modifiedAccessConditions(), Context.NONE))
.map(rb -> new SimpleResponse<>(rb, new BlockBlobItem(rb.deserializedHeaders())));
}
Expand Down Expand Up @@ -297,8 +297,8 @@ public Mono<VoidResponse> stageBlock(String base64BlockID, Flux<ByteBuf> data,
public Mono<VoidResponse> stageBlock(String base64BlockID, Flux<ByteBuf> data, long length,
LeaseAccessConditions leaseAccessConditions) {
return postProcessResponse(this.azureBlobStorage.blockBlobs().stageBlockWithRestResponseAsync(null,
null, base64BlockID, length, data, null, null, null,
null, null, null, leaseAccessConditions, Context.NONE))
null, base64BlockID, length, data, null, null, null, null,
null, null, null, leaseAccessConditions, null, Context.NONE))
.map(VoidResponse::new);
}

Expand Down Expand Up @@ -359,9 +359,9 @@ public Mono<VoidResponse> stageBlockFromURL(String base64BlockID, URL sourceURL,

return postProcessResponse(
this.azureBlobStorage.blockBlobs().stageBlockFromURLWithRestResponseAsync(null, null,
base64BlockID, 0, sourceURL, sourceRange.toHeaderValue(), sourceContentMD5, null,
base64BlockID, 0, sourceURL, sourceRange.toHeaderValue(), sourceContentMD5, null, null,
null, null, null, null,
leaseAccessConditions, sourceModifiedAccessConditions, Context.NONE))
leaseAccessConditions, null, sourceModifiedAccessConditions, Context.NONE))
.map(VoidResponse::new);
}

Expand Down Expand Up @@ -456,9 +456,9 @@ public Mono<Response<BlockBlobItem>> commitBlockList(List<String> base64BlockIDs
accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions;

return postProcessResponse(this.azureBlobStorage.blockBlobs().commitBlockListWithRestResponseAsync(
null, null, new BlockLookupList().latest(base64BlockIDs), null, metadata,
null, null, null, null, headers,
accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), Context.NONE))
null, null, new BlockLookupList().latest(base64BlockIDs), null, null, null, metadata, null,
null, null, null, null, null, headers,
accessConditions.leaseAccessConditions(), null, accessConditions.modifiedAccessConditions(), Context.NONE))
.map(rb -> new SimpleResponse<>(rb, new BlockBlobItem(rb.deserializedHeaders())));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public Mono<VoidResponse> create(Metadata metadata, PublicAccessType accessType)
metadata = metadata == null ? new Metadata() : metadata;

return postProcessResponse(this.azureBlobStorage.containers().createWithRestResponseAsync(
null, null, metadata, accessType, null, Context.NONE))
null, null, metadata, accessType, null, null, null, Context.NONE))
.map(VoidResponse::new);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ public Mono<Response<PageBlobItem>> create(long size, Long sequenceNumber, BlobH
metadata = metadata == null ? new Metadata() : metadata;

return postProcessResponse(this.azureBlobStorage.pageBlobs().createWithRestResponseAsync(null,
null, 0, size, null, metadata, null, null,
null, sequenceNumber, null, headers, accessConditions.leaseAccessConditions(),
null, 0, size, null, metadata, null, null, null,
null, sequenceNumber, null, headers, accessConditions.leaseAccessConditions(), null,
accessConditions.modifiedAccessConditions(), Context.NONE))
.map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders())));
}
Expand Down Expand Up @@ -189,9 +189,9 @@ public Mono<Response<PageBlobItem>> uploadPages(PageRange pageRange, Flux<ByteBu
String pageRangeStr = pageRangeToString(pageRange);

return postProcessResponse(this.azureBlobStorage.pageBlobs().uploadPagesWithRestResponseAsync(null,
null, body, pageRange.end() - pageRange.start() + 1, null,
null, body, pageRange.end() - pageRange.start() + 1, null, null,
null, pageRangeStr, null, null, null, null,
pageBlobAccessConditions.leaseAccessConditions(), pageBlobAccessConditions.sequenceNumberAccessConditions(),
pageBlobAccessConditions.leaseAccessConditions(), null, pageBlobAccessConditions.sequenceNumberAccessConditions(),
pageBlobAccessConditions.modifiedAccessConditions(), Context.NONE))
.map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders())));
}
Expand Down Expand Up @@ -272,7 +272,7 @@ public Mono<Response<PageBlobItem>> uploadPagesFromURL(PageRange range, URL sour
destAccessConditions = destAccessConditions == null ? new PageBlobAccessConditions() : destAccessConditions;

return postProcessResponse(this.azureBlobStorage.pageBlobs().uploadPagesFromURLWithRestResponseAsync(
null, null, sourceURL, sourceRangeString, 0, rangeString, sourceContentMD5,
null, null, sourceURL, sourceRangeString, 0, rangeString, sourceContentMD5, null,
null, null, destAccessConditions.leaseAccessConditions(),
destAccessConditions.sequenceNumberAccessConditions(), destAccessConditions.modifiedAccessConditions(),
sourceAccessConditions, Context.NONE))
Expand Down
Loading

0 comments on commit 99e76b4

Please sign in to comment.