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

Docs updates #22453

Merged
merged 3 commits into from
Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
21 changes: 18 additions & 3 deletions sdk/storage/azure-storage-blob-cryptography/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Unstructured data is data that does not adhere to a particular data model or
definition, such as text or binary data.
This package supports client side encryption for blob storage.

[Source code][source] | [API reference documentation][docs] | [REST API documentation][rest_docs] | [Product documentation][product_docs] | [Samples][samples]

## Getting started

### Prerequisites
Expand Down Expand Up @@ -133,18 +135,20 @@ EncryptedBlobClient client = new EncryptedBlobClientBuilder()

Create a `BlobServiceClient` using a connection string.

<!-- embedme ./src/samples/java/com/azure/storage/blob/specialized/cryptography/ReadmeSamples.java#L50-L54 -->
<!-- embedme ./src/samples/java/com/azure/storage/blob/specialized/cryptography/ReadmeSamples.java#L52-L58 -->
```java
EncryptedBlobClient client = new EncryptedBlobClientBuilder()
.key(key, keyWrapAlgorithm)
.keyResolver(keyResolver)
.connectionString(connectionString)
.containerName(containerName)
.blobName(blobName)
.buildEncryptedBlobClient();
```

### Use a local `KeyEncryptionKey`

<!-- embedme ./src/samples/java/com/azure/storage/blob/specialized/cryptography/ReadmeSamples.java#L58-L67 -->
<!-- embedme ./src/samples/java/com/azure/storage/blob/specialized/cryptography/ReadmeSamples.java#L62-L73 -->
```java
JsonWebKey localKey = JsonWebKey.fromAes(new SecretKeySpec(keyBytes, secretKeyAlgorithm),
Arrays.asList(KeyOperation.WRAP_KEY, KeyOperation.UNWRAP_KEY))
Expand All @@ -154,13 +158,16 @@ AsyncKeyEncryptionKey akek = new KeyEncryptionKeyClientBuilder()

EncryptedBlobClient client = new EncryptedBlobClientBuilder()
.key(akek, keyWrapAlgorithm)
.keyResolver(keyResolver)
.connectionString(connectionString)
.containerName(containerName)
.blobName(blobName)
.buildEncryptedBlobClient();
```

### Use a `KeyVaultKey`

<!-- embedme ./src/samples/java/com/azure/storage/blob/specialized/cryptography/ReadmeSamples.java#L71-L86 -->
<!-- embedme ./src/samples/java/com/azure/storage/blob/specialized/cryptography/ReadmeSamples.java#L77-L94 -->
```java
KeyClient keyClient = new KeyClientBuilder()
.vaultUrl(keyVaultUrl)
Expand All @@ -176,7 +183,10 @@ AsyncKeyEncryptionKey akek = new KeyEncryptionKeyClientBuilder()

EncryptedBlobClient client = new EncryptedBlobClientBuilder()
.key(akek, keyWrapAlgorithm)
.keyResolver(keyResolver)
.connectionString(connectionString)
.containerName(containerName)
.blobName(blobName)
.buildEncryptedBlobClient();
```

Expand Down Expand Up @@ -209,6 +219,11 @@ 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-blob-cryptography%2FREADME.png)

