From 7711785a7955defe41121e67d5570324d0da3aeb Mon Sep 17 00:00:00 2001
From: Mitch Denny
Date: Wed, 14 Aug 2019 13:10:53 -0700
Subject: [PATCH 01/95] Disable Jetty by default. (#4964)
Adds a flag to the pipeline which controls whether it is a track 1 or track 2 build.
---
.../templates/jobs/archetype-sdk-client.yml | 1 +
.../keyvault/test/EcKeyIntegrationTests.java | 5 ++
sdk/keyvault/pom.service.xml | 62 ++++++++++++-------
3 files changed, 45 insertions(+), 23 deletions(-)
diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml
index 06ce79cd972cf..21415016cac09 100644
--- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml
+++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml
@@ -228,6 +228,7 @@ jobs:
- task: Maven@3
displayName: 'Start Jetty'
+ condition: ne(variables['SdkType'], 'client')
inputs:
mavenPomFile: pom.client.xml
options: '$(DefaultOptions) $(ProfileFlag)'
diff --git a/sdk/keyvault/microsoft-azure-keyvault-test/src/test/java/com/microsoft/azure/keyvault/test/EcKeyIntegrationTests.java b/sdk/keyvault/microsoft-azure-keyvault-test/src/test/java/com/microsoft/azure/keyvault/test/EcKeyIntegrationTests.java
index f508cfa07f742..b96b62d4a7ec5 100644
--- a/sdk/keyvault/microsoft-azure-keyvault-test/src/test/java/com/microsoft/azure/keyvault/test/EcKeyIntegrationTests.java
+++ b/sdk/keyvault/microsoft-azure-keyvault-test/src/test/java/com/microsoft/azure/keyvault/test/EcKeyIntegrationTests.java
@@ -23,6 +23,7 @@
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
@@ -110,21 +111,25 @@ public void beforeMethod() throws Exception {
}
@Test
+ @Ignore("https://github.com/Azure/azure-sdk-for-java/issues/4993")
public void testSignVerifyIntegrationES256() throws Exception {
validateSignVerifyInterop(importTestKey("itwkk-p256", P256TestKey()), JsonWebKeySignatureAlgorithm.ES256, "SHA-256");
}
@Test
+ @Ignore("https://github.com/Azure/azure-sdk-for-java/issues/4993")
public void testSignVerifyIntegrationES256K() throws Exception {
validateSignVerifyInterop(importTestKey("itwkk-p256k", P256KTestKey()), JsonWebKeySignatureAlgorithm.ES256K, "SHA-256");
}
@Test
+ @Ignore("https://github.com/Azure/azure-sdk-for-java/issues/4993")
public void testSignVerifyIntegrationES384() throws Exception {
validateSignVerifyInterop(importTestKey("itwkk-p384", P384TestKey()), JsonWebKeySignatureAlgorithm.ES384, "SHA-384");
}
@Test
+ @Ignore("https://github.com/Azure/azure-sdk-for-java/issues/4993")
public void testSignVerifyIntegrationES521() throws Exception {
validateSignVerifyInterop(importTestKey("itwkk-p521", P521TestKey()), JsonWebKeySignatureAlgorithm.ES512, "SHA-512");
}
diff --git a/sdk/keyvault/pom.service.xml b/sdk/keyvault/pom.service.xml
index 956a21dfe3d7d..d64ee420186b6 100644
--- a/sdk/keyvault/pom.service.xml
+++ b/sdk/keyvault/pom.service.xml
@@ -1,30 +1,46 @@
-
+
4.0.0
com.azure
azure-keyvault-service
pom
- 1.0.0
-
-
-
- microsoft-azure-keyvault
- microsoft-azure-keyvault-core
- microsoft-azure-keyvault-webkey
- microsoft-azure-keyvault-cryptography
- microsoft-azure-keyvault-extensions
- microsoft-azure-keyvault-complete
-
-
- ../core/azure-core
- ../core/azure-core-test
- ../identity/azure-identity
- azure-keyvault-keys
- azure-keyvault-secrets
-
-
-
+ 1.0.0
+
+
+ data
+
+
+ env.SDKTYPE
+ data
+
+
+
+ microsoft-azure-keyvault
+ microsoft-azure-keyvault-complete
+ microsoft-azure-keyvault-core
+ microsoft-azure-keyvault-cryptography
+ microsoft-azure-keyvault-extensions
+ microsoft-azure-keyvault-test
+ microsoft-azure-keyvault-webkey
+
+
+
+ client
+
+
+ env.SDKTYPE
+ !data
+
+
+
+ ../core/azure-core
+ ../core/azure-core-test
+ ../identity/azure-identity
+ azure-keyvault-keys
+ azure-keyvault-secrets
+
+
+
From 1b40f3a1d4a04989c6feaad8ff4c6624aae66e71 Mon Sep 17 00:00:00 2001
From: Srikanta <51379715+srnagar@users.noreply.github.com>
Date: Wed, 14 Aug 2019 13:13:24 -0700
Subject: [PATCH 02/95] Update package groups and add description in pom.xml
for client libraries (#4987)
---
pom.client.xml | 4 ++++
sdk/identity/azure-identity/pom.xml | 4 ++++
sdk/keyvault/azure-keyvault-keys/pom.xml | 3 ++-
sdk/keyvault/azure-keyvault-secrets/pom.xml | 3 ++-
sdk/storage/azure-storage-blob/pom.xml | 3 ++-
sdk/storage/azure-storage-common/pom.xml | 3 ++-
sdk/storage/azure-storage-file/pom.xml | 3 ++-
sdk/storage/azure-storage-queue/pom.xml | 3 ++-
8 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/pom.client.xml b/pom.client.xml
index ce6957bcaeed5..76ca1105732dd 100644
--- a/pom.client.xml
+++ b/pom.client.xml
@@ -401,6 +401,10 @@
Azure Storage - Queues
com.azure.storage.queue*
+
+ Azure Telemetry
+ com.azure.tracing.opentelemetry*
+
https://docs.oracle.com/javase/8/docs/api/
diff --git a/sdk/identity/azure-identity/pom.xml b/sdk/identity/azure-identity/pom.xml
index e2be2e9b861f6..eb7e8bb04de50 100644
--- a/sdk/identity/azure-identity/pom.xml
+++ b/sdk/identity/azure-identity/pom.xml
@@ -8,6 +8,10 @@
azure-identity
1.0.0-preview.3
+ Microsoft Azure client library for Identity
+ This module contains client library for Microsoft Azure Identity.
+ https://github.com/Azure/azure-sdk-for-java
+
com.azure
azure-client-sdk-parent
diff --git a/sdk/keyvault/azure-keyvault-keys/pom.xml b/sdk/keyvault/azure-keyvault-keys/pom.xml
index c1819383b7dc4..7cf076074879e 100644
--- a/sdk/keyvault/azure-keyvault-keys/pom.xml
+++ b/sdk/keyvault/azure-keyvault-keys/pom.xml
@@ -15,7 +15,8 @@
azure-keyvault-keys
4.0.0-preview.3
- azure-keyvault-keys
+ Microsoft Azure client library for KeyVault Keys
+ This module contains client library for Microsoft Azure KeyVault Keys.
https://github.com/Azure/azure-sdk-for-java
diff --git a/sdk/keyvault/azure-keyvault-secrets/pom.xml b/sdk/keyvault/azure-keyvault-secrets/pom.xml
index 0c3cf6d4f5181..3e9d333cd1b8c 100644
--- a/sdk/keyvault/azure-keyvault-secrets/pom.xml
+++ b/sdk/keyvault/azure-keyvault-secrets/pom.xml
@@ -13,7 +13,8 @@
azure-keyvault-secrets
4.0.0-preview.3
- azure-keyvault-secrets
+ Microsoft Azure client library for KeyVault Secrets
+ This module contains client library for Microsoft Azure KeyVault Secrets.
https://github.com/Azure/azure-sdk-for-java
diff --git a/sdk/storage/azure-storage-blob/pom.xml b/sdk/storage/azure-storage-blob/pom.xml
index 59e986439e6de..71afc74b13e3c 100644
--- a/sdk/storage/azure-storage-blob/pom.xml
+++ b/sdk/storage/azure-storage-blob/pom.xml
@@ -15,7 +15,8 @@
azure-storage-blob
12.0.0-preview.3
- azure-storage-blob
+ Microsoft Azure client library for Blob Storage
+ This module contains client library for Microsoft Azure Blob Storage.
https://github.com/Azure/azure-sdk-for-java
diff --git a/sdk/storage/azure-storage-common/pom.xml b/sdk/storage/azure-storage-common/pom.xml
index e50ea1d13cd82..7eb369b5174a6 100644
--- a/sdk/storage/azure-storage-common/pom.xml
+++ b/sdk/storage/azure-storage-common/pom.xml
@@ -15,7 +15,8 @@
azure-storage-common
12.0.0-preview.3
- azure-storage-common
+ Microsoft Azure common module for Storage
+ This module contains common code based for all Microsoft Azure Storage client libraries.
https://github.com/Azure/azure-sdk-for-java
diff --git a/sdk/storage/azure-storage-file/pom.xml b/sdk/storage/azure-storage-file/pom.xml
index 91058c7dcdb72..f12383df2f0b2 100644
--- a/sdk/storage/azure-storage-file/pom.xml
+++ b/sdk/storage/azure-storage-file/pom.xml
@@ -15,7 +15,8 @@
azure-storage-file
12.0.0-preview.3
- azure-storage-file
+ Microsoft Azure client library for File Storage
+ This module contains client library for Microsoft Azure File Storage.
https://github.com/Azure/azure-sdk-for-java
diff --git a/sdk/storage/azure-storage-queue/pom.xml b/sdk/storage/azure-storage-queue/pom.xml
index 8956e06c351c7..f80a5afff324e 100644
--- a/sdk/storage/azure-storage-queue/pom.xml
+++ b/sdk/storage/azure-storage-queue/pom.xml
@@ -15,7 +15,8 @@
azure-storage-queue
12.0.0-preview.3
- azure-storage-queue
+ Microsoft Azure client library for Queue Storage
+ This module contains client library for Microsoft Azure Queue Storage.
https://github.com/Azure/azure-sdk-for-java
From 7d24f9ad248d8c0791b2d3b0fdd78a0d71a4ae6c Mon Sep 17 00:00:00 2001
From: Connie Yau
Date: Wed, 14 Aug 2019 13:19:08 -0700
Subject: [PATCH 03/95] Event Hubs: Synchronous APIs Part 2 (#4970)
* Formatting changes in EventHubAsyncProducer.
* Adding EventHubClient, EventHubConsumer, and EventHubProducer.
* Exposing EventHubClient creation in EventHubClientBuilder.
* EventHubClient, Consumer and Producer implements Closeable.
* Fixing sample by removing event hub instance from namespace connection string.
* Remove unneeded sample in EventHubClientBuilder.
* Add EventHubClient to builder annotation.
* Update EventHubClientBuilder samples. Remove unneeded ones.
* Update samples in EventHubClientBuilder.
* Fixing links to EventHubAsyncProducer samples.
* Adding EventHubProducer code samples.
* Update from Iterable to IterableResponse.
* Make test contents package-private.
* Adding tests for EventHubProducer.
* Simplifying creation of EventHubAsyncProducer
* Select correct retryDuration when constructing EventHubProducer.
* Adding EventHubProducer tests.
* Rename EventHubClientIntegrationTest -> EventHubAsyncClientIntegrationTests
* Add integration tests for EventHubClient.
* Make EventHubConsumer methods public
---
.../eventhubs/EventHubAsyncClient.java | 22 +-
.../eventhubs/EventHubAsyncProducer.java | 10 +-
.../messaging/eventhubs/EventHubClient.java | 184 +++++++++++++++
.../eventhubs/EventHubClientBuilder.java | 186 +++++++++------
.../messaging/eventhubs/EventHubConsumer.java | 75 ++++++
.../messaging/eventhubs/EventHubProducer.java | 198 ++++++++++++++++
...EventHubAsyncClientJavaDocCodeSamples.java | 35 +--
...entHubAsyncProducerJavaDocCodeSamples.java | 6 +-
.../EventHubClientJavaDocCodeSamples.java | 26 +++
.../EventHubProducerJavaDocCodeSamples.java | 111 +++++++++
.../EventHubAsyncClientIntegrationTest.java | 204 +++++++++++++++++
.../EventHubAsyncProducerIntegrationTest.java | 25 +-
.../eventhubs/EventHubAsyncProducerTest.java | 12 +-
.../EventHubClientIntegrationTest.java | 201 ++++------------
.../EventHubProducerIntegrationTest.java | 135 +++++++++++
.../eventhubs/EventHubProducerTest.java | 215 ++++++++++++++++++
16 files changed, 1350 insertions(+), 295 deletions(-)
create mode 100644 sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClient.java
create mode 100644 sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubConsumer.java
create mode 100644 sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProducer.java
create mode 100644 sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubClientJavaDocCodeSamples.java
create mode 100644 sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubProducerJavaDocCodeSamples.java
create mode 100644 sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncClientIntegrationTest.java
create mode 100644 sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerIntegrationTest.java
create mode 100644 sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerTest.java
diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncClient.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncClient.java
index b071a586319d1..a3a6c04861ecc 100644
--- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncClient.java
+++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncClient.java
@@ -49,13 +49,13 @@
* the Event Hubs namespace and offers operations for sending event data, receiving events, and inspecting the connected
* Event Hub.
*
- * Creating an {@link EventHubAsyncClient} using Event Hubs namespace connection string
+ * Creating an {@link EventHubAsyncClient} using an Event Hubs namespace connection string
*
- * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.connectionString#string-string}
+ * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string-string}
*
- * Creating an {@link EventHubAsyncClient} using Event Hub instance connection string
+ * Creating an {@link EventHubAsyncClient} using an Event Hub instance connection string
*
- * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.connectionstring#string}
+ * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string}
*
* @see EventHubClientBuilder
* @see About Azure Event Hubs
@@ -236,20 +236,22 @@ public EventHubAsyncConsumer createConsumer(String consumerGroup, String partiti
* @param options The set of options to apply when creating the consumer.
* @return An new {@link EventHubAsyncConsumer} that receives events from the partition with all configured {@link
* EventHubConsumerOptions}.
- * @throws NullPointerException If {@code eventPosition}, or {@code options} is {@code null}.
- * @throws IllegalArgumentException If {@code consumerGroup} or {@code partitionId} is {@code null} or an
- * empty string.
+ * @throws NullPointerException If {@code eventPosition}, {@code consumerGroup}, {@code partitionId}, or {@code
+ * options} is {@code null}.
+ * @throws IllegalArgumentException If {@code consumerGroup} or {@code partitionId} is an empty string.
*/
public EventHubAsyncConsumer createConsumer(String consumerGroup, String partitionId, EventPosition eventPosition,
EventHubConsumerOptions options) {
Objects.requireNonNull(eventPosition);
Objects.requireNonNull(options);
+ Objects.requireNonNull(consumerGroup);
+ Objects.requireNonNull(partitionId);
if (ImplUtils.isNullOrEmpty(consumerGroup)) {
- throw new IllegalArgumentException("'consumerGroup' cannot be null or empty.");
+ throw new IllegalArgumentException("'consumerGroup' cannot be an empty string.");
}
if (ImplUtils.isNullOrEmpty(partitionId)) {
- throw new IllegalArgumentException("'partitionId' cannot be null or empty.");
+ throw new IllegalArgumentException("'partitionId' cannot be an empty string.");
}
final EventHubConsumerOptions clonedOptions = options.clone();
@@ -268,8 +270,6 @@ public EventHubAsyncConsumer createConsumer(String consumerGroup, String partiti
return connection.createSession(entityPath).cast(EventHubSession.class);
}).flatMap(session -> {
logger.verbose("Creating consumer for path: {}", entityPath);
-
- logger.verbose("Creating producer for {}", entityPath);
final RetryPolicy retryPolicy = RetryUtil.getRetryPolicy(clonedOptions.retry());
return session.createConsumer(linkName, entityPath, getExpression(eventPosition),
diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncProducer.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncProducer.java
index e4626ddf7045c..ca3eeef4db775 100644
--- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncProducer.java
+++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncProducer.java
@@ -90,6 +90,7 @@
* same partition because they all share the same {@link BatchOptions#partitionKey()}.
*
* {@codesnippet com.azure.messaging.eventhubs.eventhubasyncproducer.send#eventDataBatch}
+ *
* @see EventHubAsyncClient#createProducer()
*/
@Immutable
@@ -166,10 +167,13 @@ public Mono createBatch(BatchOptions options) {
/**
* Sends a single event to the associated Event Hub. If the size of the single event exceeds the maximum size
* allowed, an exception will be triggered and the send will fail.
+
*
* For more information regarding the maximum event size allowed, see
* Azure Event Hubs Quotas and
* Limits .
+ *
+ *
* @param event Event to send to the service.
*
* @return A {@link Mono} that completes when the event is pushed to the service.
@@ -183,11 +187,13 @@ public Mono send(EventData event) {
/**
* Sends a single event to the associated Event Hub with the send options. If the size of the single event exceeds
* the maximum size allowed, an exception will be triggered and the send will fail.
+ *
*
* For more information regarding the maximum event size allowed, see
* Azure Event Hubs Quotas and
* Limits .
- * @param event Event to send to the service.
+ *
+ * @param event Event to send to the service.
* @param options The set of options to consider when sending this event.
*
* @return A {@link Mono} that completes when the event is pushed to the service.
@@ -217,7 +223,7 @@ public Mono send(Iterable events) {
* Sends a set of events to the associated Event Hub using a batched approach. If the size of events exceed the
* maximum size of a single batch, an exception will be triggered and the send will fail. By default, the message
* size is the max amount allowed on the link.
- * @param events Events to send to the service.
+ * @param events Events to send to the service.
* @param options The set of options to consider when sending this batch.
*
* @return A {@link Mono} that completes when all events are pushed to the service.
diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClient.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClient.java
new file mode 100644
index 0000000000000..0311132951878
--- /dev/null
+++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClient.java
@@ -0,0 +1,184 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.messaging.eventhubs;
+
+import com.azure.core.amqp.RetryOptions;
+import com.azure.core.http.rest.IterableResponse;
+import com.azure.core.implementation.annotation.ReturnType;
+import com.azure.core.implementation.annotation.ServiceClient;
+import com.azure.core.implementation.annotation.ServiceMethod;
+import com.azure.messaging.eventhubs.implementation.ConnectionOptions;
+import com.azure.messaging.eventhubs.models.EventHubConsumerOptions;
+import com.azure.messaging.eventhubs.models.EventHubProducerOptions;
+import com.azure.messaging.eventhubs.models.EventPosition;
+
+import java.io.Closeable;
+import java.time.Duration;
+import java.util.Objects;
+
+/**
+ * The main point of interaction with Azure Event Hubs, the client offers a connection to a specific Event Hub within
+ * the Event Hubs namespace and offers operations for sending event data, receiving events, and inspecting the connected
+ * Event Hub.
+ *
+ *
+ * Creating a synchronous {@link EventHubClient} using an Event Hub instance connection string
+ *
+ *
+ * {@codesnippet com.azure.messaging.eventhubs.eventhubclient.instantiation}
+ *
+ * @see EventHubClientBuilder
+ * @see EventHubAsyncClient To communicate with Event Hub using an asynchronous client.
+ * @see About Azure Event Hubs
+ */
+@ServiceClient(builder = EventHubClientBuilder.class)
+public class EventHubClient implements Closeable {
+ private final EventHubAsyncClient client;
+ private final RetryOptions retry;
+ private final EventHubProducerOptions defaultProducerOptions;
+ private final EventHubConsumerOptions defaultConsumerOptions;
+
+ EventHubClient(EventHubAsyncClient client, ConnectionOptions connectionOptions) {
+ Objects.requireNonNull(connectionOptions);
+
+ this.client = Objects.requireNonNull(client);
+ this.retry = connectionOptions.retry();
+ this.defaultProducerOptions = new EventHubProducerOptions()
+ .retry(connectionOptions.retry());
+ this.defaultConsumerOptions = new EventHubConsumerOptions()
+ .retry(connectionOptions.retry())
+ .scheduler(connectionOptions.scheduler());
+ }
+
+ /**
+ * Retrieves information about an Event Hub, including the number of partitions present and their identifiers.
+ *
+ * @return The set of information for the Event Hub that this client is associated with.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public EventHubProperties getProperties() {
+ return client.getProperties().block(retry.tryTimeout());
+ }
+
+ /**
+ * Retrieves the identifiers for all the partitions of an Event Hub.
+ *
+ * @return The identifiers for all partitions of an Event Hub.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public IterableResponse getPartitionIds() {
+ return new IterableResponse<>(client.getPartitionIds());
+ }
+
+ /**
+ * Retrieves information about a specific partition for an Event Hub, including elements that describe the available
+ * events in the partition event stream.
+ *
+ * @param partitionId The unique identifier of a partition associated with the Event Hub.
+ * @return The information for the requested partition under the Event Hub this client is associated with.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public PartitionProperties getPartitionProperties(String partitionId) {
+ return client.getPartitionProperties(partitionId).block(retry.tryTimeout());
+ }
+
+ /**
+ * Creates an Event Hub producer responsible for transmitting {@link EventData} to the Event Hub, grouped together
+ * in batches. Event data is automatically routed to an available partition.
+ *
+ * @return A new {@link EventHubProducer}.
+ */
+ public EventHubProducer createProducer() {
+ return createProducer(defaultProducerOptions);
+ }
+
+ /**
+ * Creates an Event Hub producer responsible for transmitting {@link EventData} to the Event Hub, grouped together
+ * in batches. If {@link EventHubProducerOptions#partitionId() options.partitionId()} is not {@code null}, the
+ * events are routed to that specific partition. Otherwise, events are automatically routed to an available
+ * partition.
+ *
+ * @param options The set of options to apply when creating the producer.
+ * @return A new {@link EventHubProducer}.
+ * @throws NullPointerException if {@code options} is {@code null}.
+ */
+ public EventHubProducer createProducer(EventHubProducerOptions options) {
+ Objects.requireNonNull(options);
+
+ final EventHubAsyncProducer producer = client.createProducer(options);
+
+ final Duration tryTimeout = options.retry() != null && options.retry().tryTimeout() != null
+ ? options.retry().tryTimeout()
+ : defaultProducerOptions.retry().tryTimeout();
+
+ return new EventHubProducer(producer, tryTimeout);
+ }
+
+ /**
+ * Creates an Event Hub consumer responsible for reading {@link EventData} from a specific Event Hub partition, as a
+ * member of the specified consumer group, and begins reading events from the {@code eventPosition}.
+ *
+ * The consumer created is non-exclusive, allowing multiple consumers from the same consumer group to be actively
+ * reading events from the partition. These non-exclusive consumers are sometimes referred to as "Non-epoch
+ * Consumers".
+ *
+ * @param consumerGroup The name of the consumer group this consumer is associated with. Events are read in the
+ * context of this group. The name of the consumer group that is created by default is {@link
+ * EventHubAsyncClient#DEFAULT_CONSUMER_GROUP_NAME "$Default"}.
+ * @param partitionId The identifier of the Event Hub partition.
+ * @param eventPosition The position within the partition where the consumer should begin reading events.
+ * @return A new {@link EventHubConsumer} that receives events from the partition at the given position.
+ * @throws NullPointerException If {@code eventPosition}, {@code consumerGroup}, {@code partitionId}, or {@code
+ * options} is {@code null}.
+ * @throws IllegalArgumentException If {@code consumerGroup} or {@code partitionId} is an empty string.
+ */
+ public EventHubConsumer createConsumer(String consumerGroup, String partitionId, EventPosition eventPosition) {
+ final EventHubAsyncConsumer consumer = client.createConsumer(consumerGroup, partitionId, eventPosition);
+ return new EventHubConsumer(consumer, defaultConsumerOptions);
+ }
+
+ /**
+ * Creates an Event Hub consumer responsible for reading {@link EventData} from a specific Event Hub partition, as a
+ * member of the configured consumer group, and begins reading events from the specified {@code eventPosition}.
+ *
+ *
+ * A consumer may be exclusive, which asserts ownership over the partition for the consumer group to ensure that
+ * only one consumer from that group is reading from the partition. These exclusive consumers are sometimes referred
+ * to as "Epoch Consumers."
+ *
+ * A consumer may also be non-exclusive, allowing multiple consumers from the same consumer group to be actively
+ * reading events from the partition. These non-exclusive consumers are sometimes referred to as "Non-epoch
+ * Consumers."
+ *
+ * Designating a consumer as exclusive may be specified in the {@code options}, by setting {@link
+ * EventHubConsumerOptions#ownerLevel(Long)} to a non-null value. By default, consumers are created as
+ * non-exclusive.
+ *
+ *
+ * @param consumerGroup The name of the consumer group this consumer is associated with. Events are read in the
+ * context of this group. The name of the consumer group that is created by default is {@link
+ * EventHubAsyncClient#DEFAULT_CONSUMER_GROUP_NAME "$Default"}.
+ * @param partitionId The identifier of the Event Hub partition from which events will be received.
+ * @param eventPosition The position within the partition where the consumer should begin reading events.
+ * @param options The set of options to apply when creating the consumer.
+ * @return An new {@link EventHubConsumer} that receives events from the partition with all configured {@link
+ * EventHubConsumerOptions}.
+ * @throws NullPointerException If {@code eventPosition}, {@code consumerGroup}, {@code partitionId}, or {@code
+ * options} is {@code null}.
+ * @throws IllegalArgumentException If {@code consumerGroup} or {@code partitionId} is an empty string.
+ */
+ public EventHubConsumer createConsumer(String consumerGroup, String partitionId, EventPosition eventPosition,
+ EventHubConsumerOptions options) {
+ final EventHubAsyncConsumer consumer = client.createConsumer(consumerGroup, partitionId, eventPosition, options);
+ return new EventHubConsumer(consumer, options);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void close() {
+ client.close();
+ }
+}
diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java
index 8fd54fc4b7731..cdd80c591111c 100644
--- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java
+++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java
@@ -41,27 +41,27 @@
* #credential(String, String, TokenCredential)}, is required in order to construct an {@link EventHubAsyncClient}.
*
*
- * Creating an {@link EventHubAsyncClient} using Event Hubs namespace connection string
- *
- * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.connectionString#string-string}
- *
- * Creating an {@link EventHubAsyncClient} using Event Hub instance connection string
+ *
+ * Creating an asynchronous {@link EventHubAsyncClient} using Event Hubs namespace connection string
+ *
*
- * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.connectionstring#string}
+ * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string-string}
*
- * Creating an {@link EventHubAsyncClient} using Event Hub with no retry, different timeout and new
- * Scheduler
+ *
+ * Creating a synchronous {@link EventHubClient} using an Event Hub instance connection string
+ *
*
- * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.retry-timeout-scheduler}
+ * {@codesnippet com.azure.messaging.eventhubs.eventhubclient.instantiation}
*
- * Creating an {@link EventProcessor} instance using Event Hub instance connection
- * string
+ *
+ * Creating an {@link EventProcessor} using Event Hub instance connection string
+ *
* {@codesnippet com.azure.messaging.eventhubs.eventprocessor.instantiation}
*
* @see EventHubAsyncClient
* @see EventProcessor
*/
-@ServiceClientBuilder(serviceClients = {EventHubAsyncClient.class, EventProcessor.class})
+@ServiceClientBuilder(serviceClients = {EventHubAsyncClient.class, EventHubClient.class, EventProcessor.class})
public class EventHubClientBuilder {
private static final String AZURE_EVENT_HUBS_CONNECTION_STRING = "AZURE_EVENT_HUBS_CONNECTION_STRING";
@@ -277,74 +277,44 @@ public EventHubClientBuilder retry(RetryOptions retryOptions) {
* specified but the transport type is not {@link TransportType#AMQP_WEB_SOCKETS web sockets}.
*/
public EventHubAsyncClient buildAsyncClient() {
- configuration = configuration == null ? ConfigurationManager.getConfiguration().clone() : configuration;
-
- if (credentials == null) {
- final String connectionString = configuration.get(AZURE_EVENT_HUBS_CONNECTION_STRING);
-
- if (ImplUtils.isNullOrEmpty(connectionString)) {
- throw new IllegalArgumentException("Credentials have not been set using 'EventHubClientBuilder.credentials(String)'"
- + "EventHubClientBuilder.credentials(String, String, TokenCredential). And the connection string is"
- + "not set in the '" + AZURE_EVENT_HUBS_CONNECTION_STRING + "' environment variable.");
- }
-
- connectionString(connectionString);
- }
-
- if (retryOptions == null) {
- retryOptions = DEFAULT_RETRY;
- }
-
- // If the proxy has been configured by the user but they have overridden the TransportType with something that
- // is not AMQP_WEB_SOCKETS.
- if (proxyConfiguration != null && proxyConfiguration.isProxyAddressConfigured()
- && transport != TransportType.AMQP_WEB_SOCKETS) {
- throw new IllegalArgumentException("Cannot use a proxy when TransportType is not AMQP.");
- }
-
- if (proxyConfiguration == null) {
- proxyConfiguration = getDefaultProxyConfiguration(configuration);
- }
-
- if (scheduler == null) {
- scheduler = Schedulers.elastic();
- }
-
+ final ConnectionOptions connectionOptions = getConnectionOptions();
final ReactorProvider provider = new ReactorProvider();
final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(provider);
- final CBSAuthorizationType authorizationType = credentials instanceof EventHubSharedAccessKeyCredential
- ? CBSAuthorizationType.SHARED_ACCESS_SIGNATURE
- : CBSAuthorizationType.JSON_WEB_TOKEN;
- final ConnectionOptions parameters = new ConnectionOptions(host, eventHubName, credentials, authorizationType,
- transport, retryOptions, proxyConfiguration, scheduler);
- return new EventHubAsyncClient(parameters, provider, handlerProvider);
+ return new EventHubAsyncClient(connectionOptions, provider, handlerProvider);
}
- private ProxyConfiguration getDefaultProxyConfiguration(Configuration configuration) {
- ProxyAuthenticationType authentication = ProxyAuthenticationType.NONE;
- if (proxyConfiguration != null) {
- authentication = proxyConfiguration.authentication();
- }
-
- String proxyAddress = configuration.get(BaseConfigurations.HTTP_PROXY);
-
- if (ImplUtils.isNullOrEmpty(proxyAddress)) {
- return ProxyConfiguration.SYSTEM_DEFAULTS;
- }
-
- final String[] hostPort = proxyAddress.split(":");
- if (hostPort.length < 2) {
- throw new IllegalArgumentException("HTTP_PROXY cannot be parsed into a proxy");
- }
-
- final String host = hostPort[0];
- final int port = Integer.parseInt(hostPort[1]);
- final Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port));
- final String username = configuration.get(ProxyConfiguration.PROXY_USERNAME);
- final String password = configuration.get(ProxyConfiguration.PROXY_PASSWORD);
+ /**
+ * Creates a new {@link EventHubClient} based on options set on this builder. Every time {@code buildClient()}
+ * is invoked, a new instance of {@link EventHubClient} is created.
+ *
+ *
+ * The following options are used if ones are not specified in the builder:
+ *
+ *
+ * If no configuration is specified, the {@link ConfigurationManager#getConfiguration() global configuration}
+ * is used to provide any shared configuration values. The configuration values read are the {@link
+ * BaseConfigurations#HTTP_PROXY}, {@link ProxyConfiguration#PROXY_USERNAME}, and {@link
+ * ProxyConfiguration#PROXY_PASSWORD}.
+ * If no retry is specified, the default retry options are used.
+ * If no proxy is specified, the builder checks the {@link ConfigurationManager#getConfiguration() global
+ * configuration} for a configured proxy, then it checks to see if a system proxy is configured.
+ * If no timeout is specified, a {@link ClientConstants#OPERATION_TIMEOUT timeout of one minute} is used.
+ * If no scheduler is specified, an {@link Schedulers#elastic() elastic scheduler} is used.
+ *
+ *
+ * @return A new {@link EventHubClient} instance with all the configured options.
+ * @throws IllegalArgumentException if the credentials have not been set using either {@link
+ * #connectionString(String)} or {@link #credential(String, String, TokenCredential)}. Or, if a proxy is
+ * specified but the transport type is not {@link TransportType#AMQP_WEB_SOCKETS web sockets}.
+ */
+ public EventHubClient buildClient() {
+ final ConnectionOptions connectionOptions = getConnectionOptions();
+ final ReactorProvider provider = new ReactorProvider();
+ final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(provider);
+ final EventHubAsyncClient client = new EventHubAsyncClient(connectionOptions, provider, handlerProvider);
- return new ProxyConfiguration(authentication, proxy, username, password);
+ return new EventHubClient(client, connectionOptions);
}
/**
@@ -429,4 +399,72 @@ public EventProcessor buildEventProcessor() {
return new EventProcessor(buildAsyncClient(), this.consumerGroupName,
this.partitionProcessorFactory, initialEventPosition, partitionManager, eventHubName);
}
+
+ private ConnectionOptions getConnectionOptions() {
+ configuration = configuration == null ? ConfigurationManager.getConfiguration().clone() : configuration;
+
+ if (credentials == null) {
+ final String connectionString = configuration.get(AZURE_EVENT_HUBS_CONNECTION_STRING);
+
+ if (ImplUtils.isNullOrEmpty(connectionString)) {
+ throw new IllegalArgumentException("Credentials have not been set using 'EventHubClientBuilder.credentials(String)'"
+ + "EventHubClientBuilder.credentials(String, String, TokenCredential). And the connection string is"
+ + "not set in the '" + AZURE_EVENT_HUBS_CONNECTION_STRING + "' environment variable.");
+ }
+
+ connectionString(connectionString);
+ }
+
+ if (retryOptions == null) {
+ retryOptions = DEFAULT_RETRY;
+ }
+
+ // If the proxy has been configured by the user but they have overridden the TransportType with something that
+ // is not AMQP_WEB_SOCKETS.
+ if (proxyConfiguration != null && proxyConfiguration.isProxyAddressConfigured()
+ && transport != TransportType.AMQP_WEB_SOCKETS) {
+ throw new IllegalArgumentException("Cannot use a proxy when TransportType is not AMQP.");
+ }
+
+ if (proxyConfiguration == null) {
+ proxyConfiguration = getDefaultProxyConfiguration(configuration);
+ }
+
+ if (scheduler == null) {
+ scheduler = Schedulers.elastic();
+ }
+
+ final CBSAuthorizationType authorizationType = credentials instanceof EventHubSharedAccessKeyCredential
+ ? CBSAuthorizationType.SHARED_ACCESS_SIGNATURE
+ : CBSAuthorizationType.JSON_WEB_TOKEN;
+
+ return new ConnectionOptions(host, eventHubName, credentials, authorizationType,
+ transport, retryOptions, proxyConfiguration, scheduler);
+ }
+
+ private ProxyConfiguration getDefaultProxyConfiguration(Configuration configuration) {
+ ProxyAuthenticationType authentication = ProxyAuthenticationType.NONE;
+ if (proxyConfiguration != null) {
+ authentication = proxyConfiguration.authentication();
+ }
+
+ String proxyAddress = configuration.get(BaseConfigurations.HTTP_PROXY);
+
+ if (ImplUtils.isNullOrEmpty(proxyAddress)) {
+ return ProxyConfiguration.SYSTEM_DEFAULTS;
+ }
+
+ final String[] hostPort = proxyAddress.split(":");
+ if (hostPort.length < 2) {
+ throw new IllegalArgumentException("HTTP_PROXY cannot be parsed into a proxy");
+ }
+
+ final String host = hostPort[0];
+ final int port = Integer.parseInt(hostPort[1]);
+ final Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port));
+ final String username = configuration.get(ProxyConfiguration.PROXY_USERNAME);
+ final String password = configuration.get(ProxyConfiguration.PROXY_PASSWORD);
+
+ return new ProxyConfiguration(authentication, proxy, username, password);
+ }
}
diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubConsumer.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubConsumer.java
new file mode 100644
index 0000000000000..7650df110601e
--- /dev/null
+++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubConsumer.java
@@ -0,0 +1,75 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.messaging.eventhubs;
+
+import com.azure.core.http.rest.IterableResponse;
+import com.azure.messaging.eventhubs.models.EventHubConsumerOptions;
+import com.azure.messaging.eventhubs.models.EventPosition;
+import reactor.core.publisher.Flux;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.time.Duration;
+import java.util.Objects;
+
+/**
+ * A consumer responsible for reading {@link EventData} from a specific Event Hub partition in the context of a specific
+ * consumer group.
+ *
+ *
+ * If {@link EventHubConsumer} is created where {@link EventHubConsumerOptions#ownerLevel()} has a
+ * value, then Event Hubs service will guarantee only one active consumer exists per partitionId and consumer group
+ * combination. This consumer is sometimes referred to as an "Epoch Consumer."
+ * Multiple consumers per partitionId and consumer group combination can be created by not setting
+ * {@link EventHubConsumerOptions#ownerLevel()} when creating consumers. This non-exclusive consumer is sometimes
+ * referred to as a "Non-Epoch Consumer."
+ *
+ *
+ * @see EventHubClient#createConsumer(String, String, EventPosition)
+ * @see EventHubClient#createConsumer(String, String, EventPosition, EventHubConsumerOptions)
+ */
+public class EventHubConsumer implements Closeable {
+ private final EventHubAsyncConsumer consumer;
+ private final EventHubConsumerOptions options;
+
+ EventHubConsumer(EventHubAsyncConsumer consumer, EventHubConsumerOptions options) {
+ this.consumer = Objects.requireNonNull(consumer);
+ this.options = Objects.requireNonNull(options);
+
+ //TODO (conniey): Keep track of the last sequence number as each method invoked.
+ this.consumer.receive().windowTimeout(options.prefetchCount(), this.options.retry().tryTimeout());
+ }
+
+ /**
+ * Receives a batch of EventData from the Event Hub partition.
+ *
+ * @param maximumMessageCount The maximum number of messages to receive in this batch.
+ * @return A set of {@link EventData} that was received. The iterable contains up to {@code maximumMessageCount}
+ * events.
+ */
+ public IterableResponse receive(int maximumMessageCount) {
+ return new IterableResponse<>(Flux.empty());
+ }
+
+ /**
+ * Receives a batch of EventData from the Event Hub partition
+ *
+ * @param maximumMessageCount The maximum number of messages to receive in this batch.
+ * @param maximumWaitTime The maximum amount of time to wait to build up the requested message count for the
+ * batch; if not specified, the default wait time specified when the consumer was created will be used.
+ * @return A set of {@link EventData} that was received. The iterable contains up to {@code maximumMessageCount}
+ * events.
+ */
+ public IterableResponse receive(int maximumMessageCount, Duration maximumWaitTime) {
+ return new IterableResponse<>(Flux.empty());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void close() throws IOException {
+ consumer.close();
+ }
+}
diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProducer.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProducer.java
new file mode 100644
index 0000000000000..d71484492a9f6
--- /dev/null
+++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProducer.java
@@ -0,0 +1,198 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.messaging.eventhubs;
+
+import com.azure.core.implementation.annotation.Immutable;
+import com.azure.messaging.eventhubs.models.BatchOptions;
+import com.azure.messaging.eventhubs.models.EventHubProducerOptions;
+import com.azure.messaging.eventhubs.models.SendOptions;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.time.Duration;
+import java.util.Objects;
+
+/**
+ * A producer responsible for transmitting {@link EventData} to a specific Event Hub, grouped together in batches.
+ * Depending on the options specified at creation, the producer may be created to allow event data to be automatically
+ * routed to an available partition or specific to a partition.
+ *
+ *
+ * Allowing automatic routing of partitions is recommended when:
+ *
+ * The sending of events needs to be highly available.
+ * The event data should be evenly distributed among all available partitions.
+ *
+ *
+ *
+ *
+ * If no partition is specified, the following rules are used for automatically selecting one:
+ *
+ * Distribute the events equally amongst all available partitions using a round-robin approach.
+ * If a partition becomes unavailable, the Event Hubs service will automatically detect it and forward the
+ * message to another available partition.
+ *
+ *
+ *
+ * Create a producer that routes events to any partition
+ * To allow automatic routing of messages to available partition, do not specify the {@link
+ * EventHubProducerOptions#partitionId() partitionId} when creating the {@link EventHubProducer}.
+ *
+ * {@codesnippet com.azure.messaging.eventhubs.eventhubproducer.instantiation}
+ *
+ *
Create a producer that publishes events to partition "foo" with a timeout of 45 seconds.
+ *
+ * Developers can push events to a single partition by specifying the {@link EventHubProducerOptions#partitionId(String)
+ * partitionId} when creating an {@link EventHubProducer}.
+ *
+ * {@codesnippet com.azure.messaging.eventhubs.eventhubproducer.instantiation#partitionId}
+ *
+ *
Publish events to the same partition, grouped together using {@link SendOptions#partitionKey(String)}.
+ *
+ * If developers want to push similar events to end up at the same partition, but do not require them to go to a
+ * specific partition, they can use {@link SendOptions#partitionKey(String)}.
+ *
+ * In the sample below, all the "sandwiches" end up in the same partition, but it could end up in partition 0, 1, etc.
+ * of the available partitions. All that matters to the end user is that they are grouped together.
+ *
+ * {@codesnippet com.azure.messaging.eventhubs.eventhubproducer.send#publisher-sendOptions}
+ *
+ *
Publish events using an {@link EventDataBatch}.
+ *
+ * Developers can create an {@link EventDataBatch}, add the events they want into it, and publish these events together.
+ * When creating a {@link EventDataBatch batch}, developers can specify a set of {@link BatchOptions options} to
+ * configure this batch.
+ *
+ * In the scenario below, the developer is creating a networked video game. They want to receive telemetry about their
+ * users' gaming systems, but do not want to slow down the network with telemetry. So they limit the size of their
+ * {@link EventDataBatch batches} to be no larger than 256 bytes. The events within the batch also get hashed to the
+ * same partition because they all share the same {@link BatchOptions#partitionKey()}.
+ *
+ * {@codesnippet com.azure.messaging.eventhubs.eventhubproducer.send#eventDataBatch}
+ *
+ * @see EventHubClient#createProducer()
+ * @see EventHubAsyncProducer To asynchronously generate events to an Event Hub, see EventHubAsyncProducer.
+ */
+@Immutable
+public class EventHubProducer implements Closeable {
+ private final EventHubAsyncProducer producer;
+ private final Duration tryTimeout;
+
+ /**
+ * Creates a new instance of {@link EventHubProducer} that sends messages to an Azure Event Hub.
+ *
+ * @throws NullPointerException if {@code producer} or {@code tryTimeout} is null.
+ */
+ EventHubProducer(EventHubAsyncProducer producer, Duration tryTimeout) {
+ this.producer = Objects.requireNonNull(producer);
+ this.tryTimeout = Objects.requireNonNull(tryTimeout);
+ }
+
+ /**
+ * Creates an {@link EventDataBatch} that can fit as many events as the transport allows.
+ *
+ * @return A new {@link EventDataBatch} that can fit as many events as the transport allows.
+ */
+ public EventDataBatch createBatch() {
+ return producer.createBatch().block(tryTimeout);
+ }
+
+ /**
+ * Creates an {@link EventDataBatch} that can fit as many events as the transport allows.
+ *
+ * @param options A set of options used to configure the {@link EventDataBatch}.
+ * @return A new {@link EventDataBatch} that can fit as many events as the transport allows.
+ */
+ public EventDataBatch createBatch(BatchOptions options) {
+ return producer.createBatch(options).block(tryTimeout);
+ }
+
+ /**
+ * Sends a single event to the associated Event Hub. If the size of the single event exceeds the maximum size
+ * allowed, an exception will be triggered and the send will fail.
+ *
+ *
+ * For more information regarding the maximum event size allowed, see
+ * Azure Event Hubs Quotas and
+ * Limits .
+ *
+ *
+ * @param event Event to send to the service.
+ */
+ public void send(EventData event) {
+ producer.send(event).block();
+ }
+
+ /**
+ * Sends a single event to the associated Event Hub with the send options. If the size of the single event exceeds
+ * the maximum size allowed, an exception will be triggered and the send will fail.
+ *
+ *
+ * For more information regarding the maximum event size allowed, see
+ * Azure Event Hubs Quotas and
+ * Limits .
+ *
+ *
+ * @param event Event to send to the service.
+ * @param options The set of options to consider when sending this event.
+ */
+ public void send(EventData event, SendOptions options) {
+ producer.send(event, options).block();
+ }
+
+ /**
+ * Sends a set of events to the associated Event Hub using a batched approach. If the size of events exceed the
+ * maximum size of a single batch, an exception will be triggered and the send will fail. By default, the message
+ * size is the max amount allowed on the link.
+ *
+ *
+ * For more information regarding the maximum event size allowed, see
+ * Azure Event Hubs Quotas and
+ * Limits .
+ *
+ *
+ * @param events Events to send to the service.
+ */
+ public void send(Iterable events) {
+ producer.send(events).block();
+ }
+
+ /**
+ * Sends a set of events to the associated Event Hub using a batched approach. If the size of events exceed the
+ * maximum size of a single batch, an exception will be triggered and the send will fail. By default, the message
+ * size is the max amount allowed on the link.
+ *
+ *
+ * For more information regarding the maximum event size allowed, see
+ * Azure Event Hubs Quotas and
+ * Limits .
+ *
+ *
+ * @param events Events to send to the service.
+ * @param options The set of options to consider when sending this batch.
+ */
+ public void send(Iterable events, SendOptions options) {
+ producer.send(events, options).block();
+ }
+
+ /**
+ * Sends the batch to the associated Event Hub.
+ *
+ * @param batch The batch to send to the service.
+ * @throws NullPointerException if {@code batch} is {@code null}.
+ * @see EventHubProducer#createBatch()
+ * @see EventHubProducer#createBatch(BatchOptions)
+ */
+ public void send(EventDataBatch batch) {
+ producer.send(batch).block();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void close() throws IOException {
+ producer.close();
+ }
+}
diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncClientJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncClientJavaDocCodeSamples.java
index 99b1b75dfa203..796a0738b6c75 100644
--- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncClientJavaDocCodeSamples.java
+++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncClientJavaDocCodeSamples.java
@@ -3,11 +3,6 @@
package com.azure.messaging.eventhubs;
-import com.azure.core.amqp.RetryOptions;
-import reactor.core.scheduler.Schedulers;
-
-import java.time.Duration;
-
/**
* Contains code snippets when generating javadocs through doclets for {@link EventHubAsyncClient}.
*/
@@ -17,15 +12,15 @@ public class EventHubAsyncClientJavaDocCodeSamples {
* Creating an {@link EventHubAsyncClient} using an Event Hubs namespace connection string with an Event Hub name.
*/
public void instantiation() {
- // BEGIN: com.azure.messaging.eventhubs.eventhubasyncclient.connectionString#string-string
+ // BEGIN: com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string-string
String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};"
- + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}";
+ + "SharedAccessKey={sharedAccessKey}";
String eventHubName = "my-event-hub";
EventHubAsyncClient client = new EventHubClientBuilder()
.connectionString(connectionString, eventHubName)
.buildAsyncClient();
- // END: com.azure.messaging.eventhubs.eventhubasyncclient.connectionString#string-string
+ // END: com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string-string
client.close();
}
@@ -34,34 +29,14 @@ public void instantiation() {
* Creating an {@link EventHubAsyncClient} using a connection string specific to an Event Hub instance.
*/
public void instantiationInstance() {
- // BEGIN: com.azure.messaging.eventhubs.eventhubasyncclient.connectionstring#string
- String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};"
- + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}";
-
- EventHubAsyncClient client = new EventHubClientBuilder()
- .connectionString(connectionString)
- .buildAsyncClient();
- // END: com.azure.messaging.eventhubs.eventhubasyncclient.connectionstring#string
-
- client.close();
- }
-
- /**
- * Demonstrates an {@link EventHubClientBuilder} using retry, timeout and a different scheduler.
- */
- public void instantiationRetry() {
- // BEGIN: com.azure.messaging.eventhubs.eventhubasyncclient.retry-timeout-scheduler
+ // BEGIN: com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string
String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};"
+ "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}";
- RetryOptions retryOptions = new RetryOptions()
- .tryTimeout(Duration.ofSeconds(30));
EventHubAsyncClient client = new EventHubClientBuilder()
.connectionString(connectionString)
- .retry(retryOptions)
- .scheduler(Schedulers.newElastic("dedicated-event-hub-scheduler"))
.buildAsyncClient();
- // END: com.azure.messaging.eventhubs.eventhubasyncclient.retry-timeout-scheduler
+ // END: com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string
client.close();
}
diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncProducerJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncProducerJavaDocCodeSamples.java
index 1c00ee7e23e5e..f176ebb2825e9 100644
--- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncProducerJavaDocCodeSamples.java
+++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncProducerJavaDocCodeSamples.java
@@ -22,7 +22,8 @@ public class EventHubAsyncProducerJavaDocCodeSamples {
private final EventHubAsyncClient client = new EventHubClientBuilder().connectionString("fake-string").buildAsyncClient();
/**
- * Code snippet demonstrating how to create an EventHubProducer that automatically routes events to any partition.
+ * Code snippet demonstrating how to create an {@link EventHubAsyncProducer} that automatically routes events to any
+ * partition.
*
* @throws IOException if the producer cannot be disposed.
*/
@@ -39,7 +40,8 @@ public void instantiate() throws IOException {
}
/**
- * Code snippet demonstrating how to create an EventHubProducer that routes events to a single partition.
+ * Code snippet demonstrating how to create an {@link EventHubAsyncProducer} that routes events to a single
+ * partition.
*
* @throws IOException if the producer cannot be disposed.
*/
diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubClientJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubClientJavaDocCodeSamples.java
new file mode 100644
index 0000000000000..c4f947fd78c4b
--- /dev/null
+++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubClientJavaDocCodeSamples.java
@@ -0,0 +1,26 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.messaging.eventhubs;
+
+/**
+ * Contains code snippets when generating javadocs through doclets for {@link EventHubClient}.
+ */
+public class EventHubClientJavaDocCodeSamples {
+ /**
+ * Creating an {@link EventHubClient} using a connection string specific to an Event Hub instance with different
+ * retry options.
+ */
+ public void instantiation() {
+ // BEGIN: com.azure.messaging.eventhubs.eventhubclient.instantiation
+ String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};"
+ + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}";
+
+ EventHubClient client = new EventHubClientBuilder()
+ .connectionString(connectionString)
+ .buildClient();
+ // END: com.azure.messaging.eventhubs.eventhubclient.instantiation
+
+ client.close();
+ }
+}
diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubProducerJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubProducerJavaDocCodeSamples.java
new file mode 100644
index 0000000000000..a525234d4bad4
--- /dev/null
+++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubProducerJavaDocCodeSamples.java
@@ -0,0 +1,111 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.messaging.eventhubs;
+
+import com.azure.core.amqp.RetryOptions;
+import com.azure.messaging.eventhubs.models.BatchOptions;
+import com.azure.messaging.eventhubs.models.EventHubProducerOptions;
+import com.azure.messaging.eventhubs.models.SendOptions;
+
+import java.io.IOException;
+import java.time.Duration;
+import java.util.Arrays;
+import java.util.List;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+/**
+ * Contains code snippets when generating javadocs through doclets for {@link EventHubProducer}.
+ */
+public class EventHubProducerJavaDocCodeSamples {
+ private final EventHubClient client = new EventHubClientBuilder()
+ .connectionString("fake-string")
+ .buildClient();
+
+ /**
+ * Code snippet demonstrating how to create an {@link EventHubProducer} that automatically routes events to any
+ * partition.
+ *
+ * @throws IOException if the producer cannot be disposed.
+ */
+ public void instantiate() throws IOException {
+ // BEGIN: com.azure.messaging.eventhubs.eventhubproducer.instantiation
+ EventHubClient client = new EventHubClientBuilder()
+ .connectionString("event-hubs-namespace-connection-string", "event-hub-name")
+ .buildClient();
+
+ EventHubProducer producer = client.createProducer();
+ // END: com.azure.messaging.eventhubs.eventhubproducer.instantiation
+
+ producer.close();
+ }
+
+ /**
+ * Code snippet demonstrating how to create an {@link EventHubProducer} that routes events to a single partition.
+ *
+ * @throws IOException if the producer cannot be disposed.
+ */
+ public void instantiatePartitionProducer() throws IOException {
+ // BEGIN: com.azure.messaging.eventhubs.eventhubproducer.instantiation#partitionId
+ RetryOptions retryOptions = new RetryOptions()
+ .tryTimeout(Duration.ofSeconds(45));
+ EventHubProducerOptions options = new EventHubProducerOptions()
+ .partitionId("foo")
+ .retry(retryOptions);
+
+ EventHubProducer producer = client.createProducer(options);
+ // END: com.azure.messaging.eventhubs.eventhubproducer.instantiation#partitionId
+
+ producer.close();
+ }
+
+ /**
+ * Code snippet demonstrating how to send events with a partition key.
+ */
+ public void sendEventsSendOptions() {
+ // BEGIN: com.azure.messaging.eventhubs.eventhubproducer.send#publisher-sendOptions
+ final List events = Arrays.asList(
+ new EventData("sourdough".getBytes(UTF_8)),
+ new EventData("rye".getBytes(UTF_8)),
+ new EventData("wheat".getBytes(UTF_8))
+ );
+
+ final EventHubProducer producer = client.createProducer();
+ final SendOptions options = new SendOptions()
+ .partitionKey("bread");
+
+ producer.send(events, options);
+ // END: com.azure.messaging.eventhubs.eventhubproducer.send#publisher-sendOptions
+ }
+
+ /**
+ * Code snippet demonstrating how to create an {@link EventDataBatch} and send it.
+ */
+ public void sendEventDataBatch() {
+ final EventHubProducer producer = client.createProducer();
+
+ // BEGIN: com.azure.messaging.eventhubs.eventhubproducer.send#eventDataBatch
+ final List telemetryEvents = Arrays.asList(
+ new EventData("92".getBytes(UTF_8)).addProperty("telemetry", "latency"),
+ new EventData("98".getBytes(UTF_8)).addProperty("telemetry", "cpu-temperature"),
+ new EventData("120".getBytes(UTF_8)).addProperty("telemetry", "fps")
+ );
+
+ final BatchOptions options = new BatchOptions()
+ .partitionKey("telemetry")
+ .maximumSizeInBytes(256);
+
+ EventDataBatch currentBatch = producer.createBatch(options);
+
+ // For each telemetry event, we try to add it to the current batch.
+ // When the batch is full, send it then create another batch to add more events to.
+ for (EventData event : telemetryEvents) {
+ if (!currentBatch.tryAdd(event)) {
+ producer.send(currentBatch);
+ currentBatch = producer.createBatch(options);
+ }
+ }
+ // END: com.azure.messaging.eventhubs.eventhubproducer.send#eventDataBatch
+ }
+}
diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncClientIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncClientIntegrationTest.java
new file mode 100644
index 0000000000000..c6f2c028eeeaa
--- /dev/null
+++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncClientIntegrationTest.java
@@ -0,0 +1,204 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.messaging.eventhubs;
+
+import com.azure.core.amqp.TransportType;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.messaging.eventhubs.implementation.ApiTestBase;
+import com.azure.messaging.eventhubs.implementation.ConnectionOptions;
+import com.azure.messaging.eventhubs.implementation.ReactorHandlerProvider;
+import com.azure.messaging.eventhubs.models.EventHubConsumerOptions;
+import com.azure.messaging.eventhubs.models.EventHubProducerOptions;
+import com.azure.messaging.eventhubs.models.EventPosition;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import reactor.core.Disposable;
+import reactor.core.Disposables;
+import reactor.core.publisher.Flux;
+import reactor.test.StepVerifier;
+
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
+
+import static com.azure.messaging.eventhubs.EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME;
+import static com.azure.messaging.eventhubs.TestUtils.isMatchingEvent;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+/**
+ * Tests scenarios on {@link EventHubAsyncClient}.
+ */
+@RunWith(Parameterized.class)
+public class EventHubAsyncClientIntegrationTest extends ApiTestBase {
+ private static final int NUMBER_OF_EVENTS = 5;
+
+ @Parameterized.Parameters(name = "{index}: transportType={0}")
+ public static Iterable getTransportTypes() {
+ return Arrays.asList(TransportType.AMQP, TransportType.AMQP_WEB_SOCKETS);
+ }
+
+ private static final String PARTITION_ID = "1";
+ private static final AtomicBoolean HAS_PUSHED_EVENTS = new AtomicBoolean();
+ private static final AtomicReference MESSAGES_PUSHED_INSTANT = new AtomicReference<>();
+ private static final String MESSAGE_TRACKING_VALUE = UUID.randomUUID().toString();
+
+ private EventHubAsyncClient client;
+
+ @Rule
+ public TestName testName = new TestName();
+
+ public EventHubAsyncClientIntegrationTest(TransportType transportType) {
+ super(new ClientLogger(EventHubAsyncClientIntegrationTest.class));
+
+ setTransportType(transportType);
+ }
+
+ @Override
+ protected String testName() {
+ return testName.getMethodName();
+ }
+
+ @Override
+ protected void beforeTest() {
+ skipIfNotRecordMode();
+
+ final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider());
+ final ConnectionOptions connectionOptions = getConnectionOptions();
+
+ client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider);
+
+ setupEventTestData(client);
+ }
+
+ @Override
+ protected void afterTest() {
+ dispose(client);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void nullConstructor() throws NullPointerException {
+ new EventHubAsyncClient(null, null, null);
+ }
+
+ /**
+ * Verifies that we can receive messages, and that the receiver continues to fetch messages when the prefetch queue
+ * is exhausted.
+ */
+ @Test
+ public void receiveMessage() {
+ // Arrange
+ final EventHubConsumerOptions options = new EventHubConsumerOptions()
+ .prefetchCount(2);
+ final EventHubAsyncConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID,
+ EventPosition.fromEnqueuedTime(MESSAGES_PUSHED_INSTANT.get()), options);
+
+ // Act & Assert
+ StepVerifier.create(consumer.receive().filter(x -> isMatchingEvent(x, MESSAGE_TRACKING_VALUE)).take(NUMBER_OF_EVENTS))
+ .expectNextCount(NUMBER_OF_EVENTS)
+ .verifyComplete();
+ }
+
+ /**
+ * Verifies that we can have multiple consumers listening to the same partition + consumer group at the same time.
+ */
+ @Ignore("Investigate. Only 2 of the 4 consumers get the events. The other two consumers do not.")
+ @Test
+ public void parallelEventHubClients() throws InterruptedException {
+ skipIfNotRecordMode();
+
+ // Arrange
+ final int numberOfClients = 4;
+ final int numberOfEvents = 10;
+ final String messageTrackingId = "message-tracking-id";
+ final String messageTrackingValue = UUID.randomUUID().toString();
+ final Flux events = Flux.range(0, numberOfEvents).map(number -> {
+ final EventData eventData = new EventData("testString".getBytes(UTF_8));
+ eventData.addProperty(messageTrackingId, messageTrackingValue);
+ return eventData;
+ });
+
+ final CountDownLatch countDownLatch = new CountDownLatch(numberOfClients);
+ final EventHubAsyncClient[] clients = new EventHubAsyncClient[numberOfClients];
+ for (int i = 0; i < numberOfClients; i++) {
+ clients[i] = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), new ReactorHandlerProvider(getReactorProvider()));
+ }
+
+ final EventHubAsyncProducer producer = clients[0].createProducer(new EventHubProducerOptions().partitionId(PARTITION_ID));
+ final List consumers = new ArrayList<>();
+ final Disposable.Composite subscriptions = Disposables.composite();
+
+ try {
+ for (final EventHubAsyncClient hubClient : clients) {
+ final EventHubAsyncConsumer consumer = hubClient.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, EventPosition.latest());
+ consumers.add(consumer);
+
+ final Disposable subscription = consumer.receive().filter(event -> {
+ return event.properties() != null
+ && event.properties().containsKey(messageTrackingId)
+ && messageTrackingValue.equals(event.properties().get(messageTrackingId));
+ }).take(numberOfEvents).subscribe(event -> {
+ logger.info("Event[{}] matched.", event.sequenceNumber());
+ }, error -> Assert.fail("An error should not have occurred:" + error.toString()), () -> {
+ long count = countDownLatch.getCount();
+ logger.info("Finished consuming events. Counting down: {}", count);
+ countDownLatch.countDown();
+ });
+
+ subscriptions.add(subscription);
+ }
+
+ // Act
+ producer.send(events).block(TIMEOUT);
+
+ // Assert
+ // Wait for all the events we sent to be received by each of the consumers.
+ countDownLatch.await(TIMEOUT.getSeconds(), TimeUnit.SECONDS);
+ Assert.assertEquals(0, countDownLatch.getCount());
+
+ logger.info("Completed successfully.");
+ } finally {
+ logger.info("Disposing of subscriptions, consumers and clients.");
+ subscriptions.dispose();
+
+ dispose(producer);
+ dispose(consumers.toArray(new EventHubAsyncConsumer[0]));
+ dispose(clients);
+ }
+ }
+
+ /**
+ * When we run this test, we check if there have been events already pushed to the partition, if not, we push some
+ * events there.
+ */
+ private void setupEventTestData(EventHubAsyncClient client) {
+ if (HAS_PUSHED_EVENTS.getAndSet(true)) {
+ logger.info("Already pushed events to partition. Skipping.");
+ return;
+ }
+
+ logger.info("Pushing events to partition. Message tracking value: {}", MESSAGE_TRACKING_VALUE);
+
+ final EventHubProducerOptions producerOptions = new EventHubProducerOptions().partitionId(PARTITION_ID);
+ final EventHubAsyncProducer producer = client.createProducer(producerOptions);
+ final Flux events = TestUtils.getEvents(NUMBER_OF_EVENTS, MESSAGE_TRACKING_VALUE);
+
+ try {
+ MESSAGES_PUSHED_INSTANT.set(Instant.now());
+ producer.send(events).block(TIMEOUT);
+ } finally {
+ dispose(producer);
+ }
+ }
+}
diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerIntegrationTest.java
index 11b676fdffa5e..1741a14c08c76 100644
--- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerIntegrationTest.java
+++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerIntegrationTest.java
@@ -3,15 +3,10 @@
package com.azure.messaging.eventhubs;
-import com.azure.core.amqp.TransportType;
import com.azure.core.util.logging.ClientLogger;
import com.azure.messaging.eventhubs.implementation.ApiTestBase;
-import com.azure.messaging.eventhubs.implementation.ConnectionOptions;
-import com.azure.messaging.eventhubs.implementation.ConnectionStringProperties;
-import com.azure.messaging.eventhubs.implementation.ReactorHandlerProvider;
import com.azure.messaging.eventhubs.models.BatchOptions;
import com.azure.messaging.eventhubs.models.EventHubProducerOptions;
-import com.azure.messaging.eventhubs.models.ProxyConfiguration;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
@@ -45,13 +40,13 @@ protected String testName() {
@Override
protected void beforeTest() {
- final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider());
- final ConnectionStringProperties properties = new ConnectionStringProperties(getConnectionString());
- final ConnectionOptions connectionOptions = new ConnectionOptions(properties.endpoint().getHost(),
- properties.eventHubName(), getTokenCredential(), getAuthorizationType(), TransportType.AMQP, RETRY_OPTIONS,
- ProxyConfiguration.SYSTEM_DEFAULTS, Schedulers.parallel());
+ skipIfNotRecordMode();
- client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider);
+ client = new EventHubClientBuilder()
+ .connectionString(getConnectionString())
+ .retry(RETRY_OPTIONS)
+ .scheduler(Schedulers.parallel())
+ .buildAsyncClient();
}
@Override
@@ -64,8 +59,6 @@ protected void afterTest() {
*/
@Test
public void sendMessageToPartition() throws IOException {
- skipIfNotRecordMode();
-
// Arrange
final EventHubProducerOptions producerOptions = new EventHubProducerOptions().partitionId(PARTITION_ID);
final List events = Arrays.asList(
@@ -86,8 +79,6 @@ public void sendMessageToPartition() throws IOException {
*/
@Test
public void sendMessage() throws IOException {
- skipIfNotRecordMode();
-
// Arrange
final List events = Arrays.asList(
new EventData("Event 1".getBytes(UTF_8)),
@@ -106,8 +97,6 @@ public void sendMessage() throws IOException {
*/
@Test
public void sendBatch() throws IOException {
- skipIfNotRecordMode();
-
// Arrange
final List events = Arrays.asList(
new EventData("Event 1".getBytes(UTF_8)),
@@ -134,8 +123,6 @@ public void sendBatch() throws IOException {
*/
@Test
public void sendBatchWithPartitionKey() throws IOException {
- skipIfNotRecordMode();
-
// Arrange
final List events = Arrays.asList(
new EventData("Event 1".getBytes(UTF_8)),
diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerTest.java
index eaf3bc89e17a8..76892d08ac551 100644
--- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerTest.java
+++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerTest.java
@@ -68,7 +68,7 @@ public void teardown() {
public void sendMultipleMessages() {
// Arrange
final int count = 4;
- final byte[] contents = CONTENTS.getBytes(UTF_8);
+ final byte[] contents = TEST_CONTENTS.getBytes(UTF_8);
final Flux testData = Flux.range(0, count).flatMap(number -> {
final EventData data = new EventData(contents);
return Flux.just(data);
@@ -100,7 +100,7 @@ public void sendMultipleMessages() {
@Test
public void sendSingleMessage() {
// Arrange
- final EventData testData = new EventData(CONTENTS.getBytes(UTF_8));
+ final EventData testData = new EventData(TEST_CONTENTS.getBytes(UTF_8));
when(sendLink.send(any(Message.class))).thenReturn(Mono.empty());
@@ -128,8 +128,8 @@ public void sendSingleMessage() {
public void partitionProducerCannotSendWithPartitionKey() {
// Arrange
final Flux testData = Flux.just(
- new EventData(CONTENTS.getBytes(UTF_8)),
- new EventData(CONTENTS.getBytes(UTF_8)));
+ new EventData(TEST_CONTENTS.getBytes(UTF_8)),
+ new EventData(TEST_CONTENTS.getBytes(UTF_8)));
when(sendLink.send(anyList())).thenReturn(Mono.empty());
@@ -163,7 +163,7 @@ public void sendTooManyMessages() {
// We believe 20 events is enough for that EventDataBatch to be greater than max size.
final Flux testData = Flux.range(0, 20).flatMap(number -> {
- final EventData data = new EventData(CONTENTS.getBytes(UTF_8));
+ final EventData data = new EventData(TEST_CONTENTS.getBytes(UTF_8));
return Flux.just(data);
});
@@ -378,7 +378,7 @@ public void sendsAnEventDataBatch() {
verify(link, times(2)).getLinkSize();
}
- private static final String CONTENTS = "SSLorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vehicula posuere lobortis. Aliquam finibus volutpat dolor, faucibus pellentesque ipsum bibendum vitae. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut sit amet urna hendrerit, dapibus justo a, sodales justo. Mauris finibus augue id pulvinar congue. Nam maximus luctus ipsum, at commodo ligula euismod ac. Phasellus vitae lacus sit amet diam porta placerat. \n"
+ static final String TEST_CONTENTS = "SSLorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vehicula posuere lobortis. Aliquam finibus volutpat dolor, faucibus pellentesque ipsum bibendum vitae. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut sit amet urna hendrerit, dapibus justo a, sodales justo. Mauris finibus augue id pulvinar congue. Nam maximus luctus ipsum, at commodo ligula euismod ac. Phasellus vitae lacus sit amet diam porta placerat. \n"
+ "Ut sodales efficitur sapien ut posuere. Morbi sed tellus est. Proin eu erat purus. Proin massa nunc, condimentum id iaculis dignissim, consectetur et odio. Cras suscipit sem eu libero aliquam tincidunt. Nullam ut arcu suscipit, eleifend velit in, cursus libero. Ut eleifend facilisis odio sit amet feugiat. Phasellus at nunc sit amet elit sagittis commodo ac in nisi. Fusce vitae aliquam quam. Integer vel nibh euismod, tempus elit vitae, pharetra est. Duis vulputate enim a elementum dignissim. Morbi dictum enim id elit scelerisque, in elementum nulla pharetra. \n"
+ "Aenean aliquet aliquet condimentum. Proin dapibus dui id libero tempus feugiat. Sed commodo ligula a lectus mattis, vitae tincidunt velit auctor. Fusce quis semper dui. Phasellus eu efficitur sem. Ut non sem sit amet enim condimentum venenatis id dictum massa. Nullam sagittis lacus a neque sodales, et ultrices arcu mattis. Aliquam erat volutpat. \n"
+ "Aenean fringilla quam elit, id mattis purus vestibulum nec. Praesent porta eros in dapibus molestie. Vestibulum orci libero, tincidunt et turpis eget, condimentum lobortis enim. Fusce suscipit ante et mauris consequat cursus nec laoreet lorem. Maecenas in sollicitudin diam, non tincidunt purus. Nunc mauris purus, laoreet eget interdum vitae, placerat a sapien. In mi risus, blandit eu facilisis nec, molestie suscipit leo. Pellentesque molestie urna vitae dui faucibus bibendum. \n"
diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientIntegrationTest.java
index 83eb91c703269..db8edc51cc50d 100644
--- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientIntegrationTest.java
+++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientIntegrationTest.java
@@ -3,66 +3,27 @@
package com.azure.messaging.eventhubs;
-import com.azure.core.amqp.TransportType;
+import com.azure.core.http.rest.IterableResponse;
import com.azure.core.util.logging.ClientLogger;
import com.azure.messaging.eventhubs.implementation.ApiTestBase;
-import com.azure.messaging.eventhubs.implementation.ConnectionOptions;
-import com.azure.messaging.eventhubs.implementation.ReactorHandlerProvider;
-import com.azure.messaging.eventhubs.models.EventHubConsumerOptions;
-import com.azure.messaging.eventhubs.models.EventHubProducerOptions;
-import com.azure.messaging.eventhubs.models.EventPosition;
+import com.azure.messaging.eventhubs.implementation.ConnectionStringProperties;
import org.junit.Assert;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import reactor.core.Disposable;
-import reactor.core.Disposables;
-import reactor.core.publisher.Flux;
-import reactor.test.StepVerifier;
import java.time.Instant;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
-
-import static com.azure.messaging.eventhubs.EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME;
-import static com.azure.messaging.eventhubs.TestUtils.isMatchingEvent;
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-/**
- * Tests scenarios on {@link EventHubAsyncClient}.
- */
-@RunWith(Parameterized.class)
-public class EventHubClientIntegrationTest extends ApiTestBase {
- private static final int NUMBER_OF_EVENTS = 5;
-
- @Parameterized.Parameters(name = "{index}: transportType={0}")
- public static Iterable getTransportTypes() {
- return Arrays.asList(TransportType.AMQP, TransportType.AMQP_WEB_SOCKETS);
- }
+import java.util.stream.Collectors;
- private static final String PARTITION_ID = "1";
- private static final AtomicBoolean HAS_PUSHED_EVENTS = new AtomicBoolean();
- private static final AtomicReference MESSAGES_PUSHED_INSTANT = new AtomicReference<>();
- private static final String MESSAGE_TRACKING_VALUE = UUID.randomUUID().toString();
-
- private EventHubAsyncClient client;
+public class EventHubClientIntegrationTest extends ApiTestBase {
+ private EventHubClient client;
@Rule
public TestName testName = new TestName();
- public EventHubClientIntegrationTest(TransportType transportType) {
+ public EventHubClientIntegrationTest() {
super(new ClientLogger(EventHubClientIntegrationTest.class));
-
- setTransportType(transportType);
}
@Override
@@ -74,12 +35,10 @@ protected String testName() {
protected void beforeTest() {
skipIfNotRecordMode();
- final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider());
- final ConnectionOptions connectionOptions = getConnectionOptions();
-
- client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider);
-
- setupEventTestData(client);
+ client = new EventHubClientBuilder()
+ .connectionString(getConnectionString())
+ .retry(RETRY_OPTIONS)
+ .buildClient();
}
@Override
@@ -87,118 +46,58 @@ protected void afterTest() {
dispose(client);
}
- @Test(expected = NullPointerException.class)
- public void nullConstructor() throws NullPointerException {
- new EventHubAsyncClient(null, null, null);
- }
-
/**
- * Verifies that we can receive messages, and that the receiver continues to fetch messages when the prefetch queue
- * is exhausted.
+ * Verifies we can get partition ids of an Event Hub.
*/
@Test
- public void receiveMessage() {
- // Arrange
- final EventHubConsumerOptions options = new EventHubConsumerOptions()
- .prefetchCount(2);
- final EventHubAsyncConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID,
- EventPosition.fromEnqueuedTime(MESSAGES_PUSHED_INSTANT.get()), options);
-
- // Act & Assert
- StepVerifier.create(consumer.receive().filter(x -> isMatchingEvent(x, MESSAGE_TRACKING_VALUE)).take(NUMBER_OF_EVENTS))
- .expectNextCount(NUMBER_OF_EVENTS)
- .verifyComplete();
+ public void getPartitionIds() {
+ // Act
+ final IterableResponse response = client.getPartitionIds();
+
+ // Assert
+ Assert.assertNotNull(response);
+
+ final List partitionIds = response.stream().collect(Collectors.toList());
+ Assert.assertTrue(partitionIds.size() > 1);
}
/**
- * Verifies that we can have multiple consumers listening to the same partition + consumer group at the same time.
+ * Verifies we can get partition ids of an Event Hub.
*/
- @Ignore("Investigate. Only 2 of the 4 consumers get the events. The other two consumers do not.")
@Test
- public void parallelEventHubClients() throws InterruptedException {
- skipIfNotRecordMode();
-
+ public void getMetadata() {
// Arrange
- final int numberOfClients = 4;
- final int numberOfEvents = 10;
- final String messageTrackingId = "message-tracking-id";
- final String messageTrackingValue = UUID.randomUUID().toString();
- final Flux events = Flux.range(0, numberOfEvents).map(number -> {
- final EventData eventData = new EventData("testString".getBytes(UTF_8));
- eventData.addProperty(messageTrackingId, messageTrackingValue);
- return eventData;
- });
-
- final CountDownLatch countDownLatch = new CountDownLatch(numberOfClients);
- final EventHubAsyncClient[] clients = new EventHubAsyncClient[numberOfClients];
- for (int i = 0; i < numberOfClients; i++) {
- clients[i] = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), new ReactorHandlerProvider(getReactorProvider()));
- }
-
- final EventHubAsyncProducer producer = clients[0].createProducer(new EventHubProducerOptions().partitionId(PARTITION_ID));
- final List consumers = new ArrayList<>();
- final Disposable.Composite subscriptions = Disposables.composite();
-
- try {
- for (final EventHubAsyncClient hubClient : clients) {
- final EventHubAsyncConsumer consumer = hubClient.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, EventPosition.latest());
- consumers.add(consumer);
-
- final Disposable subscription = consumer.receive().filter(event -> {
- return event.properties() != null
- && event.properties().containsKey(messageTrackingId)
- && messageTrackingValue.equals(event.properties().get(messageTrackingId));
- }).take(numberOfEvents).subscribe(event -> {
- logger.info("Event[{}] matched.", event.sequenceNumber());
- }, error -> Assert.fail("An error should not have occurred:" + error.toString()), () -> {
- long count = countDownLatch.getCount();
- logger.info("Finished consuming events. Counting down: {}", count);
- countDownLatch.countDown();
- });
-
- subscriptions.add(subscription);
- }
-
- // Act
- producer.send(events).block(TIMEOUT);
-
- // Assert
- // Wait for all the events we sent to be received by each of the consumers.
- countDownLatch.await(TIMEOUT.getSeconds(), TimeUnit.SECONDS);
- Assert.assertEquals(0, countDownLatch.getCount());
-
- logger.info("Completed successfully.");
- } finally {
- logger.info("Disposing of subscriptions, consumers and clients.");
- subscriptions.dispose();
-
- dispose(producer);
- dispose(consumers.toArray(new EventHubAsyncConsumer[0]));
- dispose(clients);
- }
+ final ConnectionStringProperties connectionProperties = getConnectionStringProperties();
+
+ // Act
+ final EventHubProperties properties = client.getProperties();
+
+ // Assert
+ Assert.assertNotNull(properties);
+ Assert.assertEquals(connectionProperties.eventHubName(), properties.name());
+ Assert.assertTrue(properties.createdAt().isBefore(Instant.now()));
+
+ Assert.assertNotNull(properties.partitionIds());
+ Assert.assertTrue(properties.partitionIds().length > 1);
}
/**
- * When we run this test, we check if there have been events already pushed to the partition, if not, we push some
- * events there.
+ * Verifies we can get partition ids of an Event Hub.
*/
- private void setupEventTestData(EventHubAsyncClient client) {
- if (HAS_PUSHED_EVENTS.getAndSet(true)) {
- logger.info("Already pushed events to partition. Skipping.");
- return;
- }
-
- logger.info("Pushing events to partition. Message tracking value: {}", MESSAGE_TRACKING_VALUE);
-
- final EventHubProducerOptions producerOptions = new EventHubProducerOptions().partitionId(PARTITION_ID);
- final EventHubAsyncProducer producer = client.createProducer(producerOptions);
- final Flux events = TestUtils.getEvents(NUMBER_OF_EVENTS, MESSAGE_TRACKING_VALUE);
-
- try {
- MESSAGES_PUSHED_INSTANT.set(Instant.now());
- producer.send(events).block(TIMEOUT);
- } finally {
- dispose(producer);
- }
+ @Test
+ public void getPartitionProperties() {
+ // Arrange
+ final ConnectionStringProperties connectionProperties = getConnectionStringProperties();
+ final EventHubProperties properties = client.getProperties();
+ final String partitionId = properties.partitionIds()[0];
+
+ // Act
+ final PartitionProperties partitionProperties = client.getPartitionProperties(partitionId);
+
+ // Assert
+ Assert.assertNotNull(partitionProperties);
+
+ Assert.assertEquals(connectionProperties.eventHubName(), partitionProperties.eventHubName());
+ Assert.assertEquals(partitionId, partitionProperties.id());
}
}
diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerIntegrationTest.java
new file mode 100644
index 0000000000000..524d7981611e6
--- /dev/null
+++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerIntegrationTest.java
@@ -0,0 +1,135 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.messaging.eventhubs;
+
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.messaging.eventhubs.implementation.ApiTestBase;
+import com.azure.messaging.eventhubs.models.BatchOptions;
+import com.azure.messaging.eventhubs.models.EventHubProducerOptions;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+import reactor.core.scheduler.Schedulers;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+public class EventHubProducerIntegrationTest extends ApiTestBase {
+ private static final String PARTITION_ID = "1";
+ private EventHubClient client;
+
+ public EventHubProducerIntegrationTest() {
+ super(new ClientLogger(EventHubProducerIntegrationTest.class));
+ }
+
+ @Rule
+ public TestName testName = new TestName();
+
+ @Override
+ protected String testName() {
+ return testName.getMethodName();
+ }
+
+ @Override
+ protected void beforeTest() {
+ skipIfNotRecordMode();
+
+ client = new EventHubClientBuilder()
+ .connectionString(getConnectionString())
+ .retry(RETRY_OPTIONS)
+ .scheduler(Schedulers.parallel())
+ .buildClient();
+ }
+
+ @Override
+ protected void afterTest() {
+ dispose(client);
+ }
+
+ /**
+ * Verifies that we can create and send a message to an Event Hub partition.
+ */
+ @Test
+ public void sendMessageToPartition() throws IOException {
+ // Arrange
+ final EventHubProducerOptions producerOptions = new EventHubProducerOptions().partitionId(PARTITION_ID);
+ final List events = Arrays.asList(
+ new EventData("Event 1".getBytes(UTF_8)),
+ new EventData("Event 2".getBytes(UTF_8)),
+ new EventData("Event 3".getBytes(UTF_8)));
+
+ // Act & Assert
+ try (EventHubProducer producer = client.createProducer(producerOptions)) {
+ producer.send(events);
+ }
+ }
+
+ /**
+ * Verifies that we can create an {@link EventHubProducer} that does not care about partitions and lets the service
+ * distribute the events.
+ */
+ @Test
+ public void sendMessage() throws IOException {
+ // Arrange
+ final List events = Arrays.asList(
+ new EventData("Event 1".getBytes(UTF_8)),
+ new EventData("Event 2".getBytes(UTF_8)),
+ new EventData("Event 3".getBytes(UTF_8)));
+
+ // Act & Assert
+ try (EventHubProducer producer = client.createProducer()) {
+ producer.send(events);
+ }
+ }
+
+ /**
+ * Verifies we can create an {@link EventDataBatch} and send it using our EventHubProducer.
+ */
+ @Test
+ public void sendBatch() throws IOException {
+ // Arrange
+ final List events = Arrays.asList(
+ new EventData("Event 1".getBytes(UTF_8)),
+ new EventData("Event 2".getBytes(UTF_8)),
+ new EventData("Event 3".getBytes(UTF_8)));
+
+ // Act & Assert
+ try (EventHubProducer producer = client.createProducer()) {
+ EventDataBatch batch = producer.createBatch();
+ events.forEach(event -> {
+ Assert.assertTrue(batch.tryAdd(event));
+ });
+
+ producer.send(batch);
+ }
+ }
+
+ /**
+ * Verifies we can create an {@link EventDataBatch} with a partition key and send it using our EventHubProducer.
+ */
+ @Test
+ public void sendBatchWithPartitionKey() throws IOException {
+ // Arrange
+ final List events = Arrays.asList(
+ new EventData("Event 1".getBytes(UTF_8)),
+ new EventData("Event 2".getBytes(UTF_8)),
+ new EventData("Event 3".getBytes(UTF_8)));
+
+ // Act & Assert
+ try (EventHubProducer producer = client.createProducer()) {
+ final BatchOptions options = new BatchOptions().partitionKey("my-partition-key");
+ final EventDataBatch batch = producer.createBatch(options);
+
+ events.forEach(event -> {
+ Assert.assertTrue(batch.tryAdd(event));
+ });
+
+ producer.send(batch);
+ }
+ }
+}
diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerTest.java
new file mode 100644
index 0000000000000..db2fae439f3b4
--- /dev/null
+++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerTest.java
@@ -0,0 +1,215 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.messaging.eventhubs;
+
+import com.azure.core.amqp.RetryOptions;
+import com.azure.core.amqp.exception.AmqpException;
+import com.azure.core.amqp.exception.ErrorCondition;
+import com.azure.core.amqp.exception.ErrorContext;
+import com.azure.messaging.eventhubs.implementation.AmqpSendLink;
+import com.azure.messaging.eventhubs.models.BatchOptions;
+import com.azure.messaging.eventhubs.models.EventHubProducerOptions;
+import com.azure.messaging.eventhubs.models.SendOptions;
+import org.apache.qpid.proton.amqp.messaging.Section;
+import org.apache.qpid.proton.message.Message;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+import java.time.Duration;
+import java.util.List;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyList;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+/**
+ * Unit tests to verify functionality of {@link EventHubProducer}.
+ */
+public class EventHubProducerTest {
+ @Mock
+ private AmqpSendLink sendLink;
+ @Captor
+ private ArgumentCaptor singleMessageCaptor;
+ @Captor
+ private ArgumentCaptor> messagesCaptor;
+
+ private EventHubAsyncProducer asyncProducer;
+ private RetryOptions retryOptions = new RetryOptions().tryTimeout(Duration.ofSeconds(30));
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ when(sendLink.getLinkSize()).thenReturn(Mono.just(EventHubAsyncProducer.MAX_MESSAGE_LENGTH_BYTES));
+ when(sendLink.getErrorContext()).thenReturn(new ErrorContext("test-namespace"));
+ when(sendLink.send(anyList())).thenReturn(Mono.empty());
+ when(sendLink.send(any(Message.class))).thenReturn(Mono.empty());
+
+ asyncProducer = new EventHubAsyncProducer(
+ Mono.fromCallable(() -> sendLink),
+ new EventHubProducerOptions().retry(retryOptions));
+ }
+
+ @After
+ public void teardown() {
+ Mockito.framework().clearInlineMocks();
+ sendLink = null;
+ singleMessageCaptor = null;
+ messagesCaptor = null;
+ }
+
+ /**
+ * Verifies can send a single message.
+ */
+ @Test
+ public void sendSingleMessage() {
+ // Arrange
+ final EventHubProducer producer = new EventHubProducer(asyncProducer, retryOptions.tryTimeout());
+ final EventData eventData = new EventData("hello-world".getBytes(UTF_8));
+
+ // Act
+ producer.send(eventData);
+
+ // Assert
+ verify(sendLink, times(1)).send(any(Message.class));
+ verify(sendLink).send(singleMessageCaptor.capture());
+
+ final Message message = singleMessageCaptor.getValue();
+ Assert.assertEquals(Section.SectionType.Data, message.getBody().getType());
+ }
+
+ /**
+ * Verifies we can send multiple messages.
+ */
+ @Test
+ public void sendMultipleMessages() {
+ // Arrange
+ final int count = 4;
+ final Iterable events = Flux.range(0, count).map(number -> {
+ final String contents = "event-data-" + number;
+ return new EventData(contents.getBytes(UTF_8));
+ }).toIterable();
+
+ final SendOptions options = new SendOptions();
+ final EventHubProducer producer = new EventHubProducer(asyncProducer, retryOptions.tryTimeout());
+
+ // Act
+ producer.send(events, options);
+
+ // Assert
+ verify(sendLink).send(messagesCaptor.capture());
+
+ final List messagesSent = messagesCaptor.getValue();
+ Assert.assertEquals(count, messagesSent.size());
+
+ messagesSent.forEach(message -> Assert.assertEquals(Section.SectionType.Data, message.getBody().getType()));
+ }
+
+ /**
+ * Verifies that the producer can create an {@link EventDataBatch} with the size given by the underlying AMQP send
+ * link.
+ */
+ @Test
+ public void createsEventDataBatch() {
+ // Arrange
+ int maxLinkSize = 1024;
+
+ // Overhead when serializing an event, to figure out what the maximum size we can use for an event payload.
+ int eventOverhead = 24;
+ int maxEventPayload = maxLinkSize - eventOverhead;
+
+ final AmqpSendLink link = mock(AmqpSendLink.class);
+ when(link.getLinkSize()).thenReturn(Mono.just(maxLinkSize));
+
+ // This event is 1024 bytes when serialized.
+ final EventData event = new EventData(new byte[maxEventPayload]);
+
+ // This event will be 1025 bytes when serialized.
+ final EventData tooLargeEvent = new EventData(new byte[maxEventPayload + 1]);
+
+ final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(retryOptions);
+ final EventHubAsyncProducer hubAsyncProducer = new EventHubAsyncProducer(Mono.fromCallable(() -> link), producerOptions);
+ final EventHubProducer hubProducer = new EventHubProducer(hubAsyncProducer, retryOptions.tryTimeout());
+
+ // Act
+ final EventDataBatch batch = hubProducer.createBatch();
+
+ // Assert
+ Assert.assertNull(batch.getPartitionKey());
+ Assert.assertFalse(batch.tryAdd(tooLargeEvent));
+ Assert.assertTrue(batch.tryAdd(event));
+
+ verify(link, times(1)).getLinkSize();
+ }
+
+ /**
+ * Verifies we can create an EventDataBatch with partition key and link size.
+ */
+ @Test
+ public void createsEventDataBatchWithPartitionKey() {
+ // Arrange
+ int maxBatchSize = 1024;
+
+ // Overhead when serializing an event, to figure out what the maximum size we can use for an event payload.
+ int eventOverhead = 98;
+ int maxEventPayload = maxBatchSize - eventOverhead;
+
+ // This event is 1024 bytes when serialized.
+ final EventData event = new EventData(new byte[maxEventPayload]);
+
+ // No idea what the overhead for adding partition key is. But we know this will be smaller than the max size.
+ final BatchOptions options = new BatchOptions()
+ .partitionKey("some-key")
+ .maximumSizeInBytes(maxBatchSize);
+ final EventHubProducer producer = new EventHubProducer(asyncProducer, retryOptions.tryTimeout());
+
+ // Act
+ final EventDataBatch batch = producer.createBatch(options);
+
+ // Arrange
+ Assert.assertEquals(options.partitionKey(), batch.getPartitionKey());
+ Assert.assertTrue(batch.tryAdd(event));
+ }
+
+ /**
+ * Verifies we can create an EventDataBatch with partition key and link size.
+ */
+ @Test
+ public void payloadTooLarge() {
+ // Arrange
+ int maxBatchSize = 1024;
+
+ // Overhead when serializing an event, to figure out what the maximum size we can use for an event payload.
+ int eventOverhead = 24;
+ int maxEventPayload = maxBatchSize - eventOverhead;
+
+ // This event is 1025 bytes when serialized.
+ final EventData event = new EventData(new byte[maxEventPayload + 1]);
+
+ // No idea what the overhead for adding partition key is. But we know this will be smaller than the max size.
+ final BatchOptions options = new BatchOptions()
+ .maximumSizeInBytes(maxBatchSize);
+ final EventHubProducer producer = new EventHubProducer(asyncProducer, retryOptions.tryTimeout());
+ final EventDataBatch batch = producer.createBatch(options);
+
+ // Act & Assert
+ try {
+ batch.tryAdd(event);
+ } catch (AmqpException e) {
+ Assert.assertEquals(ErrorCondition.LINK_PAYLOAD_SIZE_EXCEEDED, e.getErrorCondition());
+ }
+ }
+}
From 6768fc97db80bfd29f1ba031a541a3210000dee9 Mon Sep 17 00:00:00 2001
From: Mitch Denny
Date: Wed, 14 Aug 2019 14:10:56 -0700
Subject: [PATCH 04/95] Split the eventhubs client and data pipelines. (#4995)
* Split the eventhubs client and data pipelines.
* Removed redundant modules section.
* Specified artifacts for data pipeline.
---
sdk/eventhubs/ci.data.yml | 46 ++++++++++++++++++++++++++++++++++
sdk/eventhubs/ci.yml | 4 +++
sdk/eventhubs/pom.service.xml | 47 +++++++++++++++++++++++++----------
3 files changed, 84 insertions(+), 13 deletions(-)
create mode 100644 sdk/eventhubs/ci.data.yml
diff --git a/sdk/eventhubs/ci.data.yml b/sdk/eventhubs/ci.data.yml
new file mode 100644
index 0000000000000..7ca44a5f51c88
--- /dev/null
+++ b/sdk/eventhubs/ci.data.yml
@@ -0,0 +1,46 @@
+# DO NOT EDIT THIS FILE
+# This file is generated automatically and any changes will be lost.
+
+resources:
+ repositories:
+ - repository: azure-sdk-build-tools
+ type: git
+ name: internal/azure-sdk-build-tools
+
+trigger:
+ branches:
+ include:
+ - master
+ - feature/*
+ - hotfix/*
+ - release/*
+ paths:
+ include:
+ - sdk/eventhubs/
+ exclude:
+ - sdk/eventhubs/azure
+
+pr:
+ branches:
+ include:
+ - master
+ - feature/*
+ - hotfix/*
+ - release/*
+ paths:
+ include:
+ - sdk/eventhubs/
+ exclude:
+ - sdk/eventhubs/azure
+
+stages:
+ - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml
+ parameters:
+ ServiceDirectory: eventhubs
+ Artifacts:
+ - name: azure-eventhubs
+ safeName: azureeventhubs
+ - name: azure-eventhubs-eph
+ safeName: azureeventhubseph
+ - name: azure-eventhubs-extensions
+ safeName: azureeventhubsextensions
diff --git a/sdk/eventhubs/ci.yml b/sdk/eventhubs/ci.yml
index 9ecb29dd5ea32..4b074d49cf9b3 100644
--- a/sdk/eventhubs/ci.yml
+++ b/sdk/eventhubs/ci.yml
@@ -17,6 +17,8 @@ trigger:
paths:
include:
- sdk/eventhubs/
+ exclude:
+ - sdk/eventhubs/microsoft-azure
pr:
branches:
@@ -28,6 +30,8 @@ pr:
paths:
include:
- sdk/eventhubs/
+ exclude:
+ - sdk/eventhubs/microsoft-azure
stages:
- template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml
diff --git a/sdk/eventhubs/pom.service.xml b/sdk/eventhubs/pom.service.xml
index f99125abb8728..9c863056e145a 100644
--- a/sdk/eventhubs/pom.service.xml
+++ b/sdk/eventhubs/pom.service.xml
@@ -1,20 +1,41 @@
-
+
4.0.0
com.azure
azure-eventhubs-service
pom
- 1.0.0
-
- microsoft-azure-eventhubs
- microsoft-azure-eventhubs-eph
- microsoft-azure-eventhubs-extensions
- ../core/azure-core
- ../core/azure-core-test
- ../core/azure-core-amqp
- azure-messaging-eventhubs
-
+ 1.0.0
+
+
+ data
+
+
+ env.SDKTYPE
+ data
+
+
+
+ microsoft-azure-eventhubs
+ microsoft-azure-eventhubs-eph
+ microsoft-azure-eventhubs-extensions
+
+
+
+ client
+
+
+ env.SDKTYPE
+ !data
+
+
+
+ ../core/azure-core
+ ../core/azure-core-test
+ ../core/azure-core-amqp
+ azure-messaging-eventhubs
+
+
+
From 58142d5e5ccbf259fa25e07bccb237b0545a8921 Mon Sep 17 00:00:00 2001
From: Connie Yau
Date: Wed, 14 Aug 2019 15:10:32 -0700
Subject: [PATCH 05/95] Add null check to fix spotbugs warning. (#4998)
---
.../java/com/azure/messaging/eventhubs/ConsumeEvent.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEvent.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEvent.java
index 89f7b0f632578..2f33f372ba321 100644
--- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEvent.java
+++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEvent.java
@@ -51,6 +51,11 @@ public static void main(String[] args) throws InterruptedException, IOException
// TimeoutException is thrown.
String firstPartition = client.getPartitionIds().blockFirst(OPERATION_TIMEOUT);
+ // This shouldn't happen, but if we are unable to get the partitions within the timeout period.
+ if (firstPartition == null) {
+ firstPartition = "0";
+ }
+
// Create a consumer.
// The "$Default" consumer group is created by default. This value can be found by going to the Event Hub
// instance you are connecting to, and selecting the "Consumer groups" page. EventPosition.latest() tells the
From f173ae0bbe88eb115f3b8893d9bc2f4cc85b7ffd Mon Sep 17 00:00:00 2001
From: Jonathan Giles
Date: Thu, 15 Aug 2019 10:54:17 +1200
Subject: [PATCH 06/95] Seeing if we can speed up spotbugs (#4988)
* Seeing if we can speed up spotbugs by not forking the JVM for each module
---
pom.client.xml | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/pom.client.xml b/pom.client.xml
index 76ca1105732dd..617d50a5b8aeb 100644
--- a/pom.client.xml
+++ b/pom.client.xml
@@ -164,12 +164,13 @@
- Max
+ max
Low
true
${project.build.directory}/spotbugs
spotbugs/spotbugs-exclude.xml
true
+ false
@@ -442,12 +443,13 @@
- Max
+ max
Low
true
${project.build.directory}/spotbugs
spotbugs/spotbugs-exclude.xml
true
+ false
@@ -515,12 +517,13 @@
spotbugs-maven-plugin
${spotbugs.maven.version}
- Max
+ max
Low
true
${project.build.directory}/spotbugs
eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml
true
+ false
From 1ac4b2b67596de9900dd11277de82c8a305ebeb7 Mon Sep 17 00:00:00 2001
From: Mitch Denny
Date: Wed, 14 Aug 2019 21:17:38 -0700
Subject: [PATCH 07/95] Enabling javadoc production for template. (#4963)
---
pom.client.xml | 10 +++++-----
sdk/template/azure-sdk-template/pom.xml | 18 ++++++++++++------
2 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/pom.client.xml b/pom.client.xml
index 617d50a5b8aeb..525ed2caf70bb 100644
--- a/pom.client.xml
+++ b/pom.client.xml
@@ -1,7 +1,7 @@
-
+
4.0.0
com.azure
azure-client-sdk-parent
@@ -342,7 +342,6 @@
false
- com.microsoft.azure.template:
*.impl*:
*.implementation*:
com.azure.tools.checkstyle*
@@ -731,12 +730,13 @@
./eng/jacoco-test-coverage
-
+
template-module
- include-template
+ env.ENABLETEMPLATEDOCS
+ true
diff --git a/sdk/template/azure-sdk-template/pom.xml b/sdk/template/azure-sdk-template/pom.xml
index 3c5ff41f6fc2a..0d15dd67d620a 100644
--- a/sdk/template/azure-sdk-template/pom.xml
+++ b/sdk/template/azure-sdk-template/pom.xml
@@ -1,17 +1,16 @@
-
+
4.0.0
com.azure
azure-client-sdk-parent
- 1.1.0
+ 1.3.0
../../../pom.client.xml
azure-sdk-template
- 1.0.2-SNAPSHOT
- jar
+ 1.0.2
Microsoft Azure SDK for Template
This package contains Microsoft Azure SDK for Template.
@@ -23,9 +22,16 @@
- https://github.com/Azure/azure-sdk-for-java
+
+ https://github.com/Azure/azure-sdk-for-java
+
+
+ com.azure
+ azure-core
+ 1.0.0-preview.3
+
junit
junit
From d44d8c3af737ec372da3c29ca2c52f021886975a Mon Sep 17 00:00:00 2001
From: Adrian Hall
Date: Thu, 15 Aug 2019 08:53:00 -0700
Subject: [PATCH 08/95] Update link to Java Guidelines. (#4842)
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 3a89fec4d97eb..a93b2e3fb0497 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ Each service might have a number of libraries available from each of the followi
* [Management](#Management)
### Client: July 2019 Preview
-New wave of packages that we are currently releasing in **preview**. These libraries follow the [Azure SDK Design Guidelines for Java](https://azuresdkspecs.z5.web.core.windows.net/JavaSpec.html) and share a number of core features such as HTTP retries, logging, transport protocols, authentication protocols, etc., so that once you learn how to use these features in one client library, you will know how to use them in other client libraries. You can learn about these shared features [here](core).
+New wave of packages that we are currently releasing in **preview**. These libraries follow the [Azure SDK Design Guidelines for Java](https://azure.github.io/azure-sdk/java/guidelines/) and share a number of core features such as HTTP retries, logging, transport protocols, authentication protocols, etc., so that once you learn how to use these features in one client library, you will know how to use them in other client libraries. You can learn about these shared features [here](core).
These preview libraries can be easily identified by their folder, package, and namespaces names starting with `azure-`, e.g. `azure-keyvault`.
From ca83bd98bb07082d170f3fb285e4927ede16b45f Mon Sep 17 00:00:00 2001
From: Shawn Fang <45607042+mssfang@users.noreply.github.com>
Date: Thu, 15 Aug 2019 08:59:06 -0700
Subject: [PATCH 09/95] Fixes on Check on checkstyle (#5003)
* remove java code isImple check but move to suppression and add only check for public class for external Dependency check
* fixes
* Update eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml
suggest changes on comments
Co-Authored-By: Connie Yau
---
.../checks/OnlyFinalFieldsForImmutableClassCheck.java | 6 +++---
.../tools/checkstyle/checks/ServiceClientBuilderCheck.java | 2 +-
.../main/java/com/azure/tools/checkstyle/checks/Utils.java | 5 ++++-
.../main/resources/checkstyle/checkstyle-suppressions.xml | 3 +++
4 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/OnlyFinalFieldsForImmutableClassCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/OnlyFinalFieldsForImmutableClassCheck.java
index 85252a28a2149..916c7533859f3 100644
--- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/OnlyFinalFieldsForImmutableClassCheck.java
+++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/OnlyFinalFieldsForImmutableClassCheck.java
@@ -1,5 +1,5 @@
-// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
package com.azure.tools.checkstyle.checks;
@@ -19,8 +19,8 @@
*/
public class OnlyFinalFieldsForImmutableClassCheck extends AbstractCheck {
private static final String IMMUTABLE_NOTATION = "Immutable";
- private static final String ERROR_MSG = "The variable field ''%s'' should be final." +
- "Classes annotated with @Immutable are supposed to be immutable.";
+ private static final String ERROR_MSG = "The variable field ''%s'' should be final."
+ + "Classes annotated with @Immutable are supposed to be immutable.";
private boolean hasImmutableAnnotation;
diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientBuilderCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientBuilderCheck.java
index 8623828a9c63e..417643ccc4f8f 100644
--- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientBuilderCheck.java
+++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientBuilderCheck.java
@@ -90,7 +90,7 @@ public void visitToken(DetailAST token) {
// method name has prefix 'build' but not 'build*Client' or 'build*AsyncClient'
if (!methodName.endsWith("Client")) {
log(token, String.format(
- "@ServiceClientBuilder class should not have a method name, ''%s'' starting with ''build'' but not ending with ''Client''." , methodName));
+ "@ServiceClientBuilder class should not have a method name, ''%s'' starting with ''build'' but not ending with ''Client''.", methodName));
}
break;
default:
diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/Utils.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/Utils.java
index 5cc32d5249c2f..11ff09b1b760a 100644
--- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/Utils.java
+++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/Utils.java
@@ -1,3 +1,6 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
package com.azure.tools.checkstyle.checks;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
@@ -39,7 +42,7 @@ protected static boolean hasIllegalCombination(DetailAST modifiers) {
Optional illegalCombination = TokenUtil.findFirstTokenByPredicate(modifiers, (node) -> {
final int type = node.getType();
return INVALID_FINAL_COMBINATION.contains(node.getType()) || (TokenTypes.ANNOTATION == type
- && INVALID_FINAL_ANNOTATIONS.contains(node.findFirstToken(TokenTypes.IDENT).getText()));
+ && INVALID_FINAL_ANNOTATIONS.contains(node.findFirstToken(TokenTypes.IDENT).getText()));
});
return illegalCombination.isPresent();
diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml
index 553c34ca080fe..916cd16a77969 100755
--- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml
+++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml
@@ -112,6 +112,9 @@
+
+
+
From 99e76b4a691264c11e20e0c71886f659888f483a Mon Sep 17 00:00:00 2001
From: tg-msft
Date: Thu, 15 Aug 2019 11:40:09 -0700
Subject: [PATCH 10/95] Update Storage swagger (#4981)
* Move Storage to official swagger files
There are no (meaningful) code changes except the attribute in
BlobHierarchyListSegment that I can't trace to the swagger
* Upgrade blobs swagger to 2019-02-02
Note that additional work will have to be done to patch our higher level code to
pass new parameters to existing APIs
* Fixes to Swagger generation and updating to use new protocol layer
* Fixed appendBlock content-type, added SpotBug exclusions for autogen code
* Update README.md
* Fixed incorrect exclude
---
eng/.docsettings.yml | 3 +
.../resources/spotbugs/spotbugs-exclude.xml | 2 +
.../storage/blob/AppendBlobAsyncClient.java | 10 +-
.../azure/storage/blob/BlobAsyncClient.java | 14 +-
.../storage/blob/BlockBlobAsyncClient.java | 18 +-
.../storage/blob/ContainerAsyncClient.java | 2 +-
.../storage/blob/PageBlobAsyncClient.java | 10 +-
.../blob/implementation/AppendBlobsImpl.java | 77 +-
.../AzureBlobStorageBuilder.java | 44 +-
.../implementation/AzureBlobStorageImpl.java | 74 +-
.../blob/implementation/BlobsImpl.java | 368 +-
.../blob/implementation/BlockBlobsImpl.java | 126 +-
.../blob/implementation/ContainersImpl.java | 16 +-
.../blob/implementation/DirectorysImpl.java | 363 +
.../blob/implementation/PageBlobsImpl.java | 69 +-
.../blob/implementation/ServicesImpl.java | 42 +-
.../blob/models/AccessTierOptional.java | 47 +
.../blob/models/AccessTierRequired.java | 82 +
.../AppendBlobAppendBlockFromUrlHeaders.java | 34 +
.../models/AppendBlobAppendBlockHeaders.java | 97 +
.../blob/models/AppendBlobCreateHeaders.java | 62 +
.../models/BlobAbortCopyFromURLHeaders.java | 31 +
.../blob/models/BlobAcquireLeaseHeaders.java | 31 +
.../blob/models/BlobBreakLeaseHeaders.java | 31 +
.../blob/models/BlobChangeLeaseHeaders.java | 31 +
.../blob/models/BlobCopyFromURLHeaders.java | 31 +
.../models/BlobCreateSnapshotHeaders.java | 63 +
.../blob/models/BlobDeleteHeaders.java | 31 +
.../blob/models/BlobDownloadHeaders.java | 128 +
.../models/BlobGetAccountInfoHeaders.java | 31 +
.../blob/models/BlobGetPropertiesHeaders.java | 89 +
.../blob/models/BlobGetTagsHeaders.java | 172 +
.../azure/storage/blob/models/BlobItem.java | 26 +
.../storage/blob/models/BlobProperties.java | 52 +
.../blob/models/BlobReleaseLeaseHeaders.java | 31 +
.../blob/models/BlobRenameHeaders.java | 234 +
.../blob/models/BlobRenewLeaseHeaders.java | 31 +
.../models/BlobSetHTTPHeadersHeaders.java | 31 +
.../blob/models/BlobSetMetadataHeaders.java | 63 +
.../blob/models/BlobSetTagsHeaders.java | 172 +
.../blob/models/BlobSetTierHeaders.java | 31 +
.../models/BlobStartCopyFromURLHeaders.java | 31 +
.../azure/storage/blob/models/BlobTags.java | 59 +
.../blob/models/BlobUndeleteHeaders.java | 31 +
.../blob/models/BlobsGetTagsResponse.java | 35 +
.../blob/models/BlobsRenameResponse.java | 27 +
.../blob/models/BlobsSetTagsResponse.java | 27 +
.../BlockBlobCommitBlockListHeaders.java | 116 +-
.../models/BlockBlobGetBlockListHeaders.java | 31 +
.../BlockBlobStageBlockFromURLHeaders.java | 117 +-
.../models/BlockBlobStageBlockHeaders.java | 117 +-
.../blob/models/BlockBlobUploadHeaders.java | 62 +
.../models/ContainerAcquireLeaseHeaders.java | 31 +
.../models/ContainerBreakLeaseHeaders.java | 31 +
.../models/ContainerChangeLeaseHeaders.java | 31 +
.../blob/models/ContainerCreateHeaders.java | 31 +
.../blob/models/ContainerDeleteHeaders.java | 31 +
.../ContainerGetAccessPolicyHeaders.java | 31 +
.../ContainerGetAccountInfoHeaders.java | 31 +
.../models/ContainerGetPropertiesHeaders.java | 88 +
.../ContainerListBlobFlatSegmentHeaders.java | 31 +
...tainerListBlobHierarchySegmentHeaders.java | 31 +
.../models/ContainerReleaseLeaseHeaders.java | 31 +
.../models/ContainerRenewLeaseHeaders.java | 31 +
.../ContainerSetAccessPolicyHeaders.java | 31 +
.../models/ContainerSetMetadataHeaders.java | 31 +
.../blob/models/CustomerProvidedKeyInfo.java | 51 +
.../blob/models/DataLakeStorageError.java | 42 +
.../models/DataLakeStorageErrorError.java | 68 +
.../models/DataLakeStorageErrorException.java | 39 +
.../blob/models/DirectoryCreateHeaders.java | 234 +
.../blob/models/DirectoryDeleteHeaders.java | 183 +
.../blob/models/DirectoryHttpHeaders.java | 149 +
.../blob/models/DirectoryRenameHeaders.java | 275 +
.../blob/models/DirectorysCreateResponse.java | 27 +
.../blob/models/DirectorysDeleteResponse.java | 27 +
.../blob/models/DirectorysRenameResponse.java | 27 +
.../storage/blob/models/FilterBlobsItem.java | 94 +
.../blob/models/FilterBlobsResponse.java | 173 +
.../blob/models/FilterBlobsSegment.java | 44 +
.../blob/models/ListBlobsIncludeItem.java | 5 +
.../models/PageBlobClearPagesHeaders.java | 65 +
.../PageBlobCopyIncrementalHeaders.java | 31 +
.../blob/models/PageBlobCreateHeaders.java | 62 +
.../PageBlobGetPageRangesDiffHeaders.java | 31 +
.../models/PageBlobGetPageRangesHeaders.java | 31 +
.../blob/models/PageBlobResizeHeaders.java | 31 +
.../PageBlobUpdateSequenceNumberHeaders.java | 31 +
.../PageBlobUploadPagesFromURLHeaders.java | 34 +
.../models/PageBlobUploadPagesHeaders.java | 97 +
.../storage/blob/models/PathRenameMode.java | 55 +
.../blob/models/RehydratePriority.java | 42 +
.../models/ServiceFilterBlobsHeaders.java | 201 +
.../models/ServiceGetAccountInfoHeaders.java | 31 +
.../models/ServiceGetPropertiesHeaders.java | 31 +
.../models/ServiceGetStatisticsHeaders.java | 31 +
.../ServiceGetUserDelegationKeyHeaders.java | 31 +
.../ServiceListContainersSegmentHeaders.java | 31 +
.../models/ServiceSetPropertiesHeaders.java | 31 +
.../models/ServicesFilterBlobsResponse.java | 35 +
.../storage/blob/models/StorageError.java | 26 -
.../storage/blob/models/StorageErrorCode.java | 5 -
.../com/azure/storage/blob/models/Tag.java | 68 +
.../storage/blob/AppendBlobAPITest.groovy | 2 +-
.../storage/blob/BlockBlobAPITest.groovy | 6 +-
.../azure/storage/blob/PageBlobAPITest.groovy | 2 +-
.../azure-storage-blob/swagger/README.md | 870 ++
.../swagger/blob-2018-11-09.json | 8010 +++++++++++++
.../swagger/blob-2019-02-02.json | 9974 +++++++++++++++++
.../azure-storage-blob/swagger/blob.json | 8647 --------------
.../AzureFileStorageBuilder.java | 5 +-
.../implementation/AzureFileStorageImpl.java | 8 +-
.../azure-storage-file/swagger/README.md | 446 +
.../{file.json => file-2018-11-09.json} | 297 +-
.../AzureQueueStorageBuilder.java | 5 +-
.../implementation/AzureQueueStorageImpl.java | 8 +-
.../azure-storage-queue/swagger/README.md | 175 +
.../swagger/queue-2018-03-28.json | 1856 +++
.../azure-storage-queue/swagger/queue.json | 1898 ----
119 files changed, 27676 insertions(+), 11046 deletions(-)
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/DirectorysImpl.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTierOptional.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTierRequired.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetTagsHeaders.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRenameHeaders.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetTagsHeaders.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobTags.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsGetTagsResponse.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsRenameResponse.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsSetTagsResponse.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CustomerProvidedKeyInfo.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageError.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageErrorError.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageErrorException.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryCreateHeaders.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryDeleteHeaders.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryHttpHeaders.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryRenameHeaders.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysCreateResponse.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysDeleteResponse.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysRenameResponse.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsItem.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsResponse.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsSegment.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PathRenameMode.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/RehydratePriority.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceFilterBlobsHeaders.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesFilterBlobsResponse.java
create mode 100644 sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Tag.java
create mode 100644 sdk/storage/azure-storage-blob/swagger/README.md
create mode 100644 sdk/storage/azure-storage-blob/swagger/blob-2018-11-09.json
create mode 100644 sdk/storage/azure-storage-blob/swagger/blob-2019-02-02.json
delete mode 100644 sdk/storage/azure-storage-blob/swagger/blob.json
create mode 100644 sdk/storage/azure-storage-file/swagger/README.md
rename sdk/storage/azure-storage-file/swagger/{file.json => file-2018-11-09.json} (95%)
create mode 100644 sdk/storage/azure-storage-queue/swagger/README.md
create mode 100644 sdk/storage/azure-storage-queue/swagger/queue-2018-03-28.json
delete mode 100644 sdk/storage/azure-storage-queue/swagger/queue.json
diff --git a/eng/.docsettings.yml b/eng/.docsettings.yml
index 3ae4c9aa409d4..4fb91b2a5c7e7 100644
--- a/eng/.docsettings.yml
+++ b/eng/.docsettings.yml
@@ -75,6 +75,9 @@ known_content_issues:
- ['sdk/cosmos/changelog/README.md', '#3113']
- ['sdk/cosmos/microsoft-azure-cosmos-benchmark/README.md', '#3113']
- ['sdk/cosmos/README.md', '#3113']
+ - ['sdk/storage/azure-storage-blob/swagger/README.md', '#3113']
+ - ['sdk/storage/azure-storage-queue/swagger/README.md', '#3113']
+ - ['sdk/storage/azure-storage-file/swagger/README.md', '#3113']
package_indexing_exclusion_list:
- azure-loganalytics-sample
- azure-applicationinsights-query-sample
diff --git a/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml b/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml
index 6cfdbbd519233..bf64bafa0c431 100755
--- a/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml
+++ b/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml
@@ -65,6 +65,8 @@
+
+
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java
index 9cf6c224c0d3b..d2d20d34c58f6 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java
@@ -94,8 +94,8 @@ public Mono> create(BlobHTTPHeaders headers, Metadata m
accessConditions = (accessConditions == null) ? new BlobAccessConditions() : accessConditions;
return postProcessResponse(this.azureBlobStorage.appendBlobs().createWithRestResponseAsync(null,
- null, 0, null, metadata, null, null,
- null, null, headers, accessConditions.leaseAccessConditions(),
+ null, 0, null, metadata, null, null, null,
+ null, null, headers, accessConditions.leaseAccessConditions(), null,
accessConditions.modifiedAccessConditions(), Context.NONE))
.map(rb -> new SimpleResponse<>(rb, new AppendBlobItem(rb.deserializedHeaders())));
}
@@ -144,10 +144,10 @@ public Mono> appendBlock(Flux data, long lengt
: appendBlobAccessConditions;
return postProcessResponse(this.azureBlobStorage.appendBlobs().appendBlockWithRestResponseAsync(
- null, null, data, length, null, null,
+ null, null, data, length, null, null, null,
null, null, null, null,
appendBlobAccessConditions.leaseAccessConditions(),
- appendBlobAccessConditions.appendPositionAccessConditions(),
+ appendBlobAccessConditions.appendPositionAccessConditions(), null,
appendBlobAccessConditions.modifiedAccessConditions(), Context.NONE))
.map(rb -> new SimpleResponse<>(rb, new AppendBlobItem(rb.deserializedHeaders())));
}
@@ -201,7 +201,7 @@ public Mono> appendBlockFromUrl(URL sourceURL, BlobRang
return postProcessResponse(
this.azureBlobStorage.appendBlobs().appendBlockFromUrlWithRestResponseAsync(null, null,
- sourceURL, 0, sourceRange.toString(), sourceContentMD5, null, null,
+ sourceURL, 0, sourceRange.toString(), sourceContentMD5, null, null, null, null,
destAccessConditions.leaseAccessConditions(),
destAccessConditions.appendPositionAccessConditions(),
destAccessConditions.modifiedAccessConditions(), sourceAccessConditions, Context.NONE))
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java
index b4a5e38668c67..53801a50018c2 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java
@@ -13,6 +13,7 @@
import com.azure.storage.blob.implementation.AzureBlobStorageBuilder;
import com.azure.storage.blob.implementation.AzureBlobStorageImpl;
import com.azure.storage.blob.models.AccessTier;
+import com.azure.storage.blob.models.AccessTierRequired;
import com.azure.storage.blob.models.BlobAccessConditions;
import com.azure.storage.blob.models.BlobHTTPHeaders;
import com.azure.storage.blob.models.BlobRange;
@@ -245,7 +246,7 @@ public Mono> startCopyFromURL(URL sourceURL, Metadata metadata,
.sourceIfNoneMatch(sourceModifiedAccessConditions.ifNoneMatch());
return postProcessResponse(this.azureBlobStorage.blobs().startCopyFromURLWithRestResponseAsync(
- null, null, sourceURL, null, metadata, null, sourceConditions,
+ null, null, sourceURL, null, metadata, null, null, null, null, sourceConditions,
destAccessConditions.modifiedAccessConditions(), destAccessConditions.leaseAccessConditions(), Context.NONE))
.map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().copyId()));
}
@@ -340,7 +341,7 @@ public Mono> copyFromURL(URL copySource, Metadata metadata, Mod
.sourceIfNoneMatch(sourceModifiedAccessConditions.ifNoneMatch());
return postProcessResponse(this.azureBlobStorage.blobs().copyFromURLWithRestResponseAsync(
- null, null, copySource, null, metadata, null, sourceConditions,
+ null, null, copySource, null, metadata, null, null, null, sourceConditions,
destAccessConditions.modifiedAccessConditions(), destAccessConditions.leaseAccessConditions(), Context.NONE))
.map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().copyId()));
}
@@ -413,7 +414,7 @@ Mono download(BlobRange range, BlobAccessConditions acces
// TODO: range is BlobRange but expected as String
// TODO: figure out correct response
return postProcessResponse(this.azureBlobStorage.blobs().downloadWithRestResponseAsync(
- null, null, snapshot, null, null, range.toHeaderValue(), getMD5,
+ null, null, snapshot, null, null, range.toHeaderValue(), getMD5, null,
null, null, null, null,
accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), Context.NONE))
// Convert the autorest response to a DownloadAsyncResponse, which enable reliable download.
@@ -691,7 +692,7 @@ public Mono setMetadata(Metadata metadata, BlobAccessConditions ac
return postProcessResponse(this.azureBlobStorage.blobs().setMetadataWithRestResponseAsync(
null, null, null, metadata, null, null,
- null, null, accessConditions.leaseAccessConditions(),
+ null, null, accessConditions.leaseAccessConditions(), null,
accessConditions.modifiedAccessConditions(), Context.NONE))
.map(VoidResponse::new);
}
@@ -734,7 +735,7 @@ public Mono> createSnapshot(Metadata metadata, BlobAcc
return postProcessResponse(this.azureBlobStorage.blobs().createSnapshotWithRestResponseAsync(
null, null, null, metadata, null, null,
- null, null, accessConditions.modifiedAccessConditions(),
+ null, null, null, accessConditions.modifiedAccessConditions(),
accessConditions.leaseAccessConditions(), Context.NONE))
.map(rb -> new SimpleResponse<>(rb, this.getSnapshotClient(rb.deserializedHeaders().snapshot())));
}
@@ -779,9 +780,10 @@ public Mono setTier(AccessTier tier) {
*/
public Mono setTier(AccessTier tier, LeaseAccessConditions leaseAccessConditions) {
Utility.assertNotNull("tier", tier);
+ AccessTierRequired accessTierRequired = AccessTierRequired.fromString(tier.toString());
return postProcessResponse(this.azureBlobStorage.blobs().setTierWithRestResponseAsync(
- null, null, tier, null, null, leaseAccessConditions, Context.NONE))
+ null, null, accessTierRequired, null, null, null, leaseAccessConditions, Context.NONE))
.map(VoidResponse::new);
}
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java
index 162bb1917b612..91875e7a2fd55 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java
@@ -152,8 +152,8 @@ public Mono> upload(Flux data, long length, Blo
accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions;
return postProcessResponse(this.azureBlobStorage.blockBlobs().uploadWithRestResponseAsync(null,
- null, data, length, null, metadata, null, null,
- null, null, headers, accessConditions.leaseAccessConditions(),
+ null, data, length, null, metadata, null, null, null,
+ null, null, null, headers, accessConditions.leaseAccessConditions(), null,
accessConditions.modifiedAccessConditions(), Context.NONE))
.map(rb -> new SimpleResponse<>(rb, new BlockBlobItem(rb.deserializedHeaders())));
}
@@ -297,8 +297,8 @@ public Mono stageBlock(String base64BlockID, Flux data,
public Mono stageBlock(String base64BlockID, Flux data, long length,
LeaseAccessConditions leaseAccessConditions) {
return postProcessResponse(this.azureBlobStorage.blockBlobs().stageBlockWithRestResponseAsync(null,
- null, base64BlockID, length, data, null, null, null,
- null, null, null, leaseAccessConditions, Context.NONE))
+ null, base64BlockID, length, data, null, null, null, null,
+ null, null, null, leaseAccessConditions, null, Context.NONE))
.map(VoidResponse::new);
}
@@ -359,9 +359,9 @@ public Mono stageBlockFromURL(String base64BlockID, URL sourceURL,
return postProcessResponse(
this.azureBlobStorage.blockBlobs().stageBlockFromURLWithRestResponseAsync(null, null,
- base64BlockID, 0, sourceURL, sourceRange.toHeaderValue(), sourceContentMD5, null,
+ base64BlockID, 0, sourceURL, sourceRange.toHeaderValue(), sourceContentMD5, null, null,
null, null, null, null,
- leaseAccessConditions, sourceModifiedAccessConditions, Context.NONE))
+ leaseAccessConditions, null, sourceModifiedAccessConditions, Context.NONE))
.map(VoidResponse::new);
}
@@ -456,9 +456,9 @@ public Mono> commitBlockList(List base64BlockIDs
accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions;
return postProcessResponse(this.azureBlobStorage.blockBlobs().commitBlockListWithRestResponseAsync(
- null, null, new BlockLookupList().latest(base64BlockIDs), null, metadata,
- null, null, null, null, headers,
- accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), Context.NONE))
+ null, null, new BlockLookupList().latest(base64BlockIDs), null, null, null, metadata, null,
+ null, null, null, null, null, headers,
+ accessConditions.leaseAccessConditions(), null, accessConditions.modifiedAccessConditions(), Context.NONE))
.map(rb -> new SimpleResponse<>(rb, new BlockBlobItem(rb.deserializedHeaders())));
}
}
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java
index 99b1524507bf1..a741b2c7dba23 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java
@@ -278,7 +278,7 @@ public Mono create(Metadata metadata, PublicAccessType accessType)
metadata = metadata == null ? new Metadata() : metadata;
return postProcessResponse(this.azureBlobStorage.containers().createWithRestResponseAsync(
- null, null, metadata, accessType, null, Context.NONE))
+ null, null, metadata, accessType, null, null, null, Context.NONE))
.map(VoidResponse::new);
}
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java
index 944bb4ef8ff6c..57a98ebc22d1b 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java
@@ -127,8 +127,8 @@ public Mono> create(long size, Long sequenceNumber, BlobH
metadata = metadata == null ? new Metadata() : metadata;
return postProcessResponse(this.azureBlobStorage.pageBlobs().createWithRestResponseAsync(null,
- null, 0, size, null, metadata, null, null,
- null, sequenceNumber, null, headers, accessConditions.leaseAccessConditions(),
+ null, 0, size, null, metadata, null, null, null,
+ null, sequenceNumber, null, headers, accessConditions.leaseAccessConditions(), null,
accessConditions.modifiedAccessConditions(), Context.NONE))
.map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders())));
}
@@ -189,9 +189,9 @@ public Mono> uploadPages(PageRange pageRange, Flux new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders())));
}
@@ -272,7 +272,7 @@ public Mono> uploadPagesFromURL(PageRange range, URL sour
destAccessConditions = destAccessConditions == null ? new PageBlobAccessConditions() : destAccessConditions;
return postProcessResponse(this.azureBlobStorage.pageBlobs().uploadPagesFromURLWithRestResponseAsync(
- null, null, sourceURL, sourceRangeString, 0, rangeString, sourceContentMD5,
+ null, null, sourceURL, sourceRangeString, 0, rangeString, sourceContentMD5, null,
null, null, destAccessConditions.leaseAccessConditions(),
destAccessConditions.sequenceNumberAccessConditions(), destAccessConditions.modifiedAccessConditions(),
sourceAccessConditions, Context.NONE))
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java
index 3439bb917017e..9f220878e06d3 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java
@@ -25,17 +25,19 @@
import com.azure.storage.blob.models.AppendBlobsCreateResponse;
import com.azure.storage.blob.models.AppendPositionAccessConditions;
import com.azure.storage.blob.models.BlobHTTPHeaders;
+import com.azure.storage.blob.models.CustomerProvidedKeyInfo;
import com.azure.storage.blob.models.EncryptionAlgorithmType;
import com.azure.storage.blob.models.LeaseAccessConditions;
import com.azure.storage.blob.models.ModifiedAccessConditions;
import com.azure.storage.blob.models.SourceModifiedAccessConditions;
import com.azure.storage.blob.models.StorageErrorException;
import io.netty.buffer.ByteBuf;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
import java.net.URL;
import java.time.OffsetDateTime;
import java.util.Map;
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in
@@ -72,17 +74,17 @@ private interface AppendBlobsService {
@Put("{containerName}/{blob}")
@ExpectedResponses({201})
@UnexpectedResponseExceptionType(StorageErrorException.class)
- Mono create(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-blob-type") String blobType, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context);
+ Mono create(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-tags") String tags, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-blob-type") String blobType, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @QueryParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context);
@Put("{containerName}/{blob}")
@ExpectedResponses({201})
@UnexpectedResponseExceptionType(StorageErrorException.class)
- Mono appendBlock(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux body, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-blob-condition-maxsize") Long maxSize, @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context);
+ Mono appendBlock(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux body, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-blob-condition-maxsize") Long maxSize, @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, @QueryParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context);
@Put("{containerName}/{blob}")
@ExpectedResponses({201})
@UnexpectedResponseExceptionType(StorageErrorException.class)
- Mono appendBlockFromUrl(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-blob-condition-maxsize") Long maxSize, @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, Context context);
+ Mono appendBlockFromUrl(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, @HeaderParam("x-ms-source-content-crc64") String sourceContentcrc64, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-blob-condition-maxsize") Long maxSize, @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, Context context);
}
/**
@@ -99,9 +101,10 @@ private interface AppendBlobsService {
public Mono createWithRestResponseAsync(String containerName, String blob, long contentLength, Context context) {
final Integer timeout = null;
final Map metadata = null;
- final String encryptionKey = null;
- final String encryptionKeySha256 = null;
- final EncryptionAlgorithmType encryptionAlgorithm = null;
+ final String tags = null;
+ final String xMsEncryptionKey = null;
+ final String xMsEncryptionKeySha256 = null;
+ final EncryptionAlgorithmType xMsEncryptionAlgorithm = null;
final String requestId = null;
final String blobType = "AppendBlob";
final String blobContentType = null;
@@ -110,12 +113,13 @@ public Mono createWithRestResponseAsync(String contai
final String blobCacheControl = null;
final String blobContentDisposition = null;
final String leaseId = null;
+ final String encryptionScope = null;
final String ifMatch = null;
final String ifNoneMatch = null;
String blobContentMD5Converted = null;
DateTimeRfc1123 ifModifiedSinceConverted = null;
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
- return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
+ return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, tags, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
}
/**
@@ -126,19 +130,21 @@ public Mono createWithRestResponseAsync(String contai
* @param contentLength The length of the request.
* @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>.
* @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information.
- * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services.
- * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided.
- * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'.
+ * @param tags Optional. A URL encoded query param string which specifies the tags to be created with the Blob object. e.g. TagName1=TagValue1&TagName2=TagValue2. The x-ms-tags header may contain up to 2kb of tags.
+ * @param xMsEncryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services.
+ * @param xMsEncryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided.
+ * @param xMsEncryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'.
* @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
* @param blobHTTPHeaders Additional parameters for the operation.
* @param leaseAccessConditions Additional parameters for the operation.
+ * @param customerProvidedKeyInfo Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Mono which performs the network request upon subscription.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono createWithRestResponseAsync(String containerName, String blob, long contentLength, Integer timeout, Map metadata, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) {
+ public Mono createWithRestResponseAsync(String containerName, String blob, long contentLength, Integer timeout, Map metadata, String tags, String xMsEncryptionKey, String xMsEncryptionKeySha256, EncryptionAlgorithmType xMsEncryptionAlgorithm, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, CustomerProvidedKeyInfo customerProvidedKeyInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) {
final String blobType = "AppendBlob";
String blobContentType = null;
if (blobHTTPHeaders != null) {
@@ -168,6 +174,10 @@ public Mono createWithRestResponseAsync(String contai
if (leaseAccessConditions != null) {
leaseId = leaseAccessConditions.leaseId();
}
+ String encryptionScope = null;
+ if (customerProvidedKeyInfo != null) {
+ encryptionScope = customerProvidedKeyInfo.encryptionScope();
+ }
OffsetDateTime ifModifiedSince = null;
if (modifiedAccessConditions != null) {
ifModifiedSince = modifiedAccessConditions.ifModifiedSince();
@@ -187,7 +197,7 @@ public Mono createWithRestResponseAsync(String contai
String blobContentMD5Converted = Base64Util.encodeToString(blobContentMD5);
DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince);
DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince);
- return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
+ return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, tags, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
}
/**
@@ -204,20 +214,22 @@ public Mono createWithRestResponseAsync(String contai
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono appendBlockWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Context context) {
final Integer timeout = null;
- final String encryptionKey = null;
- final String encryptionKeySha256 = null;
- final EncryptionAlgorithmType encryptionAlgorithm = null;
+ final String xMsEncryptionKey = null;
+ final String xMsEncryptionKeySha256 = null;
+ final EncryptionAlgorithmType xMsEncryptionAlgorithm = null;
final String requestId = null;
final String comp = "appendblock";
final String leaseId = null;
final Long maxSize = null;
final Long appendPosition = null;
+ final String encryptionScope = null;
final String ifMatch = null;
final String ifNoneMatch = null;
String transactionalContentMD5Converted = null;
+ String transactionalContentCrc64Converted = null;
DateTimeRfc1123 ifModifiedSinceConverted = null;
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
- return service.appendBlock(containerName, blob, this.client.getUrl(), body, timeout, contentLength, transactionalContentMD5Converted, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
+ return service.appendBlock(containerName, blob, this.client.getUrl(), body, timeout, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
}
/**
@@ -229,19 +241,21 @@ public Mono appendBlockWithRestResponseAsync(Str
* @param contentLength The length of the request.
* @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>.
* @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service.
- * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services.
- * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided.
- * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'.
+ * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service.
+ * @param xMsEncryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services.
+ * @param xMsEncryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided.
+ * @param xMsEncryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'.
* @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
* @param leaseAccessConditions Additional parameters for the operation.
* @param appendPositionAccessConditions Additional parameters for the operation.
+ * @param customerProvidedKeyInfo Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Mono which performs the network request upon subscription.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono appendBlockWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Integer timeout, byte[] transactionalContentMD5, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) {
+ public Mono appendBlockWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Integer timeout, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, String xMsEncryptionKey, String xMsEncryptionKeySha256, EncryptionAlgorithmType xMsEncryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, CustomerProvidedKeyInfo customerProvidedKeyInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) {
final String comp = "appendblock";
String leaseId = null;
if (leaseAccessConditions != null) {
@@ -255,6 +269,10 @@ public Mono appendBlockWithRestResponseAsync(Str
if (appendPositionAccessConditions != null) {
appendPosition = appendPositionAccessConditions.appendPosition();
}
+ String encryptionScope = null;
+ if (customerProvidedKeyInfo != null) {
+ encryptionScope = customerProvidedKeyInfo.encryptionScope();
+ }
OffsetDateTime ifModifiedSince = null;
if (modifiedAccessConditions != null) {
ifModifiedSince = modifiedAccessConditions.ifModifiedSince();
@@ -272,9 +290,10 @@ public Mono appendBlockWithRestResponseAsync(Str
ifNoneMatch = modifiedAccessConditions.ifNoneMatch();
}
String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5);
+ String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64);
DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince);
DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince);
- return service.appendBlock(containerName, blob, this.client.getUrl(), body, timeout, contentLength, transactionalContentMD5Converted, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
+ return service.appendBlock(containerName, blob, this.client.getUrl(), body, timeout, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
}
/**
@@ -302,11 +321,13 @@ public Mono appendBlockFromUrlWithRestRes
final String sourceIfMatch = null;
final String sourceIfNoneMatch = null;
String sourceContentMD5Converted = null;
+ String sourceContentcrc64Converted = null;
+ String transactionalContentMD5Converted = null;
DateTimeRfc1123 ifModifiedSinceConverted = null;
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
DateTimeRfc1123 sourceIfModifiedSinceConverted = null;
DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null;
- return service.appendBlockFromUrl(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, timeout, contentLength, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context);
+ return service.appendBlockFromUrl(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, contentLength, transactionalContentMD5Converted, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context);
}
/**
@@ -318,7 +339,9 @@ public Mono appendBlockFromUrlWithRestRes
* @param contentLength The length of the request.
* @param sourceRange Bytes of source data in the specified range.
* @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source.
+ * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy source.
* @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>.
+ * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service.
* @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
* @param leaseAccessConditions Additional parameters for the operation.
* @param appendPositionAccessConditions Additional parameters for the operation.
@@ -329,7 +352,7 @@ public Mono appendBlockFromUrlWithRestRes
* @return a Mono which performs the network request upon subscription.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono appendBlockFromUrlWithRestResponseAsync(String containerName, String blob, URL sourceUrl, long contentLength, String sourceRange, byte[] sourceContentMD5, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) {
+ public Mono appendBlockFromUrlWithRestResponseAsync(String containerName, String blob, URL sourceUrl, long contentLength, String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, byte[] transactionalContentMD5, String requestId, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) {
final String comp = "appendblock";
String leaseId = null;
if (leaseAccessConditions != null) {
@@ -376,10 +399,12 @@ public Mono appendBlockFromUrlWithRestRes
sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch();
}
String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5);
+ String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64);
+ String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5);
DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince);
DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince);
DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince);
DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince);
- return service.appendBlockFromUrl(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, timeout, contentLength, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context);
+ return service.appendBlockFromUrl(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, contentLength, transactionalContentMD5Converted, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context);
}
}
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java
index fa28f6e26d0ed..fe79309a238bf 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java
@@ -7,6 +7,7 @@
import com.azure.core.http.HttpPipeline;
import com.azure.core.implementation.RestProxy;
import com.azure.core.implementation.annotation.ServiceClientBuilder;
+import com.azure.storage.blob.models.PathRenameMode;
/**
* A builder for creating a new instance of the AzureBlobStorage type.
@@ -45,6 +46,38 @@ public AzureBlobStorageBuilder version(String version) {
return this;
}
+ /*
+ * The filter parameter enables the caller to query blobs whose tags match a given expression. The given expression must evaluate to true for a blob to be returned in the results.
+ */
+ private String filter;
+
+ /**
+ * Sets The filter parameter enables the caller to query blobs whose tags match a given expression. The given expression must evaluate to true for a blob to be returned in the results.
+ *
+ * @param filter the filter value.
+ * @return the AzureBlobStorageBuilder.
+ */
+ public AzureBlobStorageBuilder filter(String filter) {
+ this.filter = filter;
+ return this;
+ }
+
+ /*
+ * Determines the behavior of the rename operation. Possible values include: 'legacy', 'posix'
+ */
+ private PathRenameMode pathRenameMode;
+
+ /**
+ * Sets Determines the behavior of the rename operation. Possible values include: 'legacy', 'posix'.
+ *
+ * @param pathRenameMode the pathRenameMode value.
+ * @return the AzureBlobStorageBuilder.
+ */
+ public AzureBlobStorageBuilder pathRenameMode(PathRenameMode pathRenameMode) {
+ this.pathRenameMode = pathRenameMode;
+ return this;
+ }
+
/*
* The HTTP pipeline to send requests through
*/
@@ -67,6 +100,9 @@ public AzureBlobStorageBuilder pipeline(HttpPipeline pipeline) {
* @return an instance of AzureBlobStorageImpl.
*/
public AzureBlobStorageImpl build() {
+ if (version == null) {
+ this.version = "2019-02-02";
+ }
if (pipeline == null) {
this.pipeline = RestProxy.createDefaultPipeline();
}
@@ -76,8 +112,12 @@ public AzureBlobStorageImpl build() {
}
if (this.version != null) {
client.setVersion(this.version);
- } else {
- client.setVersion("2018-11-09");
+ }
+ if (this.filter != null) {
+ client.setFilter(this.filter);
+ }
+ if (this.pathRenameMode != null) {
+ client.setPathRenameMode(this.pathRenameMode);
}
return client;
}
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java
index 5fc9bc8ae2736..d9f48fbf87990 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java
@@ -6,6 +6,7 @@
import com.azure.core.http.HttpPipeline;
import com.azure.core.implementation.RestProxy;
+import com.azure.storage.blob.models.PathRenameMode;
/**
* Initializes a new instance of the AzureBlobStorage type.
@@ -29,9 +30,11 @@ public String getUrl() {
* Sets The URL of the service account, container, or blob that is the targe of the desired operation.
*
* @param url the url value.
+ * @return the service client itself.
*/
- void setUrl(String url) {
+ AzureBlobStorageImpl setUrl(String url) {
this.url = url;
+ return this;
}
/**
@@ -52,9 +55,61 @@ public String getVersion() {
* Sets Specifies the version of the operation to use for this request.
*
* @param version the version value.
+ * @return the service client itself.
*/
- void setVersion(String version) {
+ AzureBlobStorageImpl setVersion(String version) {
this.version = version;
+ return this;
+ }
+
+ /**
+ * The filter parameter enables the caller to query blobs whose tags match a given expression. The given expression must evaluate to true for a blob to be returned in the results.
+ */
+ private String filter;
+
+ /**
+ * Gets The filter parameter enables the caller to query blobs whose tags match a given expression. The given expression must evaluate to true for a blob to be returned in the results.
+ *
+ * @return the filter value.
+ */
+ public String getFilter() {
+ return this.filter;
+ }
+
+ /**
+ * Sets The filter parameter enables the caller to query blobs whose tags match a given expression. The given expression must evaluate to true for a blob to be returned in the results.
+ *
+ * @param filter the filter value.
+ * @return the service client itself.
+ */
+ AzureBlobStorageImpl setFilter(String filter) {
+ this.filter = filter;
+ return this;
+ }
+
+ /**
+ * Determines the behavior of the rename operation. Possible values include: 'legacy', 'posix'.
+ */
+ private PathRenameMode pathRenameMode;
+
+ /**
+ * Gets Determines the behavior of the rename operation. Possible values include: 'legacy', 'posix'.
+ *
+ * @return the pathRenameMode value.
+ */
+ public PathRenameMode getPathRenameMode() {
+ return this.pathRenameMode;
+ }
+
+ /**
+ * Sets Determines the behavior of the rename operation. Possible values include: 'legacy', 'posix'.
+ *
+ * @param pathRenameMode the pathRenameMode value.
+ * @return the service client itself.
+ */
+ AzureBlobStorageImpl setPathRenameMode(PathRenameMode pathRenameMode) {
+ this.pathRenameMode = pathRenameMode;
+ return this;
}
/**
@@ -99,6 +154,20 @@ public ContainersImpl containers() {
return this.containers;
}
+ /**
+ * The DirectorysImpl object to access its operations.
+ */
+ private DirectorysImpl directorys;
+
+ /**
+ * Gets the DirectorysImpl object to access its operations.
+ *
+ * @return the DirectorysImpl object.
+ */
+ public DirectorysImpl directorys() {
+ return this.directorys;
+ }
+
/**
* The BlobsImpl object to access its operations.
*/
@@ -171,6 +240,7 @@ public AzureBlobStorageImpl(HttpPipeline httpPipeline) {
this.httpPipeline = httpPipeline;
this.services = new ServicesImpl(this);
this.containers = new ContainersImpl(this);
+ this.directorys = new DirectorysImpl(this);
this.blobs = new BlobsImpl(this);
this.pageBlobs = new PageBlobsImpl(this);
this.appendBlobs = new AppendBlobsImpl(this);
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java
index eba1efa297e4b..9f75f3503418a 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java
@@ -6,6 +6,7 @@
import com.azure.core.implementation.DateTimeRfc1123;
import com.azure.core.implementation.RestProxy;
+import com.azure.core.implementation.annotation.BodyParam;
import com.azure.core.implementation.annotation.Delete;
import com.azure.core.implementation.annotation.ExpectedResponses;
import com.azure.core.implementation.annotation.Get;
@@ -22,7 +23,8 @@
import com.azure.core.implementation.annotation.UnexpectedResponseExceptionType;
import com.azure.core.implementation.util.Base64Util;
import com.azure.core.util.Context;
-import com.azure.storage.blob.models.AccessTier;
+import com.azure.storage.blob.models.AccessTierOptional;
+import com.azure.storage.blob.models.AccessTierRequired;
import com.azure.storage.blob.models.BlobHTTPHeaders;
import com.azure.storage.blob.models.BlobsAbortCopyFromURLResponse;
import com.azure.storage.blob.models.BlobsAcquireLeaseResponse;
@@ -34,17 +36,26 @@
import com.azure.storage.blob.models.BlobsDownloadResponse;
import com.azure.storage.blob.models.BlobsGetAccountInfoResponse;
import com.azure.storage.blob.models.BlobsGetPropertiesResponse;
+import com.azure.storage.blob.models.BlobsGetTagsResponse;
import com.azure.storage.blob.models.BlobsReleaseLeaseResponse;
+import com.azure.storage.blob.models.BlobsRenameResponse;
import com.azure.storage.blob.models.BlobsRenewLeaseResponse;
import com.azure.storage.blob.models.BlobsSetHTTPHeadersResponse;
import com.azure.storage.blob.models.BlobsSetMetadataResponse;
+import com.azure.storage.blob.models.BlobsSetTagsResponse;
import com.azure.storage.blob.models.BlobsSetTierResponse;
import com.azure.storage.blob.models.BlobsStartCopyFromURLResponse;
import com.azure.storage.blob.models.BlobsUndeleteResponse;
+import com.azure.storage.blob.models.BlobTags;
+import com.azure.storage.blob.models.CustomerProvidedKeyInfo;
+import com.azure.storage.blob.models.DataLakeStorageErrorException;
import com.azure.storage.blob.models.DeleteSnapshotsOptionType;
+import com.azure.storage.blob.models.DirectoryHttpHeaders;
import com.azure.storage.blob.models.EncryptionAlgorithmType;
import com.azure.storage.blob.models.LeaseAccessConditions;
import com.azure.storage.blob.models.ModifiedAccessConditions;
+import com.azure.storage.blob.models.PathRenameMode;
+import com.azure.storage.blob.models.RehydratePriority;
import com.azure.storage.blob.models.SourceModifiedAccessConditions;
import com.azure.storage.blob.models.StorageErrorException;
import java.net.URL;
@@ -87,18 +98,23 @@ private interface BlobsService {
@Get("{containerName}/{blob}")
@ExpectedResponses({200, 206})
@UnexpectedResponseExceptionType(StorageErrorException.class)
- Mono download(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-range-get-content-md5") Boolean rangeGetContentMD5, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context);
+ Mono download(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-range-get-content-md5") Boolean rangeGetContentMD5, @HeaderParam("x-ms-range-get-content-crc64") Boolean rangeGetContentCRC64, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context);
@Head("{containerName}/{blob}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(StorageErrorException.class)
- Mono getProperties(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context);
+ Mono getProperties(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context);
@Delete("{containerName}/{blob}")
@ExpectedResponses({202})
@UnexpectedResponseExceptionType(StorageErrorException.class)
Mono delete(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-delete-snapshots") DeleteSnapshotsOptionType deleteSnapshots, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context);
+ @Put("{filesystem}/{path}")
+ @ExpectedResponses({201})
+ @UnexpectedResponseExceptionType(DataLakeStorageErrorException.class)
+ Mono rename(@PathParam("filesystem") String filesystem, @PathParam("path") String path, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @QueryParam("mode") PathRenameMode pathRenameMode, @HeaderParam("x-ms-rename-source") String renameSource, @HeaderParam("x-ms-properties") String directoryProperties, @HeaderParam("x-ms-permissions") String posixPermissions, @HeaderParam("x-ms-umask") String posixUmask, @HeaderParam("x-ms-source-lease-id") String sourceLeaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-cache-control") String cacheControl, @HeaderParam("x-ms-content-type") String contentType, @HeaderParam("x-ms-content-encoding") String contentEncoding, @HeaderParam("x-ms-content-language") String contentLanguage, @HeaderParam("x-ms-content-disposition") String contentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, Context context);
+
@Put("{containerName}/{blob}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(StorageErrorException.class)
@@ -112,7 +128,7 @@ private interface BlobsService {
@Put("{containerName}/{blob}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(StorageErrorException.class)
- Mono setMetadata(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context);
+ Mono setMetadata(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @QueryParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context);
@Put("{containerName}/{blob}")
@ExpectedResponses({201})
@@ -142,17 +158,17 @@ private interface BlobsService {
@Put("{containerName}/{blob}")
@ExpectedResponses({201})
@UnexpectedResponseExceptionType(StorageErrorException.class)
- Mono createSnapshot(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-lease-id") String leaseId, Context context);
+ Mono createSnapshot(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @QueryParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-lease-id") String leaseId, Context context);
@Put("{containerName}/{blob}")
@ExpectedResponses({202})
@UnexpectedResponseExceptionType(StorageErrorException.class)
- Mono startCopyFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-lease-id") String leaseId, Context context);
+ Mono startCopyFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-tags") String tags, @HeaderParam("x-ms-access-tier") AccessTierOptional tier, @HeaderParam("x-ms-rehydrate-priority") RehydratePriority rehydratePriority, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-lease-id") String leaseId, Context context);
@Put("{containerName}/{blob}")
@ExpectedResponses({202})
@UnexpectedResponseExceptionType(StorageErrorException.class)
- Mono copyFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-requires-sync") String xMsRequiresSync, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-lease-id") String leaseId, Context context);
+ Mono copyFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-tags") String tags, @HeaderParam("x-ms-access-tier") AccessTierOptional tier, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-requires-sync") String xMsRequiresSync, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-lease-id") String leaseId, Context context);
@Put("{containerName}/{blob}")
@ExpectedResponses({204})
@@ -162,16 +178,26 @@ private interface BlobsService {
@Put("{containerName}/{blob}")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(StorageErrorException.class)
- Mono setTier(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-access-tier") AccessTier tier, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, Context context);
+ Mono setTier(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-access-tier") AccessTierRequired tier, @HeaderParam("x-ms-rehydrate-priority") RehydratePriority rehydratePriority, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, Context context);
@Get("{containerName}/{blob}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(StorageErrorException.class)
Mono getAccountInfo(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context);
+
+ @Put("{containerName}/{blob}")
+ @ExpectedResponses({204})
+ @UnexpectedResponseExceptionType(StorageErrorException.class)
+ Mono setTags(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") BlobTags tags, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context);
+
+ @Get("{containerName}/{blob}")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(StorageErrorException.class)
+ Mono getTags(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context);
}
/**
- * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot or verison.
+ * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot or version.
*
* @param containerName The container name.
* @param blob The blob name.
@@ -186,20 +212,21 @@ public Mono downloadWithRestResponseAsync(String containe
final Integer timeout = null;
final String range = null;
final Boolean rangeGetContentMD5 = null;
- final String encryptionKey = null;
- final String encryptionKeySha256 = null;
- final EncryptionAlgorithmType encryptionAlgorithm = null;
+ final Boolean rangeGetContentCRC64 = null;
+ final String xMsEncryptionKey = null;
+ final String xMsEncryptionKeySha256 = null;
+ final EncryptionAlgorithmType xMsEncryptionAlgorithm = null;
final String requestId = null;
final String leaseId = null;
final String ifMatch = null;
final String ifNoneMatch = null;
DateTimeRfc1123 ifModifiedSinceConverted = null;
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
- return service.download(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, range, rangeGetContentMD5, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
+ return service.download(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, range, rangeGetContentMD5, rangeGetContentCRC64, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
}
/**
- * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot or verison.
+ * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot or version.
*
* @param containerName The container name.
* @param blob The blob name.
@@ -208,9 +235,10 @@ public Mono downloadWithRestResponseAsync(String containe
* @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>.
* @param range Return only the bytes of the blob in the specified range.
* @param rangeGetContentMD5 When set to true and specified together with the Range, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size.
- * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services.
- * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided.
- * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'.
+ * @param rangeGetContentCRC64 When set to true and specified together with the Range, the service returns the CRC64 hash for the range, as long as the range is less than or equal to 4 MB in size.
+ * @param xMsEncryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services.
+ * @param xMsEncryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided.
+ * @param xMsEncryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'.
* @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
* @param leaseAccessConditions Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
@@ -219,7 +247,7 @@ public Mono downloadWithRestResponseAsync(String containe
* @return a Mono which performs the network request upon subscription.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono downloadWithRestResponseAsync(String containerName, String blob, String snapshot, String versionId, Integer timeout, String range, Boolean rangeGetContentMD5, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) {
+ public Mono downloadWithRestResponseAsync(String containerName, String blob, String snapshot, String versionId, Integer timeout, String range, Boolean rangeGetContentMD5, Boolean rangeGetContentCRC64, String xMsEncryptionKey, String xMsEncryptionKeySha256, EncryptionAlgorithmType xMsEncryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) {
String leaseId = null;
if (leaseAccessConditions != null) {
leaseId = leaseAccessConditions.leaseId();
@@ -242,7 +270,7 @@ public Mono downloadWithRestResponseAsync(String containe
}
DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince);
DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince);
- return service.download(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, range, rangeGetContentMD5, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
+ return service.download(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, range, rangeGetContentMD5, rangeGetContentCRC64, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
}
/**
@@ -259,16 +287,16 @@ public Mono getPropertiesWithRestResponseAsync(Strin
final String snapshot = null;
final String versionId = null;
final Integer timeout = null;
- final String encryptionKey = null;
- final String encryptionKeySha256 = null;
- final EncryptionAlgorithmType encryptionAlgorithm = null;
+ final String xMsEncryptionKey = null;
+ final String xMsEncryptionKeySha256 = null;
+ final EncryptionAlgorithmType xMsEncryptionAlgorithm = null;
final String requestId = null;
final String leaseId = null;
final String ifMatch = null;
final String ifNoneMatch = null;
DateTimeRfc1123 ifModifiedSinceConverted = null;
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
- return service.getProperties(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
+ return service.getProperties(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
}
/**
@@ -279,9 +307,9 @@ public Mono getPropertiesWithRestResponseAsync(Strin
* @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>.
* @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve.
* @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>.
- * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services.
- * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided.
- * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'.
+ * @param xMsEncryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services.
+ * @param xMsEncryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided.
+ * @param xMsEncryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'.
* @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
* @param leaseAccessConditions Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
@@ -290,7 +318,7 @@ public Mono getPropertiesWithRestResponseAsync(Strin
* @return a Mono which performs the network request upon subscription.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getPropertiesWithRestResponseAsync(String containerName, String blob, String snapshot, String versionId, Integer timeout, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) {
+ public Mono getPropertiesWithRestResponseAsync(String containerName, String blob, String snapshot, String versionId, Integer timeout, String xMsEncryptionKey, String xMsEncryptionKeySha256, EncryptionAlgorithmType xMsEncryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) {
String leaseId = null;
if (leaseAccessConditions != null) {
leaseId = leaseAccessConditions.leaseId();
@@ -313,7 +341,7 @@ public Mono getPropertiesWithRestResponseAsync(Strin
}
DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince);
DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince);
- return service.getProperties(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
+ return service.getProperties(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
}
/**
@@ -383,6 +411,126 @@ public Mono deleteWithRestResponseAsync(String containerNam
return service.delete(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, deleteSnapshots, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
}
+ /**
+ * Rename a blob/file. By default, the destination is overwritten and if the destination already exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). To fail if the destination already exists, use a conditional request with If-None-Match: "*".
+ *
+ * @param filesystem The filesystem name.
+ * @param path The namespace path to a file or directory.
+ * @param renameSource The file or directory to be renamed. The value must have the following format: "/{filesysystem}/{path}". If "x-ms-properties" is specified, the properties will overwrite the existing properties; otherwise, the existing properties will be preserved.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @return a Mono which performs the network request upon subscription.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono renameWithRestResponseAsync(String filesystem, String path, String renameSource, Context context) {
+ final Integer timeout = null;
+ final String directoryProperties = null;
+ final String posixPermissions = null;
+ final String posixUmask = null;
+ final String sourceLeaseId = null;
+ final String requestId = null;
+ final String cacheControl = null;
+ final String contentType = null;
+ final String contentEncoding = null;
+ final String contentLanguage = null;
+ final String contentDisposition = null;
+ final String leaseId = null;
+ final String ifMatch = null;
+ final String ifNoneMatch = null;
+ final String sourceIfMatch = null;
+ final String sourceIfNoneMatch = null;
+ DateTimeRfc1123 ifModifiedSinceConverted = null;
+ DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
+ DateTimeRfc1123 sourceIfModifiedSinceConverted = null;
+ DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null;
+ return service.rename(filesystem, path, this.client.getUrl(), timeout, this.client.getPathRenameMode(), renameSource, directoryProperties, posixPermissions, posixUmask, sourceLeaseId, this.client.getVersion(), requestId, cacheControl, contentType, contentEncoding, contentLanguage, contentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context);
+ }
+
+ /**
+ * Rename a blob/file. By default, the destination is overwritten and if the destination already exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). To fail if the destination already exists, use a conditional request with If-None-Match: "*".
+ *
+ * @param filesystem The filesystem name.
+ * @param path The namespace path to a file or directory.
+ * @param renameSource The file or directory to be renamed. The value must have the following format: "/{filesysystem}/{path}". If "x-ms-properties" is specified, the properties will overwrite the existing properties; otherwise, the existing properties will be preserved.
+ * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>.
+ * @param directoryProperties Optional. User-defined properties to be stored with the file or directory, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value is base64 encoded.
+ * @param posixPermissions Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported.
+ * @param posixUmask Only valid if Hierarchical Namespace is enabled for the account. This umask restricts permission settings for file and directory, and will only be applied when default Acl does not exist in parent directory. If the umask bit has set, it means that the corresponding permission will be disabled. Otherwise the corresponding permission will be determined by the permission. A 4-digit octal notation (e.g. 0022) is supported here. If no umask was specified, a default umask - 0027 will be used.
+ * @param sourceLeaseId A lease ID for the source path. If specified, the source path must have an active lease and the leaase ID must match.
+ * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ * @param directoryHttpHeaders Additional parameters for the operation.
+ * @param leaseAccessConditions Additional parameters for the operation.
+ * @param modifiedAccessConditions Additional parameters for the operation.
+ * @param sourceModifiedAccessConditions Additional parameters for the operation.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @return a Mono which performs the network request upon subscription.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono renameWithRestResponseAsync(String filesystem, String path, String renameSource, Integer timeout, String directoryProperties, String posixPermissions, String posixUmask, String sourceLeaseId, String requestId, DirectoryHttpHeaders directoryHttpHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) {
+ String cacheControl = null;
+ if (directoryHttpHeaders != null) {
+ cacheControl = directoryHttpHeaders.cacheControl();
+ }
+ String contentType = null;
+ if (directoryHttpHeaders != null) {
+ contentType = directoryHttpHeaders.contentType();
+ }
+ String contentEncoding = null;
+ if (directoryHttpHeaders != null) {
+ contentEncoding = directoryHttpHeaders.contentEncoding();
+ }
+ String contentLanguage = null;
+ if (directoryHttpHeaders != null) {
+ contentLanguage = directoryHttpHeaders.contentLanguage();
+ }
+ String contentDisposition = null;
+ if (directoryHttpHeaders != null) {
+ contentDisposition = directoryHttpHeaders.contentDisposition();
+ }
+ String leaseId = null;
+ if (leaseAccessConditions != null) {
+ leaseId = leaseAccessConditions.leaseId();
+ }
+ OffsetDateTime ifModifiedSince = null;
+ if (modifiedAccessConditions != null) {
+ ifModifiedSince = modifiedAccessConditions.ifModifiedSince();
+ }
+ OffsetDateTime ifUnmodifiedSince = null;
+ if (modifiedAccessConditions != null) {
+ ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince();
+ }
+ String ifMatch = null;
+ if (modifiedAccessConditions != null) {
+ ifMatch = modifiedAccessConditions.ifMatch();
+ }
+ String ifNoneMatch = null;
+ if (modifiedAccessConditions != null) {
+ ifNoneMatch = modifiedAccessConditions.ifNoneMatch();
+ }
+ OffsetDateTime sourceIfModifiedSince = null;
+ if (sourceModifiedAccessConditions != null) {
+ sourceIfModifiedSince = sourceModifiedAccessConditions.sourceIfModifiedSince();
+ }
+ OffsetDateTime sourceIfUnmodifiedSince = null;
+ if (sourceModifiedAccessConditions != null) {
+ sourceIfUnmodifiedSince = sourceModifiedAccessConditions.sourceIfUnmodifiedSince();
+ }
+ String sourceIfMatch = null;
+ if (sourceModifiedAccessConditions != null) {
+ sourceIfMatch = sourceModifiedAccessConditions.sourceIfMatch();
+ }
+ String sourceIfNoneMatch = null;
+ if (sourceModifiedAccessConditions != null) {
+ sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch();
+ }
+ DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince);
+ DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince);
+ DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince);
+ DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince);
+ return service.rename(filesystem, path, this.client.getUrl(), timeout, this.client.getPathRenameMode(), renameSource, directoryProperties, posixPermissions, posixUmask, sourceLeaseId, this.client.getVersion(), requestId, cacheControl, contentType, contentEncoding, contentLanguage, contentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context);
+ }
+
/**
* Undelete a blob that was previously soft deleted.
*
@@ -525,17 +673,18 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str
public Mono setMetadataWithRestResponseAsync(String containerName, String blob, Context context) {
final Integer timeout = null;
final Map metadata = null;
- final String encryptionKey = null;
- final String encryptionKeySha256 = null;
- final EncryptionAlgorithmType encryptionAlgorithm = null;
+ final String xMsEncryptionKey = null;
+ final String xMsEncryptionKeySha256 = null;
+ final EncryptionAlgorithmType xMsEncryptionAlgorithm = null;
final String requestId = null;
final String comp = "metadata";
final String leaseId = null;
+ final String encryptionScope = null;
final String ifMatch = null;
final String ifNoneMatch = null;
DateTimeRfc1123 ifModifiedSinceConverted = null;
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
- return service.setMetadata(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
+ return service.setMetadata(containerName, blob, this.client.getUrl(), timeout, metadata, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
}
/**
@@ -545,23 +694,28 @@ public Mono setMetadataWithRestResponseAsync(String co
* @param blob The blob name.
* @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>.
* @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information.
- * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services.
- * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided.
- * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'.
+ * @param xMsEncryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services.
+ * @param xMsEncryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided.
+ * @param xMsEncryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'.
* @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
* @param leaseAccessConditions Additional parameters for the operation.
+ * @param customerProvidedKeyInfo Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Mono which performs the network request upon subscription.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono setMetadataWithRestResponseAsync(String containerName, String blob, Integer timeout, Map metadata, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) {
+ public Mono setMetadataWithRestResponseAsync(String containerName, String blob, Integer timeout, Map metadata, String xMsEncryptionKey, String xMsEncryptionKeySha256, EncryptionAlgorithmType xMsEncryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, CustomerProvidedKeyInfo customerProvidedKeyInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) {
final String comp = "metadata";
String leaseId = null;
if (leaseAccessConditions != null) {
leaseId = leaseAccessConditions.leaseId();
}
+ String encryptionScope = null;
+ if (customerProvidedKeyInfo != null) {
+ encryptionScope = customerProvidedKeyInfo.encryptionScope();
+ }
OffsetDateTime ifModifiedSince = null;
if (modifiedAccessConditions != null) {
ifModifiedSince = modifiedAccessConditions.ifModifiedSince();
@@ -580,7 +734,7 @@ public Mono setMetadataWithRestResponseAsync(String co
}
DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince);
DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince);
- return service.setMetadata(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
+ return service.setMetadata(containerName, blob, this.client.getUrl(), timeout, metadata, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
}
/**
@@ -905,17 +1059,18 @@ public Mono breakLeaseWithRestResponseAsync(String cont
public Mono createSnapshotWithRestResponseAsync(String containerName, String blob, Context context) {
final Integer timeout = null;
final Map metadata = null;
- final String encryptionKey = null;
- final String encryptionKeySha256 = null;
- final EncryptionAlgorithmType encryptionAlgorithm = null;
+ final String xMsEncryptionKey = null;
+ final String xMsEncryptionKeySha256 = null;
+ final EncryptionAlgorithmType xMsEncryptionAlgorithm = null;
final String requestId = null;
final String comp = "snapshot";
+ final String encryptionScope = null;
final String ifMatch = null;
final String ifNoneMatch = null;
final String leaseId = null;
DateTimeRfc1123 ifModifiedSinceConverted = null;
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
- return service.createSnapshot(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context);
+ return service.createSnapshot(containerName, blob, this.client.getUrl(), timeout, metadata, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, this.client.getVersion(), requestId, comp, encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context);
}
/**
@@ -925,10 +1080,11 @@ public Mono createSnapshotWithRestResponseAsync(Str
* @param blob The blob name.
* @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>.
* @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information.
- * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services.
- * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided.
- * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'.
+ * @param xMsEncryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services.
+ * @param xMsEncryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided.
+ * @param xMsEncryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'.
* @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ * @param customerProvidedKeyInfo Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
* @param leaseAccessConditions Additional parameters for the operation.
* @param context The context to associate with this operation.
@@ -936,8 +1092,12 @@ public Mono createSnapshotWithRestResponseAsync(Str
* @return a Mono which performs the network request upon subscription.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono createSnapshotWithRestResponseAsync(String containerName, String blob, Integer timeout, Map metadata, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) {
+ public Mono createSnapshotWithRestResponseAsync(String containerName, String blob, Integer timeout, Map metadata, String xMsEncryptionKey, String xMsEncryptionKeySha256, EncryptionAlgorithmType xMsEncryptionAlgorithm, String requestId, CustomerProvidedKeyInfo customerProvidedKeyInfo, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) {
final String comp = "snapshot";
+ String encryptionScope = null;
+ if (customerProvidedKeyInfo != null) {
+ encryptionScope = customerProvidedKeyInfo.encryptionScope();
+ }
OffsetDateTime ifModifiedSince = null;
if (modifiedAccessConditions != null) {
ifModifiedSince = modifiedAccessConditions.ifModifiedSince();
@@ -960,7 +1120,7 @@ public Mono createSnapshotWithRestResponseAsync(Str
}
DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince);
DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince);
- return service.createSnapshot(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context);
+ return service.createSnapshot(containerName, blob, this.client.getUrl(), timeout, metadata, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, this.client.getVersion(), requestId, comp, encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context);
}
/**
@@ -977,6 +1137,9 @@ public Mono createSnapshotWithRestResponseAsync(Str
public Mono startCopyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Context context) {
final Integer timeout = null;
final Map metadata = null;
+ final String tags = null;
+ final AccessTierOptional tier = null;
+ final RehydratePriority rehydratePriority = null;
final String requestId = null;
final String sourceIfMatch = null;
final String sourceIfNoneMatch = null;
@@ -987,7 +1150,7 @@ public Mono startCopyFromURLWithRestResponseAsync
DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null;
DateTimeRfc1123 ifModifiedSinceConverted = null;
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
- return service.startCopyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, copySource, this.client.getVersion(), requestId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context);
+ return service.startCopyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, tags, tier, rehydratePriority, copySource, this.client.getVersion(), requestId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context);
}
/**
@@ -998,6 +1161,9 @@ public Mono startCopyFromURLWithRestResponseAsync
* @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated via a shared access signature.
* @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>.
* @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information.
+ * @param tags Optional. A URL encoded query param string which specifies the tags to be created with the Blob object. e.g. TagName1=TagValue1&TagName2=TagValue2. The x-ms-tags header may contain up to 2kb of tags.
+ * @param tier Optional. Indicates the tier to be set on the blob. Possible values include: 'Hot', 'Cool', 'Archive'.
+ * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. Possible values include: 'High', 'Standard'.
* @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
* @param sourceModifiedAccessConditions Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
@@ -1007,7 +1173,7 @@ public Mono startCopyFromURLWithRestResponseAsync
* @return a Mono which performs the network request upon subscription.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono startCopyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Integer timeout, Map metadata, String requestId, SourceModifiedAccessConditions sourceModifiedAccessConditions, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) {
+ public Mono startCopyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Integer timeout, Map metadata, String tags, AccessTierOptional tier, RehydratePriority rehydratePriority, String requestId, SourceModifiedAccessConditions sourceModifiedAccessConditions, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) {
OffsetDateTime sourceIfModifiedSince = null;
if (sourceModifiedAccessConditions != null) {
sourceIfModifiedSince = sourceModifiedAccessConditions.sourceIfModifiedSince();
@@ -1048,7 +1214,7 @@ public Mono startCopyFromURLWithRestResponseAsync
DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince);
DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince);
DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince);
- return service.startCopyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, copySource, this.client.getVersion(), requestId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context);
+ return service.startCopyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, tags, tier, rehydratePriority, copySource, this.client.getVersion(), requestId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context);
}
/**
@@ -1065,6 +1231,8 @@ public Mono startCopyFromURLWithRestResponseAsync
public Mono copyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Context context) {
final Integer timeout = null;
final Map metadata = null;
+ final String tags = null;
+ final AccessTierOptional tier = null;
final String requestId = null;
final String xMsRequiresSync = "true";
final String sourceIfMatch = null;
@@ -1076,7 +1244,7 @@ public Mono copyFromURLWithRestResponseAsync(String co
DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null;
DateTimeRfc1123 ifModifiedSinceConverted = null;
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
- return service.copyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, copySource, this.client.getVersion(), requestId, xMsRequiresSync, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context);
+ return service.copyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, tags, tier, copySource, this.client.getVersion(), requestId, xMsRequiresSync, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context);
}
/**
@@ -1087,6 +1255,8 @@ public Mono copyFromURLWithRestResponseAsync(String co
* @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated via a shared access signature.
* @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>.
* @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information.
+ * @param tags Optional. A URL encoded query param string which specifies the tags to be created with the Blob object. e.g. TagName1=TagValue1&TagName2=TagValue2. The x-ms-tags header may contain up to 2kb of tags.
+ * @param tier Optional. Indicates the tier to be set on the blob. Possible values include: 'Hot', 'Cool', 'Archive'.
* @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
* @param sourceModifiedAccessConditions Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
@@ -1096,7 +1266,7 @@ public Mono copyFromURLWithRestResponseAsync(String co
* @return a Mono which performs the network request upon subscription.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono copyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Integer timeout, Map metadata, String requestId, SourceModifiedAccessConditions sourceModifiedAccessConditions, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) {
+ public Mono copyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Integer timeout, Map metadata, String tags, AccessTierOptional tier, String requestId, SourceModifiedAccessConditions sourceModifiedAccessConditions, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) {
final String xMsRequiresSync = "true";
OffsetDateTime sourceIfModifiedSince = null;
if (sourceModifiedAccessConditions != null) {
@@ -1138,7 +1308,7 @@ public Mono copyFromURLWithRestResponseAsync(String co
DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince);
DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince);
DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince);
- return service.copyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, copySource, this.client.getVersion(), requestId, xMsRequiresSync, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context);
+ return service.copyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, tags, tier, copySource, this.client.getVersion(), requestId, xMsRequiresSync, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context);
}
/**
@@ -1196,12 +1366,13 @@ public Mono abortCopyFromURLWithRestResponseAsync
* @return a Mono which performs the network request upon subscription.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono setTierWithRestResponseAsync(String containerName, String blob, AccessTier tier, Context context) {
+ public Mono setTierWithRestResponseAsync(String containerName, String blob, AccessTierRequired tier, Context context) {
final Integer timeout = null;
+ final RehydratePriority rehydratePriority = null;
final String requestId = null;
final String comp = "tier";
final String leaseId = null;
- return service.setTier(containerName, blob, this.client.getUrl(), timeout, tier, this.client.getVersion(), requestId, comp, leaseId, context);
+ return service.setTier(containerName, blob, this.client.getUrl(), timeout, tier, rehydratePriority, this.client.getVersion(), requestId, comp, leaseId, context);
}
/**
@@ -1211,6 +1382,7 @@ public Mono setTierWithRestResponseAsync(String containerN
* @param blob The blob name.
* @param tier Indicates the tier to be set on the blob. Possible values include: 'P4', 'P6', 'P10', 'P20', 'P30', 'P40', 'P50', 'Hot', 'Cool', 'Archive'.
* @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>.
+ * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. Possible values include: 'High', 'Standard'.
* @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
* @param leaseAccessConditions Additional parameters for the operation.
* @param context The context to associate with this operation.
@@ -1218,13 +1390,13 @@ public Mono setTierWithRestResponseAsync(String containerN
* @return a Mono which performs the network request upon subscription.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono setTierWithRestResponseAsync(String containerName, String blob, AccessTier tier, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) {
+ public Mono setTierWithRestResponseAsync(String containerName, String blob, AccessTierRequired tier, Integer timeout, RehydratePriority rehydratePriority, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) {
final String comp = "tier";
String leaseId = null;
if (leaseAccessConditions != null) {
leaseId = leaseAccessConditions.leaseId();
}
- return service.setTier(containerName, blob, this.client.getUrl(), timeout, tier, this.client.getVersion(), requestId, comp, leaseId, context);
+ return service.setTier(containerName, blob, this.client.getUrl(), timeout, tier, rehydratePriority, this.client.getVersion(), requestId, comp, leaseId, context);
}
/**
@@ -1242,4 +1414,88 @@ public Mono getAccountInfoWithRestResponseAsync(Str
final String comp = "properties";
return service.getAccountInfo(containerName, blob, this.client.getUrl(), this.client.getVersion(), restype, comp, context);
}
+
+ /**
+ * The Set Blob Tags operation sets tags for the specified blob. This API is only supported in version 2018-11-09 and later.
+ *
+ * @param containerName The container name.
+ * @param blob The blob name.
+ * @param tags the BlobTags value.
+ * @param contentLength The length of the request.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @return a Mono which performs the network request upon subscription.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono setTagsWithRestResponseAsync(String containerName, String blob, BlobTags tags, long contentLength, Context context) {
+ final Integer timeout = null;
+ final String requestId = null;
+ final String comp = "tags";
+ String transactionalContentMD5Converted = null;
+ String transactionalContentCrc64Converted = null;
+ return service.setTags(containerName, blob, this.client.getUrl(), tags, timeout, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, this.client.getVersion(), requestId, comp, context);
+ }
+
+ /**
+ * The Set Blob Tags operation sets tags for the specified blob. This API is only supported in version 2018-11-09 and later.
+ *
+ * @param containerName The container name.
+ * @param blob The blob name.
+ * @param tags the BlobTags value.
+ * @param contentLength The length of the request.
+ * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>.
+ * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service.
+ * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service.
+ * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @return a Mono which performs the network request upon subscription.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono setTagsWithRestResponseAsync(String containerName, String blob, BlobTags tags, long contentLength, Integer timeout, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, String requestId, Context context) {
+ final String comp = "tags";
+ String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5);
+ String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64);
+ return service.setTags(containerName, blob, this.client.getUrl(), tags, timeout, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, this.client.getVersion(), requestId, comp, context);
+ }
+
+ /**
+ * The Get Blob Tags operation returns all tags for the specified blob, snapshot, or version. This API is only supported in version 2018-11-09 and later.
+ *
+ * @param containerName The container name.
+ * @param blob The blob name.
+ * @param contentLength The length of the request.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @return a Mono which performs the network request upon subscription.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getTagsWithRestResponseAsync(String containerName, String blob, long contentLength, Context context) {
+ final Integer timeout = null;
+ final String snapshot = null;
+ final String versionId = null;
+ final String requestId = null;
+ final String comp = "tags";
+ return service.getTags(containerName, blob, this.client.getUrl(), timeout, contentLength, snapshot, versionId, this.client.getVersion(), requestId, comp, context);
+ }
+
+ /**
+ * The Get Blob Tags operation returns all tags for the specified blob, snapshot, or version. This API is only supported in version 2018-11-09 and later.
+ *
+ * @param containerName The container name.
+ * @param blob The blob name.
+ * @param contentLength The length of the request.
+ * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>.
+ * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>.
+ * @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve.
+ * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @return a Mono which performs the network request upon subscription.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getTagsWithRestResponseAsync(String containerName, String blob, long contentLength, Integer timeout, String snapshot, String versionId, String requestId, Context context) {
+ final String comp = "tags";
+ return service.getTags(containerName, blob, this.client.getUrl(), timeout, contentLength, snapshot, versionId, this.client.getVersion(), requestId, comp, context);
+ }
}
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java
index 390c2436de9a3..ec226b60e1d8a 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java
@@ -21,6 +21,7 @@
import com.azure.core.implementation.annotation.UnexpectedResponseExceptionType;
import com.azure.core.implementation.util.Base64Util;
import com.azure.core.util.Context;
+import com.azure.storage.blob.models.AccessTierOptional;
import com.azure.storage.blob.models.BlobHTTPHeaders;
import com.azure.storage.blob.models.BlockBlobsCommitBlockListResponse;
import com.azure.storage.blob.models.BlockBlobsGetBlockListResponse;
@@ -29,6 +30,7 @@
import com.azure.storage.blob.models.BlockBlobsUploadResponse;
import com.azure.storage.blob.models.BlockListType;
import com.azure.storage.blob.models.BlockLookupList;
+import com.azure.storage.blob.models.CustomerProvidedKeyInfo;
import com.azure.storage.blob.models.EncryptionAlgorithmType;
import com.azure.storage.blob.models.LeaseAccessConditions;
import com.azure.storage.blob.models.ModifiedAccessConditions;
@@ -76,22 +78,22 @@ private interface BlockBlobsService {
@Put("{containerName}/{blob}")
@ExpectedResponses({201})
@UnexpectedResponseExceptionType(StorageErrorException.class)
- Mono upload(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux body, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-blob-type") String blobType, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context);
+ Mono upload(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux body, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-tags") String tags, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("x-ms-access-tier") AccessTierOptional tier, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-blob-type") String blobType, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @QueryParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context);
@Put("{containerName}/{blob}")
@ExpectedResponses({201})
@UnexpectedResponseExceptionType(StorageErrorException.class)
- Mono stageBlock(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("blockid") String blockId, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @BodyParam("application/octet-stream") Flux body, @QueryParam("timeout") Integer timeout, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, Context context);
+ Mono stageBlock(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("blockid") String blockId, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, @BodyParam("application/octet-stream") Flux body, @QueryParam("timeout") Integer timeout, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @QueryParam("x-ms-encryption-scope") String encryptionScope, Context context);
@Put("{containerName}/{blob}")
@ExpectedResponses({201})
@UnexpectedResponseExceptionType(StorageErrorException.class)
- Mono stageBlockFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("blockid") String blockId, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, @QueryParam("timeout") Integer timeout, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, Context context);
+ Mono stageBlockFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("blockid") String blockId, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, @HeaderParam("x-ms-source-content-crc64") String sourceContentcrc64, @QueryParam("timeout") Integer timeout, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @QueryParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, Context context);
@Put("{containerName}/{blob}")
@ExpectedResponses({201})
@UnexpectedResponseExceptionType(StorageErrorException.class)
- Mono commitBlockList(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @BodyParam("application/xml; charset=utf-8") BlockLookupList blocks, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context);
+ Mono commitBlockList(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-MD5") String transactionalContentMD5, @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-tags") String tags, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("x-ms-access-tier") AccessTierOptional tier, @BodyParam("application/xml; charset=utf-8") BlockLookupList blocks, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @QueryParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context);
@Get("{containerName}/{blob}")
@ExpectedResponses({200})
@@ -114,9 +116,11 @@ private interface BlockBlobsService {
public Mono uploadWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Context context) {
final Integer timeout = null;
final Map metadata = null;
- final String encryptionKey = null;
- final String encryptionKeySha256 = null;
- final EncryptionAlgorithmType encryptionAlgorithm = null;
+ final String tags = null;
+ final String xMsEncryptionKey = null;
+ final String xMsEncryptionKeySha256 = null;
+ final EncryptionAlgorithmType xMsEncryptionAlgorithm = null;
+ final AccessTierOptional tier = null;
final String requestId = null;
final String blobType = "BlockBlob";
final String blobContentType = null;
@@ -125,12 +129,13 @@ public Mono uploadWithRestResponseAsync(String contain
final String blobCacheControl = null;
final String blobContentDisposition = null;
final String leaseId = null;
+ final String encryptionScope = null;
final String ifMatch = null;
final String ifNoneMatch = null;
String blobContentMD5Converted = null;
DateTimeRfc1123 ifModifiedSinceConverted = null;
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
- return service.upload(containerName, blob, this.client.getUrl(), body, timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
+ return service.upload(containerName, blob, this.client.getUrl(), body, timeout, contentLength, metadata, tags, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, tier, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
}
/**
@@ -142,19 +147,22 @@ public Mono uploadWithRestResponseAsync(String contain
* @param contentLength The length of the request.
* @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>.
* @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information.
- * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services.
- * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided.
- * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'.
+ * @param tags Optional. A URL encoded query param string which specifies the tags to be created with the Blob object. e.g. TagName1=TagValue1&TagName2=TagValue2. The x-ms-tags header may contain up to 2kb of tags.
+ * @param xMsEncryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services.
+ * @param xMsEncryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided.
+ * @param xMsEncryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'.
+ * @param tier Optional. Indicates the tier to be set on the blob. Possible values include: 'Hot', 'Cool', 'Archive'.
* @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
* @param blobHTTPHeaders Additional parameters for the operation.
* @param leaseAccessConditions Additional parameters for the operation.
+ * @param customerProvidedKeyInfo Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Mono which performs the network request upon subscription.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono uploadWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Integer timeout, Map metadata, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) {
+ public Mono uploadWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Integer timeout, Map metadata, String tags, String xMsEncryptionKey, String xMsEncryptionKeySha256, EncryptionAlgorithmType xMsEncryptionAlgorithm, AccessTierOptional tier, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, CustomerProvidedKeyInfo customerProvidedKeyInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) {
final String blobType = "BlockBlob";
String blobContentType = null;
if (blobHTTPHeaders != null) {
@@ -184,6 +192,10 @@ public Mono uploadWithRestResponseAsync(String contain
if (leaseAccessConditions != null) {
leaseId = leaseAccessConditions.leaseId();
}
+ String encryptionScope = null;
+ if (customerProvidedKeyInfo != null) {
+ encryptionScope = customerProvidedKeyInfo.encryptionScope();
+ }
OffsetDateTime ifModifiedSince = null;
if (modifiedAccessConditions != null) {
ifModifiedSince = modifiedAccessConditions.ifModifiedSince();
@@ -203,7 +215,7 @@ public Mono uploadWithRestResponseAsync(String contain
String blobContentMD5Converted = Base64Util.encodeToString(blobContentMD5);
DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince);
DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince);
- return service.upload(containerName, blob, this.client.getUrl(), body, timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
+ return service.upload(containerName, blob, this.client.getUrl(), body, timeout, contentLength, metadata, tags, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, tier, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context);
}
/**
@@ -221,14 +233,16 @@ public Mono uploadWithRestResponseAsync(String contain
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono stageBlockWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, Flux body, Context context) {
final Integer timeout = null;
- final String encryptionKey = null;
- final String encryptionKeySha256 = null;
- final EncryptionAlgorithmType encryptionAlgorithm = null;
+ final String xMsEncryptionKey = null;
+ final String xMsEncryptionKeySha256 = null;
+ final EncryptionAlgorithmType xMsEncryptionAlgorithm = null;
final String requestId = null;
final String comp = "block";
final String leaseId = null;
+ final String encryptionScope = null;
String transactionalContentMD5Converted = null;
- return service.stageBlock(containerName, blob, this.client.getUrl(), blockId, contentLength, transactionalContentMD5Converted, body, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, context);
+ String transactionalContentCrc64Converted = null;
+ return service.stageBlock(containerName, blob, this.client.getUrl(), blockId, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, body, timeout, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, encryptionScope, context);
}
/**
@@ -240,25 +254,32 @@ public Mono stageBlockWithRestResponseAsync(String
* @param contentLength The length of the request.
* @param body Initial data.
* @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service.
+ * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service.
* @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>.
- * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services.
- * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided.
- * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'.
+ * @param xMsEncryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services.
+ * @param xMsEncryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided.
+ * @param xMsEncryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'.
* @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
* @param leaseAccessConditions Additional parameters for the operation.
+ * @param customerProvidedKeyInfo Additional parameters for the operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Mono which performs the network request upon subscription.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono stageBlockWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, Flux body, byte[] transactionalContentMD5, Integer timeout, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) {
+ public Mono stageBlockWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, Flux body, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, String xMsEncryptionKey, String xMsEncryptionKeySha256, EncryptionAlgorithmType xMsEncryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, CustomerProvidedKeyInfo customerProvidedKeyInfo, Context context) {
final String comp = "block";
String leaseId = null;
if (leaseAccessConditions != null) {
leaseId = leaseAccessConditions.leaseId();
}
+ String encryptionScope = null;
+ if (customerProvidedKeyInfo != null) {
+ encryptionScope = customerProvidedKeyInfo.encryptionScope();
+ }
String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5);
- return service.stageBlock(containerName, blob, this.client.getUrl(), blockId, contentLength, transactionalContentMD5Converted, body, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, context);
+ String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64);
+ return service.stageBlock(containerName, blob, this.client.getUrl(), blockId, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, body, timeout, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, encryptionScope, context);
}
/**
@@ -277,18 +298,20 @@ public Mono stageBlockWithRestResponseAsync(String
public Mono stageBlockFromURLWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, URL sourceUrl, Context context) {
final String sourceRange = null;
final Integer timeout = null;
- final String encryptionKey = null;
- final String encryptionKeySha256 = null;
- final EncryptionAlgorithmType encryptionAlgorithm = null;
+ final String xMsEncryptionKey = null;
+ final String xMsEncryptionKeySha256 = null;
+ final EncryptionAlgorithmType xMsEncryptionAlgorithm = null;
final String requestId = null;
final String comp = "block";
final String leaseId = null;
+ final String encryptionScope = null;
final String sourceIfMatch = null;
final String sourceIfNoneMatch = null;
String sourceContentMD5Converted = null;
+ String sourceContentcrc64Converted = null;
DateTimeRfc1123 sourceIfModifiedSinceConverted = null;
DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null;
- return service.stageBlockFromURL(containerName, blob, this.client.getUrl(), blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context);
+ return service.stageBlockFromURL(containerName, blob, this.client.getUrl(), blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, encryptionScope, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context);
}
/**
@@ -301,24 +324,30 @@ public Mono stageBlockFromURLWithRestRespon
* @param sourceUrl Specify a URL to the copy source.
* @param sourceRange Bytes of source data in the specified range.
* @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source.
+ * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy source.
* @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>.
- * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services.
- * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided.
- * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'.
+ * @param xMsEncryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services.
+ * @param xMsEncryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided.
+ * @param xMsEncryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'.
* @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
* @param leaseAccessConditions Additional parameters for the operation.
+ * @param customerProvidedKeyInfo Additional parameters for the operation.
* @param sourceModifiedAccessConditions Additional parameters for the operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Mono which performs the network request upon subscription.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono stageBlockFromURLWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, URL sourceUrl, String sourceRange, byte[] sourceContentMD5, Integer timeout, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) {
+ public Mono stageBlockFromURLWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, URL sourceUrl, String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, String xMsEncryptionKey, String xMsEncryptionKeySha256, EncryptionAlgorithmType xMsEncryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, CustomerProvidedKeyInfo customerProvidedKeyInfo, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) {
final String comp = "block";
String leaseId = null;
if (leaseAccessConditions != null) {
leaseId = leaseAccessConditions.leaseId();
}
+ String encryptionScope = null;
+ if (customerProvidedKeyInfo != null) {
+ encryptionScope = customerProvidedKeyInfo.encryptionScope();
+ }
OffsetDateTime sourceIfModifiedSince = null;
if (sourceModifiedAccessConditions != null) {
sourceIfModifiedSince = sourceModifiedAccessConditions.sourceIfModifiedSince();
@@ -336,9 +365,10 @@ public Mono stageBlockFromURLWithRestRespon
sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch();
}
String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5);
+ String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64);
DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince);
DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince);
- return service.stageBlockFromURL(containerName, blob, this.client.getUrl(), blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context);
+ return service.stageBlockFromURL(containerName, blob, this.client.getUrl(), blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, encryptionScope, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context);
}
/**
@@ -355,9 +385,11 @@ public Mono stageBlockFromURLWithRestRespon
public Mono commitBlockListWithRestResponseAsync(String containerName, String blob, BlockLookupList blocks, Context context) {
final Integer timeout = null;
final Map