Skip to content

Commit

Permalink
Fixing Java samples (#40315)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrahimrabab authored May 23, 2024
1 parent 0bbe139 commit 35dd329
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions sdk/storage/azure-storage-blob/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,8 @@ BlobServiceClient blobStorageClient = new BlobServiceClientBuilder()
```java readme-sample-setProxy
ProxyOptions options = new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 888));
BlobServiceClient client = new BlobServiceClientBuilder()
.endpoint("<ENDPOINT>")
.sasToken("<SAS_TOKEN>")
.httpClient(new NettyAsyncHttpClientBuilder().proxy(options).build())
.buildClient();
```
Expand All @@ -566,6 +568,8 @@ Allow the client builder to determine the `HttpClient` type to be used but const
HttpClientOptions clientOptions = new HttpClientOptions()
.setProxyOptions(new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 888)));
BlobServiceClient client = new BlobServiceClientBuilder()
.endpoint("<ENDPOINT>")
.sasToken("<SAS_TOKEN>")
.clientOptions(clientOptions)
.buildClient();
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ public void setProxy() {
// BEGIN: readme-sample-setProxy
ProxyOptions options = new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 888));
BlobServiceClient client = new BlobServiceClientBuilder()
.endpoint("<ENDPOINT>")
.sasToken("<SAS_TOKEN>")
.httpClient(new NettyAsyncHttpClientBuilder().proxy(options).build())
.buildClient();
// END: readme-sample-setProxy
Expand All @@ -370,6 +372,8 @@ public void setProxy2() {
HttpClientOptions clientOptions = new HttpClientOptions()
.setProxyOptions(new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 888)));
BlobServiceClient client = new BlobServiceClientBuilder()
.endpoint("<ENDPOINT>")
.sasToken("<SAS_TOKEN>")
.clientOptions(clientOptions)
.buildClient();
// END: readme-sample-setProxy2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static void main(String[] args) {

String sourceURL = clientURL;
Duration pollInterval = Duration.ofSeconds(2);
SyncPoller<ShareFileCopyInfo, Void> poller = destFileClient.beginCopy(sourceURL, (Map<String, String>) null, pollInterval);
SyncPoller<ShareFileCopyInfo, Void> poller = destFileClient.beginCopy(sourceURL + "<SAS_TOKEN>", (Map<String, String>) null, pollInterval);

try {
poller.waitForCompletion(Duration.ofMinutes(15));
Expand Down

0 comments on commit 35dd329

Please sign in to comment.