[jdk]: https://docs.microsoft.com/java/azure/jdk/
[source]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/storage/azure-storage-blob-cryptography/src
[docs]: https://azure.github.io/azure-sdk-for-java/
[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
[samples]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/storage/azure-storage-blob-cryptography/src/samples
[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_cli]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-cli
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public class ReadmeSamples {

private BlobClient blobClient;
private String connectionString;
private String containerName;
private String blobName;
private AsyncKeyEncryptionKey key;
private AsyncKeyEncryptionKeyResolver keyResolver;
private String keyWrapAlgorithm;
Expand All @@ -51,6 +53,8 @@ public void getEncryptedBlobClient() {
.key(key, keyWrapAlgorithm)
.keyResolver(keyResolver)
.connectionString(connectionString)
.containerName(containerName)
.blobName(blobName)
.buildEncryptedBlobClient();
}

Expand All @@ -64,6 +68,8 @@ public void getClientLocalKey() {
EncryptedBlobClient client = new EncryptedBlobClientBuilder()
.key(akek, keyWrapAlgorithm)
.connectionString(connectionString)
.containerName(containerName)
.blobName(blobName)
.buildEncryptedBlobClient();
}

Expand All @@ -83,9 +89,9 @@ public void getClientKeyVaultKey() {
EncryptedBlobClient client = new EncryptedBlobClientBuilder()
.key(akek, keyWrapAlgorithm)
.connectionString(connectionString)
.containerName(containerName)
.blobName(blobName)
.buildEncryptedBlobClient();
}


}

Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ public BlobHttpHeaders setContentType(String contentType) {

/**
* Get the contentMd5 property: Optional. An MD5 hash of the blob content. Note that this hash is not validated, as
* the hashes for the individual blocks were validated when each was uploaded.
* the hashes for the individual blocks were validated when each was uploaded. The value does not need to be base64
* encoded as the SDK will perform the encoding.
*
* @return the contentMd5 value.
*/
Expand All @@ -111,7 +112,8 @@ public byte[] getContentMd5() {

/**
* Set the contentMd5 property: Optional. An MD5 hash of the blob content. Note that this hash is not validated, as
* the hashes for the individual blocks were validated when each was uploaded.
* the hashes for the individual blocks were validated when each was uploaded. The value does not need to be base64
* encoded as the SDK will perform the encoding.
*
* @param contentMd5 the contentMd5 value to set.
* @return the BlobHttpHeaders object itself.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public final class BlobItem {
private List<ObjectReplicationPolicy> objectReplicationSourcePolicies;

/*
* The isPrefix property.
* The isPrefix property. If blobs are named to mimic a directory hierarchy (i.e. path elements separated by a
* delimiter), this property may be used to determine if the {@code BlobItem} is a virtual directory.
*/
@JsonProperty(value = "IsPrefix")
private Boolean isPrefix;
Expand Down Expand Up @@ -254,7 +255,8 @@ public BlobItem setObjectReplicationSourcePolicies(List<ObjectReplicationPolicy>
}

/**
* Get the isPrefix property: The isPrefix property.
* Get the isPrefix property: If blobs are named to mimic a directory hierarchy (i.e. path elements separated by a
* delimiter), this property may be used to determine if the {@code BlobItem} is a virtual directory.
*
* @return the isPrefix value.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ public void customize(LibraryCustomization customization) {
ClassCustomization blobHttpHeaders = models.getClass("BlobHttpHeaders");
blobHttpHeaders.removeAnnotation("@JacksonXmlRootElement(localName = \"BlobHttpHeaders\")");
blobHttpHeaders.addAnnotation("@JacksonXmlRootElement(localName = \"blob-http-headers\")");
blobHttpHeaders.getMethod("getContentMd5").getJavadoc().setDescription("Get the contentMd5 property: " +
"Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for " +
"the individual blocks were validated when each was uploaded. The value does not need to be base64 " +
"encoded as the SDK will perform the encoding.");
blobHttpHeaders.getMethod("setContentMd5").getJavadoc().setDescription("Set the contentMd5 property: " +
"Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for " +
"the individual blocks were validated when each was uploaded. The value does not need to be base64 " +
"encoded as the SDK will perform the encoding.");

ClassCustomization blobContainerEncryptionScope = models.getClass("BlobContainerEncryptionScope");
blobContainerEncryptionScope.removeAnnotation("@JacksonXmlRootElement(localName = \"BlobContainerEncryptionScope\")");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,9 +549,9 @@ public PagedFlux<PathItem> listPaths() {
* If "false", the values will be returned as Azure Active Directory Object IDs.
* The default value is false. Note that group and application Object IDs are not translated because they do not
* have unique friendly names.
* @param maxResults Specifies the maximum number of blobs to return, including all BlobPrefix elements. If the
* request does not specify maxResults or specifies a value greater than 5,000, the server will return up to
* 5,000 items.
* @param maxResults Specifies the maximum number of blobs to return per page, including all BlobPrefix elements. If
* the request does not specify maxResults or specifies a value greater than 5,000, the server will return up to
* 5,000 items per page.
* @return A reactive response emitting the list of files/directories.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,10 @@ public PagedIterable<PathItem> listPaths() {
* If "false", the values will be returned as Azure Active Directory Object IDs.
* The default value is false. Note that group and application Object IDs are not translated because they do not
* have unique friendly names.
* @param maxResults Specifies the maximum number of blobs to return, including all BlobPrefix elements. If the
* request does not specify maxResults or specifies a value greater than 5,000, the server will return up to
* 5,000 items. If iterating by page, the page size passed to byPage methods such as
* * {@link PagedIterable#iterableByPage(int)} will be preferred over this value.
* @param maxResults Specifies the maximum number of blobs to return per page, including all BlobPrefix elements. If
* the request does not specify maxResults or specifies a value greater than 5,000, the server will return up to
* 5,000 items per page. If iterating by page, the page size passed to byPage methods such as
* {@link PagedIterable#iterableByPage(int)} will be preferred over this value.
* @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised.
* @return The list of files/directories.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ public ListPathsOptions setUserPrincipalNameReturned(boolean isUserPrincipalName
}

/**
* Specifies the maximum number of blobs to return, including all BlobPrefix elements. If the request does not
* specify maxResults or specifies a value greater than 5,000, the server will return up to 5,000 items.
* Specifies the maximum number of blobs to return per page, including all BlobPrefix elements. If the request does
* not specify maxResults or specifies a value greater than 5,000, the server will return up to 5,000 items per
* page.
*
* @return the number of containers to be returned in a single response
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void createShareWithMetadata() {
ShareServiceClient fileServiceClient = createClientWithSASToken();
// BEGIN: ShareServiceClient.createShareWithResponse#string-map-integer-duration-context
Response<ShareClient> response = fileServiceClient.createShareWithResponse("test",
Collections.singletonMap("share", "metadata"), null, Duration.ofSeconds(1),
Collections.singletonMap("share", "metadata"), null, Duration.ofSeconds(5),
new Context(key1, value1));
System.out.printf("Creating the share completed with status code %d", response.getStatusCode());
// END: ShareServiceClient.createShareWithResponse#string-map-integer-duration-context
Expand All @@ -130,7 +130,7 @@ public void createShareWithOptions() {
// BEGIN: ShareServiceClient.createShareWithResponse#String-ShareCreateOptions-Duration-Context
Response<ShareClient> response = fileServiceClient.createShareWithResponse("test",
new ShareCreateOptions().setMetadata(Collections.singletonMap("share", "metadata")).setQuotaInGb(1)
.setAccessTier(ShareAccessTier.HOT), Duration.ofSeconds(1), new Context(key1, value1));
.setAccessTier(ShareAccessTier.HOT), Duration.ofSeconds(5), new Context(key1, value1));
System.out.printf("Creating the share completed with status code %d", response.getStatusCode());
// END: ShareServiceClient.createShareWithResponse#String-ShareCreateOptions-Duration-Context
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void getQueueListInAccount() {
// @param options: Filter for queue selection
// @param timeout: An optional timeout applied to the operation.
// @param context: Additional context that is passed through the Http pipeline during the service call.
queueServiceClient.listQueues(markers, options, timeout, context).stream().forEach(queueItem -> {
queueServiceClient.listQueues(options, timeout, context).stream().forEach(queueItem -> {
System.out.printf("Queue %s exists in the account.", queueItem.getName());
});
}
Expand Down