Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Storage to azure-core preview 3 #4482

Merged
merged 28 commits into from
Jul 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1ec9438
Storage SAS implementation (#4404)
gapra-msft Jul 12, 2019
78db8d4
Merge branch 'master' into storage-post-review1-dev
alzimmermsft Jul 12, 2019
69026ba
Merge branch 'master' into storage-post-review1-dev
alzimmermsft Jul 16, 2019
be429c3
Remove RawClients from Blobs (#4375)
alzimmermsft Jul 16, 2019
10a85ad
Add storage swaggers
jianghaolu Jul 17, 2019
593ebf2
Update Storage to azure-core preview 3
jianghaolu Jul 19, 2019
b00cdc6
Add deleteContainer to StorageClient and getBlobClient with Snapshot …
alzimmermsft Jul 19, 2019
da7ebb6
Merge branch 'master' into storage-post-review1-dev
alzimmermsft Jul 19, 2019
78ea66b
Storage queue linting, builder refactor, tests (#4383)
sima-zhu Jul 22, 2019
b602214
Address code review feedback in AutoRest
jianghaolu Jul 24, 2019
9cbf411
Merge branch 'storage-post-review1-dev' of github.com:Azure/azure-sdk…
jianghaolu Jul 24, 2019
44fb56e
Initial checkin for Storage file (#4414)
sima-zhu Jul 24, 2019
822b41d
Merge branch 'storage-post-review1-dev' of github.com:Azure/azure-sdk…
jianghaolu Jul 24, 2019
fe9559f
Merge Storage Blob Client Builders (#4468)
alzimmermsft Jul 24, 2019
53b2854
Merge branch 'master' into storage-post-review1-dev
alzimmermsft Jul 24, 2019
e19ea2b
Regenerate blob file queue after merge
jianghaolu Jul 24, 2019
7149824
Up azure core version for file & queue
jianghaolu Jul 24, 2019
efc335c
Apply all the manual fixes in swagger
jianghaolu Jul 24, 2019
87f3090
Change directoryName to directoryPath
jianghaolu Jul 24, 2019
5ce9473
Merge branch 'storage-post-review1-dev' of github.com:Azure/azure-sdk…
jianghaolu Jul 24, 2019
28beb79
Use non-fluent pattern for generated clients
jianghaolu Jul 24, 2019
2318c30
Merge branch 'master' into storage-post-review1-dev
alzimmermsft Jul 25, 2019
62c2dfc
Merge branch 'storage-post-review1-dev' of github.com:Azure/azure-sdk…
jianghaolu Jul 26, 2019
a5bc2dd
Merge branch 'master' of github.com:Azure/azure-sdk-for-java into sto…
jianghaolu Jul 26, 2019
a2b67ea
Fix build after merging with master
jianghaolu Jul 26, 2019
6fcd538
Return void on setters
jianghaolu Jul 29, 2019
889a7ff
Merge branch 'storage-swagger' of github.com:jianghaolu/azure-sdk-for…
jianghaolu Jul 29, 2019
03c3e3c
Revert spotbugs config change
jianghaolu Jul 29, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
<Bug pattern="NP_NULL_PARAM_DEREF"/>
</Match>

<!-- The switch cases are encoded version of all SAS query parameters, which will further be appended to a request URL it seems like. A default case wouldn't make sense -->
<!-- The switch cases are encoded version of all SAS query parameters, which will further be appended to a request URL it seems like. A default case wouldn't make sense -->
<Match>
<Class name="com.microsoft.azure.storage.blob.SASQueryParameters"/>
<Bug pattern="SF_SWITCH_NO_DEFAULT"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
* <p>Create a pipeline without configuration</p>
*
* <pre>
* HttpPipeline.builder()
* new HttpPipelineBuilder()
* .build();
Copy link
Member

Choose a reason for hiding this comment

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

nit: Move the .build() onto the same line.

* </pre>
*
* <p>Create a pipeline using the default HTTP client and a retry policy</p>
*
* <pre>
* HttpPipeline.builder()
* new HttpPipelineBuilder()
* .httpClient(HttpClient.createDefault())
* .policies(new RetryPolicy())
* .build();
Expand Down
4 changes: 2 additions & 2 deletions storage/client/blob/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.0.0-preview.2</version>
<version>1.0.0-preview.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand All @@ -69,7 +69,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.0.0-preview.2</version>
<version>1.0.0-preview.3</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public class BlobAsyncClient {
public BlockBlobAsyncClient asBlockBlobAsyncClient() {
return new BlockBlobAsyncClient(new AzureBlobStorageBuilder()
.url(getBlobUrl().toString())
.pipeline(azureBlobStorage.httpPipeline()), snapshot);
.pipeline(azureBlobStorage.getHttpPipeline()), snapshot);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Jianghao to start discussion with James and Jonathan

}

/**
Expand All @@ -110,7 +110,7 @@ public BlockBlobAsyncClient asBlockBlobAsyncClient() {
public AppendBlobAsyncClient asAppendBlobAsyncClient() {
return new AppendBlobAsyncClient(new AzureBlobStorageBuilder()
.url(getBlobUrl().toString())
.pipeline(azureBlobStorage.httpPipeline()), snapshot);
.pipeline(azureBlobStorage.getHttpPipeline()), snapshot);
}

/**
Expand All @@ -122,7 +122,7 @@ public AppendBlobAsyncClient asAppendBlobAsyncClient() {
public PageBlobAsyncClient asPageBlobAsyncClient() {
return new PageBlobAsyncClient(new AzureBlobStorageBuilder()
.url(getBlobUrl().toString())
.pipeline(azureBlobStorage.httpPipeline()), snapshot);
.pipeline(azureBlobStorage.getHttpPipeline()), snapshot);
}

/**
Expand All @@ -136,7 +136,7 @@ public ContainerAsyncClient getContainerAsyncClient() {
BlobURLParts parts = URLParser.parse(getBlobUrl());
return new ContainerAsyncClient(new AzureBlobStorageBuilder()
.url(String.format("%s://%s/%s", parts.scheme(), parts.host(), parts.containerName()))
.pipeline(azureBlobStorage.httpPipeline()));
.pipeline(azureBlobStorage.getHttpPipeline()));
}

/**
Expand All @@ -147,13 +147,13 @@ public ContainerAsyncClient getContainerAsyncClient() {
*/
public URL getBlobUrl() {
try {
UrlBuilder urlBuilder = UrlBuilder.parse(azureBlobStorage.url());
UrlBuilder urlBuilder = UrlBuilder.parse(azureBlobStorage.getUrl());
if (snapshot != null) {
urlBuilder.query("snapshot=" + snapshot);
}
return urlBuilder.toURL();
} catch (MalformedURLException e) {
throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.url()), e);
throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e);
Copy link
Member

Choose a reason for hiding this comment

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

FYI: This will very shortly result in CheckStyle check failure, as the clientLogger.logAndThrow API should be used instead. The PR for this is soon to be merged here: #4566

}
}

Expand Down Expand Up @@ -925,7 +925,7 @@ public String generateSAS(String identifier, BlobSASPermission permissions, Offs
cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);

SharedKeyCredential sharedKeyCredential =
Utility.getSharedKeyCredential(this.azureBlobStorage.httpPipeline());
Utility.getSharedKeyCredential(this.azureBlobStorage.getHttpPipeline());

Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential);

Expand All @@ -944,7 +944,7 @@ ServiceSASSignatureValues configureServiceSASSignatureValues(ServiceSASSignature
String accountName) {

// Set canonical name
serviceSASSignatureValues.canonicalName(this.azureBlobStorage.url(), accountName);
serviceSASSignatureValues.canonicalName(this.azureBlobStorage.getUrl(), accountName);

// Set snapshotId
serviceSASSignatureValues.snapshotId(getSnapshotId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.azure.core.credentials.TokenCredential;
import com.azure.core.http.HttpClient;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpPipelineBuilder;
import com.azure.core.http.policy.AddDatePolicy;
import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
import com.azure.core.http.policy.HttpLogDetailLevel;
Expand Down Expand Up @@ -120,7 +121,7 @@ private AzureBlobStorageBuilder buildImpl() {
policies.addAll(this.policies);
policies.add(new HttpLoggingPolicy(logLevel));

HttpPipeline pipeline = HttpPipeline.builder()
HttpPipeline pipeline = new HttpPipelineBuilder()
.policies(policies.toArray(new HttpPipelinePolicy[0]))
.httpClient(httpClient)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public BlockBlobAsyncClient getBlockBlobAsyncClient(String blobName) {
public BlockBlobAsyncClient getBlockBlobAsyncClient(String blobName, String snapshot) {
return new BlockBlobAsyncClient(new AzureBlobStorageBuilder()
.url(Utility.appendToURLPath(getContainerUrl(), blobName).toString())
.pipeline(azureBlobStorage.httpPipeline()), snapshot);
.pipeline(azureBlobStorage.getHttpPipeline()), snapshot);
}

/**
Expand Down Expand Up @@ -140,7 +140,7 @@ public PageBlobAsyncClient getPageBlobAsyncClient(String blobName) {
public PageBlobAsyncClient getPageBlobAsyncClient(String blobName, String snapshot) {
return new PageBlobAsyncClient(new AzureBlobStorageBuilder()
.url(Utility.appendToURLPath(getContainerUrl(), blobName).toString())
.pipeline(azureBlobStorage.httpPipeline()), snapshot);
.pipeline(azureBlobStorage.getHttpPipeline()), snapshot);
}

/**
Expand Down Expand Up @@ -173,7 +173,7 @@ public AppendBlobAsyncClient getAppendBlobAsyncClient(String blobName) {
public AppendBlobAsyncClient getAppendBlobAsyncClient(String blobName, String snapshot) {
return new AppendBlobAsyncClient(new AzureBlobStorageBuilder()
.url(Utility.appendToURLPath(getContainerUrl(), blobName).toString())
.pipeline(azureBlobStorage.httpPipeline()), snapshot);
.pipeline(azureBlobStorage.getHttpPipeline()), snapshot);
}

/**
Expand Down Expand Up @@ -202,7 +202,7 @@ public BlobAsyncClient getBlobAsyncClient(String blobName) {
public BlobAsyncClient getBlobAsyncClient(String blobName, String snapshot) {
return new BlobAsyncClient(new AzureBlobStorageBuilder()
.url(Utility.appendToURLPath(getContainerUrl(), blobName).toString())
.pipeline(azureBlobStorage.httpPipeline()), snapshot);
.pipeline(azureBlobStorage.getHttpPipeline()), snapshot);
}

/**
Expand All @@ -213,7 +213,7 @@ public BlobAsyncClient getBlobAsyncClient(String blobName, String snapshot) {
public StorageAsyncClient getStorageAsyncClient() {
return new StorageAsyncClient(new AzureBlobStorageBuilder()
.url(Utility.stripLastPathSegment(getContainerUrl()).toString())
.pipeline(azureBlobStorage.httpPipeline()));
.pipeline(azureBlobStorage.getHttpPipeline()));
}

/**
Expand All @@ -224,9 +224,9 @@ public StorageAsyncClient getStorageAsyncClient() {
*/
public URL getContainerUrl() {
try {
return new URL(azureBlobStorage.url());
return new URL(azureBlobStorage.getUrl());
} catch (MalformedURLException e) {
throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.url()), e);
throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e);
}
}

Expand Down Expand Up @@ -681,7 +681,7 @@ private Flux<BlobItem> listBlobsHierarchyHelper(String delimiter, ListBlobsOptio
} else {
prefixes = Flux.empty();
}
Flux<BlobItem> result = blobs.concatWith(prefixes.map(prefix -> new BlobItem().name(prefix.name()).isPrefix(true)));
Flux<BlobItem> result = blobs.map(item -> item.isPrefix(false)).concatWith(prefixes.map(prefix -> new BlobItem().name(prefix.name()).isPrefix(true)));

if (response.value().nextMarker() != null) {
// Recursively add the continuation items to the observable.
Expand Down Expand Up @@ -1102,7 +1102,7 @@ public String generateSAS(String identifier, ContainerSASPermission permissions,
cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);

SharedKeyCredential sharedKeyCredential =
Utility.getSharedKeyCredential(this.azureBlobStorage.httpPipeline());
Utility.getSharedKeyCredential(this.azureBlobStorage.getHttpPipeline());

Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential);

Expand All @@ -1119,7 +1119,7 @@ public String generateSAS(String identifier, ContainerSASPermission permissions,
*/
private ServiceSASSignatureValues configureServiceSASSignatureValues(ServiceSASSignatureValues serviceSASSignatureValues, String accountName) {
// Set canonical name
serviceSASSignatureValues.canonicalName(this.azureBlobStorage.url(), accountName);
serviceSASSignatureValues.canonicalName(this.azureBlobStorage.getUrl(), accountName);

// Set snapshotId to null
serviceSASSignatureValues.snapshotId(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.azure.core.credentials.TokenCredential;
import com.azure.core.http.HttpClient;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpPipelineBuilder;
import com.azure.core.http.policy.AddDatePolicy;
import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
import com.azure.core.http.policy.HttpLogDetailLevel;
Expand Down Expand Up @@ -110,7 +111,7 @@ private AzureBlobStorageBuilder buildImpl() {
policies.addAll(this.policies);
policies.add(new HttpLoggingPolicy(logLevel));

HttpPipeline pipeline = HttpPipeline.builder()
HttpPipeline pipeline = new HttpPipelineBuilder()
.policies(policies.toArray(new HttpPipelinePolicy[0]))
.httpClient(httpClient)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public final class StorageAsyncClient {
public ContainerAsyncClient getContainerAsyncClient(String containerName) {
return new ContainerAsyncClient(new AzureBlobStorageBuilder()
.url(Utility.appendToURLPath(getAccountUrl(), containerName).toString())
.pipeline(azureBlobStorage.httpPipeline()));
.pipeline(azureBlobStorage.getHttpPipeline()));
}

/**
Expand Down Expand Up @@ -125,9 +125,9 @@ public Mono<VoidResponse> deleteContainer(String containerName) {
*/
public URL getAccountUrl() {
try {
return new URL(azureBlobStorage.url());
return new URL(azureBlobStorage.getUrl());
} catch (MalformedURLException e) {
throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.url()), e);
throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e);
}
}

Expand Down Expand Up @@ -318,7 +318,7 @@ public String generateAccountSAS(AccountSASService accountSASService, AccountSAS
accountSASSignatureValues.ipRange(ipRange);
accountSASSignatureValues.protocol(sasProtocol);

SharedKeyCredential sharedKeyCredential = Utility.getSharedKeyCredential(this.azureBlobStorage.httpPipeline());
SharedKeyCredential sharedKeyCredential = Utility.getSharedKeyCredential(this.azureBlobStorage.getHttpPipeline());

SASQueryParameters sasQueryParameters = accountSASSignatureValues.generateSASQueryParameters(sharedKeyCredential);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.azure.core.credentials.TokenCredential;
import com.azure.core.http.HttpClient;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpPipelineBuilder;
import com.azure.core.http.policy.AddDatePolicy;
import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
import com.azure.core.http.policy.HttpLogDetailLevel;
Expand Down Expand Up @@ -104,7 +105,7 @@ private AzureBlobStorageBuilder buildImpl() {
policies.addAll(this.policies);
policies.add(new HttpLoggingPolicy(logLevel));

HttpPipeline pipeline = HttpPipeline.builder()
HttpPipeline pipeline = new HttpPipelineBuilder()
.policies(policies.toArray(new HttpPipelinePolicy[0]))
.httpClient(httpClient)
.build();
Expand Down
Loading