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

Spring storage native sample #33985

Merged
merged 6 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
27 changes: 16 additions & 11 deletions samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,38 +32,43 @@ This section lists how-to guides for the most commonly used APIs and most common
- [How to create **Netty Http Client**](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/core/azure-core-http-netty#examples)
- [How to create **OK Http Client**](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/core/azure-core-http-okhttp#examples)
- [How to use **Azure Core Tracing Opentelemetry**](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/core/azure-core-tracing-opentelemetry#examples)
- How to configure, access, and analyze **logging** information (TODO)
- [How to configure, access, and analyze **logging** information](https://learn.microsoft.com/en-us/azure/developer/java/sdk/logging-overview)

#### Azure.Security.KeyVault.Keys
- [How to **get, set,update and delete Keys Synchronously**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/keyvault/azure-security-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorld.java)
- [How to **get, set,update and delete Keys Asynchronously**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/keyvault/azure-security-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorldAsync.java)
#### Azure Security KeyVault Keys
- [How to **get, set, update and delete Keys Synchronously**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/keyvault/azure-security-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorld.java)
- [How to **get, set, update and delete Keys Asynchronously**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/keyvault/azure-security-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorldAsync.java)
- [How to **list, recover and purge deleted Keys Synchronously**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/keyvault/azure-security-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeys.java)
- [How to **list, recover and purge deleted Keys Asynchronously**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/keyvault/azure-security-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeysAsync.java)
- [How to **backup and restore Keys Synchronously**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/keyvault/azure-security-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperations.java)
- [How to **backup and restore Keys Asynchronously**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/keyvault/azure-security-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeysAsync.java)

#### Azure.Security.KeyVault.Secret
- [How to **get, set,update and delete Secrets Synchronously**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/keyvault/azure-security-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorld.java)
- [How to **get, set,update and delete Secrets Asynchronously**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/keyvault/azure-security-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorldAsync.java)
#### Azure Security KeyVault Secret
- [How to **get, set, update and delete Secrets Synchronously**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/keyvault/azure-security-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorld.java)
- [How to **get, set, update and delete Secrets Asynchronously**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/keyvault/azure-security-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorldAsync.java)
- [How to **Managing Deleted Secrets Synchronously**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/keyvault/azure-security-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecrets.java)
- [How to **Managing Deleted Secrets Asynchronously**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/keyvault/azure-security-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecretsAsync.java)
- [How to **backup and restore Secrets Synchronously**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/keyvault/azure-security-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperations.java)
- [How to **backup and restore Secrets Asynchronously**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/keyvault/azure-security-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperationsAsync.java)


#### Azure.Storage.Blobs
#### Azure Storage Blobs
- [How to **Upload, download and list** blob](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BasicExample.java)
- [How to **Upload, download large file**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/FileTransferExample.java)
- [How to **Handle the exceptions**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java)
- [How to **Create, list and delete containers**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ListContainersExample.java)

#### Azure.Storage.Queue
#### Azure Storage Queue
- [How to **Create, list and delete** queues](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceSamples.java)
- [How to **CRUD Operations on message in** queues](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/MessageSamples.java)
- [How to **Handle the exceptions** queues](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueExceptionSamples.java)
- [How to **Async Sample** queues](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/AsyncSamples.java)

#### Azure.Storage.Blobs.Batch
#### Azure Storage Blobs Batch

- [How to **Create Blob Client**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/storage/azure-storage-blob-batch/src/samples/java/com/azure/storage/blob/batch/ReadmeSamples.java)
- [How to **Bulk Deleting**](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/storage/azure-storage-blob-batch/src/samples/java/com/azure/storage/blob/batch/ReadmeSamples.java)

### Native Image Samples

#### Azure Storage Blobs

- [How to create a native Spring web application using GraalVM to list, upload, download and delete blobs from Storage](https://github.com/Azure/azure-sdk-for-java/blob/main/samples/azure-graalvm-storage-samples-spring/README.md)
51 changes: 51 additions & 0 deletions samples/azure-graalvm-storage-samples-spring/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Spring Native Sample

This is a sample application that demonstrates the usage of the Azure SDK for Java, as well as its GraalVM support, within a Spring Native application. The sample application itself is referred to as 'Azure Storage Explorer', and with a simplified user interface it allows for a person to easily upload, download, and delete files from an Azure Blob Storage container.

## Getting Started

### Required environment variables

Before this application can run, you must set the following environment variables:

| Variable Name | Description |
|---------------|-------------|
|`azure_blob_storage_connection_string` | Set to the connection string available from the [Azure Portal](https://portal.azure.com) for a specific Azure Blob Storage account. |
|`azure_blob_storage_container_name` | Specifies which container should be created (if it does not already exist) and used to store the uploaded files. |

### Running the sample

To run the sample application without native image compilation, simply use the following command:

```shell
./mvnw spring-boot:run
```

To compile as a GraalVM native image, use the following command:

```shell
./mvnw -Pnative clean package
```

Once this completes, you will find an executable binary file in the `./target` directory called `spring-native-sample`, which you may execute as per usual, e.g:

```shell
./target/spring-native-sample
```

## Docker support

This project has been configured to let you generate a lightweight container running a native executable.
Docker should be installed and configured on your machine prior to creating the image, see [the Getting Started section of the reference guide](https://docs.spring.io/spring-native/docs/0.10.0-SNAPSHOT/reference/htmlsingle/#getting-started-buildpacks).

To create the image, run the following goal:

```
$ ./mvnw spring-boot:build-image
```

Then, you can run the app like any other container:

```
$ docker run --rm spring-native-sample:1.0.0-SNAPSHOT
```
Loading