Skip to content

Commit

Permalink
Add resource searching sample description (#17615)
Browse files Browse the repository at this point in the history
* Add resource searching sample description
  • Loading branch information
M committed Nov 19, 2020
1 parent ed03d87 commit d267e4a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion sdk/spring/azure-spring-boot-starter-storage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ private final BlobServiceAsyncClient blobServiceAsyncClient = blobServiceClientB

```

#### Search for resources
You can use implementation class `AzureStorageResourcePatternResolver` of `ResourcePatternResolver` to search resource, it supports `blob` or `file` type.
* Pattern search, the **searchPattern** should start with `azure-blob://` or `azure-file://`. Such as `azure-blob://*/*`, it means list all blobs in all containers; `azure-blob://demo-container/**`, it means list all blobs in the demo-container container, including any sub-folder.
* Location search, the **searchLocation** should start with `azure-blob://` or `azure-file://`, the remaining file path should exist, otherwise an exception will be thrown.

```java
AzureStorageResourcePatternResolver storageResourcePatternResolver = new AzureStorageResourcePatternResolver(blobServiceClientBuilder.buildClient());

Resource[] resources = storageResourcePatternResolver.getResources(searchPattern);
Resource resource = storageResourcePatternResolver.getResource(searchLocation);
```

#### Multipart upload
Files larger than 4 MiB will be uploaded to Azure Storage in parallel.

## Troubleshooting
### Enable client logging
Azure SDKs for Java offers a consistent logging story to help aid in troubleshooting application errors and expedite their resolution. The logs produced will capture the flow of an application before reaching the terminal state to help locate the root issue. View the [logging][logging] wiki for guidance about enabling logging.
Expand Down Expand Up @@ -114,4 +129,3 @@ Please follow [instructions here][contributing_md] to build from source or contr
[azure_storage]: https://azure.microsoft.com/services/storage/blobs/
[other_operation]: https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#resources
[jdk_link]: https://docs.microsoft.com/java/azure/jdk/?view=azure-java-stable

0 comments on commit d267e4a

Please sign in to comment.