Skip to content

Commit d267e4a

Browse files
author
M
authored
Add resource searching sample description (Azure#17615)
* Add resource searching sample description
1 parent ed03d87 commit d267e4a

File tree

1 file changed

+15
-1
lines changed
  • sdk/spring/azure-spring-boot-starter-storage

1 file changed

+15
-1
lines changed

sdk/spring/azure-spring-boot-starter-storage/README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,21 @@ private final BlobServiceAsyncClient blobServiceAsyncClient = blobServiceClientB
7272

7373
```
7474

75+
#### Search for resources
76+
You can use implementation class `AzureStorageResourcePatternResolver` of `ResourcePatternResolver` to search resource, it supports `blob` or `file` type.
77+
* 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.
78+
* Location search, the **searchLocation** should start with `azure-blob://` or `azure-file://`, the remaining file path should exist, otherwise an exception will be thrown.
79+
80+
```java
81+
AzureStorageResourcePatternResolver storageResourcePatternResolver = new AzureStorageResourcePatternResolver(blobServiceClientBuilder.buildClient());
82+
83+
Resource[] resources = storageResourcePatternResolver.getResources(searchPattern);
84+
Resource resource = storageResourcePatternResolver.getResource(searchLocation);
85+
```
86+
87+
#### Multipart upload
88+
Files larger than 4 MiB will be uploaded to Azure Storage in parallel.
89+
7590
## Troubleshooting
7691
### Enable client logging
7792
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.
@@ -114,4 +129,3 @@ Please follow [instructions here][contributing_md] to build from source or contr
114129
[azure_storage]: https://azure.microsoft.com/services/storage/blobs/
115130
[other_operation]: https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#resources
116131
[jdk_link]: https://docs.microsoft.com/java/azure/jdk/?view=azure-java-stable
117-

0 commit comments

Comments
 (0)