diff --git a/sdk/appconfiguration/azure-data-appconfiguration/README.md b/sdk/appconfiguration/azure-data-appconfiguration/README.md index 2ee4515c73c5..cf9bfa46796e 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/README.md +++ b/sdk/appconfiguration/azure-data-appconfiguration/README.md @@ -5,7 +5,8 @@ Modern programs, especially programs running in a cloud, generally have many com Use the client library for App Configuration to create and manage application configuration settings. -[Source code][source_code] | [Package (Maven)][package] | [API reference documentation][api_documentation] | [Product documentation][azconfig_docs] +[Source code][source_code] | [Package (Maven)][package] | [API reference documentation][api_documentation] +| [Product documentation][azconfig_docs] | [Samples][samples] ## Getting started @@ -172,7 +173,7 @@ When you interact with App Configuration using this Java client library, errors ## Next steps -[Quickstart: Create a Java Spring app with App Configuration](https://docs.microsoft.com/en-us/azure/azure-app-configuration/quickstart-java-spring-app) +[Quickstart: Create a Java Spring app with App Configuration][spring_quickstart] ## Contributing @@ -186,11 +187,13 @@ If you would like to become an active contributor to this project please follow [api_documentation]: https://aka.ms/java-docs -[app_config_store]: https://docs.microsoft.com/en-us/azure/azure-app-configuration/quickstart-dotnet-core-app#create-an-app-configuration-store -[azconfig_docs]: https://docs.microsoft.com/en-us/azure/azure-app-configuration/ +[app_config_store]: https://docs.microsoft.com/azure/azure-app-configuration/quickstart-dotnet-core-app#create-an-app-configuration-store +[azconfig_docs]: https://docs.microsoft.com/azure/azure-app-configuration [azure_cli]: https://docs.microsoft.com/cli/azure -[azure_subscription]: https://azure.microsoft.com/en-us/free/ +[azure_subscription]: https://azure.microsoft.com/free [maven]: https://maven.apache.org/ [package]: https://search.maven.org/artifact/com.azure/azure-data-appconfiguration [rest_api]: https://github.com/Azure/AppConfiguration#rest-api-reference +[samples]: src/samples/java/com/azure/data/appconfiguration [source_code]: src +[spring_quickstart]: https://docs.microsoft.com/azure/azure-app-configuration/quickstart-java-spring-app diff --git a/sdk/keyvault/azure-keyvault-keys/README.md b/sdk/keyvault/azure-keyvault-keys/README.md index 0b6e03cfd389..dbbf755a3df8 100644 --- a/sdk/keyvault/azure-keyvault-keys/README.md +++ b/sdk/keyvault/azure-keyvault-keys/README.md @@ -192,7 +192,7 @@ System.out.printf("Deleted Key's deletion date %s", deletedKey.deletedDate().toS ### List Keys List the keys in the key vault by calling `listKeys`. -```Java +```java // List operations don't return the keys with key material information. So, for each returned key we call getKey to get the key with its key material information. for (KeyBase key : keyClient.listKeys()) { Key keyWithMaterial = keyClient.getKey(key).value(); @@ -203,7 +203,7 @@ for (KeyBase key : keyClient.listKeys()) { ### Encrypt Encrypt plain text by calling `encrypt`. -``` +```java CryptographyClient cryptoClient = new CryptographyClientBuilder() .credential(new DefaultAzureCredentialBuilder().build()) .keyIdentifier(" { ### Delete a Key Asynchronously Delete an existing Key by calling `deleteKey`. -```Java +```java keyAsyncClient.deleteKey("keyName").subscribe(deletedKeyResponse -> System.out.printf("Deleted Key's deletion time %s \n", deletedKeyResponse.value().deletedDate().toString())); ``` @@ -311,7 +312,7 @@ keyAsyncClient.listKeys() ### Encrypt Asynchronously Encrypt plain text by calling `encrypt`. -``` +```java CryptographyAsyncClient cryptoAsyncClient = new CryptographyClientBuilder() .credential(new DefaultAzureCredentialBuilder().build()) .keyIdentifier("") @@ -330,7 +331,7 @@ cryptoAsyncClient.encrypt(EncryptionAlgorithm.RSA_OAEP, plainText) ### Decrypt Asynchronously Decrypt encrypted content by calling `decrypt`. -``` +```java byte[] plainText = new byte[100]; new Random(0x1234567L).nextBytes(plainText); diff --git a/sdk/storage/azure-storage-blob/README.md b/sdk/storage/azure-storage-blob/README.md index 4ee0b1bc5b68..0adb58b51fe5 100644 --- a/sdk/storage/azure-storage-blob/README.md +++ b/sdk/storage/azure-storage-blob/README.md @@ -7,7 +7,7 @@ storage is optimized for storing massive amounts of unstructured data. Unstructured data is data that does not adhere to a particular data model or definition, such as text or binary data. -[Source code][source] | [Package (Maven)][package] | [API reference documentation][docs] | [REST API documentation][rest_docs] | [Product documentation][product_docs] +[Source code][source] | [API reference documentation][docs] | [REST API documentation][rest_docs] | [Product documentation][product_docs] | [Samples][samples] ## Getting started @@ -238,12 +238,12 @@ doesn't exist in your Storage Account, a `404` error is returned, indicating `No Get started with our [Blob samples][samples]: -1. [Basic Examples](src/samples/java/BasicExample.java): Create storage, container, blob clients, Upload, download, and list blobs. -1. [File Transfer Examples](src/samples/java/FileTransferExample.java): Upload and download a large file through blobs. -1. [Storage Error Examples](src/samples/java/StorageErrorHandlingExample.java): Handle the exceptions from storage blob service side. -1. [List Container Examples](src/samples/java/ListContainersExample.java): Create, list and delete containers. -1. [Set metadata and HTTPHeaders Examples](src/samples/java/SetMetadataAndHTTPHeadersExample.java): Set metadata for container and blob, and set HTTPHeaders for blob. -1. [Azure Identity Examples](src/samples/java/AzureIdentityExample.java): Use DefaultAzureCredential to do the authentication. +1. [Basic Examples][samples_basic]: Create storage, container, blob clients, Upload, download, and list blobs. +1. [File Transfer Examples][samples_file_transfer]: Upload and download a large file through blobs. +1. [Storage Error Examples][samples_storage_error]: Handle the exceptions from storage blob service side. +1. [List Container Examples][samples_list_containers]: Create, list and delete containers. +1. [Set metadata and HTTPHeaders Examples][samples_metadata]: Set metadata for container and blob, and set HTTPHeaders for blob. +1. [Azure Identity Examples][samples_identity]: Use DefaultAzureCredential to do the authentication. ## Contributing @@ -256,24 +256,29 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fstorage%2FAzure.Storage.Blobs%2FREADME.png) -[source]: https://github.com/Azure/azure-sdk-for-java/tree/master/storage/client/blob/src -[package]: https://mvnrepository.com/artifact/com.azure/azure-storage-blob +[source]: src [docs]: http://azure.github.io/azure-sdk-for-java/ -[rest_docs]: https://docs.microsoft.com/en-us/rest/api/storageservices/blob-service-rest-api -[product_docs]: https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blobs-overview -[sas_token]: https://docs.microsoft.com/en-us/azure/storage/common/storage-dotnet-shared-access-signature-part-1 -[jdk]: https://docs.microsoft.com/en-us/java/azure/java-supported-jdk-runtime?view=azure-java-stable +[rest_docs]: https://docs.microsoft.com/rest/api/storageservices/blob-service-rest-api +[product_docs]: https://docs.microsoft.com/azure/storage/blobs/storage-blobs-overview +[sas_token]: https://docs.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1 +[jdk]: https://docs.microsoft.com/java/azure/java-supported-jdk-runtime?view=azure-java-stable [maven]: https://maven.apache.org/ -[azure_subscription]: https://azure.microsoft.com/en-us/free/ -[storage_account]: https://docs.microsoft.com/en-us/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal -[storage_account_create_ps]: https://docs.microsoft.com/en-us/azure/storage/common/storage-quickstart-create-account?tabs=azure-powershell -[storage_account_create_cli]: https://docs.microsoft.com/en-us/azure/storage/common/storage-quickstart-create-account?tabs=azure-cli -[storage_account_create_portal]: https://docs.microsoft.com/en-us/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal +[azure_subscription]: https://azure.microsoft.com/free/ +[storage_account]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal +[storage_account_create_ps]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-powershell +[storage_account_create_cli]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-cli +[storage_account_create_portal]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal [azure_cli]: https://docs.microsoft.com/cli/azure [azure_sub]: https://azure.microsoft.com/free/ [identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity/README.md -[error_codes]: https://docs.microsoft.com/en-us/rest/api/storageservices/blob-service-error-codes -[samples]: ./src/samples/ +[error_codes]: https://docs.microsoft.com/rest/api/storageservices/blob-service-error-codes +[samples]: src/samples +[samples_basic]: src/samples/java/com/azure/storage/blob/BasicExample.java +[samples_file_transfer]: src/samples/java/com/azure/storage/blob/FileTransferExample.java +[samples_storage_error]: src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java +[samples_list_containers]: src/samples/java/com/azure/storage/blob/ListContainersExample.java +[samples_metadata]: src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java +[samples_identity]: src/samples/java/com/azure/storage/blob/AzureIdentityExample.java [cla]: https://cla.microsoft.com [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/storage/azure-storage-file/README.md b/sdk/storage/azure-storage-file/README.md index eae034c3a692..75e91197b6d4 100644 --- a/sdk/storage/azure-storage-file/README.md +++ b/sdk/storage/azure-storage-file/README.md @@ -1,12 +1,13 @@ # Azure File client library for Java -The Server Message Block (SMB) protocol is the preferred file share protocol used on-premises today. +The Server Message Block (SMB) protocol is the preferred file share protocol used on-premises today. The Microsoft Azure File service enables customers to leverage the availability and scalability of Azure’s Cloud Infrastructure as a Service (IaaS) SMB without having to rewrite SMB client applications. -Files stored in Azure File service shares are accessible via the SMB protocol, and also via REST APIs. -The File service offers the following four resources: the storage account, shares, directories, and files. +Files stored in Azure File service shares are accessible via the SMB protocol, and also via REST APIs. +The File service offers the following four resources: the storage account, shares, directories, and files. Shares provide a way to organize sets of files and also can be mounted as an SMB file share that is hosted in the cloud. -[Source code][source_code] | [Package (Maven)][package] | [API reference documentation][api_documentation] | [Product documentation][azconfig_docs] +[Source code][source_code] | [API reference documentation][api_documentation] | [Product documentation][storage_docs] | +[Samples][samples] ## Getting started @@ -14,7 +15,7 @@ Shares provide a way to organize sets of files and also can be mounted as an SMB - [Java Development Kit (JDK)][jdk] with version 8 or above - [Azure Subscription][azure_subscription] -- [Create Strorage Account][storage_account] +- [Create Storage Account][storage_account] ### Adding the package to your product @@ -29,7 +30,7 @@ Shares provide a way to organize sets of files and also can be mounted as an SMB ### Create a Storage Account To create a Storage Account you can use the Azure Portal or [Azure CLI][azure_cli]. -```Powershell +```powershell az group create \ --name storage-resource-group \ --location westus @@ -37,50 +38,49 @@ az group create \ ### Authenticate the client -In order to interact with the Storage service (File Service, Share, Directory, MessageId, File) you'll need to create an instance of the Service Client class. +In order to interact with the Storage service (File Service, Share, Directory, MessageId, File) you'll need to create an instance of the Service Client class. To make this possible you'll need the Account SAS (shared access signature) string of Storage account. Learn more at [SAS Token][sas_token] #### Get Credentials - **SAS Token** - -a. Use the [Azure CLI][azure_cli] snippet below to get the SAS token from the Storage account. - -```Powershell -az storage file generate-sas - --name {account name} - --expiry {date/time to expire SAS token} - --permission {permission to grant} - --connection-string {connection string of the storage account} -``` - -```Powershell -CONNECTION_STRING= - -az storage file generate-sas - --name javasdksas - --expiry 2019-06-05 - --permission rpau - --connection-string $CONNECTION_STRING -``` -b. Alternatively, get the Account SAS Token from the Azure Portal. -``` -Go to your storage account -> Shared access signature -> Click on Generate SAS and connection string -``` + * Use the [Azure CLI][azure_cli] snippet below to get the SAS token from the Storage account. + ```powershell + az storage file generate-sas + --name {account name} + --expiry {date/time to expire SAS token} + --permission {permission to grant} + --connection-string {connection string of the storage account} + ``` + + ```powershell + CONNECTION_STRING= + + az storage file generate-sas + --name javasdksas + --expiry 2019-06-05 + --permission rpau + --connection-string $CONNECTION_STRING + ``` + * Alternatively, get the Account SAS Token from the Azure Portal. + 1. Go to your storage account. + 1. Click on "Shared access signature". + 1. Click on "Generate SAS and connection string". - **Shared Key Credential** + * There are two ways to create a shared key credential, the first is using the storage account name and account key. The second is using the storage connection string. + 1. Use account name and account key. + 1. The account name is your storage account name. + 1. Go to your storage account. + 1. Select "Access keys" tab. + 1. Copy the "Key" value for either Key 1 or Key 2. + 1. Use the connection string + 1. Go to your storage account. + 1. Select "Access keys" tab. + 1. Copy the "Connection string" value for either Key 1 or Key 2. -a. Use account name and account key. Account name is your storage account name. -``` -// Here is where we get the key -Go to your storage account -> Access keys -> Key 1/ Key 2 -> Key -``` -b. Use the connection string -``` -// Here is where we get the key -Go to your storage account -> Access Keys -> Keys 1/ Key 2 -> Connection string -``` ## Key concepts + ### URL format Files are addressable using the following URL format: ``` @@ -103,7 +103,7 @@ https://myaccount.file.core.windows.net/myshare/mydirectorypath/myfile ### Handling Exceptions ```java -TODO +// TODO ``` ### Resource Names @@ -128,12 +128,12 @@ The Azure File service naming rules for directory and file names are as follows: 1. Directory names cannot end with the forward slash character (/). If provided, it will be automatically removed. 1. File names must not end with the forward slash character (/). 1. Reserved URL characters must be properly escaped. -1. The following characters are not allowed: " \ / : | < > * ? +1. The following characters are not allowed: `" \ / : | < > * ?` 1. Illegal URL path characters not allowed. Code points like \uE000, while valid in NTFS filenames, are not valid Unicode characters. In addition, some ASCII or Unicode characters, like control characters (0x00 to 0x1F, \u0081, etc.), are also not allowed. For rules governing Unicode strings in HTTP/1.1 see [RFC 2616, Section 2.2: Basic Rules][RFC_URL_1] and [RFC 3987][RFL_URL_2]. 1. The following file names are not allowed: LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, PRN, AUX, NUL, CON, CLOCK$, dot character (.), and two dot characters (..). ### Metadata Names -Metadata for a share or file resource is stored as name-value pairs associated with the resource. Directories do not have metadata. Metadata names must adhere to the naming rules for [C# identifiers][C_identifiers]. +Metadata for a share or file resource is stored as name-value pairs associated with the resource. Directories do not have metadata. Metadata names must adhere to the naming rules for [C# identifiers][csharp_identifiers]. Note that metadata names preserve the case with which they were created, but are case-insensitive when set or read. If two or more metadata headers with the same name are submitted for a resource, the Azure File service returns status code 400 (Bad Request). @@ -141,17 +141,17 @@ Note that metadata names preserve the case with which they were created, but are The File Service REST API provides operations on accounts and manage file service properties. It allows the operations of listing and deleting shares, getting and setting file service properties. Once you have the SASToken, you can construct the file service client with `${accountName}`, `${sasToken}` -``` +```java String fileServiceURL = String.format("https://%s.file.core.windows.net", accountName); FileServiceClient fileServiceClient = new FileServiceClientBuilder().endpoint(fileServiceURL) .credential(sasToken).buildClient(); ``` -### Share +### Share The share resource includes metadata and properties for that share. It allows the opertions of creating, creating snapshot, deleting shares, getting share properties, setting metadata, getting and setting ACL (Access policy). Once you have the SASToken, you can construct the file service client with `${accountName}`, `${shareName}`, `${sasToken}` -``` +```java String shareURL = String.format("https://%s.file.core.windows.net", accountName); ShareClient shareClient = new ShareClientBuilder().endpoint(shareURL) .credential(sasToken).shareName(shareName).buildClient(); @@ -160,45 +160,45 @@ ShareClient shareClient = new ShareClientBuilder().endpoint(shareURL) ### Directory The directory resource includes the properties for that directory. It allows the operations of creating, listing, deleting directories or subdirectories or files, getting properties, setting metadata, listing and force closing the handles. Once you have the SASToken, you can construct the file service client with `${accountName}`, `${shareName}`, `${directoryPath}`, `${sasToken}` - - ``` - String directoryURL = String.format("https://%s.file.core.windows.net/%s%s", accountName, shareName, directoryPath, sasToken); - DirectoryClient directoryClient = new DirectoryClientBuilder().endpoint(directoryURL) + +```java +String directoryURL = String.format("https://%s.file.core.windows.net/%s%s", accountName, shareName, directoryPath, sasToken); +DirectoryClient directoryClient = new DirectoryClientBuilder().endpoint(directoryURL) .credential(sasToken).shareName(shareName).directoryName(directoryPath).buildClient(); - ``` +``` ### File The file resource includes the properties for that file. It allows the operations of creating, uploading, copying, downloading, deleting files or range of the files, getting properties, setting metadata, listing and force closing the handles. Once you have the SASToken, you can construct the file service client with `${accountName}`, `${shareName}`, `${directoryPath}`, `${fileName}`, `${sasToken}` - - ``` - String fileURL = String.format("https://%s.file.core.windows.net", accountName); - FileClient fileClient = new FileClientBuilder().endpoint(fileURL) + +```java +String fileURL = String.format("https://%s.file.core.windows.net", accountName); +FileClient fileClient = new FileClientBuilder().endpoint(fileURL) .credential(sasToken).shareName(shareName).filePath(directoryPath + "/" + fileName).buildClient(); - ``` +``` ## Examples The following sections provide several code snippets covering some of the most common Configuration Service tasks, including: -- [Create a Share](#Create-a-share) -- [Create a snapshot on Share](#Create-a-snapshot-on-share) -- [Create a Directory](#Create-a-directory) -- [Create a Subdirectory](#Create-a-subdirectory) -- [Create a File](#Create-a-file) -- [List all Shares](#List-all-shares) -- [List all Subdirectories and Files](#List-all-subdirectories-and-files) -- [List all ranges on file](#List-all-ranges-on-file) -- [Delete a Share](#Delete-a-share) -- [Delete a Directory](#Delete-a-directory) -- [Delete a Subdirectory](#Delete-a-subdirectory) -- [Delete a File](#Delete-a-file) -- [Copy a File](#Copy-a-file) +- [Create a Share](#create-a-share) +- [Create a snapshot on Share](#create-a-snapshot-on-share) +- [Create a Directory](#create-a-directory) +- [Create a Subdirectory](#create-a-subdirectory) +- [Create a File](#create-a-file) +- [List all Shares](#list-all-shares) +- [List all Subdirectories and Files](#list-all-subdirectories-and-files) +- [List all ranges on file](#list-all-ranges-on-file) +- [Delete a Share](#delete-a-share) +- [Delete a Directory](#delete-a-directory) +- [Delete a Subdirectory](#delete-a-subdirectory) +- [Delete a File](#delete-a-file) +- [Copy a File](#copy-a-file) - [Abort copy a File](#Abort-copy-a-file) -- [Upload data to Storage File](#Upload-data-to-storage) -- [Upload file to Storage File](#Upload-file-to-storage) -- [Download data from Storage File](#Download-data-from-storage) -- [Download file from Storage File](#Download-file-from-storage) -- [Get a File Service property](#Get-a-file-service-property) -- [Set a File Service property](#set-a-file-service-property) +- [Upload data to Storage File](#upload-data-to-storage) +- [Upload file to Storage File](#upload-file-to-storage) +- [Download data from file range](#download-data-from-file-range) +- [Download file from Storage File](#download-file-from-storage) +- [Get a file service properties](#get-a-file-service-properties) +- [Set a file service properties](#set-a-file-service-properties) - [Set a Share metadata](#Set-a-share-metadata) - [Get a Share access policy](#Get-a-share-access-policy) - [Set a Share access policy](#Set-a-share-access-policy) @@ -209,7 +209,7 @@ The following sections provide several code snippets covering some of the most c ### Create a share Create a share in the Storage Account. Throws StorageErrorException If the share fails to be created. -Taking a FileServiceClient in KeyConcept, [`${fileServiceClient}`](#File-services) . +Taking a FileServiceClient in KeyConcept, [`${fileServiceClient}`](#File-services). ```Java String shareName = "testshare"; @@ -217,7 +217,7 @@ fileServiceClient.createShare(shareName); ``` ### Create a snapshot on Share -Taking a FileServiceClient in KeyConcept, [`${fileServiceClient}`](#File-services) . +Taking a FileServiceClient in KeyConcept, [`${fileServiceClient}`](#File-services). ```Java String shareName = "testshare"; @@ -226,7 +226,7 @@ shareClient.createSnapshot(); ``` ### Create a directory -Taking the [`${shareClient}](#Create-snapshot-on-share) initialized above, [`${shareClient}`](#Share) . +Taking the [`${shareClient}](#create-a-snapshot-on-share) initialized above, [`${shareClient}`](#share). ```Java String dirName = "testdir"; @@ -234,7 +234,7 @@ shareClient.createDirectory(dirName); ``` ### Create a subdirectory -Taking the directoryClient in KeyConcept, [`${directoryClient}`](#Directory) . +Taking the directoryClient in KeyConcept, [`${directoryClient}`](#Directory). ```Java String subDirName = "testsubdir"; @@ -256,7 +256,7 @@ Taking the fileServiceClient in KeyConcept, [`${fileServiceClient}`](#File-servi fileServiceClient.listShares(); ``` -### Create all subdirectories and files +### List all subdirectories and files Taking the directoryClient in KeyConcept, [`${directoryClient}`](#Directory) ```Java @@ -383,7 +383,7 @@ shareClient.getAccessPolicy(); ### Set a share access policy Taking the shareClient in KeyConcept, [`${shareClient}`](#Share) . -```Java +```java AccessPolicy accessPolicy = new AccessPolicy().permission("r") .start(OffsetDateTime.now(ZoneOffset.UTC)) .expiry(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); @@ -432,13 +432,11 @@ When you interact with file using this Java client library, errors returned by t ## Next steps ### More Samples -- [FileServiceSample](src/samples/java/file/FileServiceSample.java) -- [ShareSample](src/samples/java/file/ShareSample.java) -- [DirectorySample](src/samples/java/file/DirectorySample.java) -- [FileSample](src/samples/java/file/FileSample.java) -- [AsyncSample](src/samples/java/file/AsyncSample.java) - -[Quickstart: Create a Java Spring app with App Configuration](https://docs.microsoft.com/en-us/azure/azure-app-configuration/quickstart-java-spring-app) +- [FileServiceSample][samples_file_service] +- [ShareSample][samples_share] +- [DirectorySample][samples_directory] +- [FileSample][samples_file] +- [AsyncSample][samples_async] ## Contributing This project welcomes contributions and suggestions. Most contributions require you to agree to a @@ -462,17 +460,22 @@ If you would like to become an active contributor to this project please follow 5. Create new Pull Request -[source_code]: to-be-continue -[package]: to-be-continue -[api_documentation]: https://docs.microsoft.com/en-us/rest/api/storageservices/file-service-rest-api -[storage_docs]: https://docs.microsoft.com/en-us/azure/storage/files/storage-files-introduction -[jdk]: https://docs.microsoft.com/en-us/java/azure/java-supported-jdk-runtime?view=azure-java-stable +[source_code]: src/ +[api_documentation]: https://docs.microsoft.com/rest/api/storageservices/file-service-rest-api +[storage_docs]: https://docs.microsoft.com/azure/storage/files/storage-files-introduction +[jdk]: https://docs.microsoft.com/java/azure/java-supported-jdk-runtime?view=azure-java-stable [maven]: https://maven.apache.org/ -[azure_subscription]: https://azure.microsoft.com/en-us/free/ -[storage_account]: https://docs.microsoft.com/en-us/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal +[azure_subscription]: https://azure.microsoft.com/free/ +[storage_account]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal [azure_cli]: https://docs.microsoft.com/cli/azure -[sas_token]: https://docs.microsoft.com/en-us/azure/storage/common/storage-dotnet-shared-access-signature-part-1 +[sas_token]: https://docs.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1 [RFC_URL_1]: https://www.ietf.org/rfc/rfc2616.txt [RFL_URL_2]: https://www.ietf.org/rfc/rfc3987.txt -[C_identifiers]: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/ -[storage_file_rest]: https://docs.microsoft.com/en-us/rest/api/storageservices/file-service-error-codes +[csharp_identifiers]: https://docs.microsoft.com/dotnet/csharp/language-reference/ +[storage_file_rest]: https://docs.microsoft.com/rest/api/storageservices/file-service-error-codes +[samples]: src/samples +[samples_file_service]: src/samples/java/com/azure/storage/file/FileServiceSample.java +[samples_share]: src/samples/java/com/azure/storage/file/ShareSample.java +[samples_directory]: src/samples/java/com/azure/storage/file/DirectorySample.java +[samples_file]: src/samples/java/com/azure/storage/file/FileSample.java +[samples_async]: src/samples/java/com/azure/storage/file/AsyncSample.java diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/file/AsyncSample.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/AsyncSample.java similarity index 98% rename from sdk/storage/azure-storage-file/src/samples/java/com/azure/file/AsyncSample.java rename to sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/AsyncSample.java index 12a0ae4e36c8..efe77a33e305 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/file/AsyncSample.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/AsyncSample.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.file; +package com.azure.storage.file; import com.azure.core.util.configuration.ConfigurationManager; import com.azure.storage.file.FileServiceAsyncClient; diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/file/DirectorySample.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectorySample.java similarity index 99% rename from sdk/storage/azure-storage-file/src/samples/java/com/azure/file/DirectorySample.java rename to sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectorySample.java index 0c3e7d768082..c8a9c850aa76 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/file/DirectorySample.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectorySample.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.file; +package com.azure.storage.file; import com.azure.core.http.rest.Response; import com.azure.core.util.configuration.ConfigurationManager; diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/file/FileSample.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileSample.java similarity index 96% rename from sdk/storage/azure-storage-file/src/samples/java/com/azure/file/FileSample.java rename to sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileSample.java index bff249f71e43..dfb99d75caf8 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/file/FileSample.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileSample.java @@ -1,13 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.file; +package com.azure.storage.file; import com.azure.core.http.rest.Response; import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.storage.file.FileClient; -import com.azure.storage.file.FileClientBuilder; -import com.azure.storage.file.ShareClient; -import com.azure.storage.file.ShareClientBuilder; import com.azure.storage.file.models.CopyStatusType; import com.azure.storage.file.models.FileCopyInfo; import com.azure.storage.file.models.FileProperties; diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/file/FileServiceSample.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceSample.java similarity index 98% rename from sdk/storage/azure-storage-file/src/samples/java/com/azure/file/FileServiceSample.java rename to sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceSample.java index f5fad2f7035a..e8d2375edf7b 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/file/FileServiceSample.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceSample.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.file; +package com.azure.storage.file; import com.azure.core.http.rest.Response; import com.azure.core.util.configuration.ConfigurationManager; diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/file/ShareSample.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareSample.java similarity index 99% rename from sdk/storage/azure-storage-file/src/samples/java/com/azure/file/ShareSample.java rename to sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareSample.java index 10c050a077ff..b0b60d11f8cc 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/file/ShareSample.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareSample.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.file; +package com.azure.storage.file; import com.azure.core.http.rest.Response; import com.azure.core.util.configuration.ConfigurationManager; diff --git a/sdk/storage/azure-storage-queue/README.md b/sdk/storage/azure-storage-queue/README.md index 18f92018e21c..f80a2c884c44 100644 --- a/sdk/storage/azure-storage-queue/README.md +++ b/sdk/storage/azure-storage-queue/README.md @@ -2,7 +2,8 @@ Azure Queue storage is a service for storing large numbers of messages that can be accessed from anywhere in the world via authenticated calls using HTTP or HTTPS. A single queue message can be up to 64 KB in size, and a queue can contain millions of messages, up to the total capacity limit of a storage account. -[Source code][source_code] | [Package (Maven)][package] | [API reference documentation][api_documentation] | [Product documentation][storage_docs] +[Source code][source_code] | [API reference documentation][api_documentation] | [Product documentation][storage_docs] | +[Samples][samples] ## Getting started @@ -10,15 +11,15 @@ A single queue message can be up to 64 KB in size, and a queue can contain milli - [Java Development Kit (JDK)][jdk] with version 8 or above - [Azure Subscription][azure_subscription] -- [Create Strorage Account][storage_account] +- [Create Storage Account][storage_account] ### Adding the package to your product ```xml com.azure - azure-storage - 12.0.0 + azure-storage-queue + 12.0.0-preview.2 ``` @@ -169,19 +170,19 @@ queueAsyncClient.create(metadata, timeout).subscribe( The following sections provide several code snippets covering some of the most common Configuration Service tasks, including: - [Build a client](#build-a-client) -- [Create a Queue](#Create-a-queue) -- [Delete a queue](#Delete-a-queue) -- [List the queues in account](#List-queues-in-account) -- [Get propertiesin Queue account](#Get-properties-in-queue-account) -- [Set propertiesin Queue account](#Set-properties-in-queue-account) -- [Get statistcs of queue](#Get-queue-service-statistics) -- [Enqueue message into a queue](#Enqueue-message-into-a-queue) -- [Update message into a queue](#Update-message-into-a-queue) -- [Peek messages into a queue](#Peek-messages-into-a-queue) -- [Dequeue messages from a queue](#Dequeue-messages-from-a-queue) -- [Delete message from a queue](#Delete-message-from-a-queue) -- [Get a Queue properties](#Get-a-queue-properties) -- [Set/Update a Queue metadata](#Set-a-queue-metadata) +- [Create a Queue](#create-a-queue) +- [Delete a queue](#delete-a-queue) +- [List the queues in account](#list-queues-in-account) +- [Get properties in Queue account](#get-properties-in-queue-account) +- [Set properties in Queue account](#set-properties-in-queue-account) +- [Get statistics of queue](#get-queue-service-statistics) +- [Enqueue message into a queue](#enqueue-message-into-a-queue) +- [Update a message in a queue](#update-a-message-in-a-queue) +- [Peek at messages in a queue](#peek-at-messages-in-a-queue) +- [Dequeue messages from a queue](#dequeue-messages-from-a-queue) +- [Delete message from a queue](#delete-message-from-a-queue) +- [Get a Queue properties](#get-a-queue-properties) +- [Set/Update a Queue metadata](#set-a-queue-metadata) ### Build a client We have two ways of building QueueService or Queue Client. Here will take queueServiceClient as an example. Same things apply to queueClient. @@ -292,7 +293,7 @@ QueueClient queueClient = new QueueClientBuilder().endpoint(queueURL).credential queueClient.enqueueMessage("myMessage"); ``` -### Update messaged from a queue +### Update a message in a queue The operation updates a message in the message queue. Use `${SASToken}` as credential. ```Java String queueSURL = String.format("https://%s.queue.core.windows.net", accountName); @@ -303,7 +304,7 @@ QueueClient queueClient = new QueueClientBuilder().endpoint(queueURL).credential queueClient.updateMessage(messageId, "new message", popReceipt, visibilityTimeout); ``` -### Peek messages from a queue +### Peek at messages in a queue The operation retrieves one or more messages from the front of the queue. Use `${SASToken}` as credential. ```Java String queueSURL = String.format("https://%s.queue.core.windows.net", accountName); @@ -367,14 +368,11 @@ When you interact with queue using this Java client library, errors returned by ## Next steps -### More Samples Get started with our [Queue samples][samples]: -- [QueueServiceSample](src/samples/java/queue/QueueServiceSample.java): Create, list and delete queues -- [MessageSample](src/samples/java/queue/MessageSample.java): Enqueue, peek dequeue, update, clear and delete messages. Get properties of the queue. -- [QueueExceptionSample](src/samples/java/queue/QueueExceptionSample.java): Handle the exceptions from storage queue service side. -- [AsyncSample](src/samples/java/queue/AsyncSample.java): Create queue and enqueue message using async queue client call. - -[Quickstart: Create a Java Spring app with App Configuration](https://docs.microsoft.com/en-us/azure/azure-app-configuration/quickstart-java-spring-app) +- [QueueServiceSample][samples_queue_service]: Create, list and delete queues +- [MessageSample][samples_message]: Enqueue, peek dequeue, update, clear and delete messages. Get properties of the queue. +- [QueueExceptionSample][samples_queue_exception]: Handle the exceptions from storage queue service side. +- [AsyncSample][samples_async]: Create queue and enqueue message using async queue client call. ## Contributing This project welcomes contributions and suggestions. Most contributions require you to agree to a @@ -398,15 +396,18 @@ If you would like to become an active contributor to this project please follow 5. Create new Pull Request -[source_code]: to-be-continue -[package]: to-be-continue -[api_documentation]: https://docs.microsoft.com/en-us/rest/api/storageservices/queue-service-rest-api -[storage_docs]: https://docs.microsoft.com/en-us/azure/storage/queues/storage-queues-introduction -[jdk]: https://docs.microsoft.com/en-us/java/azure/java-supported-jdk-runtime?view=azure-java-stable +[source_code]: src +[api_documentation]: https://docs.microsoft.com/rest/api/storageservices/queue-service-rest-api +[storage_docs]: https://docs.microsoft.com/azure/storage/queues/storage-queues-introduction +[jdk]: https://docs.microsoft.com/java/azure/java-supported-jdk-runtime?view=azure-java-stable [maven]: https://maven.apache.org/ -[azure_subscription]: https://azure.microsoft.com/en-us/free/ -[storage_account]: https://docs.microsoft.com/en-us/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal +[azure_subscription]: https://azure.microsoft.com/free/ +[storage_account]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal [azure_cli]: https://docs.microsoft.com/cli/azure -[sas_token]: https://docs.microsoft.com/en-us/azure/storage/common/storage-dotnet-shared-access-signature-part-1 -[storage_rest]: https://docs.microsoft.com/en-us/rest/api/storageservices/queue-service-error-codes -[samples]: samples/ +[sas_token]: https://docs.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1 +[storage_rest]: https://docs.microsoft.com/rest/api/storageservices/queue-service-error-codes +[samples]: src/samples +[samples_queue_service]: src/samples/java/com/azure/storage/queue/QueueServiceSamples.java +[samples_message]: src/samples/java/com/azure/storage/queue/MessageSamples.java +[samples_queue_exception]: src/samples/java/com/azure/storage/queue/QueueExceptionSamples.java +[samples_async]: src/samples/java/com/azure/storage/queue/AsyncSamples.java